lorenz 0.1.4 → 0.1.6
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/README.md +83 -20
- package/RELEASE-MANIFEST.json +6 -1
- package/node_modules/@lorenz/agent-sdk/dist/index.d.ts +1 -0
- package/node_modules/@lorenz/agent-sdk/dist/index.d.ts.map +1 -1
- package/node_modules/@lorenz/agent-sdk/dist/index.js +1 -0
- package/node_modules/@lorenz/agent-sdk/dist/index.js.map +1 -1
- package/node_modules/@lorenz/agent-sdk/dist/module.d.ts +38 -0
- package/node_modules/@lorenz/agent-sdk/dist/module.d.ts.map +1 -0
- package/node_modules/@lorenz/agent-sdk/dist/module.js +41 -0
- package/node_modules/@lorenz/agent-sdk/dist/module.js.map +1 -0
- package/node_modules/@lorenz/cli/dist/agentExecutorLoader.d.ts +30 -0
- package/node_modules/@lorenz/cli/dist/agentExecutorLoader.d.ts.map +1 -0
- package/node_modules/@lorenz/cli/dist/agentExecutorLoader.js +63 -0
- package/node_modules/@lorenz/cli/dist/agentExecutorLoader.js.map +1 -0
- package/node_modules/@lorenz/cli/dist/daemon.d.ts +42 -19
- package/node_modules/@lorenz/cli/dist/daemon.d.ts.map +1 -1
- package/node_modules/@lorenz/cli/dist/daemon.js +72 -23
- package/node_modules/@lorenz/cli/dist/daemon.js.map +1 -1
- package/node_modules/@lorenz/cli/dist/daemonLock.d.ts +59 -0
- package/node_modules/@lorenz/cli/dist/daemonLock.d.ts.map +1 -0
- package/node_modules/@lorenz/cli/dist/daemonLock.js +304 -0
- package/node_modules/@lorenz/cli/dist/daemonLock.js.map +1 -0
- package/node_modules/@lorenz/cli/dist/daemonStatus.d.ts +16 -0
- package/node_modules/@lorenz/cli/dist/daemonStatus.d.ts.map +1 -0
- package/node_modules/@lorenz/cli/dist/daemonStatus.js +21 -0
- package/node_modules/@lorenz/cli/dist/daemonStatus.js.map +1 -0
- package/node_modules/@lorenz/cli/dist/doctor.d.ts +6 -0
- package/node_modules/@lorenz/cli/dist/doctor.d.ts.map +1 -1
- package/node_modules/@lorenz/cli/dist/doctor.js +39 -2
- package/node_modules/@lorenz/cli/dist/doctor.js.map +1 -1
- package/node_modules/@lorenz/cli/dist/extensionLoader.d.ts +126 -0
- package/node_modules/@lorenz/cli/dist/extensionLoader.d.ts.map +1 -0
- package/node_modules/@lorenz/cli/dist/extensionLoader.js +187 -0
- package/node_modules/@lorenz/cli/dist/extensionLoader.js.map +1 -0
- package/node_modules/@lorenz/cli/dist/flags-manifest.d.ts +42 -0
- package/node_modules/@lorenz/cli/dist/flags-manifest.d.ts.map +1 -0
- package/node_modules/@lorenz/cli/dist/flags-manifest.js +67 -0
- package/node_modules/@lorenz/cli/dist/flags-manifest.js.map +1 -0
- package/node_modules/@lorenz/cli/dist/index.d.ts +6 -0
- package/node_modules/@lorenz/cli/dist/index.d.ts.map +1 -1
- package/node_modules/@lorenz/cli/dist/index.js +4 -0
- package/node_modules/@lorenz/cli/dist/index.js.map +1 -1
- package/node_modules/@lorenz/cli/dist/leadershipStore.d.ts +42 -0
- package/node_modules/@lorenz/cli/dist/leadershipStore.d.ts.map +1 -0
- package/node_modules/@lorenz/cli/dist/leadershipStore.js +2 -0
- package/node_modules/@lorenz/cli/dist/leadershipStore.js.map +1 -0
- package/node_modules/@lorenz/cli/dist/main.d.ts +11 -7
- package/node_modules/@lorenz/cli/dist/main.d.ts.map +1 -1
- package/node_modules/@lorenz/cli/dist/main.js +58 -8
- package/node_modules/@lorenz/cli/dist/main.js.map +1 -1
- package/node_modules/@lorenz/cli/dist/toolLoader.d.ts +28 -0
- package/node_modules/@lorenz/cli/dist/toolLoader.d.ts.map +1 -0
- package/node_modules/@lorenz/cli/dist/toolLoader.js +62 -0
- package/node_modules/@lorenz/cli/dist/toolLoader.js.map +1 -0
- package/node_modules/@lorenz/cli/dist/trackerLoader.d.ts +24 -0
- package/node_modules/@lorenz/cli/dist/trackerLoader.d.ts.map +1 -0
- package/node_modules/@lorenz/cli/dist/trackerLoader.js +34 -0
- package/node_modules/@lorenz/cli/dist/trackerLoader.js.map +1 -0
- package/node_modules/@lorenz/cli/dist/workerDriverLoader.d.ts +15 -55
- package/node_modules/@lorenz/cli/dist/workerDriverLoader.d.ts.map +1 -1
- package/node_modules/@lorenz/cli/dist/workerDriverLoader.js +26 -203
- package/node_modules/@lorenz/cli/dist/workerDriverLoader.js.map +1 -1
- package/node_modules/@lorenz/cli/package.json +1 -0
- package/node_modules/@lorenz/config/dist/index.d.ts +1 -1
- package/node_modules/@lorenz/config/dist/index.d.ts.map +1 -1
- package/node_modules/@lorenz/config/dist/index.js +1 -1
- package/node_modules/@lorenz/config/dist/index.js.map +1 -1
- package/node_modules/@lorenz/config/dist/parse.d.ts +17 -0
- package/node_modules/@lorenz/config/dist/parse.d.ts.map +1 -1
- package/node_modules/@lorenz/config/dist/parse.js +107 -11
- package/node_modules/@lorenz/config/dist/parse.js.map +1 -1
- package/node_modules/@lorenz/config/dist/schemas.d.ts +0 -2
- package/node_modules/@lorenz/config/dist/schemas.d.ts.map +1 -1
- package/node_modules/@lorenz/config/dist/schemas.js +5 -1
- package/node_modules/@lorenz/config/dist/schemas.js.map +1 -1
- package/node_modules/@lorenz/dispatch-coordinator/dist/coordinator.d.ts +55 -21
- package/node_modules/@lorenz/dispatch-coordinator/dist/coordinator.d.ts.map +1 -1
- package/node_modules/@lorenz/dispatch-coordinator/dist/coordinator.js +187 -82
- package/node_modules/@lorenz/dispatch-coordinator/dist/coordinator.js.map +1 -1
- package/node_modules/@lorenz/dispatch-coordinator/dist/gate.d.ts +6 -4
- package/node_modules/@lorenz/dispatch-coordinator/dist/gate.d.ts.map +1 -1
- package/node_modules/@lorenz/dispatch-coordinator/dist/gate.js +9 -6
- package/node_modules/@lorenz/dispatch-coordinator/dist/gate.js.map +1 -1
- package/node_modules/@lorenz/dispatch-coordinator/dist/index.d.ts +1 -1
- package/node_modules/@lorenz/dispatch-coordinator/dist/index.d.ts.map +1 -1
- package/node_modules/@lorenz/dispatch-coordinator/dist/index.js +5 -6
- package/node_modules/@lorenz/dispatch-coordinator/dist/index.js.map +1 -1
- package/node_modules/@lorenz/dispatch-coordinator/dist/mcpEndpointManager.d.ts +7 -5
- package/node_modules/@lorenz/dispatch-coordinator/dist/mcpEndpointManager.d.ts.map +1 -1
- package/node_modules/@lorenz/dispatch-coordinator/dist/mcpEndpointManager.js +12 -10
- package/node_modules/@lorenz/dispatch-coordinator/dist/mcpEndpointManager.js.map +1 -1
- package/node_modules/@lorenz/dispatch-coordinator/dist/nullEndpointManager.d.ts +11 -10
- package/node_modules/@lorenz/dispatch-coordinator/dist/nullEndpointManager.d.ts.map +1 -1
- package/node_modules/@lorenz/dispatch-coordinator/dist/nullEndpointManager.js +15 -22
- package/node_modules/@lorenz/dispatch-coordinator/dist/nullEndpointManager.js.map +1 -1
- package/node_modules/@lorenz/dispatch-coordinator/dist/types.d.ts +16 -15
- package/node_modules/@lorenz/dispatch-coordinator/dist/types.d.ts.map +1 -1
- package/node_modules/@lorenz/dispatch-coordinator/dist/types.js +6 -7
- package/node_modules/@lorenz/dispatch-coordinator/dist/types.js.map +1 -1
- package/node_modules/@lorenz/domain/dist/index.d.ts +75 -9
- package/node_modules/@lorenz/domain/dist/index.d.ts.map +1 -1
- package/node_modules/@lorenz/domain/dist/index.js +40 -0
- package/node_modules/@lorenz/domain/dist/index.js.map +1 -1
- package/node_modules/@lorenz/flags/dist/coerce.d.ts +12 -0
- package/node_modules/@lorenz/flags/dist/coerce.d.ts.map +1 -0
- package/node_modules/@lorenz/flags/dist/coerce.js +44 -0
- package/node_modules/@lorenz/flags/dist/coerce.js.map +1 -0
- package/node_modules/@lorenz/flags/dist/default.d.ts +6 -0
- package/node_modules/@lorenz/flags/dist/default.d.ts.map +1 -0
- package/node_modules/@lorenz/flags/dist/default.js +22 -0
- package/node_modules/@lorenz/flags/dist/default.js.map +1 -0
- package/node_modules/@lorenz/flags/dist/deprecations.d.ts +20 -0
- package/node_modules/@lorenz/flags/dist/deprecations.d.ts.map +1 -0
- package/node_modules/@lorenz/flags/dist/deprecations.js +42 -0
- package/node_modules/@lorenz/flags/dist/deprecations.js.map +1 -0
- package/node_modules/@lorenz/flags/dist/env.d.ts +17 -0
- package/node_modules/@lorenz/flags/dist/env.d.ts.map +1 -0
- package/node_modules/@lorenz/flags/dist/env.js +90 -0
- package/node_modules/@lorenz/flags/dist/env.js.map +1 -0
- package/node_modules/@lorenz/flags/dist/errors.d.ts +22 -0
- package/node_modules/@lorenz/flags/dist/errors.d.ts.map +1 -0
- package/node_modules/@lorenz/flags/dist/errors.js +61 -0
- package/node_modules/@lorenz/flags/dist/errors.js.map +1 -0
- package/node_modules/@lorenz/flags/dist/index.d.ts +8 -0
- package/node_modules/@lorenz/flags/dist/index.d.ts.map +1 -0
- package/node_modules/@lorenz/flags/dist/index.js +11 -0
- package/node_modules/@lorenz/flags/dist/index.js.map +1 -0
- package/node_modules/@lorenz/flags/dist/keys.d.ts +6 -0
- package/node_modules/@lorenz/flags/dist/keys.d.ts.map +1 -0
- package/node_modules/@lorenz/flags/dist/keys.js +15 -0
- package/node_modules/@lorenz/flags/dist/keys.js.map +1 -0
- package/node_modules/@lorenz/flags/dist/layers.d.ts +14 -0
- package/node_modules/@lorenz/flags/dist/layers.d.ts.map +1 -0
- package/node_modules/@lorenz/flags/dist/layers.js +107 -0
- package/node_modules/@lorenz/flags/dist/layers.js.map +1 -0
- package/node_modules/@lorenz/flags/dist/manifest.d.ts +71 -0
- package/node_modules/@lorenz/flags/dist/manifest.d.ts.map +1 -0
- package/node_modules/@lorenz/flags/dist/manifest.js +137 -0
- package/node_modules/@lorenz/flags/dist/manifest.js.map +1 -0
- package/node_modules/@lorenz/flags/dist/resolve.d.ts +8 -0
- package/node_modules/@lorenz/flags/dist/resolve.d.ts.map +1 -0
- package/node_modules/@lorenz/flags/dist/resolve.js +178 -0
- package/node_modules/@lorenz/flags/dist/resolve.js.map +1 -0
- package/node_modules/@lorenz/flags/dist/testing.d.ts +19 -0
- package/node_modules/@lorenz/flags/dist/testing.d.ts.map +1 -0
- package/node_modules/@lorenz/flags/dist/testing.js +68 -0
- package/node_modules/@lorenz/flags/dist/testing.js.map +1 -0
- package/node_modules/@lorenz/flags/dist/types.d.ts +93 -0
- package/node_modules/@lorenz/flags/dist/types.d.ts.map +1 -0
- package/node_modules/@lorenz/flags/dist/types.js +2 -0
- package/node_modules/@lorenz/flags/dist/types.js.map +1 -0
- package/node_modules/@lorenz/flags/package.json +16 -0
- package/node_modules/@lorenz/mcp/dist/agentEndpoint.d.ts +16 -3
- package/node_modules/@lorenz/mcp/dist/agentEndpoint.d.ts.map +1 -1
- package/node_modules/@lorenz/mcp/dist/agentEndpoint.js +105 -17
- package/node_modules/@lorenz/mcp/dist/agentEndpoint.js.map +1 -1
- package/node_modules/@lorenz/mcp/dist/auth.d.ts +88 -0
- package/node_modules/@lorenz/mcp/dist/auth.d.ts.map +1 -1
- package/node_modules/@lorenz/mcp/dist/auth.js +53 -0
- package/node_modules/@lorenz/mcp/dist/auth.js.map +1 -1
- package/node_modules/@lorenz/mcp/dist/index.d.ts +3 -2
- package/node_modules/@lorenz/mcp/dist/index.d.ts.map +1 -1
- package/node_modules/@lorenz/mcp/dist/index.js +1 -1
- package/node_modules/@lorenz/mcp/dist/index.js.map +1 -1
- package/node_modules/@lorenz/mcp/dist/server.d.ts +22 -0
- package/node_modules/@lorenz/mcp/dist/server.d.ts.map +1 -1
- package/node_modules/@lorenz/mcp/dist/server.js +85 -12
- package/node_modules/@lorenz/mcp/dist/server.js.map +1 -1
- package/node_modules/@lorenz/orchestrator/dist/claimStore.d.ts +157 -0
- package/node_modules/@lorenz/orchestrator/dist/claimStore.d.ts.map +1 -0
- package/node_modules/@lorenz/orchestrator/dist/claimStore.js +621 -0
- package/node_modules/@lorenz/orchestrator/dist/claimStore.js.map +1 -0
- package/node_modules/@lorenz/orchestrator/dist/codec.d.ts +38 -0
- package/node_modules/@lorenz/orchestrator/dist/codec.d.ts.map +1 -0
- package/node_modules/@lorenz/orchestrator/dist/codec.js +176 -0
- package/node_modules/@lorenz/orchestrator/dist/codec.js.map +1 -0
- package/node_modules/@lorenz/orchestrator/dist/index.d.ts +55 -51
- package/node_modules/@lorenz/orchestrator/dist/index.d.ts.map +1 -1
- package/node_modules/@lorenz/orchestrator/dist/index.js +285 -45
- package/node_modules/@lorenz/orchestrator/dist/index.js.map +1 -1
- package/node_modules/@lorenz/orchestrator/dist/sqlite.d.ts +34 -0
- package/node_modules/@lorenz/orchestrator/dist/sqlite.d.ts.map +1 -0
- package/node_modules/@lorenz/orchestrator/dist/sqlite.js +142 -0
- package/node_modules/@lorenz/orchestrator/dist/sqlite.js.map +1 -0
- package/node_modules/@lorenz/orchestrator/dist/state.d.ts +47 -0
- package/node_modules/@lorenz/orchestrator/dist/state.d.ts.map +1 -0
- package/node_modules/@lorenz/orchestrator/dist/state.js +15 -0
- package/node_modules/@lorenz/orchestrator/dist/state.js.map +1 -0
- package/node_modules/@lorenz/orchestrator/dist/turso.d.ts +28 -0
- package/node_modules/@lorenz/orchestrator/dist/turso.d.ts.map +1 -0
- package/node_modules/@lorenz/orchestrator/dist/turso.js +125 -0
- package/node_modules/@lorenz/orchestrator/dist/turso.js.map +1 -0
- package/node_modules/@lorenz/orchestrator/package.json +6 -2
- package/node_modules/@lorenz/presenter/dist/index.d.ts +14 -0
- package/node_modules/@lorenz/presenter/dist/index.d.ts.map +1 -1
- package/node_modules/@lorenz/presenter/dist/index.js +18 -0
- package/node_modules/@lorenz/presenter/dist/index.js.map +1 -1
- package/node_modules/@lorenz/projections/dist/index.d.ts.map +1 -1
- package/node_modules/@lorenz/projections/dist/index.js +1 -0
- package/node_modules/@lorenz/projections/dist/index.js.map +1 -1
- package/node_modules/@lorenz/runtime/dist/index.d.ts +27 -8
- package/node_modules/@lorenz/runtime/dist/index.d.ts.map +1 -1
- package/node_modules/@lorenz/runtime/dist/index.js +422 -98
- package/node_modules/@lorenz/runtime/dist/index.js.map +1 -1
- package/node_modules/@lorenz/runtime-events/dist/index.d.ts +14 -0
- package/node_modules/@lorenz/runtime-events/dist/index.d.ts.map +1 -1
- package/node_modules/@lorenz/server/dist/index.js +1 -1
- package/node_modules/@lorenz/server/dist/index.js.map +1 -1
- package/node_modules/@lorenz/ssh/dist/index.d.ts +2 -0
- package/node_modules/@lorenz/ssh/dist/index.d.ts.map +1 -1
- package/node_modules/@lorenz/ssh/dist/index.js +2 -1
- package/node_modules/@lorenz/ssh/dist/index.js.map +1 -1
- package/node_modules/@lorenz/tool-sdk/dist/index.d.ts +1 -0
- package/node_modules/@lorenz/tool-sdk/dist/index.d.ts.map +1 -1
- package/node_modules/@lorenz/tool-sdk/dist/index.js +1 -0
- package/node_modules/@lorenz/tool-sdk/dist/index.js.map +1 -1
- package/node_modules/@lorenz/tool-sdk/dist/module.d.ts +38 -0
- package/node_modules/@lorenz/tool-sdk/dist/module.d.ts.map +1 -0
- package/node_modules/@lorenz/tool-sdk/dist/module.js +42 -0
- package/node_modules/@lorenz/tool-sdk/dist/module.js.map +1 -0
- package/node_modules/@lorenz/tracker-sdk/dist/index.d.ts +1 -0
- package/node_modules/@lorenz/tracker-sdk/dist/index.d.ts.map +1 -1
- package/node_modules/@lorenz/tracker-sdk/dist/index.js +1 -0
- package/node_modules/@lorenz/tracker-sdk/dist/index.js.map +1 -1
- package/node_modules/@lorenz/tracker-sdk/dist/module.d.ts +37 -0
- package/node_modules/@lorenz/tracker-sdk/dist/module.d.ts.map +1 -0
- package/node_modules/@lorenz/tracker-sdk/dist/module.js +38 -0
- package/node_modules/@lorenz/tracker-sdk/dist/module.js.map +1 -0
- package/node_modules/@lorenz/worker-host-pool/dist/index.d.ts +34 -6
- package/node_modules/@lorenz/worker-host-pool/dist/index.d.ts.map +1 -1
- package/node_modules/@lorenz/worker-host-pool/dist/index.js +110 -143
- package/node_modules/@lorenz/worker-host-pool/dist/index.js.map +1 -1
- package/node_modules/@lorenz/worker-sdk/dist/index.d.ts +1 -0
- package/node_modules/@lorenz/worker-sdk/dist/index.d.ts.map +1 -1
- package/node_modules/@lorenz/worker-sdk/dist/index.js +1 -0
- package/node_modules/@lorenz/worker-sdk/dist/index.js.map +1 -1
- package/node_modules/@lorenz/worker-sdk/dist/local.d.ts +74 -0
- package/node_modules/@lorenz/worker-sdk/dist/local.d.ts.map +1 -0
- package/node_modules/@lorenz/worker-sdk/dist/local.js +112 -0
- package/node_modules/@lorenz/worker-sdk/dist/local.js.map +1 -0
- package/node_modules/@lorenz/worker-sdk/dist/module.d.ts +8 -16
- package/node_modules/@lorenz/worker-sdk/dist/module.d.ts.map +1 -1
- package/node_modules/@lorenz/worker-sdk/dist/module.js +15 -35
- package/node_modules/@lorenz/worker-sdk/dist/module.js.map +1 -1
- package/node_modules/@lorenz/workflow/dist/index.d.ts +11 -0
- package/node_modules/@lorenz/workflow/dist/index.d.ts.map +1 -1
- package/node_modules/@lorenz/workflow/dist/index.js +3 -0
- package/node_modules/@lorenz/workflow/dist/index.js.map +1 -1
- package/package.json +4 -1
|
@@ -0,0 +1,621 @@
|
|
|
1
|
+
import { performance } from "node:perf_hooks";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { isRecord } from "@lorenz/domain";
|
|
4
|
+
import { hydrateState, serializeState, } from "./codec.js";
|
|
5
|
+
import { createState } from "./state.js";
|
|
6
|
+
let nextInMemoryOwnerId = 1;
|
|
7
|
+
export class InMemoryClaimStore {
|
|
8
|
+
state;
|
|
9
|
+
kind = "memory";
|
|
10
|
+
capabilities = {
|
|
11
|
+
crashRecovery: false,
|
|
12
|
+
sharedAcrossProcesses: false,
|
|
13
|
+
retryDurability: false,
|
|
14
|
+
};
|
|
15
|
+
ownerId;
|
|
16
|
+
hydratedAt;
|
|
17
|
+
transactionsApplied = 0;
|
|
18
|
+
lastOperation = null;
|
|
19
|
+
constructor(state, options = {}) {
|
|
20
|
+
this.state = state;
|
|
21
|
+
this.ownerId = options.ownerId ?? `memory:${process.pid}:${nextInMemoryOwnerId++}`;
|
|
22
|
+
this.hydratedAt = options.hydratedAt ?? new Date();
|
|
23
|
+
}
|
|
24
|
+
read(run) {
|
|
25
|
+
return run(this.state);
|
|
26
|
+
}
|
|
27
|
+
transaction(operation, run) {
|
|
28
|
+
const result = run(this.state);
|
|
29
|
+
this.transactionsApplied += 1;
|
|
30
|
+
this.lastOperation = operation;
|
|
31
|
+
return result;
|
|
32
|
+
}
|
|
33
|
+
heartbeatOwner() {
|
|
34
|
+
// Memory stores are process-local, so there is no external owner lease to refresh.
|
|
35
|
+
}
|
|
36
|
+
status() {
|
|
37
|
+
return {
|
|
38
|
+
kind: this.kind,
|
|
39
|
+
ownerId: this.ownerId,
|
|
40
|
+
capabilities: { ...this.capabilities },
|
|
41
|
+
hydratedAt: this.hydratedAt.toISOString(),
|
|
42
|
+
transactionsApplied: this.transactionsApplied,
|
|
43
|
+
lastOperation: this.lastOperation,
|
|
44
|
+
lastCheckpointAt: null,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export class AsyncPersistentClaimStore {
|
|
49
|
+
backend;
|
|
50
|
+
async = true;
|
|
51
|
+
ownerId;
|
|
52
|
+
kind;
|
|
53
|
+
capabilities;
|
|
54
|
+
state;
|
|
55
|
+
hydratedAt;
|
|
56
|
+
now;
|
|
57
|
+
monotonicNow;
|
|
58
|
+
ownerLeaseStaleMs;
|
|
59
|
+
hydrateOptions;
|
|
60
|
+
transactionsApplied = 0;
|
|
61
|
+
lastOperation = null;
|
|
62
|
+
lastCheckpointAt = null;
|
|
63
|
+
constructor(backend, options = {}) {
|
|
64
|
+
this.backend = backend;
|
|
65
|
+
this.kind = backend.kind;
|
|
66
|
+
this.capabilities = backend.capabilities;
|
|
67
|
+
if (this.capabilities.sharedAcrossProcesses && !backend.withExclusiveTransaction) {
|
|
68
|
+
throw new Error("shared_claim_store_backend_requires_exclusive_transaction");
|
|
69
|
+
}
|
|
70
|
+
if (this.capabilities.sharedAcrossProcesses &&
|
|
71
|
+
this.capabilities.crashRecovery &&
|
|
72
|
+
(!backend.heartbeatOwner || !backend.ownerIsActive)) {
|
|
73
|
+
throw new Error("shared_crash_recovery_claim_store_requires_owner_leases");
|
|
74
|
+
}
|
|
75
|
+
this.ownerId =
|
|
76
|
+
options.ownerId ??
|
|
77
|
+
`${backend.kind}:${process.pid}:${nextPersistentOwnerId++}:${randomUUID()}`;
|
|
78
|
+
this.hydratedAt = options.hydratedAt ?? new Date();
|
|
79
|
+
this.now = options.now ?? (() => new Date());
|
|
80
|
+
this.monotonicNow = options.monotonicNow ?? (() => performance.now());
|
|
81
|
+
this.ownerLeaseStaleMs = options.ownerLeaseStaleMs ?? 300_000;
|
|
82
|
+
this.hydrateOptions = options.hydrate;
|
|
83
|
+
this.state = createState();
|
|
84
|
+
}
|
|
85
|
+
static async create(backend, options = {}) {
|
|
86
|
+
const store = new AsyncPersistentClaimStore(backend, options);
|
|
87
|
+
await store.loadInitial();
|
|
88
|
+
return store;
|
|
89
|
+
}
|
|
90
|
+
async read(run) {
|
|
91
|
+
const apply = async () => {
|
|
92
|
+
if (this.capabilities.sharedAcrossProcesses)
|
|
93
|
+
await this.reload({ heartbeatOwner: false, recoverInactiveOwners: false });
|
|
94
|
+
return run(this.state);
|
|
95
|
+
};
|
|
96
|
+
return this.backend.withExclusiveTransaction
|
|
97
|
+
? this.backend.withExclusiveTransaction(apply)
|
|
98
|
+
: apply();
|
|
99
|
+
}
|
|
100
|
+
async transaction(operation, run) {
|
|
101
|
+
let rollback = null;
|
|
102
|
+
const rollbackLocalState = () => {
|
|
103
|
+
rollback?.();
|
|
104
|
+
rollback = null;
|
|
105
|
+
};
|
|
106
|
+
const apply = async () => {
|
|
107
|
+
if (this.capabilities.sharedAcrossProcesses)
|
|
108
|
+
await this.reload({ heartbeatOwner: true, recoverInactiveOwners: true });
|
|
109
|
+
const rollbackState = cloneStateContents(this.state);
|
|
110
|
+
const rollbackTransactionsApplied = this.transactionsApplied;
|
|
111
|
+
const rollbackLastOperation = this.lastOperation;
|
|
112
|
+
const rollbackLastCheckpointAt = this.lastCheckpointAt;
|
|
113
|
+
rollback = () => {
|
|
114
|
+
replaceStateContents(this.state, rollbackState);
|
|
115
|
+
this.transactionsApplied = rollbackTransactionsApplied;
|
|
116
|
+
this.lastOperation = rollbackLastOperation;
|
|
117
|
+
this.lastCheckpointAt = rollbackLastCheckpointAt;
|
|
118
|
+
};
|
|
119
|
+
try {
|
|
120
|
+
const result = run(this.state);
|
|
121
|
+
this.transactionsApplied += 1;
|
|
122
|
+
this.lastOperation = operation;
|
|
123
|
+
await this.save(operation);
|
|
124
|
+
return result;
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
rollbackLocalState();
|
|
128
|
+
throw error;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
if (!this.backend.withExclusiveTransaction) {
|
|
132
|
+
try {
|
|
133
|
+
return await apply();
|
|
134
|
+
}
|
|
135
|
+
finally {
|
|
136
|
+
rollback = null;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
try {
|
|
140
|
+
const result = await this.backend.withExclusiveTransaction(apply);
|
|
141
|
+
rollback = null;
|
|
142
|
+
return result;
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
rollbackLocalState();
|
|
146
|
+
throw error;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
async flush() {
|
|
150
|
+
const apply = async () => {
|
|
151
|
+
if (this.capabilities.sharedAcrossProcesses)
|
|
152
|
+
await this.reload({ heartbeatOwner: true, recoverInactiveOwners: true });
|
|
153
|
+
await this.save("flush");
|
|
154
|
+
};
|
|
155
|
+
if (this.backend.withExclusiveTransaction)
|
|
156
|
+
await this.backend.withExclusiveTransaction(apply);
|
|
157
|
+
else
|
|
158
|
+
await apply();
|
|
159
|
+
}
|
|
160
|
+
async heartbeatOwner() {
|
|
161
|
+
const apply = async () => this.writeOwnerHeartbeat();
|
|
162
|
+
if (this.backend.withExclusiveTransaction)
|
|
163
|
+
await this.backend.withExclusiveTransaction(apply);
|
|
164
|
+
else
|
|
165
|
+
await apply();
|
|
166
|
+
}
|
|
167
|
+
async close() {
|
|
168
|
+
await this.backend.close?.();
|
|
169
|
+
}
|
|
170
|
+
status() {
|
|
171
|
+
return {
|
|
172
|
+
kind: this.kind,
|
|
173
|
+
ownerId: this.ownerId,
|
|
174
|
+
capabilities: { ...this.capabilities },
|
|
175
|
+
hydratedAt: this.hydratedAt.toISOString(),
|
|
176
|
+
transactionsApplied: this.transactionsApplied,
|
|
177
|
+
lastOperation: this.lastOperation,
|
|
178
|
+
lastCheckpointAt: this.lastCheckpointAt,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
async loadInitial() {
|
|
182
|
+
const apply = async () => {
|
|
183
|
+
await this.writeOwnerHeartbeat();
|
|
184
|
+
const checkpoint = await this.backend.load();
|
|
185
|
+
if (checkpoint)
|
|
186
|
+
replaceStateContents(this.state, hydrateState(checkpoint.state, this.hydrate(this.recovery(), checkpoint.ownerId)));
|
|
187
|
+
this.lastCheckpointAt = checkpoint?.writtenAt ?? null;
|
|
188
|
+
if (await this.recoverInactiveOwners())
|
|
189
|
+
await this.save("recover_stale_owners");
|
|
190
|
+
};
|
|
191
|
+
if (this.backend.withExclusiveTransaction)
|
|
192
|
+
await this.backend.withExclusiveTransaction(apply);
|
|
193
|
+
else
|
|
194
|
+
await apply();
|
|
195
|
+
}
|
|
196
|
+
async save(operation) {
|
|
197
|
+
const writtenAt = this.now().toISOString();
|
|
198
|
+
await this.backend.save({
|
|
199
|
+
version: 1,
|
|
200
|
+
ownerId: this.ownerId,
|
|
201
|
+
writtenAt,
|
|
202
|
+
operation,
|
|
203
|
+
state: serializeState(this.state),
|
|
204
|
+
});
|
|
205
|
+
this.lastCheckpointAt = writtenAt;
|
|
206
|
+
}
|
|
207
|
+
async reload(options) {
|
|
208
|
+
if (options.heartbeatOwner)
|
|
209
|
+
await this.writeOwnerHeartbeat();
|
|
210
|
+
const ownedEphemeralFields = captureOwnedRunningEphemeralFields(this.state, this.ownerId);
|
|
211
|
+
const checkpoint = await this.backend.load();
|
|
212
|
+
replaceStateContents(this.state, checkpoint
|
|
213
|
+
? hydrateState(checkpoint.state, this.hydrate("preserve", checkpoint.ownerId))
|
|
214
|
+
: createState());
|
|
215
|
+
restoreOwnedRunningEphemeralFields(this.state, this.ownerId, ownedEphemeralFields);
|
|
216
|
+
this.lastCheckpointAt = checkpoint?.writtenAt ?? null;
|
|
217
|
+
if (options.recoverInactiveOwners && (await this.recoverInactiveOwners()))
|
|
218
|
+
await this.save("recover_stale_owners");
|
|
219
|
+
}
|
|
220
|
+
async writeOwnerHeartbeat() {
|
|
221
|
+
await this.backend.heartbeatOwner?.(this.ownerId, this.now());
|
|
222
|
+
}
|
|
223
|
+
async recoverInactiveOwners() {
|
|
224
|
+
if (!this.capabilities.sharedAcrossProcesses || !this.backend.ownerIsActive)
|
|
225
|
+
return false;
|
|
226
|
+
const now = this.now();
|
|
227
|
+
let recovered = false;
|
|
228
|
+
const activeOwners = new Map();
|
|
229
|
+
for (const [key, ownerId] of [...this.state.claimOwners.entries()]) {
|
|
230
|
+
if (ownerId === this.ownerId)
|
|
231
|
+
continue;
|
|
232
|
+
let ownerActive = activeOwners.get(ownerId);
|
|
233
|
+
if (ownerActive === undefined) {
|
|
234
|
+
ownerActive = await this.backend.ownerIsActive(ownerId, now, this.ownerLeaseStaleMs);
|
|
235
|
+
activeOwners.set(ownerId, ownerActive);
|
|
236
|
+
}
|
|
237
|
+
if (ownerActive)
|
|
238
|
+
continue;
|
|
239
|
+
const reservation = this.state.reserved.get(key);
|
|
240
|
+
if (reservation?.consumedRetry &&
|
|
241
|
+
!this.state.retryAttempts.has(reservation.consumedRetry.key)) {
|
|
242
|
+
this.state.retryAttempts.set(reservation.consumedRetry.key, reservation.consumedRetry.entry);
|
|
243
|
+
}
|
|
244
|
+
const running = this.state.running.get(key);
|
|
245
|
+
if (running && running.retryAttempt !== null && !this.state.retryAttempts.has(key))
|
|
246
|
+
this.state.retryAttempts.set(key, this.retryEntryFromRunningClaim(running, now));
|
|
247
|
+
this.state.running.delete(key);
|
|
248
|
+
this.state.reserved.delete(key);
|
|
249
|
+
this.state.claimed.delete(key);
|
|
250
|
+
this.state.claimOwners.delete(key);
|
|
251
|
+
recovered = true;
|
|
252
|
+
}
|
|
253
|
+
return recovered;
|
|
254
|
+
}
|
|
255
|
+
hydrate(recovery, fallbackClaimOwnerId) {
|
|
256
|
+
const base = typeof this.hydrateOptions === "function"
|
|
257
|
+
? this.hydrateOptions()
|
|
258
|
+
: (this.hydrateOptions ?? { now: this.now(), monotonicNowMs: this.monotonicNow() });
|
|
259
|
+
return {
|
|
260
|
+
...base,
|
|
261
|
+
fallbackClaimOwnerId,
|
|
262
|
+
reservationRecovery: recovery,
|
|
263
|
+
runningRecovery: recovery,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
recovery() {
|
|
267
|
+
return this.capabilities.sharedAcrossProcesses ? "preserve" : "abandon";
|
|
268
|
+
}
|
|
269
|
+
retryEntryFromRunningClaim(entry, now) {
|
|
270
|
+
return {
|
|
271
|
+
issueId: entry.issue.id,
|
|
272
|
+
identifier: entry.identifier,
|
|
273
|
+
issueUrl: entry.issue.url ?? null,
|
|
274
|
+
attempt: entry.retryAttempt ?? 1,
|
|
275
|
+
monotonicDeadlineMs: this.monotonicNow(),
|
|
276
|
+
dueAtIso: now.toISOString(),
|
|
277
|
+
slotIndex: entry.slotIndex,
|
|
278
|
+
workerHost: entry.workerHost,
|
|
279
|
+
workspacePath: entry.workspacePath,
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
let nextPersistentOwnerId = 1;
|
|
284
|
+
export class PersistentClaimStore {
|
|
285
|
+
backend;
|
|
286
|
+
ownerId;
|
|
287
|
+
kind;
|
|
288
|
+
capabilities;
|
|
289
|
+
state;
|
|
290
|
+
hydratedAt;
|
|
291
|
+
now;
|
|
292
|
+
monotonicNow;
|
|
293
|
+
ownerLeaseStaleMs;
|
|
294
|
+
hydrateOptions;
|
|
295
|
+
transactionsApplied = 0;
|
|
296
|
+
lastOperation = null;
|
|
297
|
+
lastCheckpointAt = null;
|
|
298
|
+
constructor(backend, options = {}) {
|
|
299
|
+
this.backend = backend;
|
|
300
|
+
this.kind = backend.kind;
|
|
301
|
+
this.capabilities = backend.capabilities;
|
|
302
|
+
if (this.capabilities.sharedAcrossProcesses && !backend.withExclusiveTransaction) {
|
|
303
|
+
throw new Error("shared_claim_store_backend_requires_exclusive_transaction");
|
|
304
|
+
}
|
|
305
|
+
if (this.capabilities.sharedAcrossProcesses &&
|
|
306
|
+
this.capabilities.crashRecovery &&
|
|
307
|
+
(!backend.heartbeatOwner || !backend.ownerIsActive)) {
|
|
308
|
+
throw new Error("shared_crash_recovery_claim_store_requires_owner_leases");
|
|
309
|
+
}
|
|
310
|
+
this.ownerId =
|
|
311
|
+
options.ownerId ??
|
|
312
|
+
`${backend.kind}:${process.pid}:${nextPersistentOwnerId++}:${randomUUID()}`;
|
|
313
|
+
this.hydratedAt = options.hydratedAt ?? new Date();
|
|
314
|
+
this.now = options.now ?? (() => new Date());
|
|
315
|
+
this.monotonicNow = options.monotonicNow ?? (() => performance.now());
|
|
316
|
+
this.ownerLeaseStaleMs = options.ownerLeaseStaleMs ?? 300_000;
|
|
317
|
+
this.hydrateOptions = options.hydrate;
|
|
318
|
+
this.state = createState();
|
|
319
|
+
const loadInitial = () => {
|
|
320
|
+
this.writeOwnerHeartbeat();
|
|
321
|
+
const checkpoint = backend.load();
|
|
322
|
+
if (checkpoint)
|
|
323
|
+
replaceStateContents(this.state, hydrateState(checkpoint.state, this.hydrate(this.recovery(), checkpoint.ownerId)));
|
|
324
|
+
this.lastCheckpointAt = checkpoint?.writtenAt ?? null;
|
|
325
|
+
if (this.recoverInactiveOwners())
|
|
326
|
+
this.save("recover_stale_owners");
|
|
327
|
+
};
|
|
328
|
+
if (backend.withExclusiveTransaction)
|
|
329
|
+
backend.withExclusiveTransaction(loadInitial);
|
|
330
|
+
else
|
|
331
|
+
loadInitial();
|
|
332
|
+
}
|
|
333
|
+
read(run) {
|
|
334
|
+
const apply = () => {
|
|
335
|
+
if (this.capabilities.sharedAcrossProcesses)
|
|
336
|
+
this.reload({ heartbeatOwner: false, recoverInactiveOwners: false });
|
|
337
|
+
return run(this.state);
|
|
338
|
+
};
|
|
339
|
+
return this.backend.withExclusiveTransaction
|
|
340
|
+
? this.backend.withExclusiveTransaction(apply)
|
|
341
|
+
: apply();
|
|
342
|
+
}
|
|
343
|
+
transaction(operation, run) {
|
|
344
|
+
let rollback = null;
|
|
345
|
+
const rollbackLocalState = () => {
|
|
346
|
+
rollback?.();
|
|
347
|
+
rollback = null;
|
|
348
|
+
};
|
|
349
|
+
const apply = () => {
|
|
350
|
+
if (this.capabilities.sharedAcrossProcesses)
|
|
351
|
+
this.reload({ heartbeatOwner: true, recoverInactiveOwners: true });
|
|
352
|
+
const rollbackState = cloneStateContents(this.state);
|
|
353
|
+
const rollbackTransactionsApplied = this.transactionsApplied;
|
|
354
|
+
const rollbackLastOperation = this.lastOperation;
|
|
355
|
+
const rollbackLastCheckpointAt = this.lastCheckpointAt;
|
|
356
|
+
rollback = () => {
|
|
357
|
+
replaceStateContents(this.state, rollbackState);
|
|
358
|
+
this.transactionsApplied = rollbackTransactionsApplied;
|
|
359
|
+
this.lastOperation = rollbackLastOperation;
|
|
360
|
+
this.lastCheckpointAt = rollbackLastCheckpointAt;
|
|
361
|
+
};
|
|
362
|
+
try {
|
|
363
|
+
const result = run(this.state);
|
|
364
|
+
this.transactionsApplied += 1;
|
|
365
|
+
this.lastOperation = operation;
|
|
366
|
+
this.save(operation);
|
|
367
|
+
return result;
|
|
368
|
+
}
|
|
369
|
+
catch (error) {
|
|
370
|
+
rollbackLocalState();
|
|
371
|
+
throw error;
|
|
372
|
+
}
|
|
373
|
+
};
|
|
374
|
+
if (!this.backend.withExclusiveTransaction) {
|
|
375
|
+
try {
|
|
376
|
+
return apply();
|
|
377
|
+
}
|
|
378
|
+
finally {
|
|
379
|
+
rollback = null;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
try {
|
|
383
|
+
const result = this.backend.withExclusiveTransaction(apply);
|
|
384
|
+
rollback = null;
|
|
385
|
+
return result;
|
|
386
|
+
}
|
|
387
|
+
catch (error) {
|
|
388
|
+
rollbackLocalState();
|
|
389
|
+
throw error;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
flush() {
|
|
393
|
+
const apply = () => {
|
|
394
|
+
if (this.capabilities.sharedAcrossProcesses)
|
|
395
|
+
this.reload({ heartbeatOwner: true, recoverInactiveOwners: true });
|
|
396
|
+
this.save("flush");
|
|
397
|
+
};
|
|
398
|
+
if (this.backend.withExclusiveTransaction)
|
|
399
|
+
this.backend.withExclusiveTransaction(apply);
|
|
400
|
+
else
|
|
401
|
+
apply();
|
|
402
|
+
}
|
|
403
|
+
heartbeatOwner() {
|
|
404
|
+
const apply = () => this.writeOwnerHeartbeat();
|
|
405
|
+
if (this.backend.withExclusiveTransaction)
|
|
406
|
+
this.backend.withExclusiveTransaction(apply);
|
|
407
|
+
else
|
|
408
|
+
apply();
|
|
409
|
+
}
|
|
410
|
+
close() {
|
|
411
|
+
this.backend.close?.();
|
|
412
|
+
}
|
|
413
|
+
status() {
|
|
414
|
+
return {
|
|
415
|
+
kind: this.kind,
|
|
416
|
+
ownerId: this.ownerId,
|
|
417
|
+
capabilities: { ...this.capabilities },
|
|
418
|
+
hydratedAt: this.hydratedAt.toISOString(),
|
|
419
|
+
transactionsApplied: this.transactionsApplied,
|
|
420
|
+
lastOperation: this.lastOperation,
|
|
421
|
+
lastCheckpointAt: this.lastCheckpointAt,
|
|
422
|
+
};
|
|
423
|
+
}
|
|
424
|
+
save(operation) {
|
|
425
|
+
const writtenAt = this.now().toISOString();
|
|
426
|
+
this.backend.save({
|
|
427
|
+
version: 1,
|
|
428
|
+
ownerId: this.ownerId,
|
|
429
|
+
writtenAt,
|
|
430
|
+
operation,
|
|
431
|
+
state: serializeState(this.state),
|
|
432
|
+
});
|
|
433
|
+
this.lastCheckpointAt = writtenAt;
|
|
434
|
+
}
|
|
435
|
+
reload(options) {
|
|
436
|
+
if (options.heartbeatOwner)
|
|
437
|
+
this.writeOwnerHeartbeat();
|
|
438
|
+
const ownedEphemeralFields = captureOwnedRunningEphemeralFields(this.state, this.ownerId);
|
|
439
|
+
const checkpoint = this.backend.load();
|
|
440
|
+
replaceStateContents(this.state, checkpoint
|
|
441
|
+
? hydrateState(checkpoint.state, this.hydrate("preserve", checkpoint.ownerId))
|
|
442
|
+
: createState());
|
|
443
|
+
restoreOwnedRunningEphemeralFields(this.state, this.ownerId, ownedEphemeralFields);
|
|
444
|
+
this.lastCheckpointAt = checkpoint?.writtenAt ?? null;
|
|
445
|
+
if (options.recoverInactiveOwners && this.recoverInactiveOwners())
|
|
446
|
+
this.save("recover_stale_owners");
|
|
447
|
+
}
|
|
448
|
+
writeOwnerHeartbeat() {
|
|
449
|
+
this.backend.heartbeatOwner?.(this.ownerId, this.now());
|
|
450
|
+
}
|
|
451
|
+
recoverInactiveOwners() {
|
|
452
|
+
if (!this.capabilities.sharedAcrossProcesses || !this.backend.ownerIsActive)
|
|
453
|
+
return false;
|
|
454
|
+
const now = this.now();
|
|
455
|
+
let recovered = false;
|
|
456
|
+
const activeOwners = new Map();
|
|
457
|
+
for (const [key, ownerId] of [...this.state.claimOwners.entries()]) {
|
|
458
|
+
if (ownerId === this.ownerId)
|
|
459
|
+
continue;
|
|
460
|
+
let ownerActive = activeOwners.get(ownerId);
|
|
461
|
+
if (ownerActive === undefined) {
|
|
462
|
+
ownerActive = this.backend.ownerIsActive(ownerId, now, this.ownerLeaseStaleMs);
|
|
463
|
+
activeOwners.set(ownerId, ownerActive);
|
|
464
|
+
}
|
|
465
|
+
if (ownerActive)
|
|
466
|
+
continue;
|
|
467
|
+
const reservation = this.state.reserved.get(key);
|
|
468
|
+
if (reservation?.consumedRetry &&
|
|
469
|
+
!this.state.retryAttempts.has(reservation.consumedRetry.key)) {
|
|
470
|
+
this.state.retryAttempts.set(reservation.consumedRetry.key, reservation.consumedRetry.entry);
|
|
471
|
+
}
|
|
472
|
+
const running = this.state.running.get(key);
|
|
473
|
+
if (running && running.retryAttempt !== null && !this.state.retryAttempts.has(key))
|
|
474
|
+
this.state.retryAttempts.set(key, this.retryEntryFromRunningClaim(running, now));
|
|
475
|
+
this.state.running.delete(key);
|
|
476
|
+
this.state.reserved.delete(key);
|
|
477
|
+
this.state.claimed.delete(key);
|
|
478
|
+
this.state.claimOwners.delete(key);
|
|
479
|
+
recovered = true;
|
|
480
|
+
}
|
|
481
|
+
return recovered;
|
|
482
|
+
}
|
|
483
|
+
hydrate(recovery, fallbackClaimOwnerId) {
|
|
484
|
+
const base = typeof this.hydrateOptions === "function"
|
|
485
|
+
? this.hydrateOptions()
|
|
486
|
+
: (this.hydrateOptions ?? { now: this.now(), monotonicNowMs: this.monotonicNow() });
|
|
487
|
+
return {
|
|
488
|
+
...base,
|
|
489
|
+
fallbackClaimOwnerId,
|
|
490
|
+
reservationRecovery: recovery,
|
|
491
|
+
runningRecovery: recovery,
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
recovery() {
|
|
495
|
+
return this.capabilities.sharedAcrossProcesses ? "preserve" : "abandon";
|
|
496
|
+
}
|
|
497
|
+
retryEntryFromRunningClaim(entry, now) {
|
|
498
|
+
return {
|
|
499
|
+
issueId: entry.issue.id,
|
|
500
|
+
identifier: entry.identifier,
|
|
501
|
+
issueUrl: entry.issue.url ?? null,
|
|
502
|
+
attempt: entry.retryAttempt ?? 1,
|
|
503
|
+
monotonicDeadlineMs: this.monotonicNow(),
|
|
504
|
+
dueAtIso: now.toISOString(),
|
|
505
|
+
slotIndex: entry.slotIndex,
|
|
506
|
+
workerHost: entry.workerHost,
|
|
507
|
+
workspacePath: entry.workspacePath,
|
|
508
|
+
};
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
export function isClaimStore(value) {
|
|
512
|
+
if (!isRecord(value))
|
|
513
|
+
return false;
|
|
514
|
+
const candidate = value;
|
|
515
|
+
if (candidate.async === true)
|
|
516
|
+
return false;
|
|
517
|
+
return (typeof candidate.kind === "string" &&
|
|
518
|
+
typeof candidate.ownerId === "string" &&
|
|
519
|
+
typeof candidate.capabilities === "object" &&
|
|
520
|
+
typeof candidate.read === "function" &&
|
|
521
|
+
typeof candidate.transaction === "function" &&
|
|
522
|
+
typeof candidate.heartbeatOwner === "function" &&
|
|
523
|
+
typeof candidate.status === "function" &&
|
|
524
|
+
candidate.state !== undefined);
|
|
525
|
+
}
|
|
526
|
+
export function isAsyncClaimStore(value) {
|
|
527
|
+
if (!isRecord(value))
|
|
528
|
+
return false;
|
|
529
|
+
const candidate = value;
|
|
530
|
+
return (candidate.async === true &&
|
|
531
|
+
typeof candidate.kind === "string" &&
|
|
532
|
+
typeof candidate.ownerId === "string" &&
|
|
533
|
+
typeof candidate.capabilities === "object" &&
|
|
534
|
+
typeof candidate.read === "function" &&
|
|
535
|
+
typeof candidate.transaction === "function" &&
|
|
536
|
+
typeof candidate.heartbeatOwner === "function" &&
|
|
537
|
+
typeof candidate.status === "function" &&
|
|
538
|
+
candidate.state !== undefined);
|
|
539
|
+
}
|
|
540
|
+
export function isClaimStoreLike(value) {
|
|
541
|
+
return isAsyncClaimStore(value) || isClaimStore(value);
|
|
542
|
+
}
|
|
543
|
+
function replaceStateContents(target, source) {
|
|
544
|
+
target.running = source.running;
|
|
545
|
+
target.reserved = source.reserved;
|
|
546
|
+
target.claimed = source.claimed;
|
|
547
|
+
target.claimOwners = source.claimOwners;
|
|
548
|
+
target.retryAttempts = source.retryAttempts;
|
|
549
|
+
target.completed = source.completed;
|
|
550
|
+
target.usageTotals = source.usageTotals;
|
|
551
|
+
target.usageDeltaBases = source.usageDeltaBases;
|
|
552
|
+
target.rateLimits = source.rateLimits;
|
|
553
|
+
target.blockedDispatches = source.blockedDispatches;
|
|
554
|
+
}
|
|
555
|
+
function cloneStateContents(source) {
|
|
556
|
+
const state = createState();
|
|
557
|
+
state.running = new Map([...source.running.entries()].map(([key, entry]) => [key, cloneRunningEntry(entry)]));
|
|
558
|
+
state.reserved = new Map([...source.reserved.entries()].map(([key, record]) => [key, cloneReservationRecord(record)]));
|
|
559
|
+
state.claimed = new Set(source.claimed);
|
|
560
|
+
state.claimOwners = new Map(source.claimOwners);
|
|
561
|
+
state.retryAttempts = new Map([...source.retryAttempts.entries()].map(([key, entry]) => [key, { ...entry }]));
|
|
562
|
+
state.completed = new Set(source.completed);
|
|
563
|
+
state.usageTotals = { ...source.usageTotals };
|
|
564
|
+
state.usageDeltaBases = new Map([...source.usageDeltaBases.entries()].map(([key, value]) => [key, { ...value }]));
|
|
565
|
+
state.rateLimits = source.rateLimits;
|
|
566
|
+
state.blockedDispatches = source.blockedDispatches.map((entry) => ({ ...entry }));
|
|
567
|
+
return state;
|
|
568
|
+
}
|
|
569
|
+
function cloneRunningEntry(entry) {
|
|
570
|
+
return {
|
|
571
|
+
...entry,
|
|
572
|
+
issue: cloneIssueForMemory(entry.issue),
|
|
573
|
+
usageTotals: { ...entry.usageTotals },
|
|
574
|
+
startedAt: new Date(entry.startedAt),
|
|
575
|
+
lastAgentTimestamp: entry.lastAgentTimestamp ? new Date(entry.lastAgentTimestamp) : null,
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
function cloneReservationRecord(record) {
|
|
579
|
+
return {
|
|
580
|
+
...record,
|
|
581
|
+
issue: cloneIssueForMemory(record.issue),
|
|
582
|
+
reservedAt: new Date(record.reservedAt),
|
|
583
|
+
expiresAt: new Date(record.expiresAt),
|
|
584
|
+
consumedRetry: record.consumedRetry
|
|
585
|
+
? { key: record.consumedRetry.key, entry: { ...record.consumedRetry.entry } }
|
|
586
|
+
: null,
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
function cloneIssueForMemory(issue) {
|
|
590
|
+
return {
|
|
591
|
+
...issue,
|
|
592
|
+
labels: [...issue.labels],
|
|
593
|
+
blockers: issue.blockers.map((blocker) => ({ ...blocker })),
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
function captureOwnedRunningEphemeralFields(state, ownerId) {
|
|
597
|
+
const fields = new Map();
|
|
598
|
+
for (const [key, entry] of state.running.entries()) {
|
|
599
|
+
if (state.claimOwners.get(key) !== ownerId)
|
|
600
|
+
continue;
|
|
601
|
+
fields.set(key, {
|
|
602
|
+
executorPid: entry.executorPid,
|
|
603
|
+
lastAgentMessage: entry.lastAgentMessage,
|
|
604
|
+
sessionId: entry.sessionId,
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
return fields;
|
|
608
|
+
}
|
|
609
|
+
function restoreOwnedRunningEphemeralFields(state, ownerId, fields) {
|
|
610
|
+
for (const [key, field] of fields.entries()) {
|
|
611
|
+
if (state.claimOwners.get(key) !== ownerId)
|
|
612
|
+
continue;
|
|
613
|
+
const entry = state.running.get(key);
|
|
614
|
+
if (!entry)
|
|
615
|
+
continue;
|
|
616
|
+
entry.executorPid = field.executorPid;
|
|
617
|
+
entry.lastAgentMessage = field.lastAgentMessage;
|
|
618
|
+
entry.sessionId = field.sessionId;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
//# sourceMappingURL=claimStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claimStore.js","sourceRoot":"","sources":["../src/claimStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAsC,MAAM,gBAAgB,CAAC;AAE9E,OAAO,EACL,YAAY,EACZ,cAAc,GAGf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAkD,MAAM,YAAY,CAAC;AAyFzF,IAAI,mBAAmB,GAAG,CAAC,CAAC;AAE5B,MAAM,OAAO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