@leitwerk-dev/watcher-utils 0.1.2 → 0.1.3
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/duration-parse.d.ts +2 -3
- package/dist/duration-parse.d.ts.map +1 -0
- package/dist/duration-parse.js +15 -6
- package/dist/duration-parse.js.map +1 -1
- package/dist/index.d.ts +8 -19
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -81
- package/dist/index.js.map +1 -1
- package/dist/poll-loop.d.ts +5 -6
- package/dist/poll-loop.d.ts.map +1 -0
- package/dist/poll-loop.js +58 -9
- package/dist/poll-loop.js.map +1 -1
- package/dist/process-helpers.d.ts +7 -9
- package/dist/process-helpers.d.ts.map +1 -0
- package/dist/process-helpers.js +32 -10
- package/dist/process-helpers.js.map +1 -1
- package/dist/trigger-files.d.ts +10 -0
- package/dist/trigger-files.d.ts.map +1 -0
- package/dist/trigger-files.js +31 -0
- package/dist/trigger-files.js.map +1 -0
- package/dist/watcher-coordinator.d.ts +26 -28
- package/dist/watcher-coordinator.d.ts.map +1 -0
- package/dist/watcher-coordinator.js +130 -21
- package/dist/watcher-coordinator.js.map +1 -1
- package/package.json +4 -4
package/dist/duration-parse.d.ts
CHANGED
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
* `options.allowHours` is retained for existing callers; the underlying `ms`
|
|
6
6
|
* parser supports hours and other common duration units by default.
|
|
7
7
|
*/
|
|
8
|
-
declare function parseDurationMs(value: string, defaultMs: number, _options?: {
|
|
8
|
+
export declare function parseDurationMs(value: string, defaultMs: number, _options?: {
|
|
9
9
|
allowHours?: boolean;
|
|
10
10
|
}): number;
|
|
11
|
-
|
|
12
|
-
export { parseDurationMs };
|
|
11
|
+
//# sourceMappingURL=duration-parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"duration-parse.d.ts","sourceRoot":"","sources":["../src/duration-parse.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC9B,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,EACjB,QAAQ,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GACrC,MAAM,CAOR"}
|
package/dist/duration-parse.js
CHANGED
|
@@ -1,7 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import ms from "ms";
|
|
2
|
+
/**
|
|
3
|
+
* Parse a human-friendly duration string (e.g. "150ms", "1.5s", "2 min") into
|
|
4
|
+
* milliseconds. Returns `defaultMs` when the input cannot be parsed.
|
|
5
|
+
*
|
|
6
|
+
* `options.allowHours` is retained for existing callers; the underlying `ms`
|
|
7
|
+
* parser supports hours and other common duration units by default.
|
|
8
|
+
*/
|
|
9
|
+
export function parseDurationMs(value, defaultMs, _options = {}) {
|
|
10
|
+
const parsed = ms(value.trim());
|
|
11
|
+
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
12
|
+
return defaultMs;
|
|
13
|
+
}
|
|
14
|
+
return parsed;
|
|
15
|
+
}
|
|
7
16
|
//# sourceMappingURL=duration-parse.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"file":"duration-parse.js","sourceRoot":"","sources":["../src/duration-parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAC9B,KAAa,EACb,SAAiB,EACjB,WAAqC,EAAE;IAEvC,MAAM,MAAM,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,EAAoB,CAAC,CAAC;IAClD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5C,OAAO,SAAS,CAAC;IAClB,CAAC;IAED,OAAO,MAAM,CAAC;AACf,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type TriggerFileReadResult = {
|
|
10
|
-
exists: false;
|
|
11
|
-
} | {
|
|
12
|
-
exists: true;
|
|
13
|
-
content: string;
|
|
14
|
-
};
|
|
15
|
-
declare function errorCode(error: unknown): string | null;
|
|
16
|
-
declare function readTriggerFile(filePath: string): Promise<TriggerFileReadResult>;
|
|
17
|
-
declare function consumeTriggerFile(filePath: string): Promise<void>;
|
|
18
|
-
|
|
19
|
-
export { type TriggerFileReadResult, consumeTriggerFile, errorCode, readTriggerFile };
|
|
1
|
+
/** @deprecated Import external-write idempotency from `@leitwerk-dev/external-writes`. */
|
|
2
|
+
export { createWriteIdentity, type EnsureWriteResult, type ExternalWriteLogRecordInput, type ExternalWriteLogRepoLike, ensureWrite, recordWriteIfMissing, type WriteIdentity, } from "@leitwerk-dev/external-writes";
|
|
3
|
+
export { parseDurationMs } from "./duration-parse.js";
|
|
4
|
+
export { createPollLoop, emptyPollResult, type PollLoop, type PollResult, } from "./poll-loop.js";
|
|
5
|
+
export { ensureWorkerForActiveAgent, hasProcessEvent, type ProcessEventRepoLike, processNeedsWorker, type WorkerSupervisorLike, } from "./process-helpers.js";
|
|
6
|
+
export { consumeTriggerFile, errorCode, readTriggerFile, type TriggerFileReadResult, } from "./trigger-files.js";
|
|
7
|
+
export { type AgentRepoAccessorLike, type BroadcasterLike, type CompletionReconciliationOptions, type CompletionReconciliationResult, type ContinueWatcherAgentStartupOptions, continueWatcherAgentStartup, type DiscoveryPassOptions, deferWatcherLaunchStart, launchFailureMessage, requireWatcherStartTurnId, runWatcherAbortReconciliation, runWatcherCompletionReconciliation, runWatcherDiscoveryPass, shouldEnsureWorkerForExistingActiveAgent, type WatcherCommandResult, type WatcherCommandServiceLike, type WatcherStartupDeps, } from "./watcher-coordinator.js";
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,OAAO,EACN,mBAAmB,EACnB,KAAK,iBAAiB,EACtB,KAAK,2BAA2B,EAChC,KAAK,wBAAwB,EAC7B,WAAW,EACX,oBAAoB,EACpB,KAAK,aAAa,GAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACN,cAAc,EACd,eAAe,EACf,KAAK,QAAQ,EACb,KAAK,UAAU,GACf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,0BAA0B,EAC1B,eAAe,EACf,KAAK,oBAAoB,EACzB,kBAAkB,EAClB,KAAK,oBAAoB,GACzB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,kBAAkB,EAClB,SAAS,EACT,eAAe,EACf,KAAK,qBAAqB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,KAAK,kCAAkC,EACvC,2BAA2B,EAC3B,KAAK,oBAAoB,EACzB,uBAAuB,EACvB,oBAAoB,EACpB,yBAAyB,EACzB,6BAA6B,EAC7B,kCAAkC,EAClC,uBAAuB,EACvB,wCAAwC,EACxC,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,GACvB,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,82 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "./
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} from "./
|
|
8
|
-
import {
|
|
9
|
-
continueWatcherAgentStartup,
|
|
10
|
-
deferWatcherLaunchStart,
|
|
11
|
-
launchFailureMessage,
|
|
12
|
-
requireWatcherStartTurnId,
|
|
13
|
-
runWatcherAbortReconciliation,
|
|
14
|
-
runWatcherCompletionReconciliation,
|
|
15
|
-
runWatcherDiscoveryPass,
|
|
16
|
-
shouldEnsureWorkerForExistingActiveAgent
|
|
17
|
-
} from "./chunk-XLVMFO6W.js";
|
|
18
|
-
import {
|
|
19
|
-
ensureWorkerForActiveAgent,
|
|
20
|
-
hasProcessEvent,
|
|
21
|
-
processNeedsWorker
|
|
22
|
-
} from "./chunk-3KGAUQIG.js";
|
|
23
|
-
|
|
24
|
-
// src/index.ts
|
|
25
|
-
import {
|
|
26
|
-
createWriteIdentity,
|
|
27
|
-
ensureWrite,
|
|
28
|
-
recordWriteIfMissing
|
|
29
|
-
} from "@leitwerk-dev/external-writes";
|
|
30
|
-
|
|
31
|
-
// src/trigger-files.ts
|
|
32
|
-
import { readFile, unlink } from "fs/promises";
|
|
33
|
-
function errorCode(error) {
|
|
34
|
-
if (typeof error !== "object" || error === null || !("code" in error)) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
const code = error.code;
|
|
38
|
-
return typeof code === "string" ? code : null;
|
|
39
|
-
}
|
|
40
|
-
async function readTriggerFile(filePath) {
|
|
41
|
-
try {
|
|
42
|
-
return { exists: true, content: await readFile(filePath, "utf8") };
|
|
43
|
-
} catch (error) {
|
|
44
|
-
if (errorCode(error) === "ENOENT") {
|
|
45
|
-
return { exists: false };
|
|
46
|
-
}
|
|
47
|
-
throw error;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
async function consumeTriggerFile(filePath) {
|
|
51
|
-
try {
|
|
52
|
-
await unlink(filePath);
|
|
53
|
-
} catch (error) {
|
|
54
|
-
if (errorCode(error) === "ENOENT") {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
throw error;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
export {
|
|
61
|
-
consumeTriggerFile,
|
|
62
|
-
continueWatcherAgentStartup,
|
|
63
|
-
createPollLoop,
|
|
64
|
-
createWriteIdentity,
|
|
65
|
-
deferWatcherLaunchStart,
|
|
66
|
-
emptyPollResult,
|
|
67
|
-
ensureWorkerForActiveAgent,
|
|
68
|
-
ensureWrite,
|
|
69
|
-
errorCode,
|
|
70
|
-
hasProcessEvent,
|
|
71
|
-
launchFailureMessage,
|
|
72
|
-
parseDurationMs,
|
|
73
|
-
processNeedsWorker,
|
|
74
|
-
readTriggerFile,
|
|
75
|
-
recordWriteIfMissing,
|
|
76
|
-
requireWatcherStartTurnId,
|
|
77
|
-
runWatcherAbortReconciliation,
|
|
78
|
-
runWatcherCompletionReconciliation,
|
|
79
|
-
runWatcherDiscoveryPass,
|
|
80
|
-
shouldEnsureWorkerForExistingActiveAgent
|
|
81
|
-
};
|
|
1
|
+
/** @deprecated Import external-write idempotency from `@leitwerk-dev/external-writes`. */
|
|
2
|
+
export { createWriteIdentity, ensureWrite, recordWriteIfMissing, } from "@leitwerk-dev/external-writes";
|
|
3
|
+
export { parseDurationMs } from "./duration-parse.js";
|
|
4
|
+
export { createPollLoop, emptyPollResult, } from "./poll-loop.js";
|
|
5
|
+
export { ensureWorkerForActiveAgent, hasProcessEvent, processNeedsWorker, } from "./process-helpers.js";
|
|
6
|
+
export { consumeTriggerFile, errorCode, readTriggerFile, } from "./trigger-files.js";
|
|
7
|
+
export { continueWatcherAgentStartup, deferWatcherLaunchStart, launchFailureMessage, requireWatcherStartTurnId, runWatcherAbortReconciliation, runWatcherCompletionReconciliation, runWatcherDiscoveryPass, shouldEnsureWorkerForExistingActiveAgent, } from "./watcher-coordinator.js";
|
|
82
8
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,OAAO,EACN,mBAAmB,EAInB,WAAW,EACX,oBAAoB,GAEpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EACN,cAAc,EACd,eAAe,GAGf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,0BAA0B,EAC1B,eAAe,EAEf,kBAAkB,GAElB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,kBAAkB,EAClB,SAAS,EACT,eAAe,GAEf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAMN,2BAA2B,EAE3B,uBAAuB,EACvB,oBAAoB,EACpB,yBAAyB,EACzB,6BAA6B,EAC7B,kCAAkC,EAClC,uBAAuB,EACvB,wCAAwC,GAIxC,MAAM,0BAA0B,CAAC"}
|
package/dist/poll-loop.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
interface PollResult {
|
|
1
|
+
export interface PollResult {
|
|
2
2
|
created: string[];
|
|
3
3
|
aborted: string[];
|
|
4
4
|
labelExchanged: string[];
|
|
5
5
|
skipped: string[];
|
|
6
6
|
errors: string[];
|
|
7
7
|
}
|
|
8
|
-
declare function emptyPollResult(): PollResult;
|
|
9
|
-
interface PollLoop<T extends PollResult = PollResult> {
|
|
8
|
+
export declare function emptyPollResult(): PollResult;
|
|
9
|
+
export interface PollLoop<T extends PollResult = PollResult> {
|
|
10
10
|
poll(): Promise<T>;
|
|
11
11
|
start(): void;
|
|
12
12
|
stop(): void;
|
|
@@ -15,11 +15,10 @@ interface PollLoop<T extends PollResult = PollResult> {
|
|
|
15
15
|
* Create a non-overlapping polling loop. `pollOnce` is the actual work;
|
|
16
16
|
* concurrent calls to `poll()` coalesce into the in-flight promise.
|
|
17
17
|
*/
|
|
18
|
-
declare function createPollLoop<T extends PollResult>(opts: {
|
|
18
|
+
export declare function createPollLoop<T extends PollResult>(opts: {
|
|
19
19
|
pollOnce: () => Promise<T>;
|
|
20
20
|
isEnabled: () => boolean;
|
|
21
21
|
pollInterval: () => string;
|
|
22
22
|
defaultIntervalMs?: number;
|
|
23
23
|
}): PollLoop<T>;
|
|
24
|
-
|
|
25
|
-
export { type PollLoop, type PollResult, createPollLoop, emptyPollResult };
|
|
24
|
+
//# sourceMappingURL=poll-loop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"poll-loop.d.ts","sourceRoot":"","sources":["../src/poll-loop.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IAC1B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,wBAAgB,eAAe,IAAI,UAAU,CAQ5C;AAED,MAAM,WAAW,QAAQ,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU;IAC1D,IAAI,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;IACnB,KAAK,IAAI,IAAI,CAAC;IACd,IAAI,IAAI,IAAI,CAAC;CACb;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,UAAU,EAAE,IAAI,EAAE;IAC1D,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;IAC3B,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,YAAY,EAAE,MAAM,MAAM,CAAC;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC3B,GAAG,QAAQ,CAAC,CAAC,CAAC,CA6Cd"}
|
package/dist/poll-loop.js
CHANGED
|
@@ -1,10 +1,59 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
1
|
+
import { parseDurationMs } from "./duration-parse.js";
|
|
2
|
+
export function emptyPollResult() {
|
|
3
|
+
return {
|
|
4
|
+
created: [],
|
|
5
|
+
aborted: [],
|
|
6
|
+
labelExchanged: [],
|
|
7
|
+
skipped: [],
|
|
8
|
+
errors: [],
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Create a non-overlapping polling loop. `pollOnce` is the actual work;
|
|
13
|
+
* concurrent calls to `poll()` coalesce into the in-flight promise.
|
|
14
|
+
*/
|
|
15
|
+
export function createPollLoop(opts) {
|
|
16
|
+
let timer = null;
|
|
17
|
+
let pollInFlight = null;
|
|
18
|
+
const defaultMs = opts.defaultIntervalMs ?? 60_000;
|
|
19
|
+
async function poll() {
|
|
20
|
+
if (pollInFlight) {
|
|
21
|
+
return pollInFlight;
|
|
22
|
+
}
|
|
23
|
+
const running = (async () => {
|
|
24
|
+
try {
|
|
25
|
+
return await opts.pollOnce();
|
|
26
|
+
}
|
|
27
|
+
finally {
|
|
28
|
+
pollInFlight = null;
|
|
29
|
+
}
|
|
30
|
+
})();
|
|
31
|
+
pollInFlight = running;
|
|
32
|
+
return running;
|
|
33
|
+
}
|
|
34
|
+
function pollAndIgnoreUnhandledRejection() {
|
|
35
|
+
void poll().catch(() => undefined);
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
poll,
|
|
39
|
+
start() {
|
|
40
|
+
if (timer) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (!opts.isEnabled()) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const ms = parseDurationMs(opts.pollInterval(), defaultMs);
|
|
47
|
+
timer = setInterval(pollAndIgnoreUnhandledRejection, ms);
|
|
48
|
+
pollAndIgnoreUnhandledRejection();
|
|
49
|
+
},
|
|
50
|
+
stop() {
|
|
51
|
+
if (!timer) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
clearInterval(timer);
|
|
55
|
+
timer = null;
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
10
59
|
//# sourceMappingURL=poll-loop.js.map
|
package/dist/poll-loop.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"file":"poll-loop.js","sourceRoot":"","sources":["../src/poll-loop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAUtD,MAAM,UAAU,eAAe;IAC9B,OAAO;QACN,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,EAAE;QACX,cAAc,EAAE,EAAE;QAClB,OAAO,EAAE,EAAE;QACX,MAAM,EAAE,EAAE;KACV,CAAC;AACH,CAAC;AAQD;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAuB,IAKpD;IACA,IAAI,KAAK,GAA0C,IAAI,CAAC;IACxD,IAAI,YAAY,GAAsB,IAAI,CAAC;IAC3C,MAAM,SAAS,GAAG,IAAI,CAAC,iBAAiB,IAAI,MAAM,CAAC;IAEnD,KAAK,UAAU,IAAI;QAClB,IAAI,YAAY,EAAE,CAAC;YAClB,OAAO,YAAY,CAAC;QACrB,CAAC;QACD,MAAM,OAAO,GAAG,CAAC,KAAK,IAAI,EAAE;YAC3B,IAAI,CAAC;gBACJ,OAAO,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC9B,CAAC;oBAAS,CAAC;gBACV,YAAY,GAAG,IAAI,CAAC;YACrB,CAAC;QACF,CAAC,CAAC,EAAE,CAAC;QACL,YAAY,GAAG,OAAO,CAAC;QACvB,OAAO,OAAO,CAAC;IAChB,CAAC;IAED,SAAS,+BAA+B;QACvC,KAAK,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACpC,CAAC;IAED,OAAO;QACN,IAAI;QACJ,KAAK;YACJ,IAAI,KAAK,EAAE,CAAC;gBACX,OAAO;YACR,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,CAAC;gBACvB,OAAO;YACR,CAAC;YACD,MAAM,EAAE,GAAG,eAAe,CAAC,IAAI,CAAC,YAAY,EAAE,EAAE,SAAS,CAAC,CAAC;YAC3D,KAAK,GAAG,WAAW,CAAC,+BAA+B,EAAE,EAAE,CAAC,CAAC;YACzD,+BAA+B,EAAE,CAAC;QACnC,CAAC;QACD,IAAI;YACH,IAAI,CAAC,KAAK,EAAE,CAAC;gBACZ,OAAO;YACR,CAAC;YACD,aAAa,CAAC,KAAK,CAAC,CAAC;YACrB,KAAK,GAAG,IAAI,CAAC;QACd,CAAC;KACD,CAAC;AACH,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { ProcessInstance } from
|
|
2
|
-
|
|
3
|
-
interface ProcessEventRepoLike {
|
|
1
|
+
import type { ProcessInstance } from "@leitwerk-dev/domain";
|
|
2
|
+
export interface ProcessEventRepoLike {
|
|
4
3
|
create(input: {
|
|
5
4
|
instanceId: string;
|
|
6
5
|
eventType: string;
|
|
@@ -10,23 +9,22 @@ interface ProcessEventRepoLike {
|
|
|
10
9
|
eventType: string;
|
|
11
10
|
}>;
|
|
12
11
|
}
|
|
13
|
-
interface WorkerSupervisorLike {
|
|
12
|
+
export interface WorkerSupervisorLike {
|
|
14
13
|
spawnWorker(instanceId: string): Promise<unknown>;
|
|
15
14
|
getWorker(instanceId: string): unknown | undefined;
|
|
16
15
|
}
|
|
17
16
|
/**
|
|
18
17
|
* Check whether a process already has an event of the given type.
|
|
19
18
|
*/
|
|
20
|
-
declare function hasProcessEvent(events: ProcessEventRepoLike, instanceId: string, eventType: string): boolean;
|
|
21
|
-
declare function processNeedsWorker(process: Pick<ProcessInstance, "selectedTurnId" | "lifecycleStatus">): boolean;
|
|
19
|
+
export declare function hasProcessEvent(events: ProcessEventRepoLike, instanceId: string, eventType: string): boolean;
|
|
20
|
+
export declare function processNeedsWorker(process: Pick<ProcessInstance, "selectedTurnId" | "lifecycleStatus">): boolean;
|
|
22
21
|
/**
|
|
23
22
|
* Spawn a worker for a process whose selected turn is runnable but currently has
|
|
24
23
|
* no running worker. No-ops when the process is not worker-runnable or already
|
|
25
24
|
* has a worker.
|
|
26
25
|
*/
|
|
27
|
-
declare function ensureWorkerForActiveAgent(deps: {
|
|
26
|
+
export declare function ensureWorkerForActiveAgent(deps: {
|
|
28
27
|
events: ProcessEventRepoLike;
|
|
29
28
|
supervisor: WorkerSupervisorLike;
|
|
30
29
|
}, process: ProcessInstance): Promise<void>;
|
|
31
|
-
|
|
32
|
-
export { type ProcessEventRepoLike, type WorkerSupervisorLike, ensureWorkerForActiveAgent, hasProcessEvent, processNeedsWorker };
|
|
30
|
+
//# sourceMappingURL=process-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process-helpers.d.ts","sourceRoot":"","sources":["../src/process-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,WAAW,oBAAoB;IACpC,MAAM,CAAC,KAAK,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC;IAClG,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACjF;AAED,MAAM,WAAW,oBAAoB;IACpC,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAClD,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;CACnD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC9B,MAAM,EAAE,oBAAoB,EAC5B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GACf,OAAO,CAET;AAED,wBAAgB,kBAAkB,CACjC,OAAO,EAAE,IAAI,CAAC,eAAe,EAAE,gBAAgB,GAAG,iBAAiB,CAAC,GAClE,OAAO,CAET;AAED;;;;GAIG;AACH,wBAAsB,0BAA0B,CAC/C,IAAI,EAAE;IAAE,MAAM,EAAE,oBAAoB,CAAC;IAAC,UAAU,EAAE,oBAAoB,CAAA;CAAE,EACxE,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,IAAI,CAAC,CAgBf"}
|
package/dist/process-helpers.js
CHANGED
|
@@ -1,11 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Check whether a process already has an event of the given type.
|
|
3
|
+
*/
|
|
4
|
+
export function hasProcessEvent(events, instanceId, eventType) {
|
|
5
|
+
return events.listByInstance(instanceId, 200).some((event) => event.eventType === eventType);
|
|
6
|
+
}
|
|
7
|
+
export function processNeedsWorker(process) {
|
|
8
|
+
return process.selectedTurnId !== null && process.lifecycleStatus === "active";
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Spawn a worker for a process whose selected turn is runnable but currently has
|
|
12
|
+
* no running worker. No-ops when the process is not worker-runnable or already
|
|
13
|
+
* has a worker.
|
|
14
|
+
*/
|
|
15
|
+
export async function ensureWorkerForActiveAgent(deps, process) {
|
|
16
|
+
if (!processNeedsWorker(process) || deps.supervisor.getWorker(process.id)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
await deps.supervisor.spawnWorker(process.id);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
deps.events.create({
|
|
24
|
+
instanceId: process.id,
|
|
25
|
+
eventType: "worker_spawn_failed",
|
|
26
|
+
data: {
|
|
27
|
+
reason: error instanceof Error ? error.message : "Failed to spawn worker",
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
11
33
|
//# sourceMappingURL=process-helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"file":"process-helpers.js","sourceRoot":"","sources":["../src/process-helpers.ts"],"names":[],"mappings":"AAYA;;GAEG;AACH,MAAM,UAAU,eAAe,CAC9B,MAA4B,EAC5B,UAAkB,EAClB,SAAiB;IAEjB,OAAO,MAAM,CAAC,cAAc,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;AAC9F,CAAC;AAED,MAAM,UAAU,kBAAkB,CACjC,OAAoE;IAEpE,OAAO,OAAO,CAAC,cAAc,KAAK,IAAI,IAAI,OAAO,CAAC,eAAe,KAAK,QAAQ,CAAC;AAChF,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC/C,IAAwE,EACxE,OAAwB;IAExB,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC;QAC3E,OAAO;IACR,CAAC;IACD,IAAI,CAAC;QACJ,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;YAClB,UAAU,EAAE,OAAO,CAAC,EAAE;YACtB,SAAS,EAAE,qBAAqB;YAChC,IAAI,EAAE;gBACL,MAAM,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB;aACzE;SACD,CAAC,CAAC;QACH,MAAM,KAAK,CAAC;IACb,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type TriggerFileReadResult = {
|
|
2
|
+
exists: false;
|
|
3
|
+
} | {
|
|
4
|
+
exists: true;
|
|
5
|
+
content: string;
|
|
6
|
+
};
|
|
7
|
+
export declare function errorCode(error: unknown): string | null;
|
|
8
|
+
export declare function readTriggerFile(filePath: string): Promise<TriggerFileReadResult>;
|
|
9
|
+
export declare function consumeTriggerFile(filePath: string): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=trigger-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigger-files.d.ts","sourceRoot":"","sources":["../src/trigger-files.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,qBAAqB,GAAG;IAAE,MAAM,EAAE,KAAK,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1F,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAMvD;AAED,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAStF;AAED,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CASxE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { readFile, unlink } from "node:fs/promises";
|
|
2
|
+
export function errorCode(error) {
|
|
3
|
+
if (typeof error !== "object" || error === null || !("code" in error)) {
|
|
4
|
+
return null;
|
|
5
|
+
}
|
|
6
|
+
const code = error.code;
|
|
7
|
+
return typeof code === "string" ? code : null;
|
|
8
|
+
}
|
|
9
|
+
export async function readTriggerFile(filePath) {
|
|
10
|
+
try {
|
|
11
|
+
return { exists: true, content: await readFile(filePath, "utf8") };
|
|
12
|
+
}
|
|
13
|
+
catch (error) {
|
|
14
|
+
if (errorCode(error) === "ENOENT") {
|
|
15
|
+
return { exists: false };
|
|
16
|
+
}
|
|
17
|
+
throw error;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export async function consumeTriggerFile(filePath) {
|
|
21
|
+
try {
|
|
22
|
+
await unlink(filePath);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
if (errorCode(error) === "ENOENT") {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=trigger-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trigger-files.js","sourceRoot":"","sources":["../src/trigger-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAIpD,MAAM,UAAU,SAAS,CAAC,KAAc;IACvC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,EAAE,CAAC;QACvE,OAAO,IAAI,CAAC;IACb,CAAC;IACD,MAAM,IAAI,GAAI,KAA4B,CAAC,IAAI,CAAC;IAChD,OAAO,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,QAAgB;IACrD,IAAI,CAAC;QACJ,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CAAC;IACpE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,SAAS,CAAC,KAAK,CAAC,KAAK,QAAQ,EAAE,CAAC;YACnC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QAC1B,CAAC;QACD,MAAM,KAAK,CAAC;IACb,CAAC;AACF,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,QAAgB;IACxD,IAAI,CAAC;QACJ,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;IACxB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,SAAS,CAAC,KAAK,CAAC,KAAK,QAAQ,EAAE,CAAC;YACnC,OAAO;QACR,CAAC;QACD,MAAM,KAAK,CAAC;IACb,CAAC;AACF,CAAC"}
|
|
@@ -1,33 +1,32 @@
|
|
|
1
|
-
import { ProcessInstance, TurnId } from
|
|
2
|
-
import { ExternalWriteLogRepoLike, WriteIdentity } from
|
|
3
|
-
import { KnownDurableWsFrameType, WsPayloadByType } from
|
|
4
|
-
import { PollResult } from
|
|
5
|
-
import { ProcessEventRepoLike, WorkerSupervisorLike } from
|
|
6
|
-
|
|
7
|
-
interface AgentRepoAccessorLike {
|
|
1
|
+
import type { ProcessInstance, TurnId } from "@leitwerk-dev/domain";
|
|
2
|
+
import { type ExternalWriteLogRepoLike, type WriteIdentity } from "@leitwerk-dev/external-writes";
|
|
3
|
+
import type { KnownDurableWsFrameType, WsPayloadByType } from "@leitwerk-dev/protocol";
|
|
4
|
+
import type { PollResult } from "./poll-loop.js";
|
|
5
|
+
import { type ProcessEventRepoLike, type WorkerSupervisorLike } from "./process-helpers.js";
|
|
6
|
+
export interface AgentRepoAccessorLike {
|
|
8
7
|
getById(id: string): ProcessInstance | null;
|
|
9
8
|
}
|
|
10
|
-
interface BroadcasterLike {
|
|
9
|
+
export interface BroadcasterLike {
|
|
11
10
|
sendDurable<T extends KnownDurableWsFrameType>(type: T, payload: WsPayloadByType[T], instanceId?: string): void;
|
|
12
11
|
}
|
|
13
|
-
interface WatcherCommandResult {
|
|
12
|
+
export interface WatcherCommandResult {
|
|
14
13
|
ok: boolean;
|
|
15
14
|
code?: string;
|
|
16
15
|
message?: string;
|
|
17
16
|
process?: ProcessInstance | null;
|
|
18
17
|
}
|
|
19
|
-
interface WatcherCommandServiceLike {
|
|
18
|
+
export interface WatcherCommandServiceLike {
|
|
20
19
|
startProcess(instanceId: string, startTurnId: TurnId): Promise<WatcherCommandResult>;
|
|
21
20
|
abortProcess(instanceId: string): Promise<WatcherCommandResult>;
|
|
22
21
|
}
|
|
23
|
-
interface WatcherStartupDeps {
|
|
22
|
+
export interface WatcherStartupDeps {
|
|
24
23
|
processes: AgentRepoAccessorLike;
|
|
25
24
|
events: ProcessEventRepoLike;
|
|
26
25
|
broadcaster: BroadcasterLike;
|
|
27
26
|
commands: WatcherCommandServiceLike;
|
|
28
27
|
supervisor: WorkerSupervisorLike;
|
|
29
28
|
}
|
|
30
|
-
interface ContinueWatcherAgentStartupOptions {
|
|
29
|
+
export interface ContinueWatcherAgentStartupOptions {
|
|
31
30
|
process: ProcessInstance;
|
|
32
31
|
startTurnId: TurnId;
|
|
33
32
|
createdEventData: Record<string, unknown>;
|
|
@@ -37,13 +36,13 @@ interface ContinueWatcherAgentStartupOptions {
|
|
|
37
36
|
afterCreatedEvent?: (process: ProcessInstance) => Promise<void> | void;
|
|
38
37
|
beforeStart?: (process: ProcessInstance) => Promise<void>;
|
|
39
38
|
}
|
|
40
|
-
declare function requireWatcherStartTurnId(launchPlan: {
|
|
39
|
+
export declare function requireWatcherStartTurnId(launchPlan: {
|
|
41
40
|
launcherId: string;
|
|
42
41
|
startTurnId: TurnId | null;
|
|
43
42
|
}, targetLabel: string): TurnId;
|
|
44
|
-
declare function continueWatcherAgentStartup(deps: WatcherStartupDeps, opts: ContinueWatcherAgentStartupOptions): Promise<string>;
|
|
45
|
-
type DiscoveryResumeResult = "handled" | "skipped" | undefined;
|
|
46
|
-
type DiscoveryCreateResult = {
|
|
43
|
+
export declare function continueWatcherAgentStartup(deps: WatcherStartupDeps, opts: ContinueWatcherAgentStartupOptions): Promise<string>;
|
|
44
|
+
export type DiscoveryResumeResult = "handled" | "skipped" | undefined;
|
|
45
|
+
export type DiscoveryCreateResult = {
|
|
47
46
|
outcome: "created";
|
|
48
47
|
instanceId: string;
|
|
49
48
|
} | {
|
|
@@ -51,7 +50,7 @@ type DiscoveryCreateResult = {
|
|
|
51
50
|
} | {
|
|
52
51
|
outcome: "handled";
|
|
53
52
|
} | null | undefined;
|
|
54
|
-
interface DiscoveryPassOptions<TItem> {
|
|
53
|
+
export interface DiscoveryPassOptions<TItem> {
|
|
55
54
|
items: readonly TItem[];
|
|
56
55
|
result: PollResult;
|
|
57
56
|
findExistingAgent(item: TItem): ProcessInstance | null;
|
|
@@ -61,8 +60,8 @@ interface DiscoveryPassOptions<TItem> {
|
|
|
61
60
|
ensureWorkerForExistingAgent?(process: ProcessInstance, item: TItem): Promise<boolean>;
|
|
62
61
|
formatError(item: TItem, error: unknown): string;
|
|
63
62
|
}
|
|
64
|
-
declare function runWatcherDiscoveryPass<TItem>(opts: DiscoveryPassOptions<TItem>): Promise<void>;
|
|
65
|
-
interface AbortReconciliationOptions {
|
|
63
|
+
export declare function runWatcherDiscoveryPass<TItem>(opts: DiscoveryPassOptions<TItem>): Promise<void>;
|
|
64
|
+
export interface AbortReconciliationOptions {
|
|
66
65
|
candidates: readonly ProcessInstance[];
|
|
67
66
|
result: PollResult;
|
|
68
67
|
events: ProcessEventRepoLike;
|
|
@@ -72,13 +71,13 @@ interface AbortReconciliationOptions {
|
|
|
72
71
|
getErrorLabel(process: ProcessInstance): string;
|
|
73
72
|
getAbortedEventData(process: ProcessInstance): Record<string, unknown>;
|
|
74
73
|
}
|
|
75
|
-
declare function runWatcherAbortReconciliation(opts: AbortReconciliationOptions): Promise<void>;
|
|
76
|
-
interface CompletionReconciliationResult {
|
|
74
|
+
export declare function runWatcherAbortReconciliation(opts: AbortReconciliationOptions): Promise<void>;
|
|
75
|
+
export interface CompletionReconciliationResult {
|
|
77
76
|
changed: boolean;
|
|
78
77
|
writeIdentity?: WriteIdentity;
|
|
79
78
|
metadata?: Record<string, unknown>;
|
|
80
79
|
}
|
|
81
|
-
interface CompletionReconciliationOptions {
|
|
80
|
+
export interface CompletionReconciliationOptions {
|
|
82
81
|
candidates: readonly ProcessInstance[];
|
|
83
82
|
result: PollResult;
|
|
84
83
|
externalWrites: ExternalWriteLogRepoLike;
|
|
@@ -86,16 +85,15 @@ interface CompletionReconciliationOptions {
|
|
|
86
85
|
getResultLabel(process: ProcessInstance): string;
|
|
87
86
|
getErrorLabel(process: ProcessInstance): string;
|
|
88
87
|
}
|
|
89
|
-
declare function runWatcherCompletionReconciliation(opts: CompletionReconciliationOptions): Promise<void>;
|
|
90
|
-
declare function shouldEnsureWorkerForExistingActiveAgent(deps: {
|
|
88
|
+
export declare function runWatcherCompletionReconciliation(opts: CompletionReconciliationOptions): Promise<void>;
|
|
89
|
+
export declare function shouldEnsureWorkerForExistingActiveAgent(deps: {
|
|
91
90
|
supervisor: WorkerSupervisorLike;
|
|
92
91
|
}, process: ProcessInstance): boolean;
|
|
93
|
-
declare function deferWatcherLaunchStart<TLaunchPlan extends {
|
|
92
|
+
export declare function deferWatcherLaunchStart<TLaunchPlan extends {
|
|
94
93
|
startTurnId: unknown;
|
|
95
94
|
}>(launchPlan: TLaunchPlan): TLaunchPlan;
|
|
96
|
-
declare function launchFailureMessage(result: {
|
|
95
|
+
export declare function launchFailureMessage(result: {
|
|
97
96
|
status: number;
|
|
98
97
|
body: Record<string, unknown>;
|
|
99
98
|
}): string;
|
|
100
|
-
|
|
101
|
-
export { type AbortReconciliationOptions, type AgentRepoAccessorLike, type BroadcasterLike, type CompletionReconciliationOptions, type CompletionReconciliationResult, type ContinueWatcherAgentStartupOptions, type DiscoveryCreateResult, type DiscoveryPassOptions, type DiscoveryResumeResult, type WatcherCommandResult, type WatcherCommandServiceLike, type WatcherStartupDeps, continueWatcherAgentStartup, deferWatcherLaunchStart, launchFailureMessage, requireWatcherStartTurnId, runWatcherAbortReconciliation, runWatcherCompletionReconciliation, runWatcherDiscoveryPass, shouldEnsureWorkerForExistingActiveAgent };
|
|
99
|
+
//# sourceMappingURL=watcher-coordinator.d.ts.map
|
|
@@ -0,0 +1 @@
|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C,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,WAAW,+BAA+B;IAC/C,UAAU,EAAE,SAAS,eAAe,EAAE,CAAC;IACvC,MAAM,EAAE,UAAU,CAAC;IACnB,cAAc,EAAE,wBAAwB,CAAC;IACzC,SAAS,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;IAC7E,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAAC;IACjD,aAAa,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAAC;CAChD;AAED,wBAAsB,kCAAkC,CACvD,IAAI,EAAE,+BAA+B,GACnC,OAAO,CAAC,IAAI,CAAC,CAuBf;AAED,wBAAgB,wCAAwC,CACvD,IAAI,EAAE;IAAE,UAAU,EAAE,oBAAoB,CAAA;CAAE,EAC1C,OAAO,EAAE,eAAe,GACtB,OAAO,CAET;AAED,wBAAgB,uBAAuB,CAAC,WAAW,SAAS;IAAE,WAAW,EAAE,OAAO,CAAA;CAAE,EACnF,UAAU,EAAE,WAAW,GACrB,WAAW,CAEb;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE;IAC5C,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC9B,GAAG,MAAM,CAIT"}
|
|
@@ -1,22 +1,131 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
import { recordWriteIfMissing, } from "@leitwerk-dev/external-writes";
|
|
2
|
+
import { ensureWorkerForActiveAgent, hasProcessEvent, processNeedsWorker, } from "./process-helpers.js";
|
|
3
|
+
export function requireWatcherStartTurnId(launchPlan, targetLabel) {
|
|
4
|
+
if (launchPlan.startTurnId) {
|
|
5
|
+
return launchPlan.startTurnId;
|
|
6
|
+
}
|
|
7
|
+
throw new Error(`Watcher launcher '${launchPlan.launcherId}' did not declare a startTurnId for ${targetLabel}`);
|
|
8
|
+
}
|
|
9
|
+
export async function continueWatcherAgentStartup(deps, opts) {
|
|
10
|
+
const { process } = opts;
|
|
11
|
+
if (!hasProcessEvent(deps.events, process.id, "agent_created")) {
|
|
12
|
+
deps.events.create({
|
|
13
|
+
instanceId: process.id,
|
|
14
|
+
eventType: "agent_created",
|
|
15
|
+
data: opts.createdEventData,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
await opts.afterCreatedEvent?.(process);
|
|
19
|
+
await opts.beforeStart?.(process);
|
|
20
|
+
let currentProcess = deps.processes.getById(process.id) ?? process;
|
|
21
|
+
if (currentProcess.lifecycleStatus === "discovered") {
|
|
22
|
+
const startResult = await deps.commands.startProcess(currentProcess.id, opts.startTurnId);
|
|
23
|
+
if (!startResult.ok) {
|
|
24
|
+
currentProcess = startResult.process ?? currentProcess;
|
|
25
|
+
throw new Error(startResult.message ?? "Failed to start process");
|
|
26
|
+
}
|
|
27
|
+
currentProcess = startResult.process ?? currentProcess;
|
|
28
|
+
if (opts.broadcastCreated !== false) {
|
|
29
|
+
deps.broadcaster.sendDurable("process.created", {
|
|
30
|
+
process: currentProcess,
|
|
31
|
+
processId: currentProcess.processId,
|
|
32
|
+
...opts.createdBroadcastData,
|
|
33
|
+
}, currentProcess.id);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
await ensureWorkerForActiveAgent(deps, currentProcess);
|
|
37
|
+
return currentProcess.id;
|
|
38
|
+
}
|
|
39
|
+
export async function runWatcherDiscoveryPass(opts) {
|
|
40
|
+
for (const item of opts.items) {
|
|
41
|
+
try {
|
|
42
|
+
const existingAgent = opts.findExistingAgent(item);
|
|
43
|
+
if (existingAgent) {
|
|
44
|
+
if (existingAgent.lifecycleStatus === "discovered") {
|
|
45
|
+
const resumeResult = await opts.resumeDiscoveredAgent(existingAgent, item);
|
|
46
|
+
if (resumeResult === "skipped") {
|
|
47
|
+
opts.result.skipped.push(opts.getResultLabel(item));
|
|
48
|
+
}
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
if (opts.ensureWorkerForExistingAgent) {
|
|
52
|
+
const handled = await opts.ensureWorkerForExistingAgent(existingAgent, item);
|
|
53
|
+
if (handled) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
opts.result.skipped.push(opts.getResultLabel(item));
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
const createResult = await opts.createAgent(item);
|
|
61
|
+
if (createResult?.outcome === "created") {
|
|
62
|
+
opts.result.created.push(opts.getResultLabel(item));
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (createResult?.outcome === "skipped") {
|
|
66
|
+
opts.result.skipped.push(opts.getResultLabel(item));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
opts.result.errors.push(opts.formatError(item, error));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
export async function runWatcherAbortReconciliation(opts) {
|
|
75
|
+
for (const process of opts.candidates) {
|
|
76
|
+
try {
|
|
77
|
+
const shouldAbort = await opts.shouldAbort(process);
|
|
78
|
+
if (!shouldAbort) {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
const abortResult = await opts.commands.abortProcess(process.id);
|
|
82
|
+
if (!abortResult.ok) {
|
|
83
|
+
if (abortResult.code === "worker_reconcile_failed") {
|
|
84
|
+
throw new Error(abortResult.message ?? "Failed to abort process");
|
|
85
|
+
}
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
const abortedAgent = abortResult.process ?? process;
|
|
89
|
+
if (!hasProcessEvent(opts.events, abortedAgent.id, "aborted_label_removed")) {
|
|
90
|
+
opts.events.create({
|
|
91
|
+
instanceId: abortedAgent.id,
|
|
92
|
+
eventType: "aborted_label_removed",
|
|
93
|
+
data: opts.getAbortedEventData(abortedAgent),
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
opts.result.aborted.push(opts.getResultLabel(process));
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
opts.result.errors.push(`${opts.getErrorLabel(process)}: ${error instanceof Error ? error.message : String(error)}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
export async function runWatcherCompletionReconciliation(opts) {
|
|
104
|
+
for (const process of opts.candidates) {
|
|
105
|
+
try {
|
|
106
|
+
const reconciliation = await opts.reconcile(process);
|
|
107
|
+
if (!reconciliation.changed) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
if (reconciliation.writeIdentity) {
|
|
111
|
+
recordWriteIfMissing(opts.externalWrites, process.id, reconciliation.writeIdentity, reconciliation.metadata);
|
|
112
|
+
}
|
|
113
|
+
opts.result.labelExchanged.push(opts.getResultLabel(process));
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
opts.result.errors.push(`${opts.getErrorLabel(process)}: ${error instanceof Error ? error.message : String(error)}`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export function shouldEnsureWorkerForExistingActiveAgent(deps, process) {
|
|
121
|
+
return processNeedsWorker(process) && !deps.supervisor.getWorker(process.id);
|
|
122
|
+
}
|
|
123
|
+
export function deferWatcherLaunchStart(launchPlan) {
|
|
124
|
+
return launchPlan.startTurnId === null ? launchPlan : { ...launchPlan, startTurnId: null };
|
|
125
|
+
}
|
|
126
|
+
export function launchFailureMessage(result) {
|
|
127
|
+
return typeof result.body.error === "string" && result.body.error.trim().length > 0
|
|
128
|
+
? result.body.error
|
|
129
|
+
: `Process launch failed with status ${result.status}`;
|
|
130
|
+
}
|
|
22
131
|
//# sourceMappingURL=watcher-coordinator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"file":"watcher-coordinator.js","sourceRoot":"","sources":["../src/watcher-coordinator.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,oBAAoB,GAEpB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,EACN,0BAA0B,EAC1B,eAAe,EAEf,kBAAkB,GAElB,MAAM,sBAAsB,CAAC;AA6C9B,MAAM,UAAU,yBAAyB,CACxC,UAA8D,EAC9D,WAAmB;IAEnB,IAAI,UAAU,CAAC,WAAW,EAAE,CAAC;QAC5B,OAAO,UAAU,CAAC,WAAW,CAAC;IAC/B,CAAC;IACD,MAAM,IAAI,KAAK,CACd,qBAAqB,UAAU,CAAC,UAAU,uCAAuC,WAAW,EAAE,CAC9F,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAChD,IAAwB,EACxB,IAAwC;IAExC,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEzB,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,EAAE,eAAe,CAAC,EAAE,CAAC;QAChE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;YAClB,UAAU,EAAE,OAAO,CAAC,EAAE;YACtB,SAAS,EAAE,eAAe;YAC1B,IAAI,EAAE,IAAI,CAAC,gBAAgB;SAC3B,CAAC,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,CAAC;IAElC,IAAI,cAAc,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,OAAO,CAAC;IACnE,IAAI,cAAc,CAAC,eAAe,KAAK,YAAY,EAAE,CAAC;QAC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AK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QAClF,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK;QACnB,CAAC,CAAC,qCAAqC,MAAM,CAAC,MAAM,EAAE,CAAC;AACzD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leitwerk-dev/watcher-utils",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/leitwerk-dev/leitwerk.git",
|
|
@@ -18,9 +18,9 @@
|
|
|
18
18
|
"build": "tsup --silent"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@leitwerk-dev/domain": "0.1.
|
|
22
|
-
"@leitwerk-dev/external-writes": "0.1.
|
|
23
|
-
"@leitwerk-dev/protocol": "0.1.
|
|
21
|
+
"@leitwerk-dev/domain": "0.1.3",
|
|
22
|
+
"@leitwerk-dev/external-writes": "0.1.3",
|
|
23
|
+
"@leitwerk-dev/protocol": "0.1.3",
|
|
24
24
|
"ms": "^2.1.3"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|