@hearsay-tools/squawk 0.18.0-dev.8057 → 0.18.0-dev.8063
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/built-in-wait-kinds.d.ts +2 -1
- package/dist/built-in-wait-kinds.js +9 -5
- package/dist/built-in-wait-kinds.js.map +1 -1
- package/dist/ci-wait/pr-wait-kind.d.ts +65 -0
- package/dist/ci-wait/pr-wait-kind.js +120 -0
- package/dist/ci-wait/pr-wait-kind.js.map +1 -0
- package/dist/delegation/routes.d.ts +79 -79
- package/dist/delegation/wait-kinds.d.ts +8 -0
- package/dist/delegation/wait-kinds.js +317 -0
- package/dist/delegation/wait-kinds.js.map +1 -0
- package/dist/runs/run-archive.d.ts +72 -72
- package/dist/server/live-routes.d.ts +6 -6
- package/dist/server/reports-api.d.ts +2 -2
- package/dist/server/runner-install-routes.d.ts +10 -10
- package/dist/server/server.d.ts +1373 -1373
- package/dist/workflows/run/wait-engine.d.ts +95 -109
- package/dist/workflows/run/wait-engine.js +100 -212
- package/dist/workflows/run/wait-engine.js.map +1 -1
- package/dist/workflows/run/wait-kind-registry.d.ts +78 -2
- package/dist/workflows/run/wait-kind-registry.js.map +1 -1
- package/dist/workflows/run/wait-kinds.d.ts +390 -1011
- package/dist/workflows/run/wait-kinds.js +71 -188
- package/dist/workflows/run/wait-kinds.js.map +1 -1
- package/dist/workflows/run/wait-registration.d.ts +7 -0
- package/dist/workflows/run/wait-registration.js +2 -0
- package/dist/workflows/run/wait-registration.js.map +1 -1
- package/dist/workflows/run/wait-registry.d.ts +26 -36
- package/dist/workflows/run/wait-registry.js +71 -160
- package/dist/workflows/run/wait-registry.js.map +1 -1
- package/dist/workflows/waits.d.ts +2 -2
- package/dist/workflows/waits.js +2 -2
- package/dist/workflows/waits.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,19 +1,19 @@
|
|
|
1
|
+
import { type WaitFeatureServices } from './wait-kind-registry.ts';
|
|
1
2
|
import type { Wait, WaitErrorCode, AskErrorCode, WorkerWaitEntry } from '../../contract/index.js';
|
|
2
3
|
import type { ActiveRun } from '../active-run.ts';
|
|
3
4
|
import type { RunModuleContext } from './types.ts';
|
|
4
5
|
import type { RunRecord } from '../../runs/store.ts';
|
|
5
|
-
import type { CiWatcherSupervisor } from '../../ci-wait/supervisor.ts';
|
|
6
6
|
import { ProcessWaitSupervisor } from '../../process-wait/supervisor.ts';
|
|
7
7
|
import type { ExitFileRoots } from '../../process-wait/exit-file.ts';
|
|
8
8
|
import { type WaitResult } from '../waits.ts';
|
|
9
9
|
import { type RegistrationIdentity } from './wait-registration.ts';
|
|
10
10
|
export declare function warnRegistrationRefused(code: WaitErrorCode | AskErrorCode): void;
|
|
11
11
|
/** What the engine asks the rest of the run manager (ADR 0053): wake admission, the run line,
|
|
12
|
-
* the family reconcile, human waits and the subagent session.
|
|
13
|
-
|
|
12
|
+
* the family reconcile, human waits and the subagent session. Feature wait kinds add their own
|
|
13
|
+
* services through `WaitFeatureServices`. */
|
|
14
|
+
export interface WaitEngineHost extends WaitFeatureServices {
|
|
14
15
|
active(id: string): ActiveRun | undefined;
|
|
15
16
|
canProceedWithRun(id: string, run: RunRecord | undefined): run is RunRecord;
|
|
16
|
-
ciSupervisor(): Pick<CiWatcherSupervisor, 'resolve' | 'watch' | 'close'>;
|
|
17
17
|
reconcileWorkerWaits(family?: string): void;
|
|
18
18
|
noticeParkedWorkers(id: string): void;
|
|
19
19
|
withdrawSquawkHumanWaits(id: string): void;
|
|
@@ -69,24 +69,21 @@ export declare class WaitEngine {
|
|
|
69
69
|
private readonly host;
|
|
70
70
|
private readonly maxAutoContinues;
|
|
71
71
|
private readonly processSupervisor;
|
|
72
|
-
/** One CI watch per open CI wait, keyed by wait id. */
|
|
73
|
-
private readonly ciWatches;
|
|
74
72
|
/** A resolution whose checkpoint failed, retried by wait id. */
|
|
75
|
-
private readonly
|
|
76
|
-
/**
|
|
77
|
-
|
|
78
|
-
private readonly
|
|
73
|
+
private readonly settleRetries;
|
|
74
|
+
/** Each armed wait's watch, by wait id: the context its row's lifecycle reads, and the signal
|
|
75
|
+
* the engine aborts when it disarms the wait. */
|
|
76
|
+
private readonly armedWatches;
|
|
79
77
|
private readonly workerResolveRetries;
|
|
80
|
-
/** One timer per
|
|
78
|
+
/** One timer per wait with an armed deadline, keyed by wait id. */
|
|
81
79
|
private readonly waitTimers;
|
|
82
|
-
/** The watch adapter each row names. */
|
|
83
|
-
private readonly watches;
|
|
84
80
|
constructor(context: RunModuleContext, host: WaitEngineHost, maxAutoContinues: number, processSupervisor?: Pick<ProcessWaitSupervisor, 'watch' | 'close'>);
|
|
85
81
|
/** Whether the run's open-wait list has room. Each caller keeps its own refusal shape. */
|
|
86
82
|
hasRoom(run: Pick<RunRecord, 'waits'>): boolean;
|
|
87
83
|
/** Commit, arm and (at a boundary) park on a newly registered wait. A wait opened with the
|
|
88
84
|
* result its caller already holds arms nothing and resolves with it after the park. */
|
|
89
85
|
open<W extends Wait>(runId: string, state: ActiveRun | undefined, wait: W, options: OpenOptions): OpenResult<W>;
|
|
86
|
+
/** A row's open hook replaces the arm a newly opened wait takes. */
|
|
90
87
|
private armOpened;
|
|
91
88
|
/**
|
|
92
89
|
* Commit a changed open wait, then arm it. A moved deadline disarms the old one first; an
|
|
@@ -97,10 +94,10 @@ export declare class WaitEngine {
|
|
|
97
94
|
log: string;
|
|
98
95
|
}): boolean;
|
|
99
96
|
private commitOpened;
|
|
100
|
-
/** A
|
|
97
|
+
/** A wait its open hook already settled is no longer listed, and parks nothing. */
|
|
101
98
|
private park;
|
|
102
99
|
/** The entry as recorded now: the store keeps the entry it was given, and only its phase can
|
|
103
|
-
* have moved since. A
|
|
100
|
+
* have moved since. A row's lookup can read a wait its open hook already settled. */
|
|
104
101
|
private openedEntry;
|
|
105
102
|
/** Where a process wait's exit file may sit: the run's worktree (the checkout for a run without
|
|
106
103
|
* one) and, unless turned off, the Squawk temp directory its agent gets as `TMPDIR`. */
|
|
@@ -240,30 +237,6 @@ export declare class WaitEngine {
|
|
|
240
237
|
deadline: string;
|
|
241
238
|
seconds: number;
|
|
242
239
|
note?: string | undefined;
|
|
243
|
-
} | {
|
|
244
|
-
id: string;
|
|
245
|
-
source: "agent" | "cezar";
|
|
246
|
-
via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
|
|
247
|
-
registeredAt: string;
|
|
248
|
-
phase: "cancelled" | "delivered" | "open" | "resolved";
|
|
249
|
-
resolvedAt?: string | undefined;
|
|
250
|
-
deliveredAt?: string | undefined;
|
|
251
|
-
cancelledAt?: string | undefined;
|
|
252
|
-
turnId: string;
|
|
253
|
-
kind: "process";
|
|
254
|
-
deadline: string;
|
|
255
|
-
timeoutSeconds: number;
|
|
256
|
-
pid: number;
|
|
257
|
-
startToken?: string | undefined;
|
|
258
|
-
exitFile?: string | undefined;
|
|
259
|
-
note?: string | undefined;
|
|
260
|
-
result?: {
|
|
261
|
-
outcome: "deadline" | "error" | "exit_file" | "exited";
|
|
262
|
-
observedAt: string;
|
|
263
|
-
exitCode?: number | undefined;
|
|
264
|
-
exitFileNote?: "not-an-exit-code" | undefined;
|
|
265
|
-
diagnostic?: string | undefined;
|
|
266
|
-
} | undefined;
|
|
267
240
|
} | {
|
|
268
241
|
id: string;
|
|
269
242
|
source: "agent" | "cezar";
|
|
@@ -325,6 +298,30 @@ export declare class WaitEngine {
|
|
|
325
298
|
reason: "outcome" | "timeout";
|
|
326
299
|
} | undefined;
|
|
327
300
|
wakeInputId?: string | undefined;
|
|
301
|
+
} | {
|
|
302
|
+
id: string;
|
|
303
|
+
source: "agent" | "cezar";
|
|
304
|
+
via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
|
|
305
|
+
registeredAt: string;
|
|
306
|
+
phase: "cancelled" | "delivered" | "open" | "resolved";
|
|
307
|
+
resolvedAt?: string | undefined;
|
|
308
|
+
deliveredAt?: string | undefined;
|
|
309
|
+
cancelledAt?: string | undefined;
|
|
310
|
+
turnId: string;
|
|
311
|
+
kind: "process";
|
|
312
|
+
deadline: string;
|
|
313
|
+
timeoutSeconds: number;
|
|
314
|
+
pid: number;
|
|
315
|
+
startToken?: string | undefined;
|
|
316
|
+
exitFile?: string | undefined;
|
|
317
|
+
note?: string | undefined;
|
|
318
|
+
result?: {
|
|
319
|
+
outcome: "deadline" | "error" | "exit_file" | "exited";
|
|
320
|
+
observedAt: string;
|
|
321
|
+
exitCode?: number | undefined;
|
|
322
|
+
exitFileNote?: "not-an-exit-code" | undefined;
|
|
323
|
+
diagnostic?: string | undefined;
|
|
324
|
+
} | undefined;
|
|
328
325
|
} | {
|
|
329
326
|
id: string;
|
|
330
327
|
source: "agent" | "cezar";
|
|
@@ -452,30 +449,6 @@ export declare class WaitEngine {
|
|
|
452
449
|
deadline: string;
|
|
453
450
|
seconds: number;
|
|
454
451
|
note?: string | undefined;
|
|
455
|
-
} | {
|
|
456
|
-
id: string;
|
|
457
|
-
source: "agent" | "cezar";
|
|
458
|
-
via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
|
|
459
|
-
registeredAt: string;
|
|
460
|
-
phase: "cancelled" | "delivered" | "open" | "resolved";
|
|
461
|
-
resolvedAt?: string | undefined;
|
|
462
|
-
deliveredAt?: string | undefined;
|
|
463
|
-
cancelledAt?: string | undefined;
|
|
464
|
-
turnId: string;
|
|
465
|
-
kind: "process";
|
|
466
|
-
deadline: string;
|
|
467
|
-
timeoutSeconds: number;
|
|
468
|
-
pid: number;
|
|
469
|
-
startToken?: string | undefined;
|
|
470
|
-
exitFile?: string | undefined;
|
|
471
|
-
note?: string | undefined;
|
|
472
|
-
result?: {
|
|
473
|
-
outcome: "deadline" | "error" | "exit_file" | "exited";
|
|
474
|
-
observedAt: string;
|
|
475
|
-
exitCode?: number | undefined;
|
|
476
|
-
exitFileNote?: "not-an-exit-code" | undefined;
|
|
477
|
-
diagnostic?: string | undefined;
|
|
478
|
-
} | undefined;
|
|
479
452
|
} | {
|
|
480
453
|
id: string;
|
|
481
454
|
source: "agent" | "cezar";
|
|
@@ -537,6 +510,30 @@ export declare class WaitEngine {
|
|
|
537
510
|
reason: "outcome" | "timeout";
|
|
538
511
|
} | undefined;
|
|
539
512
|
wakeInputId?: string | undefined;
|
|
513
|
+
} | {
|
|
514
|
+
id: string;
|
|
515
|
+
source: "agent" | "cezar";
|
|
516
|
+
via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
|
|
517
|
+
registeredAt: string;
|
|
518
|
+
phase: "cancelled" | "delivered" | "open" | "resolved";
|
|
519
|
+
resolvedAt?: string | undefined;
|
|
520
|
+
deliveredAt?: string | undefined;
|
|
521
|
+
cancelledAt?: string | undefined;
|
|
522
|
+
turnId: string;
|
|
523
|
+
kind: "process";
|
|
524
|
+
deadline: string;
|
|
525
|
+
timeoutSeconds: number;
|
|
526
|
+
pid: number;
|
|
527
|
+
startToken?: string | undefined;
|
|
528
|
+
exitFile?: string | undefined;
|
|
529
|
+
note?: string | undefined;
|
|
530
|
+
result?: {
|
|
531
|
+
outcome: "deadline" | "error" | "exit_file" | "exited";
|
|
532
|
+
observedAt: string;
|
|
533
|
+
exitCode?: number | undefined;
|
|
534
|
+
exitFileNote?: "not-an-exit-code" | undefined;
|
|
535
|
+
diagnostic?: string | undefined;
|
|
536
|
+
} | undefined;
|
|
540
537
|
} | {
|
|
541
538
|
id: string;
|
|
542
539
|
source: "agent" | "cezar";
|
|
@@ -663,30 +660,6 @@ export declare class WaitEngine {
|
|
|
663
660
|
deadline: string;
|
|
664
661
|
seconds: number;
|
|
665
662
|
note?: string | undefined;
|
|
666
|
-
} | {
|
|
667
|
-
id: string;
|
|
668
|
-
source: "agent" | "cezar";
|
|
669
|
-
via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
|
|
670
|
-
registeredAt: string;
|
|
671
|
-
phase: "cancelled" | "delivered" | "open" | "resolved";
|
|
672
|
-
resolvedAt?: string | undefined;
|
|
673
|
-
deliveredAt?: string | undefined;
|
|
674
|
-
cancelledAt?: string | undefined;
|
|
675
|
-
turnId: string;
|
|
676
|
-
kind: "process";
|
|
677
|
-
deadline: string;
|
|
678
|
-
timeoutSeconds: number;
|
|
679
|
-
pid: number;
|
|
680
|
-
startToken?: string | undefined;
|
|
681
|
-
exitFile?: string | undefined;
|
|
682
|
-
note?: string | undefined;
|
|
683
|
-
result?: {
|
|
684
|
-
outcome: "deadline" | "error" | "exit_file" | "exited";
|
|
685
|
-
observedAt: string;
|
|
686
|
-
exitCode?: number | undefined;
|
|
687
|
-
exitFileNote?: "not-an-exit-code" | undefined;
|
|
688
|
-
diagnostic?: string | undefined;
|
|
689
|
-
} | undefined;
|
|
690
663
|
} | {
|
|
691
664
|
id: string;
|
|
692
665
|
source: "agent" | "cezar";
|
|
@@ -748,6 +721,30 @@ export declare class WaitEngine {
|
|
|
748
721
|
reason: "outcome" | "timeout";
|
|
749
722
|
} | undefined;
|
|
750
723
|
wakeInputId?: string | undefined;
|
|
724
|
+
} | {
|
|
725
|
+
id: string;
|
|
726
|
+
source: "agent" | "cezar";
|
|
727
|
+
via: "ask-line" | "budget" | "cez-message-wait" | "cez-worker-wait" | "cezar_ask" | "cezar_wait" | "cezar_wait_for_ci" | "completion" | "monitoring-line" | "native-ask" | "native-subagents" | "no-wait" | "schedule-wakeup";
|
|
728
|
+
registeredAt: string;
|
|
729
|
+
phase: "cancelled" | "delivered" | "open" | "resolved";
|
|
730
|
+
resolvedAt?: string | undefined;
|
|
731
|
+
deliveredAt?: string | undefined;
|
|
732
|
+
cancelledAt?: string | undefined;
|
|
733
|
+
turnId: string;
|
|
734
|
+
kind: "process";
|
|
735
|
+
deadline: string;
|
|
736
|
+
timeoutSeconds: number;
|
|
737
|
+
pid: number;
|
|
738
|
+
startToken?: string | undefined;
|
|
739
|
+
exitFile?: string | undefined;
|
|
740
|
+
note?: string | undefined;
|
|
741
|
+
result?: {
|
|
742
|
+
outcome: "deadline" | "error" | "exit_file" | "exited";
|
|
743
|
+
observedAt: string;
|
|
744
|
+
exitCode?: number | undefined;
|
|
745
|
+
exitFileNote?: "not-an-exit-code" | undefined;
|
|
746
|
+
diagnostic?: string | undefined;
|
|
747
|
+
} | undefined;
|
|
751
748
|
} | {
|
|
752
749
|
id: string;
|
|
753
750
|
source: "agent" | "cezar";
|
|
@@ -1254,30 +1251,20 @@ export declare class WaitEngine {
|
|
|
1254
1251
|
}[];
|
|
1255
1252
|
} | undefined;
|
|
1256
1253
|
} | undefined): ExitFileRoots;
|
|
1257
|
-
/** Start what resolves an open wait: the
|
|
1258
|
-
* (restart) resolves at once.
|
|
1254
|
+
/** Start what resolves an open wait: the lifecycle its row registers. An overdue deadline
|
|
1255
|
+
* (restart) resolves at once. A plugin kind's arm runs once per watch; a built-in kind's
|
|
1256
|
+
* own guard keeps it idempotent across refreshes and recovery. */
|
|
1259
1257
|
private armWait;
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1258
|
+
/** The wait's watch context: the armed one, now reading this entry, or a new one. */
|
|
1259
|
+
private watchContext;
|
|
1260
|
+
/** The wait's one timer. A newer timer clears the previous one, and disarm clears the current one. */
|
|
1261
|
+
private armTimer;
|
|
1262
|
+
/** A timer, peer or subagent deadline. A stopping, stopped or finishing run takes no
|
|
1263
|
+
* self-generated wake: the wait stays open for that transition to cancel, as the monitoring
|
|
1264
|
+
* timer did before it was a wait. */
|
|
1264
1265
|
private armDeadline;
|
|
1265
|
-
/**
|
|
1266
|
-
* A worker wait's deadline re-observes its family (hearsay-tools/cezarion#1235): the reconcile
|
|
1267
|
-
* resolves it with `timeout`, keeping any outcome observed by then. A failed checkpoint is
|
|
1268
|
-
* retried every second while the wait is still open, never dropped as an uncaught error. An
|
|
1269
|
-
* outcome whose resolution failed to commit arms the same retry with `firstDelay` 1 second.
|
|
1270
|
-
*/
|
|
1271
|
-
private armWorkerDeadline;
|
|
1272
1266
|
/** Stop everything that could still resolve this wait. */
|
|
1273
1267
|
private disarmWait;
|
|
1274
|
-
/**
|
|
1275
|
-
* Watch a process wait's command (hearsay-tools/cezarion#1446). Like a timer, its wake is the
|
|
1276
|
-
* agent's own arrangement: a stopping, stopped or finishing run takes none, and the wait stays
|
|
1277
|
-
* open for that transition to cancel.
|
|
1278
|
-
*/
|
|
1279
|
-
private startProcessWatch;
|
|
1280
|
-
private startCiWatch;
|
|
1281
1268
|
/** `resolveWait`, retried while its durable checkpoint is unavailable: a failed write may not
|
|
1282
1269
|
* drop the accepted intent or publish a false result. */
|
|
1283
1270
|
settleWait(runId: string, waitId: string, result?: WaitResult): void;
|
|
@@ -1290,8 +1277,7 @@ export declare class WaitEngine {
|
|
|
1290
1277
|
dispose(): void;
|
|
1291
1278
|
/** The open peer waits of these runs whose named peer already wrote, settled or was deleted resolve now. */
|
|
1292
1279
|
resolvePeerWaits(runIds: readonly string[]): void;
|
|
1293
|
-
/**
|
|
1294
|
-
* and the wait stays for that transition to cancel. True when the wait is no longer open. */
|
|
1280
|
+
/** The wait's row re-observes its target now. True when the wait is no longer open. */
|
|
1295
1281
|
private resolvePeerWait;
|
|
1296
1282
|
/** Commit an open wait as resolved together with its lifecycle input (id = wait id, or an
|
|
1297
1283
|
* upgraded worker wait's `wakeInputId`), then queue the run's wake. A worker wait passes the
|