@hearsay-tools/squawk 0.18.0-dev.7777 → 0.18.0-dev.7788
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/artifacts/removal-slot.d.ts +3 -0
- package/dist/artifacts/removal-slot.js +7 -0
- package/dist/artifacts/removal-slot.js.map +1 -0
- package/dist/autosave-removal-slots.d.ts +6 -0
- package/dist/autosave-removal-slots.js +13 -0
- package/dist/autosave-removal-slots.js.map +1 -0
- package/dist/built-in-run-slots.d.ts +9 -0
- package/dist/built-in-run-slots.js +21 -0
- package/dist/built-in-run-slots.js.map +1 -0
- package/dist/delegation/family-end.js +5 -1
- package/dist/delegation/family-end.js.map +1 -1
- package/dist/delegation/removal-slot.d.ts +4 -0
- package/dist/delegation/removal-slot.js +20 -0
- package/dist/delegation/removal-slot.js.map +1 -0
- package/dist/delegation/routes.d.ts +79 -79
- package/dist/delegation/transport.d.ts +11 -11
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/jobs/removal-slot.d.ts +4 -0
- package/dist/jobs/removal-slot.js +10 -0
- package/dist/jobs/removal-slot.js.map +1 -0
- package/dist/runs/lifecycle.d.ts +1 -1
- package/dist/runs/ports.d.ts +0 -11
- package/dist/runs/removal-slots.d.ts +56 -0
- package/dist/runs/removal-slots.js +66 -0
- package/dist/runs/removal-slots.js.map +1 -0
- package/dist/runs/retention.d.ts +10 -7
- package/dist/runs/retention.js +8 -19
- package/dist/runs/retention.js.map +1 -1
- package/dist/runs/store.d.ts +6 -5
- package/dist/runs/store.js +23 -42
- package/dist/runs/store.js.map +1 -1
- package/dist/server/live-routes.d.ts +6 -6
- package/dist/server/models-routes.d.ts +13 -13
- package/dist/server/project-context.js +3 -3
- package/dist/server/project-context.js.map +1 -1
- package/dist/server/reports-api.d.ts +2 -2
- package/dist/server/workspace-live-routes.d.ts +6 -6
- package/package.json +4 -4
- package/scripts/benchmark-family-reconcile.ts +2 -0
- package/scripts/benchmark-run-store.ts +2 -0
- package/scripts/benchmark-stuck-destroys.ts +2 -0
- package/scripts/benchmark-worker-lifecycle.ts +2 -0
- package/scripts/benchmark-workspace-events.ts +2 -0
- package/scripts/benchmark-worktree-retention.ts +2 -0
- package/scripts/measure-transcript-facts-health.mjs +4 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { removeArtifacts } from './lifecycle.js';
|
|
2
|
+
/** Removes the run's published artifacts with its history. */
|
|
3
|
+
export const artifactsRemovalCleanup = {
|
|
4
|
+
name: 'artifacts',
|
|
5
|
+
removed: (runId, dataDir) => removeArtifacts(dataDir, runId),
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=removal-slot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removal-slot.js","sourceRoot":"","sources":["../../src/artifacts/removal-slot.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,8DAA8D;AAC9D,MAAM,CAAC,MAAM,uBAAuB,GAAmB;IACrD,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,eAAe,CAAC,OAAO,EAAE,KAAK,CAAC;CAC7D,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DeletionGate, RemovalCleanup } from './runs/removal-slots.ts';
|
|
2
|
+
/** Refuses a run's history and worktree deletion while its autosave cleanup is not confirmed. The
|
|
3
|
+
* tmp directory of an archived family member is not the autosave's to keep. */
|
|
4
|
+
export declare const autosaveDeletionGate: DeletionGate;
|
|
5
|
+
/** Clears the run's autosave cleanup evidence with its history. */
|
|
6
|
+
export declare const autosaveRemovalCleanup: RemovalCleanup;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { autosaveCleanupBlocker, clearAutosaveCleanup } from './autosave-cleanup.js';
|
|
2
|
+
/** Refuses a run's history and worktree deletion while its autosave cleanup is not confirmed. The
|
|
3
|
+
* tmp directory of an archived family member is not the autosave's to keep. */
|
|
4
|
+
export const autosaveDeletionGate = {
|
|
5
|
+
name: 'autosave cleanup',
|
|
6
|
+
refuse: (runId, kind, dataDir) => kind === 'archive-tmp' ? undefined : autosaveCleanupBlocker(dataDir, runId),
|
|
7
|
+
};
|
|
8
|
+
/** Clears the run's autosave cleanup evidence with its history. */
|
|
9
|
+
export const autosaveRemovalCleanup = {
|
|
10
|
+
name: 'autosave cleanup',
|
|
11
|
+
removed: (runId, dataDir) => clearAutosaveCleanup(dataDir, runId),
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=autosave-removal-slots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autosave-removal-slots.js","sourceRoot":"","sources":["../src/autosave-removal-slots.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAErF;gFACgF;AAChF,MAAM,CAAC,MAAM,oBAAoB,GAAiB;IAChD,IAAI,EAAE,kBAAkB;IACxB,MAAM,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,sBAAsB,CAAC,OAAO,EAAE,KAAK,CAAC;CAC9G,CAAC;AAEF,mEAAmE;AACnE,MAAM,CAAC,MAAM,sBAAsB,GAAmB;IACpD,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,oBAAoB,CAAC,OAAO,EAAE,KAAK,CAAC;CAClE,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type RunSlots } from './runs/removal-slots.ts';
|
|
2
|
+
/** The removal slots that ship with Squawk, in the order each path asks them. */
|
|
3
|
+
export declare const BUILT_IN_RUN_SLOTS: RunSlots;
|
|
4
|
+
/**
|
|
5
|
+
* Register the built-in removal slots and seal the registry. Each process entry calls it once,
|
|
6
|
+
* beside `registerBuiltInRunners()`, before it can delete, reclaim or archive a run. A second call
|
|
7
|
+
* registers the same objects again, which the registry ignores.
|
|
8
|
+
*/
|
|
9
|
+
export declare function registerBuiltInRunSlots(): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { registerRunSlots, sealRunSlots } from './runs/removal-slots.js';
|
|
2
|
+
import { autosaveDeletionGate, autosaveRemovalCleanup } from './autosave-removal-slots.js';
|
|
3
|
+
import { artifactsRemovalCleanup } from './artifacts/removal-slot.js';
|
|
4
|
+
import { jobsDeletionGate } from './jobs/removal-slot.js';
|
|
5
|
+
import { workerEvidencePreparation } from './delegation/removal-slot.js';
|
|
6
|
+
/** The removal slots that ship with Squawk, in the order each path asks them. */
|
|
7
|
+
export const BUILT_IN_RUN_SLOTS = {
|
|
8
|
+
gates: [autosaveDeletionGate, jobsDeletionGate],
|
|
9
|
+
preparations: [workerEvidencePreparation],
|
|
10
|
+
cleanups: [artifactsRemovalCleanup, autosaveRemovalCleanup],
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Register the built-in removal slots and seal the registry. Each process entry calls it once,
|
|
14
|
+
* beside `registerBuiltInRunners()`, before it can delete, reclaim or archive a run. A second call
|
|
15
|
+
* registers the same objects again, which the registry ignores.
|
|
16
|
+
*/
|
|
17
|
+
export function registerBuiltInRunSlots() {
|
|
18
|
+
registerRunSlots(BUILT_IN_RUN_SLOTS);
|
|
19
|
+
sealRunSlots();
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=built-in-run-slots.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"built-in-run-slots.js","sourceRoot":"","sources":["../src/built-in-run-slots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAiB,MAAM,yBAAyB,CAAC;AACxF,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAC3F,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,iFAAiF;AACjF,MAAM,CAAC,MAAM,kBAAkB,GAAa;IAC1C,KAAK,EAAE,CAAC,oBAAoB,EAAE,gBAAgB,CAAC;IAC/C,YAAY,EAAE,CAAC,yBAAyB,CAAC;IACzC,QAAQ,EAAE,CAAC,uBAAuB,EAAE,sBAAsB,CAAC;CAC5D,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,uBAAuB;IACrC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;IACrC,YAAY,EAAE,CAAC;AACjB,CAAC"}
|
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
* branch through its compare-and-swap, which deletes nothing while the branch holds commits that
|
|
6
6
|
* no other ref keeps. A deleted branch completes the worker's destroy, so the parent's slot is
|
|
7
7
|
* free again. A receipt whose run this project no longer has gets the same removal, after its
|
|
8
|
-
* directory is reclaimed if clean. The branch sweep runs this step.
|
|
8
|
+
* directory is reclaimed if clean. The branch sweep runs this step. Throws only in a process that
|
|
9
|
+
* sealed no removal slots (`runs/removal-slots.ts`), before it removes anything.
|
|
9
10
|
*/
|
|
10
11
|
import { existsSync, realpathSync } from 'node:fs';
|
|
11
12
|
import { join } from 'node:path';
|
|
12
13
|
import { projectPaths } from '../project-paths.js';
|
|
13
14
|
import { cleanupSafety, workerFamilyEnded } from '../runs/retention.js';
|
|
15
|
+
import { assertRunSlotsSealed } from '../runs/removal-slots.js';
|
|
14
16
|
import { isLiveRecord } from '../runs/run-row.js';
|
|
15
17
|
import { ownedWorkspaceReceipts } from './workspace-record.js';
|
|
16
18
|
import { releaseThenRemoveWorktree } from '../git-worktree-release.js';
|
|
@@ -28,6 +30,8 @@ export function endedWorkerBranch(run, store) {
|
|
|
28
30
|
* against Continue and other cleanup for the removal, or returns null when it is in use. `signal`
|
|
29
31
|
* stops the step before its next workspace. Returns the worker ids whose branch went. */
|
|
30
32
|
export async function releaseEndedWorkerBranches(repoRoot, store, claim, signal) {
|
|
33
|
+
// Outside every catch below, so a process that sealed no slots removes no orphan directory or branch.
|
|
34
|
+
assertRunSlotsSealed();
|
|
31
35
|
// Without its runs every receipt would look orphaned.
|
|
32
36
|
if (store.unavailable)
|
|
33
37
|
return [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"family-end.js","sourceRoot":"","sources":["../../src/delegation/family-end.ts"],"names":[],"mappings":"AAAA
|
|
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,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAKrD,MAAM,OAAO,GAAwB,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;AAExF;sBACsB;AACtB,MAAM,UAAU,iBAAiB,CAAC,GAAc,EAAE,KAAuD;IACvG,IAAI,GAAG,CAAC,UAAU,EAAE,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,UAAU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U,EAAE,IAAI,KAAK,QAAQ,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;YAC1E,KAAK,CAAC,gBAAgB,CAAC,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,4 @@
|
|
|
1
|
+
import type { ReclaimPreparation } from '../runs/removal-slots.ts';
|
|
2
|
+
/** The reclaim preparation of workers: an owned worker's evidence is saved before its worktree goes.
|
|
3
|
+
* A worker whose evidence could not be saved keeps its worktree until the next pass. */
|
|
4
|
+
export declare const workerEvidencePreparation: ReclaimPreparation;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { collectWorkerEvidence } from './results.js';
|
|
2
|
+
/** Snapshot parent-owned worker evidence before the checkout goes. A collect/commit failure
|
|
3
|
+
* returns false so the directory is left for the next pass. */
|
|
4
|
+
async function preserveWorkerResult(repoRoot, store, run) {
|
|
5
|
+
if (run.delegation?.role !== 'worker')
|
|
6
|
+
return true;
|
|
7
|
+
const evidence = await collectWorkerEvidence(repoRoot, store, run);
|
|
8
|
+
store.commitWorkerResult(run.delegation.parentRunId, evidence.result, evidence.diffSnapshot);
|
|
9
|
+
return evidence.diffSnapshot !== undefined || evidence.result.diff.state === 'available';
|
|
10
|
+
}
|
|
11
|
+
/** The reclaim preparation of workers: an owned worker's evidence is saved before its worktree goes.
|
|
12
|
+
* A worker whose evidence could not be saved keeps its worktree until the next pass. */
|
|
13
|
+
export const workerEvidencePreparation = {
|
|
14
|
+
name: 'worker evidence',
|
|
15
|
+
async prepare(run, { repoRoot, store }) {
|
|
16
|
+
if (!(await preserveWorkerResult(repoRoot, store, run)))
|
|
17
|
+
throw new Error('Worker evidence was not saved');
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=removal-slot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removal-slot.js","sourceRoot":"","sources":["../../src/delegation/removal-slot.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD;gEACgE;AAChE,KAAK,UAAU,oBAAoB,CAAC,QAAgB,EAAE,KAAoB,EAAE,GAAc;IACxF,IAAI,GAAG,CAAC,UAAU,EAAE,IAAI,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IACnD,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC,QAAQ,EAAE,KAAiB,EAAE,GAAG,CAAC,CAAC;IAC/E,KAAK,CAAC,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,EAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC7F,OAAO,QAAQ,CAAC,YAAY,KAAK,SAAS,IAAI,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,KAAK,WAAW,CAAC;AAC3F,CAAC;AAED;yFACyF;AACzF,MAAM,CAAC,MAAM,yBAAyB,GAAuB;IAC3D,IAAI,EAAE,iBAAiB;IACvB,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE;QACpC,IAAI,CAAC,CAAC,MAAM,oBAAoB,CAAC,QAAQ,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;IAC5G,CAAC;CACF,CAAC"}
|
|
@@ -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,24 +85,22 @@ 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
|
+
} | {
|
|
94
104
|
runner: string;
|
|
95
105
|
models: {
|
|
96
106
|
id: string;
|
|
@@ -101,16 +111,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
101
111
|
source: "cache" | "live" | "unavailable";
|
|
102
112
|
stale: boolean;
|
|
103
113
|
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;
|
|
@@ -232,13 +232,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
232
232
|
status: 200;
|
|
233
233
|
input: {
|
|
234
234
|
json: {
|
|
235
|
-
requestIds: string[];
|
|
236
|
-
mode?: "all" | "any" | "one" | undefined;
|
|
237
|
-
timeoutSeconds?: number | undefined;
|
|
238
|
-
} | {
|
|
239
235
|
workerIds: string[];
|
|
240
236
|
timeoutSeconds?: number | undefined;
|
|
241
237
|
mode?: "all" | "any" | "one" | undefined;
|
|
238
|
+
} | {
|
|
239
|
+
requestIds: string[];
|
|
240
|
+
mode?: "all" | "any" | "one" | undefined;
|
|
241
|
+
timeoutSeconds?: number | undefined;
|
|
242
242
|
} | {
|
|
243
243
|
peerIds: string[];
|
|
244
244
|
timeoutSeconds?: number | undefined;
|
|
@@ -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,6 +66,17 @@ 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
|
+
} | {
|
|
69
80
|
scope: "host-default-account";
|
|
70
81
|
runners: {
|
|
71
82
|
requiresAccountHome?: boolean | undefined;
|
|
@@ -87,17 +98,6 @@ export declare function createDelegationApp(routes: DelegationRoutes): import("h
|
|
|
87
98
|
reason?: string | undefined;
|
|
88
99
|
}[];
|
|
89
100
|
nextOffset?: number | undefined;
|
|
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;
|
package/dist/index.js
CHANGED
|
@@ -19,11 +19,15 @@ import { workerCleanups } from './delegation/worker-cleanup.js';
|
|
|
19
19
|
import { onTerminal } from './serve-listener.js';
|
|
20
20
|
import { installWindowsIdentityStore } from './delegation/windows-identity-store.js';
|
|
21
21
|
import { registerBuiltInRunners } from './runners/built-in.js';
|
|
22
|
+
import { registerBuiltInRunSlots } from './built-in-run-slots.js';
|
|
22
23
|
// Workspace receipts and markers use the host's identity store (ADR 0032).
|
|
23
24
|
installWindowsIdentityStore();
|
|
24
25
|
// Every command, the cockpit, a headless task and each child process that reruns this entry read
|
|
25
26
|
// runner data from the registry (spec 2026-11-18-runner-definitions).
|
|
26
27
|
registerBuiltInRunners();
|
|
28
|
+
// A deletion, a reclaim or a family archive asks the removal slots, and throws in a process that
|
|
29
|
+
// sealed none (spec 2026-11-21-run-lifecycle-and-store-ports).
|
|
30
|
+
registerBuiltInRunSlots();
|
|
27
31
|
warnLegacyEnv(process.env);
|
|
28
32
|
// ---- workspace boot ----------------------------------------------------------
|
|
29
33
|
/**
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AA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G,cAAc,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa;IAChI,YAAY,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,IAAI,EAAE,EAAE,GAAG,gBAAgB,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,EAAE,CAAC;CACtK,CAAC,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;IACxB,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { agentTmpDirLocations } from '../runs/agent-tmpdir.js';
|
|
2
|
+
import { jobRunsIn } from './job.js';
|
|
3
|
+
/** Keeps an archived family member's tmp directory while a job runs in it, so the job's log and
|
|
4
|
+
* exit code outlive the task. */
|
|
5
|
+
export const jobsDeletionGate = {
|
|
6
|
+
name: 'jobs',
|
|
7
|
+
refuse: (runId, kind, dataDir) => kind === 'archive-tmp' && jobRunsIn(agentTmpDirLocations(dataDir, runId))
|
|
8
|
+
? 'a job runs in the task tmp directory' : undefined,
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=removal-slot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"removal-slot.js","sourceRoot":"","sources":["../../src/jobs/removal-slot.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC;kCACkC;AAClC,MAAM,CAAC,MAAM,gBAAgB,GAAiB;IAC5C,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,IAAI,KAAK,aAAa,IAAI,SAAS,CAAC,oBAAoB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACzG,CAAC,CAAC,sCAAsC,CAAC,CAAC,CAAC,SAAS;CACvD,CAAC"}
|
package/dist/runs/lifecycle.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* the store wrote; it never writes (ADR 0056, ADR 0064). `RunStore.open` builds one and exposes it
|
|
5
5
|
* as `store.lifecycle`, typed by the port `RunLifecycleSource`, so nothing else publishes to it.
|
|
6
6
|
*
|
|
7
|
-
* Delivery is synchronous, in subscription order, at the moment the store
|
|
7
|
+
* Delivery is synchronous, in subscription order, at the moment the store writes.
|
|
8
8
|
* A listener that throws is logged with its event type and run id, and the next listener runs. A
|
|
9
9
|
* listener may return a promise: it is not awaited, and a rejection is logged. A publish from inside
|
|
10
10
|
* a listener is delivered at once, before the outer delivery continues, as `EventEmitter` does.
|
package/dist/runs/ports.d.ts
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
* `.ai/specs/2026-11-21-run-lifecycle-and-store-ports.md`), and the port then points at the module
|
|
9
9
|
* that implements it. A later slice may move a method between ports when its topic moves. The store stays the only writer of status and exit fields (ADR 0056).
|
|
10
10
|
*/
|
|
11
|
-
import type { EventEmitter } from 'node:events';
|
|
12
11
|
import type { RunStore } from './store.ts';
|
|
13
12
|
export type { RunLifecycleSource } from './lifecycle.ts';
|
|
14
13
|
/** One run's record, by id. Nearly every caller needs only this. */
|
|
@@ -138,16 +137,6 @@ export interface RunPins {
|
|
|
138
137
|
pin: RunStore['pin'];
|
|
139
138
|
unpin: RunStore['unpin'];
|
|
140
139
|
}
|
|
141
|
-
/**
|
|
142
|
-
* The store's own `EventEmitter` surface. Transitional: the activity publisher still listens
|
|
143
|
-
* through it, and slice B4 (hearsay-tools/squawk#4032) moves that listener to `RunLifecycleSource`
|
|
144
|
-
* and deletes this port. The members are `EventEmitter`'s: the store's own `on` returns `this`, a
|
|
145
|
-
* `RunStore`, which no other emitter is.
|
|
146
|
-
*/
|
|
147
|
-
export interface RunStoreEvents {
|
|
148
|
-
on: EventEmitter['on'];
|
|
149
|
-
off: EventEmitter['off'];
|
|
150
|
-
}
|
|
151
140
|
/** The repository identity a store learns after it opens. */
|
|
152
141
|
export interface RunRepoHandle {
|
|
153
142
|
setRepoHandle: RunStore['setRepoHandle'];
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { WorkerResults } from './ports.ts';
|
|
2
|
+
import type { RunRecord } from './store.ts';
|
|
3
|
+
/**
|
|
4
|
+
* The removal slots (spec 2026-11-21-run-lifecycle-and-store-ports, "Removal slots"; owner decision
|
|
5
|
+
* 2): the features that a run deletion, a worktree reclaim or a family archive must ask, as three
|
|
6
|
+
* named slots in one process-wide registry. The core asks the registry and imports no feature. An
|
|
7
|
+
* entry fills the registry with `registerBuiltInRunSlots()` (`built-in-run-slots.ts`) before the CLI
|
|
8
|
+
* dispatch; a test seals it with only the slots it needs (`removal-slots.testkit.ts`).
|
|
9
|
+
*
|
|
10
|
+
* Fail closed: until the registry is sealed, every read throws an error that names the missing
|
|
11
|
+
* registration, and each removal path reads it before its first side effect.
|
|
12
|
+
*/
|
|
13
|
+
/** What a deletion removes: a run's history, its worktree or worker resources, or the agent tmp
|
|
14
|
+
* directory of an archived family member. */
|
|
15
|
+
export type DeletionKind = 'history' | 'worktree' | 'archive-tmp';
|
|
16
|
+
/** Refuses a deletion while the feature still needs what it removes. */
|
|
17
|
+
export interface DeletionGate {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
/** A reason refuses the deletion; undefined lets it go ahead. `dataDir` is the run's data dir. */
|
|
20
|
+
refuse(runId: string, kind: DeletionKind, dataDir: string): string | undefined;
|
|
21
|
+
}
|
|
22
|
+
/** What a reclaim preparation gets from the reclaim: the repository and the store it reclaims in. */
|
|
23
|
+
export interface ReclaimContext {
|
|
24
|
+
readonly repoRoot: string;
|
|
25
|
+
/** The store the reclaim runs in. */
|
|
26
|
+
readonly store: WorkerResults;
|
|
27
|
+
}
|
|
28
|
+
/** Work that must finish before a reclaimed worktree goes. A rejection stops the reclaim. */
|
|
29
|
+
export interface ReclaimPreparation {
|
|
30
|
+
readonly name: string;
|
|
31
|
+
prepare(run: RunRecord, context: ReclaimContext): Promise<void>;
|
|
32
|
+
}
|
|
33
|
+
/** Removes what a feature keeps for a run when the run's history goes. */
|
|
34
|
+
export interface RemovalCleanup {
|
|
35
|
+
readonly name: string;
|
|
36
|
+
removed(runId: string, dataDir: string): void;
|
|
37
|
+
}
|
|
38
|
+
export interface RunSlots {
|
|
39
|
+
readonly gates?: readonly DeletionGate[] | undefined;
|
|
40
|
+
readonly preparations?: readonly ReclaimPreparation[] | undefined;
|
|
41
|
+
readonly cleanups?: readonly RemovalCleanup[] | undefined;
|
|
42
|
+
}
|
|
43
|
+
/** Add slots, in call order. Registering the same slot object again does nothing. */
|
|
44
|
+
export declare function registerRunSlots(slots: RunSlots): void;
|
|
45
|
+
/** Close the registry: removals may run, and no new slot may register. */
|
|
46
|
+
export declare function sealRunSlots(): void;
|
|
47
|
+
/** Whether this process sealed its removal slots. Never throws. */
|
|
48
|
+
export declare function runSlotsSealed(): boolean;
|
|
49
|
+
/** Throws unless the registry is sealed. A removal path calls it before its first side effect. */
|
|
50
|
+
export declare function assertRunSlotsSealed(): void;
|
|
51
|
+
/** The first gate's reason to refuse this deletion, in registration order. */
|
|
52
|
+
export declare function deletionRefusal(runId: string, kind: DeletionKind, dataDir: string): string | undefined;
|
|
53
|
+
/** Run every preparation in registration order; the first rejection stops the rest. */
|
|
54
|
+
export declare function prepareReclaim(run: RunRecord, context: ReclaimContext): Promise<void>;
|
|
55
|
+
/** Run every cleanup in registration order, then throw the first failure. */
|
|
56
|
+
export declare function runRemovalCleanups(runId: string, dataDir: string): void;
|