@hearsay-tools/squawk 0.18.0-pr3467.6147 → 0.18.0-pr3474.6175
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ci-wait/controller.d.ts +37 -37
- package/dist/delegation/identity-file-store.d.ts +1 -1
- package/dist/delegation/owned-workspace-release.d.ts +8 -0
- package/dist/delegation/owned-workspace-release.js +9 -0
- package/dist/delegation/owned-workspace-release.js.map +1 -0
- package/dist/delegation/provision.d.ts +4 -2
- package/dist/delegation/provision.js +5 -3
- package/dist/delegation/provision.js.map +1 -1
- package/dist/delegation/routes.d.ts +15 -15
- package/dist/delegation/service.d.ts +13 -4
- package/dist/delegation/service.js +13 -7
- package/dist/delegation/service.js.map +1 -1
- package/dist/delegation/transport.d.ts +75 -75
- package/dist/delegation/windows-identity-store.d.ts +1 -1
- package/dist/delegation/windows-identity-store.js +1 -1
- package/dist/delegation/windows-identity-store.js.map +1 -1
- package/dist/delegation/worker-cleanup.d.ts +3 -1
- package/dist/delegation/worker-cleanup.js +7 -2
- package/dist/delegation/worker-cleanup.js.map +1 -1
- package/dist/delegation/workspace-git.d.ts +19 -0
- package/dist/delegation/workspace-git.js +67 -0
- package/dist/delegation/workspace-git.js.map +1 -0
- package/dist/delegation/workspace-record.d.ts +63 -0
- package/dist/delegation/workspace-record.js +78 -0
- package/dist/delegation/workspace-record.js.map +1 -0
- package/dist/delegation/workspace-removal.d.ts +19 -0
- package/dist/delegation/workspace-removal.js +284 -0
- package/dist/delegation/workspace-removal.js.map +1 -0
- package/dist/delegation/workspace.d.ts +1 -28
- package/dist/delegation/workspace.js +7 -411
- package/dist/delegation/workspace.js.map +1 -1
- package/dist/git-worktree-release.d.ts +5 -9
- package/dist/git-worktree-release.js +5 -10
- package/dist/git-worktree-release.js.map +1 -1
- package/dist/headless-run.d.ts +3 -0
- package/dist/headless-run.js +1 -1
- package/dist/headless-run.js.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/project-migration/containment.js +1 -1
- package/dist/project-migration/containment.js.map +1 -1
- package/dist/project-migration/plan.js +1 -1
- package/dist/project-migration/plan.js.map +1 -1
- package/dist/project-migration/steps.js +1 -1
- package/dist/project-migration/steps.js.map +1 -1
- package/dist/serve-command.d.ts +3 -0
- package/dist/serve-command.js +1 -1
- package/dist/serve-command.js.map +1 -1
- package/dist/server/activity-routes.d.ts +23 -23
- package/dist/server/server.d.ts +1581 -1579
- package/dist/server/server.js +1 -1
- package/dist/server/server.js.map +1 -1
- package/dist/server/workspace-live-routes.d.ts +6 -6
- package/package.json +4 -4
- package/scripts/benchmark-stuck-destroys.ts +2 -1
|
@@ -280,12 +280,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
280
280
|
"/api/v1/tools/ask": {
|
|
281
281
|
$post: {
|
|
282
282
|
output: {
|
|
283
|
-
|
|
284
|
-
code: 'unavailable';
|
|
283
|
+
code: 'capability_revoked';
|
|
285
284
|
message: string;
|
|
286
285
|
};
|
|
287
286
|
outputFormat: "json";
|
|
288
|
-
status:
|
|
287
|
+
status: 401;
|
|
289
288
|
input: {
|
|
290
289
|
json: {
|
|
291
290
|
questions: {
|
|
@@ -303,11 +302,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
303
302
|
};
|
|
304
303
|
} | {
|
|
305
304
|
output: {
|
|
306
|
-
|
|
305
|
+
ok: false;
|
|
306
|
+
code: 'unavailable';
|
|
307
307
|
message: string;
|
|
308
308
|
};
|
|
309
309
|
outputFormat: "json";
|
|
310
|
-
status:
|
|
310
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
311
311
|
input: {
|
|
312
312
|
json: {
|
|
313
313
|
questions: {
|
|
@@ -375,12 +375,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
375
375
|
"/api/v1/tools/cancel-wait": {
|
|
376
376
|
$post: {
|
|
377
377
|
output: {
|
|
378
|
-
|
|
379
|
-
code: 'unavailable';
|
|
378
|
+
code: 'capability_revoked';
|
|
380
379
|
message: string;
|
|
381
380
|
};
|
|
382
381
|
outputFormat: "json";
|
|
383
|
-
status:
|
|
382
|
+
status: 401;
|
|
384
383
|
input: {
|
|
385
384
|
json: {
|
|
386
385
|
wait_id: string;
|
|
@@ -388,11 +387,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
388
387
|
};
|
|
389
388
|
} | {
|
|
390
389
|
output: {
|
|
391
|
-
|
|
390
|
+
cancelled: false;
|
|
391
|
+
code: 'unavailable';
|
|
392
392
|
message: string;
|
|
393
393
|
};
|
|
394
394
|
outputFormat: "json";
|
|
395
|
-
status:
|
|
395
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
396
396
|
input: {
|
|
397
397
|
json: {
|
|
398
398
|
wait_id: string;
|
|
@@ -440,12 +440,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
440
440
|
"/api/v1/tools/done": {
|
|
441
441
|
$post: {
|
|
442
442
|
output: {
|
|
443
|
-
|
|
444
|
-
code: 'unavailable';
|
|
443
|
+
code: 'capability_revoked';
|
|
445
444
|
message: string;
|
|
446
445
|
};
|
|
447
446
|
outputFormat: "json";
|
|
448
|
-
status:
|
|
447
|
+
status: 401;
|
|
449
448
|
input: {
|
|
450
449
|
json: {
|
|
451
450
|
summary?: string | undefined;
|
|
@@ -453,11 +452,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
453
452
|
};
|
|
454
453
|
} | {
|
|
455
454
|
output: {
|
|
456
|
-
|
|
455
|
+
ok: false;
|
|
456
|
+
code: 'unavailable';
|
|
457
457
|
message: string;
|
|
458
458
|
};
|
|
459
459
|
outputFormat: "json";
|
|
460
|
-
status:
|
|
460
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
461
461
|
input: {
|
|
462
462
|
json: {
|
|
463
463
|
summary?: string | undefined;
|
|
@@ -525,13 +525,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
525
525
|
"/api/v1/tools/preview-stop": {
|
|
526
526
|
$post: {
|
|
527
527
|
output: {
|
|
528
|
-
|
|
529
|
-
code: "adopted" | "approval_required" | "headless" | "invalid_input" | "not_registered" | "port_held" | "port_in_use" | "preview_disabled" | "restarted" | "stopped" | "unavailable" | "worktree_missing";
|
|
528
|
+
code: 'capability_revoked';
|
|
530
529
|
message: string;
|
|
531
|
-
hint: string;
|
|
532
530
|
};
|
|
533
531
|
outputFormat: "json";
|
|
534
|
-
status:
|
|
532
|
+
status: 401;
|
|
535
533
|
input: {
|
|
536
534
|
json: {
|
|
537
535
|
port: number;
|
|
@@ -540,11 +538,13 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
540
538
|
};
|
|
541
539
|
} | {
|
|
542
540
|
output: {
|
|
543
|
-
|
|
541
|
+
ok: boolean;
|
|
542
|
+
code: "adopted" | "approval_required" | "headless" | "invalid_input" | "not_registered" | "port_held" | "port_in_use" | "preview_disabled" | "restarted" | "stopped" | "unavailable" | "worktree_missing";
|
|
544
543
|
message: string;
|
|
544
|
+
hint: string;
|
|
545
545
|
};
|
|
546
546
|
outputFormat: "json";
|
|
547
|
-
status:
|
|
547
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
548
548
|
input: {
|
|
549
549
|
json: {
|
|
550
550
|
port: number;
|
|
@@ -557,13 +557,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
557
557
|
"/api/v1/tools/preview-serve": {
|
|
558
558
|
$post: {
|
|
559
559
|
output: {
|
|
560
|
-
|
|
561
|
-
code: "cezar_port" | "cwd_outside_worktree" | "headless" | "invalid_input" | "port_held" | "preview_disabled" | "registered" | "replaced" | "too_many" | "unavailable" | "worktree_missing";
|
|
560
|
+
code: 'capability_revoked';
|
|
562
561
|
message: string;
|
|
563
|
-
hint: string;
|
|
564
562
|
};
|
|
565
563
|
outputFormat: "json";
|
|
566
|
-
status:
|
|
564
|
+
status: 401;
|
|
567
565
|
input: {
|
|
568
566
|
json: {
|
|
569
567
|
command: string;
|
|
@@ -575,11 +573,13 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
575
573
|
};
|
|
576
574
|
} | {
|
|
577
575
|
output: {
|
|
578
|
-
|
|
576
|
+
ok: boolean;
|
|
577
|
+
code: "cezar_port" | "cwd_outside_worktree" | "headless" | "invalid_input" | "port_held" | "preview_disabled" | "registered" | "replaced" | "too_many" | "unavailable" | "worktree_missing";
|
|
579
578
|
message: string;
|
|
579
|
+
hint: string;
|
|
580
580
|
};
|
|
581
581
|
outputFormat: "json";
|
|
582
|
-
status:
|
|
582
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
583
583
|
input: {
|
|
584
584
|
json: {
|
|
585
585
|
command: string;
|
|
@@ -595,12 +595,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
595
595
|
"/api/v1/tools/schedule-task": {
|
|
596
596
|
$post: {
|
|
597
597
|
output: {
|
|
598
|
-
|
|
599
|
-
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
598
|
+
code: 'capability_revoked';
|
|
600
599
|
message: string;
|
|
601
600
|
};
|
|
602
601
|
outputFormat: "json";
|
|
603
|
-
status:
|
|
602
|
+
status: 401;
|
|
604
603
|
input: {
|
|
605
604
|
json: {
|
|
606
605
|
at?: string | undefined;
|
|
@@ -617,11 +616,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
617
616
|
};
|
|
618
617
|
} | {
|
|
619
618
|
output: {
|
|
620
|
-
|
|
619
|
+
ok: false;
|
|
620
|
+
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
621
621
|
message: string;
|
|
622
622
|
};
|
|
623
623
|
outputFormat: "json";
|
|
624
|
-
status:
|
|
624
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
625
625
|
input: {
|
|
626
626
|
json: {
|
|
627
627
|
at?: string | undefined;
|
|
@@ -676,12 +676,11 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
676
676
|
"/api/v1/tools/scheduled-tasks": {
|
|
677
677
|
$post: {
|
|
678
678
|
output: {
|
|
679
|
-
|
|
680
|
-
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
679
|
+
code: 'capability_revoked';
|
|
681
680
|
message: string;
|
|
682
681
|
};
|
|
683
682
|
outputFormat: "json";
|
|
684
|
-
status:
|
|
683
|
+
status: 401;
|
|
685
684
|
input: {
|
|
686
685
|
json: {
|
|
687
686
|
at?: string | undefined;
|
|
@@ -714,11 +713,12 @@ export declare function ciToolRoutes(capabilities: Map<string, Capability>): imp
|
|
|
714
713
|
};
|
|
715
714
|
} | {
|
|
716
715
|
output: {
|
|
717
|
-
|
|
716
|
+
ok: false;
|
|
717
|
+
code: import('../contract/index.js').ScheduledTaskRefusalCode;
|
|
718
718
|
message: string;
|
|
719
719
|
};
|
|
720
720
|
outputFormat: "json";
|
|
721
|
-
status:
|
|
721
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
722
722
|
input: {
|
|
723
723
|
json: {
|
|
724
724
|
at?: string | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Where the ownership policy in `workspace.ts` keeps its identity files: the receipt directory,
|
|
2
|
+
* Where the ownership policy in `workspace-record.ts` keeps its identity files: the receipt directory,
|
|
3
3
|
* receipts, cleanup checkpoints and Git administration markers. The store owns the platform's
|
|
4
4
|
* safety rules; the policy owns what the files prove (ADR 0032).
|
|
5
5
|
*
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { WorkerDestroyResult, WorkerWorkspace } from '../contract/index.js';
|
|
2
|
+
import { type RemovalReport } from './workspace-removal.ts';
|
|
3
|
+
import type { PreviewHostLike } from '../preview/registration.ts';
|
|
4
|
+
/** A destroyed owned worker's checkout: the same rule as `releaseThenRemoveWorktree` (`git-worktree-release.ts`),
|
|
5
|
+
* through the delegation cleanup's own fenced removal. */
|
|
6
|
+
export declare function releaseThenRemoveOwnedWorkspace(deps: {
|
|
7
|
+
previewHost?: Pick<PreviewHostLike, 'release'> | undefined;
|
|
8
|
+
}, repoRoot: string, workspace: WorkerWorkspace, assertCurrent?: () => void, assertUnheld?: () => void, report?: RemovalReport): Promise<WorkerDestroyResult>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { removeOwnedWorkspace } from './workspace-removal.js';
|
|
2
|
+
/** A destroyed owned worker's checkout: the same rule as `releaseThenRemoveWorktree` (`git-worktree-release.ts`),
|
|
3
|
+
* through the delegation cleanup's own fenced removal. */
|
|
4
|
+
export async function releaseThenRemoveOwnedWorkspace(deps, repoRoot, workspace, assertCurrent, assertUnheld, report) {
|
|
5
|
+
return removeOwnedWorkspace(repoRoot, workspace, assertCurrent, async () => {
|
|
6
|
+
await deps.previewHost?.release(workspace.ownerRunId).catch(() => undefined);
|
|
7
|
+
}, assertUnheld, report);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=owned-workspace-release.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"owned-workspace-release.js","sourceRoot":"","sources":["../../src/delegation/owned-workspace-release.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAsB,MAAM,wBAAwB,CAAC;AAGlF;0DAC0D;AAC1D,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,IAAoE,EACpE,QAAgB,EAChB,SAA0B,EAC1B,aAA0B,EAC1B,YAAyB,EACzB,MAAsB;IAEtB,OAAO,oBAAoB,CAAC,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,IAAI,EAAE;QACzE,MAAM,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAC/E,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RunManager } from '../workflows/run.ts';
|
|
2
2
|
import type { RunStore } from '../runs/store.ts';
|
|
3
3
|
import { CredentialRegistry } from './credentials.ts';
|
|
4
|
-
import { DelegationService, type DelegationProject } from './service.ts';
|
|
4
|
+
import { DelegationService, type DelegationProject, type WorkerCleanupFactory } from './service.ts';
|
|
5
5
|
export type DelegationSession = {
|
|
6
6
|
restrictCrossSessionMessaging: true;
|
|
7
7
|
env: Record<string, string>;
|
|
@@ -26,8 +26,10 @@ export declare class DelegationController {
|
|
|
26
26
|
private projects;
|
|
27
27
|
private closed;
|
|
28
28
|
private warned;
|
|
29
|
+
/** `cleanup` lets the service destroy workers; the process entries pass `workerCleanups()`. */
|
|
30
|
+
constructor(cleanup?: WorkerCleanupFactory);
|
|
29
31
|
get url(): string | undefined;
|
|
30
|
-
static start(): Promise<DelegationController>;
|
|
32
|
+
static start(cleanup?: WorkerCleanupFactory): Promise<DelegationController>;
|
|
31
33
|
private unavailable;
|
|
32
34
|
attachProject(project: DelegationProject & {
|
|
33
35
|
manager: Pick<RunManager, 'setDelegationProvisioner'>;
|
|
@@ -152,15 +152,17 @@ export function provisionDelegationSession(options) {
|
|
|
152
152
|
}
|
|
153
153
|
/** Owns one invisible loopback listener in this controller, for cockpit AND headless use. */
|
|
154
154
|
export class DelegationController {
|
|
155
|
-
service
|
|
155
|
+
service;
|
|
156
156
|
credentials = new CredentialRegistry();
|
|
157
157
|
transport;
|
|
158
158
|
projects = new Map();
|
|
159
159
|
closed = false;
|
|
160
160
|
warned = false;
|
|
161
|
+
/** `cleanup` lets the service destroy workers; the process entries pass `workerCleanups()`. */
|
|
162
|
+
constructor(cleanup) { this.service = new DelegationService(cleanup); }
|
|
161
163
|
get url() { return this.transport?.url; }
|
|
162
|
-
static async start() {
|
|
163
|
-
const controller = new DelegationController();
|
|
164
|
+
static async start(cleanup) {
|
|
165
|
+
const controller = new DelegationController(cleanup);
|
|
164
166
|
// Always on since hearsay-tools/cezarion#2784: each task's switches gate workers and messaging.
|
|
165
167
|
try {
|
|
166
168
|
controller.transport = await startDelegationTransport(createDelegationApp(createDelegationRoutes(controller.service, controller.credentials)));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provision.js","sourceRoot":"","sources":["../../src/delegation/provision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC7F,OAAO,EAAE,iBAAiB,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"provision.js","sourceRoot":"","sources":["../../src/delegation/provision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC7F,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAqD,MAAM,cAAc,CAAC;AACpH,OAAO,EAAE,WAAW,EAAE,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Routes(service: DelegationService, crede
|
|
|
90
90
|
authFailureId?: string | undefined;
|
|
91
91
|
runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
|
|
92
92
|
}[];
|
|
93
|
+
} | {
|
|
94
|
+
runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
|
|
95
|
+
models: {
|
|
96
|
+
id: string;
|
|
97
|
+
label: string;
|
|
98
|
+
description: string;
|
|
99
|
+
effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
|
|
100
|
+
}[];
|
|
101
|
+
source: "cache" | "live" | "unavailable";
|
|
102
|
+
stale: boolean;
|
|
103
|
+
reason?: string | undefined;
|
|
93
104
|
} | {
|
|
94
105
|
tasks: {
|
|
95
106
|
id: string;
|
|
@@ -102,17 +113,6 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
102
113
|
reason?: string | undefined;
|
|
103
114
|
}[];
|
|
104
115
|
nextOffset?: number | undefined;
|
|
105
|
-
} | {
|
|
106
|
-
runner: "claude" | "codex" | "cursor" | "omp" | "opencode" | "pi";
|
|
107
|
-
models: {
|
|
108
|
-
id: string;
|
|
109
|
-
label: string;
|
|
110
|
-
description: string;
|
|
111
|
-
effortLevels?: ("high" | "low" | "max" | "medium" | "xhigh")[] | undefined;
|
|
112
|
-
}[];
|
|
113
|
-
source: "cache" | "live" | "unavailable";
|
|
114
|
-
stale: boolean;
|
|
115
|
-
reason?: string | undefined;
|
|
116
116
|
};
|
|
117
117
|
outputFormat: "json";
|
|
118
118
|
status: 200;
|
|
@@ -221,13 +221,13 @@ export declare function createDelegationRoutes(service: DelegationService, crede
|
|
|
221
221
|
status: 200;
|
|
222
222
|
input: {
|
|
223
223
|
json: {
|
|
224
|
-
workerIds: string[];
|
|
225
|
-
timeoutSeconds?: number | undefined;
|
|
226
|
-
mode?: "all" | "any" | "one" | undefined;
|
|
227
|
-
} | {
|
|
228
224
|
requestIds: string[];
|
|
229
225
|
mode?: "all" | "any" | "one" | undefined;
|
|
230
226
|
timeoutSeconds?: number | undefined;
|
|
227
|
+
} | {
|
|
228
|
+
workerIds: string[];
|
|
229
|
+
timeoutSeconds?: number | undefined;
|
|
230
|
+
mode?: "all" | "any" | "one" | undefined;
|
|
231
231
|
} | {
|
|
232
232
|
peerIds: string[];
|
|
233
233
|
timeoutSeconds?: number | undefined;
|
|
@@ -3,11 +3,10 @@ import { type HostDiscovery } from '../discovery/choices.ts';
|
|
|
3
3
|
export { rootDelegation } from './conversations.ts';
|
|
4
4
|
import { type DiscoveryRequest, type DiscoveryResponse } from '../contract/index.js';
|
|
5
5
|
import { type ConversationSendRequest, type ConversationSendResult, type ConversationInspectRequest, type ConversationInspectResult, type ConversationCancelRequest, type InboxReserveResult, type InboxReceiptRequest, type InboxReceiptResult, type RequestWaitRequest, type RequestOutcome } from '../contract/index.js';
|
|
6
|
-
import { type PeerWaitRequest, type WorkerCancelWaitRequest, type WorkerListPage, type WorkerListQuery, type WorkerCollectedResult, type WorkerInspection, type WorkerParams, type WorkerSpawnRequest, type WorkerSteerRequest, type WorkerWaitRequest } from '../contract/index.js';
|
|
6
|
+
import { type PeerWaitRequest, type WorkerCancelWaitRequest, type WorkerListPage, type WorkerListQuery, type WorkerCollectedResult, type WorkerInspection, type WorkerParams, type WorkerSpawnRequest, type WorkerSteerRequest, type WorkerDestroyResult, type WorkerWaitRequest } from '../contract/index.js';
|
|
7
7
|
import type { RunStore, RunRecord } from '../runs/store.ts';
|
|
8
8
|
import type { RunManager } from '../workflows/run.ts';
|
|
9
9
|
import type { Caller } from './credentials.ts';
|
|
10
|
-
import { type WorkerCleanupOptions } from './worker-cleanup.ts';
|
|
11
10
|
export type DelegationManager = Pick<RunManager, 'acknowledgeInbox' | 'awaitRunTermination' | 'builtinSkills' | 'canClaimInboxInput' | 'cancelPeerWait' | 'cancelWorkerWait' | 'claimWorkerCleanup' | 'continueRun' | 'deliverConversationInput' | 'enqueueOwnedRun' | 'isActive' | 'pauseWorkerCleanup' | 'previewHost' | 'reconcileWorkerWaits' | 'recoverWorkerCleanup' | 'registerPeerWait' | 'registerRequestWait' | 'registerWorkerWait' | 'releaseInbox' | 'requestWorkerStop' | 'reserveInboxInputs' | 'selectDelegationExecutionSettings' | 'settleOrphanedWorkerExecution' | 'steerWorker' | 'takeWorkerTerminationBlocker'>;
|
|
12
11
|
export type DelegationProject = {
|
|
13
12
|
home: Home;
|
|
@@ -16,9 +15,18 @@ export type DelegationProject = {
|
|
|
16
15
|
store: RunStore;
|
|
17
16
|
manager: DelegationManager;
|
|
18
17
|
};
|
|
18
|
+
/** One registered project's destroy state and retry lifecycle, as `WorkerCleanup` (`worker-cleanup.ts`) implements it. */
|
|
19
|
+
export type WorkerCleanupPort = {
|
|
20
|
+
request(workerId: string, check: () => RunRecord): Promise<WorkerDestroyResult>;
|
|
21
|
+
armAfterRecovery(): void;
|
|
22
|
+
detach(): void;
|
|
23
|
+
};
|
|
24
|
+
/** Builds a project's cleanup when it registers. The process entries supply `workerCleanups()`, as they
|
|
25
|
+
* supply discovery; a service built without one refuses destroys, so it never loads the removal path. */
|
|
26
|
+
export type WorkerCleanupFactory = (project: DelegationProject, isAttached: () => boolean, serialized: <T>(key: string, operation: () => Promise<T>) => Promise<T>) => WorkerCleanupPort;
|
|
19
27
|
/** A single controller's shared policy adapter; managers retain scheduling and lifecycle ownership. */
|
|
20
28
|
export declare class DelegationService {
|
|
21
|
-
private readonly
|
|
29
|
+
private readonly cleanup?;
|
|
22
30
|
private discovery?;
|
|
23
31
|
setDiscovery(discovery: HostDiscovery): void;
|
|
24
32
|
discover(caller: Caller, value: DiscoveryRequest): Promise<DiscoveryResponse>;
|
|
@@ -26,12 +34,13 @@ export declare class DelegationService {
|
|
|
26
34
|
private projects;
|
|
27
35
|
private serial;
|
|
28
36
|
private cleanups;
|
|
29
|
-
constructor(
|
|
37
|
+
constructor(cleanup?: WorkerCleanupFactory | undefined);
|
|
30
38
|
registerProject(project: DelegationProject): () => void;
|
|
31
39
|
/** Called only after manager recovery, when persisted destroy intents may be retried. */
|
|
32
40
|
armDestroyRetries(projectId: string): void;
|
|
33
41
|
/** The data directory of the caller's project, for the listener's migration admission. */
|
|
34
42
|
projectDataDir(caller: Caller): string | undefined;
|
|
43
|
+
private cleanupFor;
|
|
35
44
|
private context;
|
|
36
45
|
private serialized;
|
|
37
46
|
private target;
|
|
@@ -27,7 +27,6 @@ import { isAuthenticatedCaller } from './credentials.js';
|
|
|
27
27
|
import { parseDelegationEffort } from './effort.js';
|
|
28
28
|
import { authorizeWorkerList, authorizeSpawn, authorizeSpawnReplay, authorizeWorker, authorizeCancelWait, authorizeRetainedResult, DelegationPolicyError, MESSAGING_OFF, requireWorkersAllowed } from './policy.js';
|
|
29
29
|
import { planOwnedWorkspace, readOwnedDiff, resolveWorkerBaseline, verifyOwnedWorkspace } from './workspace.js';
|
|
30
|
-
import { WorkerCleanup } from './worker-cleanup.js';
|
|
31
30
|
/**
|
|
32
31
|
* Resolve an explicit workflow or skill. With neither, use the built-in quick-task constant, not
|
|
33
32
|
* a repo override. Require at least one agent step and resolve its runner/account independently.
|
|
@@ -170,7 +169,7 @@ function assertNewPeerSend(pair, request) {
|
|
|
170
169
|
}
|
|
171
170
|
/** A single controller's shared policy adapter; managers retain scheduling and lifecycle ownership. */
|
|
172
171
|
export class DelegationService {
|
|
173
|
-
|
|
172
|
+
cleanup;
|
|
174
173
|
discovery;
|
|
175
174
|
setDiscovery(discovery) { this.discovery = discovery; }
|
|
176
175
|
async discover(caller, value) {
|
|
@@ -214,8 +213,8 @@ export class DelegationService {
|
|
|
214
213
|
projects = new Map();
|
|
215
214
|
serial = new Map();
|
|
216
215
|
cleanups = new Map();
|
|
217
|
-
constructor(
|
|
218
|
-
this.
|
|
216
|
+
constructor(cleanup) {
|
|
217
|
+
this.cleanup = cleanup;
|
|
219
218
|
}
|
|
220
219
|
registerProject(project) {
|
|
221
220
|
const existing = this.projects.get(project.id);
|
|
@@ -224,7 +223,8 @@ export class DelegationService {
|
|
|
224
223
|
this.cleanups.get(project.id)?.detach();
|
|
225
224
|
existing?.manager.pauseWorkerCleanup();
|
|
226
225
|
this.projects.set(project.id, project);
|
|
227
|
-
|
|
226
|
+
if (this.cleanup)
|
|
227
|
+
this.cleanups.set(project.id, this.cleanup(project, () => this.projects.get(project.id) === project, (key, operation) => this.serialized(key, operation)));
|
|
228
228
|
return () => { if (this.projects.get(project.id) === project) {
|
|
229
229
|
this.cleanups.get(project.id)?.detach();
|
|
230
230
|
project.manager.pauseWorkerCleanup();
|
|
@@ -239,6 +239,12 @@ export class DelegationService {
|
|
|
239
239
|
const project = isAuthenticatedCaller(caller) ? this.projects.get(caller.projectId) : undefined;
|
|
240
240
|
return project ? projectPaths(project.root).write : undefined;
|
|
241
241
|
}
|
|
242
|
+
cleanupFor(project) {
|
|
243
|
+
const cleanup = this.cleanups.get(project.id);
|
|
244
|
+
if (!cleanup)
|
|
245
|
+
throw new DelegationPolicyError('unavailable_transport', 'Worker cleanup is unavailable');
|
|
246
|
+
return cleanup;
|
|
247
|
+
}
|
|
242
248
|
context(caller) {
|
|
243
249
|
const project = isAuthenticatedCaller(caller) ? this.projects.get(caller.projectId) : undefined;
|
|
244
250
|
if (!project)
|
|
@@ -815,7 +821,7 @@ export class DelegationService {
|
|
|
815
821
|
}
|
|
816
822
|
async destroy(caller, params) {
|
|
817
823
|
const { project, worker } = this.target(caller, params, 'destroy');
|
|
818
|
-
return this.
|
|
824
|
+
return this.cleanupFor(project).request(worker.id, () => this.target(caller, params, 'destroy').worker);
|
|
819
825
|
}
|
|
820
826
|
/** Existing human HTTP authority, bound to its resolved project; never mint a pretend agent caller. */
|
|
821
827
|
async destroyForHuman(projectId, workerId) {
|
|
@@ -829,7 +835,7 @@ export class DelegationService {
|
|
|
829
835
|
return worker;
|
|
830
836
|
};
|
|
831
837
|
check();
|
|
832
|
-
return this.
|
|
838
|
+
return this.cleanupFor(project).request(workerId, check);
|
|
833
839
|
}
|
|
834
840
|
}
|
|
835
841
|
/** No agent session was recorded, so a resume starts a fresh one (hearsay-tools/squawk#3337). */
|