@hearsay-tools/squawk 0.18.0-pr4133.7953 → 0.18.0-pr4135.7976.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.
Files changed (60) hide show
  1. package/dist/core/runner-definition.d.ts +0 -8
  2. package/dist/core/runner-definition.js.map +1 -1
  3. package/dist/core/skill-path-scope.js +1 -1
  4. package/dist/core/skill-path-scope.js.map +1 -1
  5. package/dist/core/skill-probe.d.ts +6 -1
  6. package/dist/core/skill-probe.js +10 -4
  7. package/dist/core/skill-probe.js.map +1 -1
  8. package/dist/delegation/family-end.d.ts +2 -2
  9. package/dist/delegation/family-end.js +4 -0
  10. package/dist/delegation/family-end.js.map +1 -1
  11. package/dist/delegation/receipt-cache.d.ts +9 -0
  12. package/dist/delegation/receipt-cache.js +26 -0
  13. package/dist/delegation/receipt-cache.js.map +1 -0
  14. package/dist/delegation/routes.d.ts +75 -75
  15. package/dist/delegation/transport.d.ts +15 -15
  16. package/dist/delegation/workspace-record.d.ts +1 -2
  17. package/dist/delegation/workspace-record.js +39 -17
  18. package/dist/delegation/workspace-record.js.map +1 -1
  19. package/dist/git-worktree.js +21 -0
  20. package/dist/git-worktree.js.map +1 -1
  21. package/dist/paths.d.ts +1 -0
  22. package/dist/paths.js +1 -1
  23. package/dist/paths.js.map +1 -1
  24. package/dist/runners/antigravity/account-home.d.ts +2 -1
  25. package/dist/runners/antigravity/account-home.js +17 -3
  26. package/dist/runners/antigravity/account-home.js.map +1 -1
  27. package/dist/runners/antigravity/antigravity-skill-catalog.d.ts +8 -3
  28. package/dist/runners/antigravity/antigravity-skill-catalog.js +169 -43
  29. package/dist/runners/antigravity/antigravity-skill-catalog.js.map +1 -1
  30. package/dist/runners/antigravity/definition.js +0 -1
  31. package/dist/runners/antigravity/definition.js.map +1 -1
  32. package/dist/runs/ports.d.ts +5 -0
  33. package/dist/runs/run-queries.d.ts +8 -0
  34. package/dist/runs/run-queries.js +49 -0
  35. package/dist/runs/run-queries.js.map +1 -1
  36. package/dist/runs/store.js +1 -1
  37. package/dist/runs/store.js.map +1 -1
  38. package/dist/runs/transcript-facts-queue.d.ts +5 -1
  39. package/dist/runs/transcript-facts-queue.js +48 -9
  40. package/dist/runs/transcript-facts-queue.js.map +1 -1
  41. package/dist/server/bounded-read-cache.d.ts +10 -0
  42. package/dist/server/bounded-read-cache.js +54 -0
  43. package/dist/server/bounded-read-cache.js.map +1 -0
  44. package/dist/server/repo-branch-forge.js +38 -10
  45. package/dist/server/repo-branch-forge.js.map +1 -1
  46. package/dist/server/repo-branches.js +28 -17
  47. package/dist/server/repo-branches.js.map +1 -1
  48. package/dist/server/repo-read-cache.d.ts +22 -0
  49. package/dist/server/repo-read-cache.js +51 -0
  50. package/dist/server/repo-read-cache.js.map +1 -0
  51. package/dist/server/server.d.ts +34 -34
  52. package/dist/server/server.js +26 -23
  53. package/dist/server/server.js.map +1 -1
  54. package/dist/server/worktree-size-cache.d.ts +3 -0
  55. package/dist/server/worktree-size-cache.js +8 -0
  56. package/dist/server/worktree-size-cache.js.map +1 -0
  57. package/package.json +4 -4
  58. package/scripts/mock-acp.mjs +9 -2
  59. package/scripts/mock-skill-data/antigravity.mjs +66 -0
  60. package/scripts/mock-skill-fixtures.mjs +10 -0
