@hearsay-tools/squawk 0.18.0-pr4133.7953 → 0.18.0-pr4136.7972.2
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/core/runner-facts.d.ts +3 -2
- package/dist/core/runner-facts.js.map +1 -1
- package/dist/delegation/family-end.d.ts +2 -2
- package/dist/delegation/family-end.js +4 -0
- package/dist/delegation/family-end.js.map +1 -1
- package/dist/delegation/receipt-cache.d.ts +9 -0
- package/dist/delegation/receipt-cache.js +26 -0
- package/dist/delegation/receipt-cache.js.map +1 -0
- package/dist/delegation/routes.d.ts +75 -75
- package/dist/delegation/transport.d.ts +15 -15
- package/dist/delegation/workspace-record.d.ts +1 -2
- package/dist/delegation/workspace-record.js +39 -17
- package/dist/delegation/workspace-record.js.map +1 -1
- package/dist/git-worktree.js +21 -0
- package/dist/git-worktree.js.map +1 -1
- package/dist/runners/antigravity/antigravity-runner.d.ts +1 -1
- package/dist/runners/antigravity/antigravity-session.d.ts +1 -1
- package/dist/runners/antigravity/antigravity-session.js +5 -2
- package/dist/runners/antigravity/antigravity-session.js.map +1 -1
- package/dist/runners/antigravity/facts.d.ts +1 -1
- package/dist/runners/antigravity/facts.js +3 -1
- package/dist/runners/antigravity/facts.js.map +1 -1
- package/dist/runners/antigravity/mock.d.ts +1 -0
- package/dist/runners/antigravity/mock.js +1 -1
- package/dist/runners/antigravity/mock.js.map +1 -1
- package/dist/runners/antigravity/tool-transcript.d.ts +25 -11
- package/dist/runners/antigravity/tool-transcript.js +81 -16
- package/dist/runners/antigravity/tool-transcript.js.map +1 -1
- package/dist/runners/omp/mock.d.ts +8 -0
- package/dist/runners/omp/mock.js +9 -0
- package/dist/runners/omp/mock.js.map +1 -1
- package/dist/runners/opencode/mock.d.ts +8 -0
- package/dist/runners/opencode/mock.js +9 -0
- package/dist/runners/opencode/mock.js.map +1 -1
- package/dist/runners/pi/mock.d.ts +8 -0
- package/dist/runners/pi/mock.js +9 -0
- package/dist/runners/pi/mock.js.map +1 -1
- package/dist/runs/ports.d.ts +5 -0
- package/dist/runs/run-queries.d.ts +8 -0
- package/dist/runs/run-queries.js +49 -0
- package/dist/runs/run-queries.js.map +1 -1
- package/dist/runs/store.js +1 -1
- package/dist/runs/store.js.map +1 -1
- package/dist/runs/transcript-facts-queue.d.ts +5 -1
- package/dist/runs/transcript-facts-queue.js +48 -9
- package/dist/runs/transcript-facts-queue.js.map +1 -1
- package/dist/server/bounded-read-cache.d.ts +10 -0
- package/dist/server/bounded-read-cache.js +54 -0
- package/dist/server/bounded-read-cache.js.map +1 -0
- package/dist/server/repo-branch-forge.js +38 -10
- package/dist/server/repo-branch-forge.js.map +1 -1
- package/dist/server/repo-branches.js +28 -17
- package/dist/server/repo-branches.js.map +1 -1
- package/dist/server/repo-read-cache.d.ts +22 -0
- package/dist/server/repo-read-cache.js +51 -0
- package/dist/server/repo-read-cache.js.map +1 -0
- package/dist/server/server.d.ts +34 -34
- package/dist/server/server.js +26 -23
- package/dist/server/server.js.map +1 -1
- package/dist/server/worktree-size-cache.d.ts +3 -0
- package/dist/server/worktree-size-cache.js +8 -0
- package/dist/server/worktree-size-cache.js.map +1 -0
- package/dist/workflows/run/session-events.d.ts +2 -0
- package/dist/workflows/run/turn-nudges.d.ts +2 -1
- package/dist/workflows/run/turn-nudges.js +4 -4
- package/dist/workflows/run/turn-nudges.js.map +1 -1
- package/package.json +4 -4
- package/scripts/mock-acp.mjs +39 -5
|
@@ -37,8 +37,9 @@ export interface RunnerFacts {
|
|
|
37
37
|
* the wire carries no child session and no child transcript.
|
|
38
38
|
*/
|
|
39
39
|
readonly childWork: 'nested' | 'none';
|
|
40
|
-
/** Hook runs. `reported`: the
|
|
41
|
-
* `none`: hooks run inside the harness
|
|
40
|
+
/** Hook runs. `reported`: the runner emits hook items (from wire frames or its session
|
|
41
|
+
* transcript). `none`: hooks run inside the harness with no reported output; a runner declaring
|
|
42
|
+
* `none` must declare named `R77` and `UI2` exemptions in `runners/<id>/mock.ts`. */
|
|
42
43
|
readonly hookEvents: 'reported' | 'none';
|
|
43
44
|
/**
|
|
44
45
|
* How long a human prompt on its way to the wire holds agent input back. `none`: agent input is
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner-facts.js","sourceRoot":"","sources":["../../src/core/runner-facts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"runner-facts.js","sourceRoot":"","sources":["../../src/core/runner-facts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AA6F5G;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAA0C,IAAI,KAAK,CAAC,EAAiC,EAAE;IAC9G,GAAG,CAAC,MAAM,EAAE,EAAE;QACZ,IAAI,OAAO,EAAE,KAAK,QAAQ;YAAE,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC3D,OAAO,gBAAgB,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;IACrD,CAAC;IACD,GAAG,CAAC,CAAC,EAAE,EAAE;QACP,OAAO,OAAO,EAAE,KAAK,QAAQ,IAAI,cAAc,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACjE,CAAC;IACD,OAAO;QACL,OAAO,CAAC,GAAG,iBAAiB,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACtD,CAAC;IACD,wBAAwB,CAAC,CAAC,EAAE,EAAE;QAC5B,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,CAAC,cAAc,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC;YAAE,OAAO,SAAS,CAAC;QAC/E,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC;IACtG,CAAC;IACD,wFAAwF;IACxF,6FAA6F;IAC7F,4CAA4C;IAC5C,GAAG,EAAE,GAAG,EAAE,CAAC,KAAK;IAChB,cAAc,EAAE,GAAG,EAAE,CAAC,KAAK;IAC3B,cAAc,EAAE,GAAG,EAAE,CAAC,KAAK;IAC3B,cAAc,EAAE,GAAG,EAAE,CAAC,KAAK;IAC3B,iBAAiB,EAAE,GAAG,EAAE,CAAC,KAAK;CAC/B,CAAC,CAAC;AAEH,gFAAgF;AAChF,MAAM,UAAU,YAAY,CAAC,OAAwC;IACnE,OAAO,iBAAiB,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;AAC9G,CAAC"}
|
|
@@ -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":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EA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;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 @@
|
|
|
1
|
+
{"version":3,"file":"receipt-cache.js","sourceRoot":"","sources":["../../src/delegation/receipt-cache.ts"],"names":[],"mappings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;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"}
|
|
@@ -27,6 +27,18 @@ 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
|
+
} | {
|
|
30
42
|
output: {
|
|
31
43
|
workers: {
|
|
32
44
|
workerId: string;
|
|
@@ -73,34 +85,12 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
73
85
|
offset?: string | undefined;
|
|
74
86
|
};
|
|
75
87
|
};
|
|
76
|
-
} | {
|
|
77
|
-
output: {
|
|
78
|
-
error: string;
|
|
79
|
-
code?: "invalid_input" | undefined;
|
|
80
|
-
};
|
|
81
|
-
outputFormat: "json";
|
|
82
|
-
status: 400;
|
|
83
|
-
input: {
|
|
84
|
-
query: {
|
|
85
|
-
offset?: string | undefined;
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
90
|
} & {
|
|
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;
|
|
@@ -629,6 +629,18 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
629
629
|
} & {
|
|
630
630
|
"/:workerId": {
|
|
631
631
|
$get: {
|
|
632
|
+
output: {
|
|
633
|
+
error: string;
|
|
634
|
+
code?: "invalid_input" | undefined;
|
|
635
|
+
};
|
|
636
|
+
outputFormat: "json";
|
|
637
|
+
status: 400;
|
|
638
|
+
input: {
|
|
639
|
+
param: {
|
|
640
|
+
workerId: string;
|
|
641
|
+
};
|
|
642
|
+
};
|
|
643
|
+
} | {
|
|
632
644
|
output: {
|
|
633
645
|
workerId: string;
|
|
634
646
|
settled: boolean;
|
|
@@ -746,7 +758,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
746
758
|
workerId: string;
|
|
747
759
|
};
|
|
748
760
|
};
|
|
749
|
-
}
|
|
761
|
+
};
|
|
762
|
+
};
|
|
763
|
+
} & {
|
|
764
|
+
"/:workerId/collect": {
|
|
765
|
+
$post: {
|
|
750
766
|
output: {
|
|
751
767
|
error: string;
|
|
752
768
|
code?: "invalid_input" | undefined;
|
|
@@ -757,12 +773,10 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
757
773
|
param: {
|
|
758
774
|
workerId: string;
|
|
759
775
|
};
|
|
776
|
+
} & {
|
|
777
|
+
json: Record<string, never>;
|
|
760
778
|
};
|
|
761
|
-
}
|
|
762
|
-
};
|
|
763
|
-
} & {
|
|
764
|
-
"/:workerId/collect": {
|
|
765
|
-
$post: {
|
|
779
|
+
} | {
|
|
766
780
|
output: {
|
|
767
781
|
workerId: string;
|
|
768
782
|
parentRunId: string;
|
|
@@ -885,7 +899,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
885
899
|
} & {
|
|
886
900
|
json: Record<string, never>;
|
|
887
901
|
};
|
|
888
|
-
}
|
|
902
|
+
};
|
|
903
|
+
};
|
|
904
|
+
} & {
|
|
905
|
+
"/:workerId/steer": {
|
|
906
|
+
$post: {
|
|
889
907
|
output: {
|
|
890
908
|
error: string;
|
|
891
909
|
code?: "invalid_input" | undefined;
|
|
@@ -897,13 +915,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
897
915
|
workerId: string;
|
|
898
916
|
};
|
|
899
917
|
} & {
|
|
900
|
-
json:
|
|
918
|
+
json: {
|
|
919
|
+
text: string;
|
|
920
|
+
};
|
|
901
921
|
};
|
|
902
|
-
}
|
|
903
|
-
};
|
|
904
|
-
} & {
|
|
905
|
-
"/:workerId/steer": {
|
|
906
|
-
$post: {
|
|
922
|
+
} | {
|
|
907
923
|
output: {
|
|
908
924
|
workerId: string;
|
|
909
925
|
state: "delivered" | "queued";
|
|
@@ -919,7 +935,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
919
935
|
text: string;
|
|
920
936
|
};
|
|
921
937
|
};
|
|
922
|
-
}
|
|
938
|
+
};
|
|
939
|
+
};
|
|
940
|
+
} & {
|
|
941
|
+
"/:workerId/stop": {
|
|
942
|
+
$post: {
|
|
923
943
|
output: {
|
|
924
944
|
error: string;
|
|
925
945
|
code?: "invalid_input" | undefined;
|
|
@@ -931,15 +951,9 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
931
951
|
workerId: string;
|
|
932
952
|
};
|
|
933
953
|
} & {
|
|
934
|
-
json:
|
|
935
|
-
text: string;
|
|
936
|
-
};
|
|
954
|
+
json: Record<string, never>;
|
|
937
955
|
};
|
|
938
|
-
}
|
|
939
|
-
};
|
|
940
|
-
} & {
|
|
941
|
-
"/:workerId/stop": {
|
|
942
|
-
$post: {
|
|
956
|
+
} | {
|
|
943
957
|
output: {
|
|
944
958
|
workerId: string;
|
|
945
959
|
state: "stopping" | "terminated";
|
|
@@ -953,7 +967,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
953
967
|
} & {
|
|
954
968
|
json: Record<string, never>;
|
|
955
969
|
};
|
|
956
|
-
}
|
|
970
|
+
};
|
|
971
|
+
};
|
|
972
|
+
} & {
|
|
973
|
+
"/:workerId/destroy": {
|
|
974
|
+
$post: {
|
|
957
975
|
output: {
|
|
958
976
|
error: string;
|
|
959
977
|
code?: "invalid_input" | undefined;
|
|
@@ -965,13 +983,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
965
983
|
workerId: string;
|
|
966
984
|
};
|
|
967
985
|
} & {
|
|
968
|
-
json:
|
|
986
|
+
json: {
|
|
987
|
+
discardWork?: true | undefined;
|
|
988
|
+
};
|
|
969
989
|
};
|
|
970
|
-
}
|
|
971
|
-
};
|
|
972
|
-
} & {
|
|
973
|
-
"/:workerId/destroy": {
|
|
974
|
-
$post: {
|
|
990
|
+
} | {
|
|
975
991
|
output: {
|
|
976
992
|
workerId: string;
|
|
977
993
|
state: "complete" | "incomplete";
|
|
@@ -1000,22 +1016,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1000
1016
|
discardWork?: true | undefined;
|
|
1001
1017
|
};
|
|
1002
1018
|
};
|
|
1003
|
-
} | {
|
|
1004
|
-
output: {
|
|
1005
|
-
error: string;
|
|
1006
|
-
code?: "invalid_input" | undefined;
|
|
1007
|
-
};
|
|
1008
|
-
outputFormat: "json";
|
|
1009
|
-
status: 400;
|
|
1010
|
-
input: {
|
|
1011
|
-
param: {
|
|
1012
|
-
workerId: string;
|
|
1013
|
-
};
|
|
1014
|
-
} & {
|
|
1015
|
-
json: {
|
|
1016
|
-
discardWork?: true | undefined;
|
|
1017
|
-
};
|
|
1018
|
-
};
|
|
1019
1019
|
} | {
|
|
1020
1020
|
output: {
|
|
1021
1021
|
workerId: string;
|
|
@@ -1051,13 +1051,11 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1051
1051
|
"/:workerId/diff": {
|
|
1052
1052
|
$get: {
|
|
1053
1053
|
output: {
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
diff: string;
|
|
1057
|
-
truncated: boolean;
|
|
1054
|
+
error: string;
|
|
1055
|
+
code?: "invalid_input" | undefined;
|
|
1058
1056
|
};
|
|
1059
1057
|
outputFormat: "json";
|
|
1060
|
-
status:
|
|
1058
|
+
status: 400;
|
|
1061
1059
|
input: {
|
|
1062
1060
|
param: {
|
|
1063
1061
|
workerId: string;
|
|
@@ -1065,11 +1063,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
1065
1063
|
};
|
|
1066
1064
|
} | {
|
|
1067
1065
|
output: {
|
|
1068
|
-
|
|
1069
|
-
|
|
1066
|
+
workerId: string;
|
|
1067
|
+
baselineSha: string;
|
|
1068
|
+
diff: string;
|
|
1069
|
+
truncated: boolean;
|
|
1070
1070
|
};
|
|
1071
1071
|
outputFormat: "json";
|
|
1072
|
-
status:
|
|
1072
|
+
status: 200;
|
|
1073
1073
|
input: {
|
|
1074
1074
|
param: {
|
|
1075
1075
|
workerId: string;
|
|
@@ -66,17 +66,6 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
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;
|
|
@@ -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
|
|
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;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/** The owned-workspace record: receipt and cleanup checkpoint schemas, identity files and the intent check, on top of the Git layer. */
|
|
2
2
|
import { projectPaths } from '../project-paths.js';
|
|
3
|
+
import { ReceiptCache } from './receipt-cache.js';
|
|
4
|
+
import { posixIdentityFileStore } from './posix-workspace-identity.js';
|
|
3
5
|
import { identityFileStore } from './identity-file-store.js';
|
|
4
6
|
import { entryExists as exists } from './entry-exists.js';
|
|
5
7
|
import { createHash } from 'node:crypto';
|
|
6
|
-
import { readdir, realpath } from 'node:fs/promises';
|
|
8
|
+
import { lstat, readdir, realpath } from 'node:fs/promises';
|
|
7
9
|
import { dirname, join } from 'node:path';
|
|
8
10
|
import { z } from 'zod';
|
|
9
11
|
import { ownedWorkspaceSchema } from '../contract/index.js';
|
|
@@ -60,25 +62,45 @@ export async function ownedWorkspaceRecordFiles(repoRoot) {
|
|
|
60
62
|
return [];
|
|
61
63
|
return (await readdir(dir)).filter(name => name.endsWith('.json')).sort().map(name => join(dir, name));
|
|
62
64
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
+
const receiptCache = new ReceiptCache();
|
|
66
|
+
async function cachedRecord(path, schema) {
|
|
67
|
+
const info = await lstat(path);
|
|
68
|
+
// Native Windows ACL checks cannot be represented by POSIX stat fields. Keep its checked read.
|
|
69
|
+
const cacheable = identityFileStore() === posixIdentityFileStore && info.isFile() &&
|
|
70
|
+
!info.isSymbolicLink() && info.size <= RECEIPT_CAP && (info.mode & 0o077) === 0;
|
|
71
|
+
const cached = cacheable ? receiptCache.get(path, info) : undefined;
|
|
72
|
+
if (cached)
|
|
73
|
+
return cached;
|
|
74
|
+
const value = schema.parse(JSON.parse(await readIdentityFile(path, RECEIPT_CAP)));
|
|
75
|
+
// A replacement during the checked read must not associate different bytes with the old stat.
|
|
76
|
+
const after = await lstat(path);
|
|
77
|
+
if (cacheable && receiptCache.key(info) === receiptCache.key(after))
|
|
78
|
+
receiptCache.set(path, info, value);
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
/** Each readable receipt's workspace and cleanup state. Unreadable records are skipped. */
|
|
65
82
|
export async function ownedWorkspaceReceipts(repoRoot) {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
83
|
+
const dir = await receiptDirectory(repoRoot, false);
|
|
84
|
+
const files = await exists(dir) ? (await readdir(dir)).filter(name => name.endsWith('.json')).sort().map(name => join(dir, name)) : [];
|
|
85
|
+
receiptCache.prune(dir, new Set(files));
|
|
86
|
+
const receipts = new Map();
|
|
87
|
+
// Bound open handles on cold reads while allowing independent stat calls to overlap on warm reads.
|
|
88
|
+
let next = 0;
|
|
89
|
+
await Promise.all(Array.from({ length: 32 }, async () => {
|
|
90
|
+
while (next < files.length) {
|
|
91
|
+
const path = files[next++];
|
|
92
|
+
if (path.endsWith('.cleanup.json'))
|
|
73
93
|
continue;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
94
|
+
try {
|
|
95
|
+
const receipt = await cachedRecord(path, receiptSchema);
|
|
96
|
+
const checkpoint = path.replace(/\.json$/, '.cleanup.json');
|
|
97
|
+
const cleaned = await exists(checkpoint) && (await cachedRecord(checkpoint, cleanupSchema)).phase === 'complete';
|
|
98
|
+
receipts.set(path, { workspace: receipt.workspace, cleaned });
|
|
99
|
+
}
|
|
100
|
+
catch { /* unreadable */ }
|
|
78
101
|
}
|
|
79
|
-
|
|
80
|
-
}
|
|
81
|
-
return receipts;
|
|
102
|
+
}));
|
|
103
|
+
return files.flatMap(path => { const receipt = receipts.get(path); return receipt ? [receipt] : []; });
|
|
82
104
|
}
|
|
83
105
|
/** One receipt or cleanup checkpoint, read with the identity-file checks. */
|
|
84
106
|
export function readOwnedWorkspaceRecord(path) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workspace-record.js","sourceRoot":"","sources":["../../src/delegation/workspace-record.ts"],"names":[],"mappings":"AAAA,wIAAwI;AACxI,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,WAAW,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"workspace-record.js","sourceRoot":"","sources":["../../src/delegation/workspace-record.ts"],"names":[],"mappings":"AAAA,wIAAwI;AACxI,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,WAAW,IAAI,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC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E,CAAC,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;AACjE,CAAC;AACD,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,IAAY;IAC5C,IAAI,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC;QAAE,OAAO,SAAS,CAAC;IAC1C,OAAO,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,gBAAgB,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;AACpF,CAAC"}
|
package/dist/git-worktree.js
CHANGED
|
@@ -300,12 +300,20 @@ export function worktreeSizeBytes(path) {
|
|
|
300
300
|
});
|
|
301
301
|
});
|
|
302
302
|
}
|
|
303
|
+
const ownedReceiptCache = new Map();
|
|
304
|
+
function ownedReceiptKey(info) {
|
|
305
|
+
return [info.dev, info.ino, info.size, info.mtimeMs, info.ctimeMs].join(':');
|
|
306
|
+
}
|
|
303
307
|
async function collectOwnedReceipts(receipts, sets) {
|
|
304
308
|
const entries = await readdir(receipts).catch((error) => {
|
|
305
309
|
if (error.code === 'ENOENT')
|
|
306
310
|
return [];
|
|
307
311
|
throw error;
|
|
308
312
|
});
|
|
313
|
+
const present = new Set(entries.map(entry => join(receipts, entry)));
|
|
314
|
+
for (const path of ownedReceiptCache.keys())
|
|
315
|
+
if (dirname(path) === receipts && !present.has(path))
|
|
316
|
+
ownedReceiptCache.delete(path);
|
|
309
317
|
for (const entry of entries) {
|
|
310
318
|
if (!entry.endsWith('.json'))
|
|
311
319
|
continue;
|
|
@@ -313,6 +321,14 @@ async function collectOwnedReceipts(receipts, sets) {
|
|
|
313
321
|
const info = await lstat(path);
|
|
314
322
|
if (!info.isFile() || info.isSymbolicLink() || info.size > 16_384)
|
|
315
323
|
return true;
|
|
324
|
+
const key = ownedReceiptKey(info);
|
|
325
|
+
const cached = ownedReceiptCache.get(path);
|
|
326
|
+
if (cached?.key === key) {
|
|
327
|
+
sets.paths.add(cached.path);
|
|
328
|
+
sets.branches.add(cached.branch);
|
|
329
|
+
continue;
|
|
330
|
+
}
|
|
331
|
+
ownedReceiptCache.delete(path);
|
|
316
332
|
const receipt = JSON.parse(await readFile(path, 'utf8'));
|
|
317
333
|
if (!receipt || typeof receipt !== 'object' || !('workspace' in receipt))
|
|
318
334
|
return true;
|
|
@@ -324,6 +340,11 @@ async function collectOwnedReceipts(receipts, sets) {
|
|
|
324
340
|
!['cezar', 'squawk'].some(name => workspace.path.endsWith(join('.ai', name, 'worktrees', workspace.ownerRunId))) ||
|
|
325
341
|
entry.replace(/(?:\.cleanup)?\.json$/, '') !== workspace.resourceId)
|
|
326
342
|
return true;
|
|
343
|
+
if (key === ownedReceiptKey(await lstat(path))) {
|
|
344
|
+
if (ownedReceiptCache.size >= 20_000)
|
|
345
|
+
ownedReceiptCache.delete(ownedReceiptCache.keys().next().value);
|
|
346
|
+
ownedReceiptCache.set(path, { key, path: workspace.path, branch: workspace.branch });
|
|
347
|
+
}
|
|
327
348
|
sets.paths.add(workspace.path);
|
|
328
349
|
sets.branches.add(workspace.branch);
|
|
329
350
|
}
|