harnery 0.45.0 → 0.45.2
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/commander.js +0 -1
- package/dist/commands/files.d.ts +2 -2
- package/dist/commands/files.d.ts.map +1 -1
- package/dist/commands/files.js +4 -7
- package/dist/commands/servers.d.ts.map +1 -1
- package/dist/commands/servers.js +17 -11
- package/dist/commands/tunnel.d.ts +0 -15
- package/dist/commands/tunnel.d.ts.map +1 -1
- package/dist/commands/tunnel.js +153 -453
- package/dist/commands/workflow.d.ts.map +1 -1
- package/dist/commands/workflow.js +6 -45
- package/dist/core/agents/coord-client.d.ts.map +1 -1
- package/dist/core/agents/coord-client.js +0 -18
- package/dist/core/agents/live-authority-v3.d.ts +0 -1
- package/dist/core/agents/live-authority-v3.d.ts.map +1 -1
- package/dist/core/agents/live-authority-v3.js +0 -11
- package/dist/core/agents/live-lifecycle-v3.d.ts +2 -4
- package/dist/core/agents/live-lifecycle-v3.d.ts.map +1 -1
- package/dist/core/agents/live-lifecycle-v3.js +7 -28
- package/dist/core/agents/state/heartbeat-writer.d.ts.map +1 -1
- package/dist/core/agents/state/heartbeat-writer.js +14 -25
- package/dist/core/agents/state/live-coordination-writer.d.ts.map +1 -1
- package/dist/core/agents/state/live-coordination-writer.js +0 -5
- package/dist/core/agents/state/pidmap.d.ts.map +1 -1
- package/dist/core/agents/state/pidmap.js +2 -7
- package/dist/core/agents/state/proc-start.d.ts +20 -31
- package/dist/core/agents/state/proc-start.d.ts.map +1 -1
- package/dist/core/agents/state/proc-start.js +37 -70
- package/dist/core/agents/state/service-process.d.ts +61 -0
- package/dist/core/agents/state/service-process.d.ts.map +1 -0
- package/dist/core/agents/state/service-process.js +143 -0
- package/dist/core/agents/state/stale-sweep.d.ts.map +1 -1
- package/dist/core/agents/state/stale-sweep.js +70 -180
- package/dist/core/artifacts/activity.d.ts +4 -1
- package/dist/core/artifacts/activity.d.ts.map +1 -1
- package/dist/core/artifacts/activity.js +8 -2
- package/dist/core/artifacts/delivery-card.d.ts.map +1 -1
- package/dist/core/artifacts/delivery-card.js +1 -2
- package/dist/core/artifacts/index.d.ts.map +1 -1
- package/dist/core/artifacts/index.js +38 -12
- package/dist/core/context/index.d.ts +6 -4
- package/dist/core/context/index.d.ts.map +1 -1
- package/dist/core/context/index.js +194 -256
- package/dist/core/context/observation.d.ts +9 -9
- package/dist/core/context/observation.d.ts.map +1 -1
- package/dist/core/context/observation.js +37 -6
- package/dist/core/events/v3/authority-outbox.d.ts.map +1 -1
- package/dist/core/events/v3/authority-outbox.js +0 -29
- package/dist/core/events/v3/producers/coordination-recorder.d.ts +0 -1
- package/dist/core/events/v3/producers/coordination-recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/coordination-recorder.js +0 -7
- package/dist/core/events/v3/producers/recorder.d.ts.map +1 -1
- package/dist/core/events/v3/producers/recorder.js +64 -77
- package/dist/core/events/v3/runtime-build.d.ts +14 -0
- package/dist/core/events/v3/runtime-build.d.ts.map +1 -1
- package/dist/core/events/v3/runtime-build.js +44 -0
- package/dist/core/governor/index.d.ts +2 -1
- package/dist/core/governor/index.d.ts.map +1 -1
- package/dist/core/governor/index.js +2 -1
- package/dist/core/governor/service-read.d.ts +3 -10
- package/dist/core/governor/service-read.d.ts.map +1 -1
- package/dist/core/governor/service-read.js +10 -94
- package/dist/core/governor/service.d.ts +3 -7
- package/dist/core/governor/service.d.ts.map +1 -1
- package/dist/core/governor/service.js +17 -182
- package/dist/core/hooks/cli.js +78 -48
- package/dist/core/hooks/resolve/owner.js +2 -2
- package/dist/core/resources/sampler.js +2 -2
- package/dist/core/resources/service-status.d.ts +2 -14
- package/dist/core/resources/service-status.d.ts.map +1 -1
- package/dist/core/resources/service-status.js +3 -23
- package/dist/core/resources/service.d.ts +3 -7
- package/dist/core/resources/service.d.ts.map +1 -1
- package/dist/core/resources/service.js +12 -101
- package/dist/core/resources/status.d.ts.map +1 -1
- package/dist/core/resources/status.js +3 -2
- package/dist/core/semantic/service.d.ts.map +1 -1
- package/dist/core/semantic/service.js +9 -2
- package/dist/core/servers/index.d.ts +11 -10
- package/dist/core/servers/index.d.ts.map +1 -1
- package/dist/core/servers/index.js +82 -192
- package/dist/core/servers/tunnels.d.ts +3 -5
- package/dist/core/servers/tunnels.d.ts.map +1 -1
- package/dist/core/servers/tunnels.js +2 -45
- package/dist/core/storage/durable-history.js +56 -22
- package/dist/core/storage/segments.d.ts.map +1 -1
- package/dist/core/storage/segments.js +73 -17
- package/dist/core/supervisor/service.d.ts +4 -7
- package/dist/core/supervisor/service.d.ts.map +1 -1
- package/dist/core/supervisor/service.js +23 -122
- package/dist/core/supervisor/services.js +2 -2
- package/dist/core/supervisor/status.d.ts +3 -17
- package/dist/core/supervisor/status.d.ts.map +1 -1
- package/dist/core/supervisor/status.js +7 -70
- package/dist/core/work/state.js +7 -7
- package/dist/core/workflow/engine.d.ts.map +1 -1
- package/dist/core/workflow/engine.js +23 -66
- package/dist/core/workflow/index.d.ts +3 -4
- package/dist/core/workflow/index.d.ts.map +1 -1
- package/dist/core/workflow/index.js +2 -2
- package/dist/core/workflow/live-session-v3.d.ts +0 -6
- package/dist/core/workflow/live-session-v3.d.ts.map +1 -1
- package/dist/core/workflow/live-session-v3.js +5 -126
- package/dist/core/workflow/proof.d.ts +4 -4
- package/dist/core/workflow/proof.d.ts.map +1 -1
- package/dist/core/workflow/proof.js +34 -86
- package/dist/core/workflow/resume-lock.d.ts +17 -0
- package/dist/core/workflow/resume-lock.d.ts.map +1 -0
- package/dist/core/workflow/resume-lock.js +158 -0
- package/dist/core/workflow/run-state.d.ts +0 -21
- package/dist/core/workflow/run-state.d.ts.map +1 -1
- package/dist/core/workflow/run-state.js +3 -174
- package/dist/core/workflow/spawn-claude.d.ts.map +1 -1
- package/dist/core/workflow/spawn-claude.js +0 -19
- package/dist/core/workflow/spawn-codex.d.ts.map +1 -1
- package/dist/core/workflow/spawn-codex.js +0 -13
- package/dist/core/workflow/spawn-cursor.d.ts.map +1 -1
- package/dist/core/workflow/spawn-cursor.js +0 -19
- package/dist/core/workflow/spawn-opencode.d.ts.map +1 -1
- package/dist/core/workflow/spawn-opencode.js +0 -14
- package/dist/core/workflow/types.d.ts +11 -54
- package/dist/core/workflow/types.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/leases.d.ts +4 -0
- package/dist/core/workflow/workspaces/leases.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/leases.js +1 -1
- package/dist/core/workflow/workspaces/local-git.js +91 -210
- package/dist/core/workflow/workspaces/ownership.d.ts +0 -7
- package/dist/core/workflow/workspaces/ownership.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/ownership.js +3 -130
- package/dist/core/workflow/workspaces/reclaim.d.ts +4 -7
- package/dist/core/workflow/workspaces/reclaim.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/reclaim.js +0 -4
- package/dist/core/workflow/workspaces/recovery.d.ts +1 -1
- package/dist/core/workflow/workspaces/recovery.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/recovery.js +1 -1
- package/dist/core/workflow/workspaces/state.d.ts.map +1 -1
- package/dist/core/workflow/workspaces/state.js +1 -4
- package/dist/lib/identities/assume.d.ts.map +1 -1
- package/dist/lib/identities/assume.js +0 -4
- package/dist/lib/tunnel/state.d.ts +6 -13
- package/dist/lib/tunnel/state.d.ts.map +1 -1
- package/dist/lib/tunnel/state.js +12 -58
- package/package.json +1 -6
- package/src/commander.ts +0 -10
- package/src/commands/files.ts +5 -13
- package/src/commands/servers.ts +23 -12
- package/src/commands/tunnel.ts +166 -533
- package/src/commands/workflow.ts +8 -58
- package/src/core/agents/coord-client.ts +0 -20
- package/src/core/agents/live-authority-v3.ts +0 -17
- package/src/core/agents/live-lifecycle-v3.ts +14 -52
- package/src/core/agents/state/heartbeat-writer.ts +12 -29
- package/src/core/agents/state/live-coordination-writer.ts +0 -29
- package/src/core/agents/state/pidmap.ts +2 -15
- package/src/core/agents/state/proc-start.ts +41 -69
- package/src/core/agents/state/service-process.ts +217 -0
- package/src/core/agents/state/stale-sweep.ts +82 -247
- package/src/core/artifacts/activity.ts +9 -2
- package/src/core/artifacts/delivery-card.ts +1 -7
- package/src/core/artifacts/index.ts +45 -12
- package/src/core/context/index.ts +207 -272
- package/src/core/context/observation.ts +40 -9
- package/src/core/events/v3/authority-outbox.ts +0 -56
- package/src/core/events/v3/producers/coordination-recorder.ts +0 -15
- package/src/core/events/v3/producers/recorder.ts +68 -94
- package/src/core/events/v3/runtime-build.ts +62 -0
- package/src/core/governor/index.ts +1 -2
- package/src/core/governor/service-read.ts +15 -114
- package/src/core/governor/service.ts +36 -220
- package/src/core/hooks/cli.ts +85 -47
- package/src/core/hooks/resolve/owner.ts +2 -2
- package/src/core/resources/sampler.ts +3 -2
- package/src/core/resources/service-status.ts +6 -35
- package/src/core/resources/service.ts +23 -133
- package/src/core/resources/status.ts +3 -2
- package/src/core/semantic/service.ts +8 -2
- package/src/core/servers/index.ts +86 -228
- package/src/core/servers/tunnels.ts +3 -55
- package/src/core/storage/durable-history.ts +52 -20
- package/src/core/storage/segments.ts +79 -17
- package/src/core/supervisor/service.ts +33 -155
- package/src/core/supervisor/services.ts +2 -2
- package/src/core/supervisor/status.ts +10 -85
- package/src/core/work/state.ts +7 -7
- package/src/core/workflow/engine.ts +22 -74
- package/src/core/workflow/index.ts +2 -13
- package/src/core/workflow/live-session-v3.ts +5 -146
- package/src/core/workflow/proof.ts +40 -104
- package/src/core/workflow/resume-lock.ts +179 -0
- package/src/core/workflow/run-state.ts +3 -207
- package/src/core/workflow/spawn-claude.ts +0 -18
- package/src/core/workflow/spawn-codex.ts +0 -13
- package/src/core/workflow/spawn-cursor.ts +0 -18
- package/src/core/workflow/spawn-opencode.ts +0 -14
- package/src/core/workflow/types.ts +11 -41
- package/src/core/workflow/workspaces/leases.ts +1 -1
- package/src/core/workflow/workspaces/local-git.ts +120 -239
- package/src/core/workflow/workspaces/ownership.ts +3 -158
- package/src/core/workflow/workspaces/reclaim.ts +3 -9
- package/src/core/workflow/workspaces/recovery.ts +1 -1
- package/src/core/workflow/workspaces/state.ts +1 -5
- package/src/lib/identities/assume.ts +0 -4
- package/src/lib/tunnel/state.ts +15 -70
- package/dist/commands/turn-rollback.d.ts +0 -5
- package/dist/commands/turn-rollback.d.ts.map +0 -1
- package/dist/commands/turn-rollback.js +0 -76
- package/dist/core/agents/state/process-handle.d.ts +0 -26
- package/dist/core/agents/state/process-handle.d.ts.map +0 -1
- package/dist/core/agents/state/process-handle.js +0 -121
- package/dist/core/agents/state/unchanged-file.d.ts +0 -44
- package/dist/core/agents/state/unchanged-file.d.ts.map +0 -1
- package/dist/core/agents/state/unchanged-file.js +0 -390
- package/dist/core/events/v3/generation-custody.d.ts +0 -5
- package/dist/core/events/v3/generation-custody.d.ts.map +0 -1
- package/dist/core/events/v3/generation-custody.js +0 -50
- package/dist/core/turn-rollback/content.d.ts +0 -53
- package/dist/core/turn-rollback/content.d.ts.map +0 -1
- package/dist/core/turn-rollback/content.js +0 -396
- package/dist/core/turn-rollback/index.d.ts +0 -72
- package/dist/core/turn-rollback/index.d.ts.map +0 -1
- package/dist/core/turn-rollback/index.js +0 -443
- package/dist/core/workflow/failure-evidence.d.ts +0 -16
- package/dist/core/workflow/failure-evidence.d.ts.map +0 -1
- package/dist/core/workflow/failure-evidence.js +0 -114
- package/dist/core/workflow/recovery-audit.d.ts +0 -30
- package/dist/core/workflow/recovery-audit.d.ts.map +0 -1
- package/dist/core/workflow/recovery-audit.js +0 -116
- package/src/commands/turn-rollback.ts +0 -111
- package/src/core/agents/state/process-handle.ts +0 -165
- package/src/core/agents/state/unchanged-file.ts +0 -456
- package/src/core/events/v3/generation-custody.ts +0 -59
- package/src/core/turn-rollback/content.ts +0 -499
- package/src/core/turn-rollback/index.ts +0 -580
- package/src/core/workflow/failure-evidence.ts +0 -141
- package/src/core/workflow/recovery-audit.ts +0 -181
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* which `gc` never stops; a record without an owner is never stopped
|
|
20
20
|
* automatically.
|
|
21
21
|
*/
|
|
22
|
-
import { createHash
|
|
22
|
+
import { createHash } from "node:crypto";
|
|
23
23
|
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync } from "node:fs";
|
|
24
24
|
import { hostname } from "node:os";
|
|
25
25
|
import { basename, isAbsolute, join, relative, resolve } from "node:path";
|
|
@@ -31,13 +31,13 @@ import { readCoordinationViewV3, requireAuthoritySafeCoordinationViewV3, } from
|
|
|
31
31
|
import { liveInstanceIdV3 } from "../events/v3/live-route-observer.js";
|
|
32
32
|
import { resolveOwner } from "../hooks/resolve/owner.js";
|
|
33
33
|
import { writePrivateJsonAtomic } from "../storage/atomic-json.js";
|
|
34
|
-
import { acquireNoClobberLease } from "../workflow/workspaces/leases.js";
|
|
35
34
|
import { ancestry, establishedConnectionCounts, listListeningPorts, listListeningSockets, processStartedAt, readProcessInfo, scanSupport, } from "./net.js";
|
|
35
|
+
// Host supervisors verify and signal their own children with the same checks.
|
|
36
36
|
export { processStartToken, signalIfSameGeneration, verifyProcessGeneration, } from "../agents/state/proc-start.js";
|
|
37
37
|
export { acquireNoClobberLease } from "../workflow/workspaces/leases.js";
|
|
38
38
|
export { ancestry, establishedConnectionCounts, listListeningPorts, listListeningSockets, lsofConnectionCounts, lsofListeningSockets, parseElapsed, parseLsofListen, parseProcNetTcp, processStartedAt, psProcessInfo, readProcessInfo, scanSupport, } from "./net.js";
|
|
39
|
-
export {
|
|
40
|
-
export const SERVER_RECORD_SCHEMA_VERSION =
|
|
39
|
+
export { tunnelServerId, tunnelServerInput } from "./tunnels.js";
|
|
40
|
+
export const SERVER_RECORD_SCHEMA_VERSION = 1;
|
|
41
41
|
export const SERVER_DEFAULT_IDLE_HOURS = 2;
|
|
42
42
|
export const SERVER_DEFAULT_OWNER_STALE_HOURS = 24;
|
|
43
43
|
const TOUCH_INTERVAL_MS = 60_000;
|
|
@@ -86,54 +86,40 @@ export function registerServer(input, options) {
|
|
|
86
86
|
!(Number.isInteger(input.port) && input.port > 0 && input.port < 65536))
|
|
87
87
|
throw new Error(`invalid server port: ${input.port}`);
|
|
88
88
|
const id = input.id ?? serverId(input.type, input.scope);
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
verifyProcessGeneration(pid, input.start_token) !== "same")
|
|
124
|
-
throw new Error(`pid ${pid} generation could not be verified before registration`);
|
|
125
|
-
if (existsSync(path)) {
|
|
126
|
-
const existing = readRecord(path);
|
|
127
|
-
if (!existing)
|
|
128
|
-
throw new Error(`registration ${id} custody is unknown: invalid or older server record retained`);
|
|
129
|
-
if (sameProcessCustody(existing, record) && serverState(existing) === "running")
|
|
130
|
-
return existing;
|
|
131
|
-
if (existing.host !== hostname() || !allProcessesAbsent(existing))
|
|
132
|
-
throw new Error(`registration ${id} custody is held by a live or unverifiable server`);
|
|
133
|
-
}
|
|
134
|
-
writePrivateJsonAtomic(path, record);
|
|
135
|
-
return record;
|
|
136
|
-
});
|
|
89
|
+
const now = new Date().toISOString();
|
|
90
|
+
const startToken = input.start_token ?? processStartToken(pid);
|
|
91
|
+
const pids = [...new Set(input.pids?.filter((p) => Number.isSafeInteger(p) && p > 0))];
|
|
92
|
+
const pidsStartTokens = {};
|
|
93
|
+
for (const auxiliaryPid of pids) {
|
|
94
|
+
const token = processStartToken(auxiliaryPid);
|
|
95
|
+
if (token)
|
|
96
|
+
pidsStartTokens[auxiliaryPid] = token;
|
|
97
|
+
}
|
|
98
|
+
const owner = input.owner === undefined ? callingOwner(coordRoot) : (input.owner ?? undefined);
|
|
99
|
+
const record = {
|
|
100
|
+
schema_version: SERVER_RECORD_SCHEMA_VERSION,
|
|
101
|
+
id,
|
|
102
|
+
kind: input.kind,
|
|
103
|
+
type: input.type,
|
|
104
|
+
label: input.label ?? id,
|
|
105
|
+
...(input.url ? { url: input.url } : {}),
|
|
106
|
+
...(input.port ? { port: input.port } : {}),
|
|
107
|
+
pid,
|
|
108
|
+
...(startToken ? { start_token: startToken } : {}),
|
|
109
|
+
...(pids.length ? { pids, pids_start_tokens: pidsStartTokens } : {}),
|
|
110
|
+
host: hostname(),
|
|
111
|
+
...(input.scope ? { scope: resolve(input.scope) } : {}),
|
|
112
|
+
...(input.cwd ? { cwd: resolve(input.cwd) } : {}),
|
|
113
|
+
...(input.log ? { log: resolve(input.log) } : {}),
|
|
114
|
+
...(owner ? { owner } : {}),
|
|
115
|
+
started_at: input.started_at ?? now,
|
|
116
|
+
registered_at: now,
|
|
117
|
+
last_active_at: now,
|
|
118
|
+
};
|
|
119
|
+
if (input.start_token !== undefined && verifyProcessGeneration(pid, input.start_token) !== "same")
|
|
120
|
+
throw new Error(`pid ${pid} generation could not be verified before registration`);
|
|
121
|
+
writePrivateJsonAtomic(recordPath(coordRoot, id), record);
|
|
122
|
+
return record;
|
|
137
123
|
}
|
|
138
124
|
/** Best-effort registration that never throws (for server start paths). */
|
|
139
125
|
export function tryRegisterServer(input, options) {
|
|
@@ -156,106 +142,43 @@ function callingOwner(coordRoot) {
|
|
|
156
142
|
return undefined;
|
|
157
143
|
}
|
|
158
144
|
}
|
|
159
|
-
/**
|
|
160
|
-
|
|
145
|
+
/**
|
|
146
|
+
* Remove a server's record. With `pid`, only a record still naming that pid
|
|
147
|
+
* is removed, so a replacement that re-registered the same id survives.
|
|
148
|
+
*/
|
|
149
|
+
export function unregisterServer(id, options) {
|
|
161
150
|
const coordRoot = rootOf(options);
|
|
162
|
-
if (!coordRoot || !
|
|
151
|
+
if (!coordRoot || !isValidServerId(id))
|
|
163
152
|
return false;
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
throw new Error("registration custody root is unavailable");
|
|
170
|
-
const lease = serverMutationLease(coordRoot, record.id);
|
|
171
|
-
try {
|
|
172
|
-
const current = readServer(record.id, { coordRoot });
|
|
173
|
-
if (!current ||
|
|
174
|
-
current.registration_id !== record.registration_id ||
|
|
175
|
-
!sameProcessCustody(current, record))
|
|
176
|
-
throw new Error(`registration ${record.id} custody changed`);
|
|
177
|
-
const result = effect();
|
|
178
|
-
if (result !== null &&
|
|
179
|
-
(typeof result === "object" || typeof result === "function") &&
|
|
180
|
-
typeof result.then === "function")
|
|
181
|
-
return Promise.resolve(result).finally(() => lease.release());
|
|
182
|
-
lease.release();
|
|
183
|
-
return result;
|
|
184
|
-
}
|
|
185
|
-
catch (error) {
|
|
186
|
-
lease.release();
|
|
187
|
-
throw error;
|
|
153
|
+
const path = recordPath(coordRoot, id);
|
|
154
|
+
if (options?.pid !== undefined) {
|
|
155
|
+
const record = readRecord(path);
|
|
156
|
+
if (record && record.pid !== options.pid)
|
|
157
|
+
return false;
|
|
188
158
|
}
|
|
189
|
-
|
|
190
|
-
function removeServerReceipt(coordRoot, record) {
|
|
191
|
-
const path = recordPath(coordRoot, record.id);
|
|
192
|
-
const current = readRecord(path);
|
|
193
|
-
if (!current ||
|
|
194
|
-
current.registration_id !== record.registration_id ||
|
|
195
|
-
!sameProcessCustody(current, record))
|
|
159
|
+
if (!existsSync(path))
|
|
196
160
|
return false;
|
|
197
|
-
rmSync(path);
|
|
161
|
+
rmSync(path, { force: true });
|
|
198
162
|
return true;
|
|
199
163
|
}
|
|
200
|
-
function serverMutationLease(coordRoot, id) {
|
|
201
|
-
recordPath(coordRoot, id);
|
|
202
|
-
const scope = `server-registration-${id}`;
|
|
203
|
-
return acquireNoClobberLease({
|
|
204
|
-
path: join(serversDir(coordRoot), ".custody", id),
|
|
205
|
-
scope,
|
|
206
|
-
authoritySha256: createHash("sha256").update(scope).digest("hex"),
|
|
207
|
-
staleAfterMs: 1,
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
function withServerMutation(coordRoot, id, operation) {
|
|
211
|
-
const lease = serverMutationLease(coordRoot, id);
|
|
212
|
-
try {
|
|
213
|
-
return operation();
|
|
214
|
-
}
|
|
215
|
-
finally {
|
|
216
|
-
lease.release();
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
function sameProcessCustody(a, b) {
|
|
220
|
-
const helpers = (record) => [...new Set(record.pids ?? [])]
|
|
221
|
-
.sort((x, y) => x - y)
|
|
222
|
-
.map((pid) => [pid, record.pids_start_tokens?.[pid] ?? null]);
|
|
223
|
-
return (a.schema_version === SERVER_RECORD_SCHEMA_VERSION &&
|
|
224
|
-
b.schema_version === SERVER_RECORD_SCHEMA_VERSION &&
|
|
225
|
-
a.id === b.id &&
|
|
226
|
-
a.pid === b.pid &&
|
|
227
|
-
a.start_token === b.start_token &&
|
|
228
|
-
a.host === b.host &&
|
|
229
|
-
a.kind === b.kind &&
|
|
230
|
-
a.type === b.type &&
|
|
231
|
-
a.scope === b.scope &&
|
|
232
|
-
a.owner?.instance_id === b.owner?.instance_id &&
|
|
233
|
-
JSON.stringify(helpers(a)) === JSON.stringify(helpers(b)));
|
|
234
|
-
}
|
|
235
164
|
export function readServer(id, options) {
|
|
236
165
|
const coordRoot = rootOf(options);
|
|
237
166
|
if (!coordRoot || !isValidServerId(id))
|
|
238
167
|
return null;
|
|
239
|
-
|
|
240
|
-
const record = readRecord(path);
|
|
241
|
-
if (!record && existsSync(path))
|
|
242
|
-
throw new Error(`server record ${id} is invalid or uses an older schema; retained without custody`);
|
|
243
|
-
return record;
|
|
168
|
+
return readRecord(recordPath(coordRoot, id));
|
|
244
169
|
}
|
|
245
170
|
/** Mark a server as used now. */
|
|
246
171
|
export function touchServer(id, options) {
|
|
247
172
|
const coordRoot = rootOf(options);
|
|
248
173
|
if (!coordRoot || !isValidServerId(id))
|
|
249
174
|
return;
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
last_active_at: (options?.now ?? new Date()).toISOString(),
|
|
258
|
-
});
|
|
175
|
+
const path = recordPath(coordRoot, id);
|
|
176
|
+
const record = readRecord(path);
|
|
177
|
+
if (!record)
|
|
178
|
+
return;
|
|
179
|
+
writePrivateJsonAtomic(path, {
|
|
180
|
+
...record,
|
|
181
|
+
last_active_at: (options?.now ?? new Date()).toISOString(),
|
|
259
182
|
});
|
|
260
183
|
}
|
|
261
184
|
/**
|
|
@@ -284,8 +207,6 @@ function readRecord(path) {
|
|
|
284
207
|
const value = JSON.parse(readFileSync(path, "utf8"));
|
|
285
208
|
if (value?.schema_version !== SERVER_RECORD_SCHEMA_VERSION ||
|
|
286
209
|
typeof value.id !== "string" ||
|
|
287
|
-
typeof value.registration_id !== "string" ||
|
|
288
|
-
!/^[0-9a-f-]{36}$/.test(value.registration_id) ||
|
|
289
210
|
!Number.isSafeInteger(value.pid) ||
|
|
290
211
|
(value.kind !== "service" && value.kind !== "session"))
|
|
291
212
|
return null;
|
|
@@ -304,12 +225,8 @@ export function readServerRecords(options) {
|
|
|
304
225
|
return [];
|
|
305
226
|
return readdirSync(dir)
|
|
306
227
|
.filter((name) => name.endsWith(".json"))
|
|
307
|
-
.map((name) =>
|
|
308
|
-
|
|
309
|
-
if (!record)
|
|
310
|
-
throw new Error(`server record ${name} is invalid or uses an older schema; retained without custody`);
|
|
311
|
-
return record;
|
|
312
|
-
})
|
|
228
|
+
.map((name) => readRecord(join(dir, name)))
|
|
229
|
+
.filter((record) => record !== null)
|
|
313
230
|
.sort((a, b) => a.kind.localeCompare(b.kind) || a.type.localeCompare(b.type) || a.id.localeCompare(b.id));
|
|
314
231
|
}
|
|
315
232
|
export function pidAlive(pid) {
|
|
@@ -380,7 +297,7 @@ export function listServers(options) {
|
|
|
380
297
|
records.forEach((record, i) => {
|
|
381
298
|
const state = states[i];
|
|
382
299
|
if (state === "dead" && allProcessesAbsent(record) && options?.prune !== false) {
|
|
383
|
-
unregisterServer(record, { coordRoot });
|
|
300
|
+
unregisterServer(record.id, { coordRoot, pid: record.pid });
|
|
384
301
|
pruned.push(record.id);
|
|
385
302
|
return;
|
|
386
303
|
}
|
|
@@ -513,49 +430,11 @@ export function planServerGc(views, policy) {
|
|
|
513
430
|
}
|
|
514
431
|
/**
|
|
515
432
|
* Stop a verified server with SIGTERM, then SIGKILL after the grace period.
|
|
516
|
-
*
|
|
517
|
-
*
|
|
433
|
+
* Each signal, including the process group and auxiliary processes, requires
|
|
434
|
+
* a fresh generation check. Unknown or different generations retain the record.
|
|
518
435
|
*/
|
|
519
436
|
export async function stopServer(record, options) {
|
|
520
437
|
const coordRoot = rootOf(options);
|
|
521
|
-
if (!coordRoot)
|
|
522
|
-
return {
|
|
523
|
-
id: record.id,
|
|
524
|
-
stopped: false,
|
|
525
|
-
method: "refused",
|
|
526
|
-
generation: "unknown",
|
|
527
|
-
detail: "registration custody root is unavailable",
|
|
528
|
-
};
|
|
529
|
-
let lease;
|
|
530
|
-
try {
|
|
531
|
-
lease = serverMutationLease(coordRoot, record.id);
|
|
532
|
-
}
|
|
533
|
-
catch {
|
|
534
|
-
return {
|
|
535
|
-
id: record.id,
|
|
536
|
-
stopped: false,
|
|
537
|
-
method: "refused",
|
|
538
|
-
generation: "unknown",
|
|
539
|
-
detail: "registration custody is unavailable",
|
|
540
|
-
};
|
|
541
|
-
}
|
|
542
|
-
try {
|
|
543
|
-
const current = readServer(record.id, { coordRoot });
|
|
544
|
-
if (!current || current.registration_id !== record.registration_id)
|
|
545
|
-
return {
|
|
546
|
-
id: record.id,
|
|
547
|
-
stopped: false,
|
|
548
|
-
method: "refused",
|
|
549
|
-
generation: "unknown",
|
|
550
|
-
detail: "registration custody changed; retained current server",
|
|
551
|
-
};
|
|
552
|
-
return await stopServerWithCustody(record, coordRoot, options);
|
|
553
|
-
}
|
|
554
|
-
finally {
|
|
555
|
-
lease.release();
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
async function stopServerWithCustody(record, coordRoot, options) {
|
|
559
438
|
const graceMs = options?.graceMs ?? 5_000;
|
|
560
439
|
const dependencies = options?.signalDependencies ?? {};
|
|
561
440
|
const targets = [
|
|
@@ -573,7 +452,7 @@ async function stopServerWithCustody(record, coordRoot, options) {
|
|
|
573
452
|
});
|
|
574
453
|
const finish = (result) => {
|
|
575
454
|
if (result.stopped || result.method === "not-running")
|
|
576
|
-
|
|
455
|
+
unregisterServer(record.id, { coordRoot, pid: record.pid });
|
|
577
456
|
return result;
|
|
578
457
|
};
|
|
579
458
|
if (record.host !== hostname())
|
|
@@ -595,9 +474,6 @@ async function stopServerWithCustody(record, coordRoot, options) {
|
|
|
595
474
|
}
|
|
596
475
|
if (targets.every((target) => processPresence(target.pid, dependencies.probePid) === "absent"))
|
|
597
476
|
return finish({ id: record.id, stopped: false, method: "not-running" });
|
|
598
|
-
const current = readServer(record.id, { coordRoot });
|
|
599
|
-
if (!current || !sameProcessCustody(current, record))
|
|
600
|
-
return refuse(record.pid, "unknown");
|
|
601
477
|
for (const name of ["SIGTERM", "SIGKILL"]) {
|
|
602
478
|
for (const target of targets) {
|
|
603
479
|
const presence = processPresence(target.pid, dependencies.probePid);
|
|
@@ -605,9 +481,11 @@ async function stopServerWithCustody(record, coordRoot, options) {
|
|
|
605
481
|
continue;
|
|
606
482
|
if (presence === "unknown")
|
|
607
483
|
return refuse(target.pid, "unknown");
|
|
608
|
-
const result =
|
|
609
|
-
|
|
610
|
-
|
|
484
|
+
const result = target.pid === record.pid
|
|
485
|
+
? signalServerLeader(target.pid, target.token, name, dependencies)
|
|
486
|
+
: signalIfSameGeneration(target.pid, target.token, name, dependencies);
|
|
487
|
+
if (result.verdict !== "same")
|
|
488
|
+
return refuse(target.pid, result.verdict);
|
|
611
489
|
}
|
|
612
490
|
const observed = await waitForExit(targets, name === "SIGTERM" ? graceMs : 2_000, dependencies);
|
|
613
491
|
if (observed.refused)
|
|
@@ -623,6 +501,18 @@ async function stopServerWithCustody(record, coordRoot, options) {
|
|
|
623
501
|
detail: "process survived SIGKILL",
|
|
624
502
|
};
|
|
625
503
|
}
|
|
504
|
+
function signalServerLeader(pid, token, name, dependencies) {
|
|
505
|
+
// The leader's generation authorizes its group. A failed group signal must
|
|
506
|
+
// not reuse that observation for the direct-PID fallback.
|
|
507
|
+
const kill = dependencies.kill ?? process.kill;
|
|
508
|
+
const group = signalIfSameGeneration(pid, token, name, {
|
|
509
|
+
readToken: dependencies.readToken,
|
|
510
|
+
kill: (leader, signal) => kill(-leader, signal),
|
|
511
|
+
});
|
|
512
|
+
return group.sent || group.verdict !== "same"
|
|
513
|
+
? group
|
|
514
|
+
: signalIfSameGeneration(pid, token, name, dependencies);
|
|
515
|
+
}
|
|
626
516
|
async function waitForExit(targets, waitMs, dependencies) {
|
|
627
517
|
const deadline = Date.now() + waitMs;
|
|
628
518
|
while (true) {
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
* Tunnels as registry services.
|
|
3
3
|
*
|
|
4
4
|
* `tunnel up` and `tunnel reload` register the new gate; `tunnel down` removes
|
|
5
|
-
* its record.
|
|
5
|
+
* its record. Older tunnels need an explicit adoption of an observed listener.
|
|
6
6
|
*/
|
|
7
|
-
import { type
|
|
8
|
-
import {
|
|
9
|
-
/** Verify only witnesses saved by the original tunnel registration. */
|
|
10
|
-
export declare function createTunnelReadinessVerifier(options: ServerOptions): TunnelReadinessVerifier;
|
|
7
|
+
import { type TunnelState } from "../../lib/tunnel/state.js";
|
|
8
|
+
import type { RegisterServerInput } from "./index.js";
|
|
11
9
|
export declare function tunnelServerId(name: string): string;
|
|
12
10
|
/** Register the new gate; saved helper PIDs have no generation witnesses. */
|
|
13
11
|
export declare function tunnelServerInput(state: TunnelState, coordRoot: string): RegisterServerInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tunnels.d.ts","sourceRoot":"","sources":["../../../src/core/servers/tunnels.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"tunnels.d.ts","sourceRoot":"","sources":["../../../src/core/servers/tunnels.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,6EAA6E;AAC7E,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,GAAG,mBAAmB,CAc5F"}
|
|
@@ -2,57 +2,15 @@
|
|
|
2
2
|
* Tunnels as registry services.
|
|
3
3
|
*
|
|
4
4
|
* `tunnel up` and `tunnel reload` register the new gate; `tunnel down` removes
|
|
5
|
-
* its record.
|
|
5
|
+
* its record. Older tunnels need an explicit adoption of an observed listener.
|
|
6
6
|
*/
|
|
7
|
-
import { hostname } from "node:os";
|
|
8
7
|
import { resolve } from "node:path";
|
|
9
|
-
import { gateLogFile
|
|
10
|
-
import { readServer, verifyProcessGeneration, withServerRegistrationCustody, } from "./index.js";
|
|
11
|
-
/** Verify only witnesses saved by the original tunnel registration. */
|
|
12
|
-
export function createTunnelReadinessVerifier(options) {
|
|
13
|
-
return {
|
|
14
|
-
observeProcess(pid, originalToken) {
|
|
15
|
-
try {
|
|
16
|
-
process.kill(pid, 0);
|
|
17
|
-
}
|
|
18
|
-
catch (error) {
|
|
19
|
-
const code = error.code;
|
|
20
|
-
if (code === "ESRCH")
|
|
21
|
-
return "absent";
|
|
22
|
-
return "unknown";
|
|
23
|
-
}
|
|
24
|
-
return verifyProcessGeneration(pid, originalToken);
|
|
25
|
-
},
|
|
26
|
-
withRegistration(state, inspect) {
|
|
27
|
-
try {
|
|
28
|
-
const original = readServer(tunnelServerId(state.name), options);
|
|
29
|
-
if (!original ||
|
|
30
|
-
original.host !== hostname() ||
|
|
31
|
-
original.kind !== "service" ||
|
|
32
|
-
original.type !== "tunnel" ||
|
|
33
|
-
original.registration_id !== state.registration_id ||
|
|
34
|
-
original.pid !== state.gate_pid ||
|
|
35
|
-
original.start_token !== state.gate_start_token ||
|
|
36
|
-
original.port !== state.gate_port ||
|
|
37
|
-
original.url !== state.url)
|
|
38
|
-
return "unknown";
|
|
39
|
-
return withServerRegistrationCustody(original, options, inspect);
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
return "unknown";
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
}
|
|
8
|
+
import { gateLogFile } from "../../lib/tunnel/state.js";
|
|
47
9
|
export function tunnelServerId(name) {
|
|
48
10
|
return `tunnel-${name.toLowerCase().replace(/[^a-z0-9._-]+/g, "-")}`;
|
|
49
11
|
}
|
|
50
12
|
/** Register the new gate; saved helper PIDs have no generation witnesses. */
|
|
51
13
|
export function tunnelServerInput(state, coordRoot) {
|
|
52
|
-
if (Object.hasOwn(state, "provider_pid") || Object.hasOwn(state, "provider_start_token"))
|
|
53
|
-
throw new Error("obsolete tunnel provider authority is unknown; state retained");
|
|
54
|
-
if (!state.gate_start_token)
|
|
55
|
-
throw new Error("tunnel gate generation witness is unavailable; state retained");
|
|
56
14
|
return {
|
|
57
15
|
id: tunnelServerId(state.name),
|
|
58
16
|
kind: "service",
|
|
@@ -61,7 +19,6 @@ export function tunnelServerInput(state, coordRoot) {
|
|
|
61
19
|
url: state.url,
|
|
62
20
|
port: state.gate_port,
|
|
63
21
|
pid: state.gate_pid,
|
|
64
|
-
start_token: state.gate_start_token,
|
|
65
22
|
log: resolve(coordRoot, ".cache", "tunnel", gateLogFile(state.name)),
|
|
66
23
|
cwd: coordRoot,
|
|
67
24
|
started_at: state.started_at,
|
|
@@ -394,31 +394,55 @@ function acquireLease(lease) {
|
|
|
394
394
|
pid: process.pid,
|
|
395
395
|
acquired_at: new Date().toISOString(),
|
|
396
396
|
};
|
|
397
|
-
|
|
398
|
-
try {
|
|
399
|
-
mkdirSync(lease, { mode: stateDirMode() });
|
|
400
|
-
assertDirectoryWithinParent(lease, parent);
|
|
401
|
-
claimed = captureDirectoryIdentity(lease);
|
|
402
|
-
writeOwner(join(lease, "owner.json"), owner);
|
|
403
|
-
syncDirectory(claimed);
|
|
397
|
+
if (claimLease(lease, parent, owner))
|
|
404
398
|
return owner;
|
|
399
|
+
if (recoverStaleLease(lease, DURABLE_HISTORY_LEASE_STALE_MS))
|
|
400
|
+
continue;
|
|
401
|
+
throw new Error(`durable history lease busy: ${lease}`);
|
|
402
|
+
}
|
|
403
|
+
throw new Error(`durable history lease busy: ${lease}`);
|
|
404
|
+
}
|
|
405
|
+
/**
|
|
406
|
+
* Publish a complete lease in one rename. The owner record is written and synced
|
|
407
|
+
* in a private claim directory first, so a writer stopped at any point leaves
|
|
408
|
+
* either no lease or one with an owner. A held lease always has an owner record,
|
|
409
|
+
* here and in the earlier create-then-write protocol, so a rename that replaces
|
|
410
|
+
* an empty lease directory never takes a held lease. A lease with any entry makes
|
|
411
|
+
* the rename fail and the caller reports it busy.
|
|
412
|
+
*/
|
|
413
|
+
function claimLease(lease, parent, owner) {
|
|
414
|
+
const claim = `${lease}.claim-${process.pid}-${owner.owner_id}`;
|
|
415
|
+
try {
|
|
416
|
+
mkdirSync(claim, { mode: stateDirMode() });
|
|
417
|
+
assertDirectoryWithinParent(claim, parent);
|
|
418
|
+
const claimed = captureDirectoryIdentity(claim);
|
|
419
|
+
writeOwner(join(claim, "owner.json"), owner);
|
|
420
|
+
syncDirectory(claimed);
|
|
421
|
+
renameSync(claim, lease);
|
|
422
|
+
}
|
|
423
|
+
catch {
|
|
424
|
+
return false;
|
|
425
|
+
}
|
|
426
|
+
finally {
|
|
427
|
+
try {
|
|
428
|
+
rmSync(claim, { recursive: true, force: true });
|
|
405
429
|
}
|
|
406
430
|
catch {
|
|
407
|
-
|
|
408
|
-
try {
|
|
409
|
-
assertDirectoryIdentity(claimed);
|
|
410
|
-
rmSync(lease, { recursive: true, force: false });
|
|
411
|
-
}
|
|
412
|
-
catch {
|
|
413
|
-
// Never remove a lease after its directory identity changes.
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
if (recoverStaleLease(lease, DURABLE_HISTORY_LEASE_STALE_MS))
|
|
417
|
-
continue;
|
|
418
|
-
throw new Error(`durable history lease busy: ${lease}`);
|
|
431
|
+
// A leftover claim directory never blocks a lease.
|
|
419
432
|
}
|
|
420
433
|
}
|
|
421
|
-
|
|
434
|
+
try {
|
|
435
|
+
assertDirectoryWithinParent(lease, parent);
|
|
436
|
+
const current = JSON.parse(completeJsonl(join(lease, "owner.json")));
|
|
437
|
+
if (current.owner_id !== owner.owner_id)
|
|
438
|
+
return false;
|
|
439
|
+
syncDirectory(parent);
|
|
440
|
+
return true;
|
|
441
|
+
}
|
|
442
|
+
catch {
|
|
443
|
+
releaseOwnedLease(lease, owner);
|
|
444
|
+
return false;
|
|
445
|
+
}
|
|
422
446
|
}
|
|
423
447
|
function writeOwner(path, owner) {
|
|
424
448
|
const parent = captureDirectoryIdentity(dirname(path));
|
|
@@ -468,7 +492,7 @@ function recoverStaleLease(lease, staleMs) {
|
|
|
468
492
|
assertDirectoryIdentity(leaseIdentity);
|
|
469
493
|
if (completeJsonl(ownerPath) !== raw)
|
|
470
494
|
return false;
|
|
471
|
-
|
|
495
|
+
retireLease(lease, randomUUID());
|
|
472
496
|
return true;
|
|
473
497
|
}
|
|
474
498
|
catch {
|
|
@@ -480,12 +504,22 @@ function releaseOwnedLease(lease, owner) {
|
|
|
480
504
|
const current = JSON.parse(completeJsonl(join(lease, "owner.json")));
|
|
481
505
|
if (current.owner_id !== owner.owner_id)
|
|
482
506
|
return;
|
|
483
|
-
|
|
507
|
+
retireLease(lease, owner.owner_id);
|
|
484
508
|
}
|
|
485
509
|
catch {
|
|
486
510
|
// A missing or replaced lease does not belong to this operation.
|
|
487
511
|
}
|
|
488
512
|
}
|
|
513
|
+
/**
|
|
514
|
+
* Move a lease aside before deleting it. Its path goes from held to absent in
|
|
515
|
+
* one rename and is never an empty directory that a concurrent claim could
|
|
516
|
+
* replace while a recursive removal is still running.
|
|
517
|
+
*/
|
|
518
|
+
function retireLease(lease, tag) {
|
|
519
|
+
const retired = `${lease}.retired-${process.pid}-${tag}`;
|
|
520
|
+
renameSync(lease, retired);
|
|
521
|
+
rmSync(retired, { recursive: true, force: true });
|
|
522
|
+
}
|
|
489
523
|
function processIsAlive(pid) {
|
|
490
524
|
try {
|
|
491
525
|
process.kill(pid, 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"segments.d.ts","sourceRoot":"","sources":["../../../src/core/storage/segments.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,eAAe,CAAC;AAEpE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAI3D,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,yBAAyB,CAAC;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,oEAAoE;IACpE,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,SAAS,mBAAmB,EAAE,CAAC;CAC1C;AAED,MAAM,WA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