@@ -38,14 +38,6 @@ export interface RunnerDefinition {
38
38
  /** Runners whose native build/auth controls the list can invalidate before the ordinary TTL. */
39
39
  loadModelCatalogKey?(): Promise<(options: ModelDiscoveryContext) => Promise<string>>;
40
40
  /** Imports the runner's skill list adapter, which lists the skills its CLI sees. */
41
- /** A filesystem catalog exposes only sources confirmed in the native harness. */
42
- readonly skillCatalog?: {
43
- readonly source: 'filesystem';
44
- readonly projectRoots: readonly string[];
45
- readonly userRoots: readonly string[];
46
- readonly plugins: false;
47
- readonly evidence: string;
48
- };
49
41
  loadSkillCatalog(): Promise<(options: SkillDiscoveryOptions) => Promise<SkillCatalog>>;
50
42
  /** The native config files that Settings → Agent config shows, and the runner's pane there. */
51
43
  readonly configFiles: RunnerConfigFiles;
@@ -1 +1 @@
1
- {"version":3,"file":"runner-definition.js","sourceRoot":"","sources":["../../src/core/runner-definition.ts"],"names":[],"mappings":"AA+UA,0BAA0B;AAC1B,MAAM,UAAU,YAAY,CAAC,UAA4B;IACvD,OAAO,UAAU,CAAC;AACpB,CAAC"}
1
+ {"version":3,"file":"runner-definition.js","sourceRoot":"","sources":["../../src/core/runner-definition.ts"],"names":[],"mappings":"AA6UA,0BAA0B;AAC1B,MAAM,UAAU,YAAY,CAAC,UAA4B;IACvD,OAAO,UAAU,CAAC;AACpB,CAAC"}
@@ -10,7 +10,7 @@ export function skillPathScope(path, cwd, userHome) {
10
10
  if (within(cwd, path))
11
11
  return 'repo';
12
12
  const normalized = path.split(sep).join('/');
13
- const marker = normalized.search(/\/(?:\.agents|\.claude|\.opencode|\.pi)\/skills?\//);
13
+ const marker = normalized.search(/\/(?:\.agents?|\.claude|\.opencode|\.pi)\/skills?\//);
14
14
  if (marker !== -1) {
15
15
  const root = normalized.slice(0, marker);
16
16
  if (root !== userHome && within(root, cwd))
@@ -1 +1 @@
1
- {"version":3,"file":"skill-path-scope.js","sourceRoot":"","sources":["../../src/core/skill-path-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAGtD,SAAS,MAAM,CAAC,MAAc,EAAE,IAAY;IAC1C,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACtC,OAAO,MAAM,KAAK,EAAE,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC;AACrG,CAAC;AACD,8EAA8E;AAC9E,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,GAAW,EAAE,QAAgB;IACxE,IAAI,CAAC,UAAU,C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: string, args: readonly string[], cwd: string, env: NodeJS.ProcessEnv) => ChildProcessWithoutNullStreams) | undefined;
9
9
  }
10
+ export interface SkillProbeExtra {
11
+ executable?: string | undefined;
12
+ extraEnv?: Record<string, string> | undefined;
13
+ onSpawn?: ((pid: number) => void) | undefined;
14
+ }
10
15
  export declare function skillExecutable(runner: string, bin?: string): string;
11
16
  /** A no-turn probe owns a process group. Kill it and observe exit before releasing its caller. */
12
- export declare function skillProbe<T>(runner: string, args: readonly string[], options: SkillDiscoveryOptions, read: (child: ChildProcessWithoutNullStreams, signal: AbortSignal, env: NodeJS.ProcessEnv) => Promise<T>): Promise<T>;
17
+ export declare function skillProbe<T>(runner: string, args: readonly string[], options: SkillDiscoveryOptions, read: (child: ChildProcessWithoutNullStreams, signal: AbortSignal, env: NodeJS.ProcessEnv) => Promise<T>, extra?: SkillProbeExtra): Promise<T>;
13
18
  /** Bound streams even when a CLI emits a single line without a newline. */
14
19
  export declare function skillLines(child: ChildProcessWithoutNullStreams): AsyncGenerator<string>;
15
20
  /** CLI list commands finish on EOF; errors and deadlines are owned by skillProbe. */
@@ -7,15 +7,16 @@ import { runnerDefinition } from './runner-registry.js';
7
7
  import { processGroupAlive, sessionGroupOf, signalOwnedSessionGroup, signalSession, spawnSessionLeader } from './session-process.js';
8
8
  export function skillExecutable(runner, bin) {
9
9
  return bin ?? { claude: productEnv('CLAUDE_BIN'), codex: productEnv('CODEX_BIN'),
10
- opencode: productEnv('OPENCODE_BIN'), pi: productEnv('PI_BIN'), omp: productEnv('OMP_BIN') }[runner] ?? (productEnv('DRY_RUN') === '1'
10
+ opencode: productEnv('OPENCODE_BIN'), pi: productEnv('PI_BIN'), omp: productEnv('OMP_BIN'),
11
+ antigravity: productEnv('ANTIGRAVITY_BIN') }[runner] ?? (productEnv('DRY_RUN') === '1'
11
12
  ? fileURLToPath(new URL(`../../scripts/${runnerDefinition(runner).mock.script}`, import.meta.url)) : runner);
12
13
  }
13
14
  /** A no-turn probe owns a process group. Kill it and observe exit before releasing its caller. */
14
- export async function skillProbe(runner, args, options, read) {
15
+ export async function skillProbe(runner, args, options, read, extra = {}) {
15
16
  options.signal?.throwIfAborted();
16
- const env = buildChildEnv({ backend: runner, extraEnv: profileEnv(runner, options.accountHome) });
17
+ const env = buildChildEnv({ backend: runner, extraEnv: { ...profileEnv(runner, options.accountHome), ...extra.extraEnv } });
17
18
  const launch = options.spawn ?? ((bin, argv, cwd, env) => spawnSessionLeader(bin, argv, { cwd, env }));
18
- const child = launch(skillExecutable(runner, options.bin), args, options.cwd, env);
19
+ const child = launch(extra.executable ?? skillExecutable(runner, options.bin), args, options.cwd, env);
19
20
  const group = child.pid === undefined ? undefined : sessionGroupOf(child.pid);
20
21
  const exited = probeExit(child);
21
22
  const signal = AbortSignal.any([options.signal ?? new AbortController().signal, AbortSignal.timeout(options.timeoutMs ?? 15_000)]);
@@ -35,7 +36,12 @@ export async function skillProbe(runner, args, options, read) {
35
36
  if (signal.aborted)
36
37
  onAbort();
37
38
  });
39
+ // If onSpawn throws before Promise.race attaches handlers, killing the child in finally rejects failed.
40
+ failed.catch(() => { });
41
+ aborted.catch(() => { });
38
42
  try {
43
+ if (child.pid !== undefined)
44
+ extra.onSpawn?.(child.pid);
39
45
  return await Promise.race([read(child, signal, env), failed, aborted]);
40
46
  }
41
47
  finally {
@@ -1 +1 @@
1
- {"version":3,"file":"skill-probe.js","sourceRoot":"","sources":["../../src/core/skill-probe.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAA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rE,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;IAChC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,UAAU,CAAC,KAAK,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7D,IAAI,MAAM,MAAM,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IACrE,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,SAAS,CAAC,KAAqC;IACtD,IAAI,KAAK,CAAC,QAAQ,KAAK,IAAI,IAAI,KAAK,CAAC,UAAU,KAAK,IAAI;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACjG,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;QAC3B,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAC5B,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS;YAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;AACL,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,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAA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 '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":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,sGAAsG;AACtG,MAAM,OAAO,YAAY;IACN,OAAO,GAAG,IAAI,GAAG,EAAqC,CAAC;IACxE,GAAG,CAAC,IAAW;QACb,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACpG,CAAC;IACD,GAAG,CAAC,IAAY,EAAE,IAAW;QAC3B,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,KAAK,EAAE,GAAG,KAAK,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,OAAO,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACvE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC1B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,GAAG,CAAC,IAAY,EAAE,IAAW,EAAE,KAAQ;QACrC,IAAI,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,MAAM;YAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAM,CAAC,CAAC;QACxF,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACjF,CAAC;IACD,KAAK,CAAC,SAAiB,EAAE,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"}
@@ -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: Record<string, never>;
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: Record<string, never>;
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
- workerId: string;
1055
- baselineSha: string;
1056
- diff: string;
1057
- truncated: boolean;
1054
+ error: string;
1055
+ code?: "invalid_input" | undefined;
1058
1056
  };
1059
1057
  outputFormat: "json";
1060
- status: 200;
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
- error: string;
1069
- code?: "invalid_input" | undefined;
1066
+ workerId: string;
1067
+ baselineSha: string;
1068
+ diff: string;
1069
+ truncated: boolean;
1070
1070
  };
1071
1071
  outputFormat: "json";
1072
- status: 400;
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, 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;
@@ -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
- /** Each readable receipt's workspace, and whether its cleanup checkpoint says the removal completed.
64
- * An unreadable record is skipped: only an explicit destroy acts on it. */
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 receipts = [];
67
- for (const path of await ownedWorkspaceRecordFiles(repoRoot)) {
68
- if (path.endsWith('.cleanup.json'))
69
- continue;
70
- try {
71
- const receipt = await readReceipt(path);
72
- if (!receipt)
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
- const checkpoint = path.replace(/\.json$/, '.cleanup.json');
75
- const cleaned = await exists(checkpoint) &&
76
- cleanupSchema.parse(JSON.parse(await readIdentityFile(checkpoint, RECEIPT_CAP))).phase === 'complete';
77
- receipts.push({ workspace: receipt.workspace, cleaned });
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
- catch { /* unreadable */ }
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) {