@trusty-squire/mcp 1.1.18 → 1.1.19-rc.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/bin.js +7 -12
- package/dist/bin.js.map +1 -1
- package/dist/bot/broker/authority.d.ts +6 -2
- package/dist/bot/broker/authority.d.ts.map +1 -1
- package/dist/bot/broker/authority.js +25 -5
- package/dist/bot/broker/authority.js.map +1 -1
- package/dist/bot/broker/discovery.d.ts +15 -0
- package/dist/bot/broker/discovery.d.ts.map +1 -1
- package/dist/bot/broker/discovery.js +142 -7
- package/dist/bot/broker/discovery.js.map +1 -1
- package/dist/bot/broker/forwarder.d.ts.map +1 -1
- package/dist/bot/broker/forwarder.js +9 -3
- package/dist/bot/broker/forwarder.js.map +1 -1
- package/dist/bot/broker/mcp-principal.js +2 -2
- package/dist/bot/broker/mcp-principal.js.map +1 -1
- package/dist/bot/broker/mcp-socket.js +1 -1
- package/dist/bot/broker/mcp-socket.js.map +1 -1
- package/dist/bot/broker/protocol.d.ts.map +1 -1
- package/dist/bot/broker/protocol.js +2 -1
- package/dist/bot/broker/protocol.js.map +1 -1
- package/dist/bot/broker/transport.d.ts.map +1 -1
- package/dist/bot/broker/transport.js +4 -5
- package/dist/bot/broker/transport.js.map +1 -1
- package/dist/bot/session/lifecycle.d.ts.map +1 -1
- package/dist/bot/session/lifecycle.js +3 -30
- package/dist/bot/session/lifecycle.js.map +1 -1
- package/dist/bot/session/model.d.ts.map +1 -1
- package/dist/bot/session/model.js.map +1 -1
- package/dist/relay.d.ts.map +1 -1
- package/dist/relay.js +26 -3
- package/dist/relay.js.map +1 -1
- package/dist/server.d.ts +1 -3
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +11 -239
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
- package/dist/bot/broker/agent-identity.d.ts +0 -4
- package/dist/bot/broker/agent-identity.d.ts.map +0 -1
- package/dist/bot/broker/agent-identity.js +0 -12
- package/dist/bot/broker/agent-identity.js.map +0 -1
- package/dist/server-instance-registry.d.ts +0 -115
- package/dist/server-instance-registry.d.ts.map +0 -1
- package/dist/server-instance-registry.js +0 -405
- package/dist/server-instance-registry.js.map +0 -1
|
@@ -1,405 +0,0 @@
|
|
|
1
|
-
// Self-clean stale prior `mcp server` instances at startup.
|
|
2
|
-
//
|
|
3
|
-
// A host agent relaunches `mcp server` on every reconnect but does not
|
|
4
|
-
// reliably terminate the instance it superseded. A live box carried a
|
|
5
|
-
// superseded claude-code server sitting beside its replacement, plus two
|
|
6
|
-
// codex-identity servers orphaned to init for ~31 hours — each keeping a
|
|
7
|
-
// browser/reaper child tree resident. The owner-process reaper next door
|
|
8
|
-
// only reaps a dead owner's CHILDREN; nothing reaped a wedged owner itself.
|
|
9
|
-
// This registry does.
|
|
10
|
-
//
|
|
11
|
-
// The gate is deliberately narrow, because one shared box legitimately runs
|
|
12
|
-
// many concurrent servers — including several of the SAME agent identity,
|
|
13
|
-
// one per project/lane. So there is no name-based or blanket kill anywhere
|
|
14
|
-
// here. A prior instance is a candidate only when all of these hold:
|
|
15
|
-
// * its recorded agent identity EXACTLY matches ours (and ours is set),
|
|
16
|
-
// * it is not us, and its birth identity still names a live process,
|
|
17
|
-
// * and it is draining past its published shutdown deadline.
|
|
18
|
-
import { chmodSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync, } from "node:fs";
|
|
19
|
-
import { homedir } from "node:os";
|
|
20
|
-
import { join, resolve } from "node:path";
|
|
21
|
-
import { createHash, randomUUID } from "node:crypto";
|
|
22
|
-
import { processBirthIdentity, processBirthIdentityState, } from "./bot/profile.js";
|
|
23
|
-
import { VERSION } from "./version.js";
|
|
24
|
-
// A quiet stdio connection is still a live client. Exiting it after an idle
|
|
25
|
-
// period strands hosts that keep their MCP connection open between turns.
|
|
26
|
-
// Idle self-exit is therefore opt-in for hosts that explicitly accept that
|
|
27
|
-
// tradeoff; EOF, transport closure, signals and output failure still tear down
|
|
28
|
-
// the process by default.
|
|
29
|
-
const DEFAULT_IDLE_TIMEOUT_MS = 0;
|
|
30
|
-
const DEFAULT_IDLE_TIMEOUT_WITH_SESSION_MS = 0;
|
|
31
|
-
const DEFAULT_IDLE_CHECK_INTERVAL_MS = 5 * 60 * 1_000; // 5m when idle exit is configured
|
|
32
|
-
// An orphan's stdio peer is gone, so a well-behaved instance exits within
|
|
33
|
-
// milliseconds. Still alive and quiet this long past that means wedged.
|
|
34
|
-
const DEFAULT_HEARTBEAT_INTERVAL_MS = 30 * 1_000;
|
|
35
|
-
const DEFAULT_REAP_GRACE_MS = 2_000;
|
|
36
|
-
const DEFAULT_SHUTDOWN_DEADLINE_MS = 30_000;
|
|
37
|
-
function envMs(name, fallback) {
|
|
38
|
-
const raw = process.env[name];
|
|
39
|
-
if (raw === undefined)
|
|
40
|
-
return fallback;
|
|
41
|
-
const parsed = Number(raw);
|
|
42
|
-
return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
|
|
43
|
-
}
|
|
44
|
-
export function idleTimeoutMs() {
|
|
45
|
-
return envMs("TRUSTY_SQUIRE_SERVER_IDLE_TIMEOUT_MS", DEFAULT_IDLE_TIMEOUT_MS);
|
|
46
|
-
}
|
|
47
|
-
export function idleTimeoutWithSessionMs() {
|
|
48
|
-
return envMs("TRUSTY_SQUIRE_SERVER_IDLE_TIMEOUT_WITH_SESSION_MS", DEFAULT_IDLE_TIMEOUT_WITH_SESSION_MS);
|
|
49
|
-
}
|
|
50
|
-
export function idleCheckIntervalMs() {
|
|
51
|
-
return envMs("TRUSTY_SQUIRE_SERVER_IDLE_CHECK_INTERVAL_MS", DEFAULT_IDLE_CHECK_INTERVAL_MS);
|
|
52
|
-
}
|
|
53
|
-
export function heartbeatIntervalMs() {
|
|
54
|
-
return envMs("TRUSTY_SQUIRE_SERVER_HEARTBEAT_INTERVAL_MS", DEFAULT_HEARTBEAT_INTERVAL_MS);
|
|
55
|
-
}
|
|
56
|
-
export function shutdownDeadlineMs() {
|
|
57
|
-
return envMs("TRUSTY_SQUIRE_SERVER_SHUTDOWN_DEADLINE_MS", DEFAULT_SHUTDOWN_DEADLINE_MS);
|
|
58
|
-
}
|
|
59
|
-
export function serverReapBounds() {
|
|
60
|
-
return {
|
|
61
|
-
graceMs: envMs("TRUSTY_SQUIRE_SERVER_REAP_GRACE_MS", DEFAULT_REAP_GRACE_MS),
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function serverInstanceRootDir() {
|
|
65
|
-
const configured = (process.env.TRUSTY_SQUIRE_SERVER_INSTANCE_DIR ?? "").trim();
|
|
66
|
-
return configured.length > 0
|
|
67
|
-
? resolve(configured)
|
|
68
|
-
: join(homedir(), ".trusty-squire", "server-instances");
|
|
69
|
-
}
|
|
70
|
-
function agentIdentity() {
|
|
71
|
-
return (process.env.TRUSTY_SQUIRE_AGENT_IDENTITY ?? "").trim();
|
|
72
|
-
}
|
|
73
|
-
export function serverLauncherLineage(options = {}) {
|
|
74
|
-
const env = options.env ?? process.env;
|
|
75
|
-
const value = (env.TRUSTY_SQUIRE_SERVER_LINEAGE ??
|
|
76
|
-
env.TRUSTY_SQUIRE_FORWARDER_CREDENTIAL ??
|
|
77
|
-
"").trim();
|
|
78
|
-
if (value.length > 0)
|
|
79
|
-
return createHash("sha256").update(value).digest("hex");
|
|
80
|
-
return "";
|
|
81
|
-
}
|
|
82
|
-
function ensurePrivateDir(path) {
|
|
83
|
-
mkdirSync(path, { recursive: true, mode: 0o700 });
|
|
84
|
-
chmodSync(path, 0o700);
|
|
85
|
-
}
|
|
86
|
-
function isServerInstanceRecord(value) {
|
|
87
|
-
if (value === null || typeof value !== "object")
|
|
88
|
-
return false;
|
|
89
|
-
const record = value;
|
|
90
|
-
const numbers = [
|
|
91
|
-
record.pid,
|
|
92
|
-
record.parent_pid,
|
|
93
|
-
record.started_at,
|
|
94
|
-
record.heartbeat_at,
|
|
95
|
-
record.last_activity_at,
|
|
96
|
-
record.active_sessions,
|
|
97
|
-
record.in_flight_calls,
|
|
98
|
-
];
|
|
99
|
-
return (record.version === 1 &&
|
|
100
|
-
typeof record.agent_identity === "string" &&
|
|
101
|
-
typeof record.start_time === "string" &&
|
|
102
|
-
typeof record.server_version === "string" &&
|
|
103
|
-
numbers.every((entry) => Number.isSafeInteger(entry)) &&
|
|
104
|
-
(record.pid ?? 0) > 0);
|
|
105
|
-
}
|
|
106
|
-
export function readServerInstanceRecord(path) {
|
|
107
|
-
try {
|
|
108
|
-
const parsed = JSON.parse(readFileSync(path, "utf8"));
|
|
109
|
-
return isServerInstanceRecord(parsed) ? parsed : null;
|
|
110
|
-
}
|
|
111
|
-
catch {
|
|
112
|
-
return null;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
function writeServerInstanceRecord(path, record) {
|
|
116
|
-
const temporary = `${path}.tmp-${randomUUID()}`;
|
|
117
|
-
try {
|
|
118
|
-
writeFileSync(temporary, `${JSON.stringify(record)}\n`, { mode: 0o600, flag: "wx" });
|
|
119
|
-
renameSync(temporary, path);
|
|
120
|
-
}
|
|
121
|
-
finally {
|
|
122
|
-
rmSync(temporary, { force: true });
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
/** PPid is field 4 of /proc/<pid>/stat — index 1 after the comm close-paren. */
|
|
126
|
-
function linuxParentPid(pid) {
|
|
127
|
-
try {
|
|
128
|
-
const stat = readFileSync(`/proc/${pid}/stat`, "utf8");
|
|
129
|
-
const closeParen = stat.lastIndexOf(")");
|
|
130
|
-
if (closeParen < 0)
|
|
131
|
-
return "unknown";
|
|
132
|
-
const parent = Number(stat
|
|
133
|
-
.slice(closeParen + 2)
|
|
134
|
-
.trim()
|
|
135
|
-
.split(/\s+/)[1]);
|
|
136
|
-
return Number.isSafeInteger(parent) && parent >= 0 ? parent : "unknown";
|
|
137
|
-
}
|
|
138
|
-
catch (error) {
|
|
139
|
-
const code = error.code;
|
|
140
|
-
return code === "ENOENT" || code === "ESRCH" ? "stale" : "unknown";
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
function linuxProcessIds() {
|
|
144
|
-
try {
|
|
145
|
-
return readdirSync("/proc")
|
|
146
|
-
.filter((entry) => /^\d+$/.test(entry))
|
|
147
|
-
.map(Number);
|
|
148
|
-
}
|
|
149
|
-
catch {
|
|
150
|
-
return [];
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Descendants by PPid chain — never by process group. A stdio server shares
|
|
155
|
-
* its parent's process group, so `kill(-pgid)` would take the host agent
|
|
156
|
-
* down with it.
|
|
157
|
-
*/
|
|
158
|
-
export function processDescendantIdentities(pid, readers = {}) {
|
|
159
|
-
const readProcessIds = readers.readProcessIds ?? linuxProcessIds;
|
|
160
|
-
const readParentPid = readers.readParentPid ?? linuxParentPid;
|
|
161
|
-
const readBirthIdentity = readers.readBirthIdentity ?? processBirthIdentity;
|
|
162
|
-
const children = new Map();
|
|
163
|
-
for (const candidate of readProcessIds()) {
|
|
164
|
-
if (candidate === pid)
|
|
165
|
-
continue;
|
|
166
|
-
const parent = readParentPid(candidate);
|
|
167
|
-
if (typeof parent !== "number")
|
|
168
|
-
continue;
|
|
169
|
-
const siblings = children.get(parent);
|
|
170
|
-
if (siblings === undefined)
|
|
171
|
-
children.set(parent, [candidate]);
|
|
172
|
-
else
|
|
173
|
-
siblings.push(candidate);
|
|
174
|
-
}
|
|
175
|
-
const seen = new Set([pid]);
|
|
176
|
-
const descendants = [];
|
|
177
|
-
const queue = [pid];
|
|
178
|
-
while (queue.length > 0) {
|
|
179
|
-
for (const child of children.get(queue.shift()) ?? []) {
|
|
180
|
-
if (seen.has(child))
|
|
181
|
-
continue;
|
|
182
|
-
seen.add(child);
|
|
183
|
-
queue.push(child);
|
|
184
|
-
const identity = readBirthIdentity(child);
|
|
185
|
-
if (identity !== null)
|
|
186
|
-
descendants.push(identity);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
return descendants;
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* The whole safety contract, as one pure function. `forget` means the record
|
|
193
|
-
* names no live process — delete the file, signal nothing.
|
|
194
|
-
*/
|
|
195
|
-
export function serverInstanceReapDecision(record, self, liveness, parentPid, now, _bounds) {
|
|
196
|
-
if (record.pid === self.pid)
|
|
197
|
-
return "keep";
|
|
198
|
-
// A record naming a process that is already gone is file GC, not a kill —
|
|
199
|
-
// safe for any identity, and the only thing that keeps the directory from
|
|
200
|
-
// growing for an identity that never launches again.
|
|
201
|
-
if (liveness === "stale" || parentPid === "stale")
|
|
202
|
-
return "forget";
|
|
203
|
-
// Guard rail: identity is the outer fence on SIGNALLING. An unset identity
|
|
204
|
-
// matches nothing, so a host that never set one is never a target.
|
|
205
|
-
if (self.agent_identity.length === 0)
|
|
206
|
-
return "keep";
|
|
207
|
-
if (record.agent_identity !== self.agent_identity)
|
|
208
|
-
return "keep";
|
|
209
|
-
// Agent labels are shared by legitimate concurrent projects. Only the stable,
|
|
210
|
-
// secret-derived launcher lineage is authority to signal a live predecessor.
|
|
211
|
-
if (!record.launcher_lineage ||
|
|
212
|
-
!self.launcher_lineage ||
|
|
213
|
-
record.launcher_lineage !== self.launcher_lineage)
|
|
214
|
-
return "keep";
|
|
215
|
-
// A pid we cannot read is a pid we do not kill.
|
|
216
|
-
if (liveness === "unknown" || parentPid === "unknown")
|
|
217
|
-
return "keep";
|
|
218
|
-
return record.state === "draining" &&
|
|
219
|
-
typeof record.shutdown_deadline_at === "number" &&
|
|
220
|
-
now >= record.shutdown_deadline_at
|
|
221
|
-
? "reap"
|
|
222
|
-
: "keep";
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Publish this instance's heartbeat so a later launch of the same identity can
|
|
226
|
-
* tell "still serving a client" from "wedged". Returns null when there is
|
|
227
|
-
* nothing to publish (non-Linux, no agent identity, unreadable birth identity).
|
|
228
|
-
*/
|
|
229
|
-
export function registerServerInstance(options = {}) {
|
|
230
|
-
if (process.platform !== "linux")
|
|
231
|
-
return null;
|
|
232
|
-
const identity = options.identity ?? agentIdentity();
|
|
233
|
-
if (identity.length === 0)
|
|
234
|
-
return null;
|
|
235
|
-
const birth = processBirthIdentity(process.pid);
|
|
236
|
-
if (birth === null)
|
|
237
|
-
return null;
|
|
238
|
-
const parent = linuxParentPid(process.pid);
|
|
239
|
-
const now = options.now ?? Date.now;
|
|
240
|
-
const rootDir = resolve(options.rootDir ?? serverInstanceRootDir());
|
|
241
|
-
const startedAt = now();
|
|
242
|
-
let record = {
|
|
243
|
-
version: 1,
|
|
244
|
-
agent_identity: identity,
|
|
245
|
-
launcher_lineage: options.launcherLineage ?? serverLauncherLineage(),
|
|
246
|
-
state: "serving",
|
|
247
|
-
pid: birth.pid,
|
|
248
|
-
start_time: birth.start_time,
|
|
249
|
-
parent_pid: typeof parent === "number" ? parent : 0,
|
|
250
|
-
started_at: startedAt,
|
|
251
|
-
heartbeat_at: startedAt,
|
|
252
|
-
last_activity_at: startedAt,
|
|
253
|
-
active_sessions: 0,
|
|
254
|
-
in_flight_calls: 0,
|
|
255
|
-
server_version: VERSION,
|
|
256
|
-
};
|
|
257
|
-
const path = join(rootDir, `${birth.pid}-${randomUUID()}.json`);
|
|
258
|
-
try {
|
|
259
|
-
ensurePrivateDir(rootDir);
|
|
260
|
-
writeServerInstanceRecord(path, record);
|
|
261
|
-
}
|
|
262
|
-
catch {
|
|
263
|
-
return null;
|
|
264
|
-
}
|
|
265
|
-
let released = false;
|
|
266
|
-
return {
|
|
267
|
-
path,
|
|
268
|
-
heartbeat: (activity) => {
|
|
269
|
-
if (released)
|
|
270
|
-
return;
|
|
271
|
-
record = {
|
|
272
|
-
...record,
|
|
273
|
-
heartbeat_at: now(),
|
|
274
|
-
last_activity_at: activity.lastActivityAt,
|
|
275
|
-
active_sessions: activity.activeSessions,
|
|
276
|
-
in_flight_calls: activity.inFlightCalls,
|
|
277
|
-
};
|
|
278
|
-
try {
|
|
279
|
-
writeServerInstanceRecord(path, record);
|
|
280
|
-
}
|
|
281
|
-
catch {
|
|
282
|
-
// A heartbeat that cannot be written only costs this instance its
|
|
283
|
-
// protection from a later launch; it must never break serving.
|
|
284
|
-
}
|
|
285
|
-
},
|
|
286
|
-
markDraining: (deadlineAt, activity) => {
|
|
287
|
-
if (released)
|
|
288
|
-
return;
|
|
289
|
-
record = {
|
|
290
|
-
...record,
|
|
291
|
-
state: "draining",
|
|
292
|
-
shutdown_deadline_at: deadlineAt,
|
|
293
|
-
heartbeat_at: now(),
|
|
294
|
-
last_activity_at: activity.lastActivityAt,
|
|
295
|
-
active_sessions: activity.activeSessions,
|
|
296
|
-
in_flight_calls: activity.inFlightCalls,
|
|
297
|
-
};
|
|
298
|
-
try {
|
|
299
|
-
writeServerInstanceRecord(path, record);
|
|
300
|
-
}
|
|
301
|
-
catch {
|
|
302
|
-
// Shutdown continues to its hard deadline even if observability fails.
|
|
303
|
-
}
|
|
304
|
-
},
|
|
305
|
-
release: () => {
|
|
306
|
-
released = true;
|
|
307
|
-
rmSync(path, { force: true });
|
|
308
|
-
},
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
async function terminateServerInstanceTree(record, bounds, runtime) {
|
|
312
|
-
const readBirthState = runtime.readBirthState ?? processBirthIdentityState;
|
|
313
|
-
const readDescendants = runtime.readDescendants ?? ((pid) => processDescendantIdentities(pid));
|
|
314
|
-
const kill = runtime.kill ?? ((pid, signal) => process.kill(pid, signal));
|
|
315
|
-
const wait = runtime.wait ??
|
|
316
|
-
(async (ms) => await new Promise((done) => setTimeout(done, ms).unref()));
|
|
317
|
-
// Snapshot the tree BEFORE signalling: once the owner dies its children are
|
|
318
|
-
// re-parented to init and the PPid chain that identifies them is gone. Each
|
|
319
|
-
// entry carries a birth identity so a pid recycled during the grace window
|
|
320
|
-
// is not escalated to SIGKILL by mistake.
|
|
321
|
-
const tree = [
|
|
322
|
-
{ pid: record.pid, start_time: record.start_time },
|
|
323
|
-
...readDescendants(record.pid).filter((entry) => entry.pid !== process.pid),
|
|
324
|
-
];
|
|
325
|
-
const signalled = [];
|
|
326
|
-
const signal = (signalName) => {
|
|
327
|
-
const alive = [];
|
|
328
|
-
for (const identity of tree) {
|
|
329
|
-
if (readBirthState(identity) !== "matching")
|
|
330
|
-
continue;
|
|
331
|
-
alive.push(identity);
|
|
332
|
-
try {
|
|
333
|
-
kill(identity.pid, signalName);
|
|
334
|
-
if (!signalled.includes(identity.pid))
|
|
335
|
-
signalled.push(identity.pid);
|
|
336
|
-
}
|
|
337
|
-
catch { }
|
|
338
|
-
}
|
|
339
|
-
return alive;
|
|
340
|
-
};
|
|
341
|
-
signal("SIGTERM");
|
|
342
|
-
await wait(bounds.graceMs);
|
|
343
|
-
if (signal("SIGKILL").length > 0)
|
|
344
|
-
await wait(bounds.graceMs);
|
|
345
|
-
return signalled;
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* Reap stale prior instances of OUR agent identity. Never throws: a startup
|
|
349
|
-
* housekeeping pass must not be able to stop the server from serving.
|
|
350
|
-
*/
|
|
351
|
-
export async function reapStaleServerInstances(runtime = {}) {
|
|
352
|
-
const summary = { reaped: 0, forgotten: 0, kept: 0, signalled: [] };
|
|
353
|
-
if (process.platform !== "linux" && runtime.self === undefined)
|
|
354
|
-
return summary;
|
|
355
|
-
const birth = processBirthIdentity(process.pid);
|
|
356
|
-
const self = runtime.self ?? {
|
|
357
|
-
agent_identity: agentIdentity(),
|
|
358
|
-
launcher_lineage: runtime.launcherLineage ?? serverLauncherLineage(),
|
|
359
|
-
pid: process.pid,
|
|
360
|
-
start_time: birth?.start_time ?? "unknown",
|
|
361
|
-
};
|
|
362
|
-
if (self.agent_identity.length === 0)
|
|
363
|
-
return summary;
|
|
364
|
-
const rootDir = resolve(runtime.rootDir ?? serverInstanceRootDir());
|
|
365
|
-
const bounds = runtime.bounds ?? serverReapBounds();
|
|
366
|
-
const now = (runtime.now ?? Date.now)();
|
|
367
|
-
const readBirthState = runtime.readBirthState ?? processBirthIdentityState;
|
|
368
|
-
const readParentPid = runtime.readParentPid ?? linuxParentPid;
|
|
369
|
-
let entries;
|
|
370
|
-
try {
|
|
371
|
-
entries = readdirSync(rootDir).filter((entry) => entry.endsWith(".json"));
|
|
372
|
-
}
|
|
373
|
-
catch {
|
|
374
|
-
return summary;
|
|
375
|
-
}
|
|
376
|
-
for (const entry of entries) {
|
|
377
|
-
const path = join(rootDir, entry);
|
|
378
|
-
const record = readServerInstanceRecord(path);
|
|
379
|
-
if (record === null)
|
|
380
|
-
continue;
|
|
381
|
-
const decision = serverInstanceReapDecision(record, self, readBirthState(record), readParentPid(record.pid), now, bounds);
|
|
382
|
-
if (decision === "keep") {
|
|
383
|
-
summary.kept += 1;
|
|
384
|
-
continue;
|
|
385
|
-
}
|
|
386
|
-
if (decision === "forget") {
|
|
387
|
-
summary.forgotten += 1;
|
|
388
|
-
rmSync(path, { force: true });
|
|
389
|
-
continue;
|
|
390
|
-
}
|
|
391
|
-
try {
|
|
392
|
-
summary.signalled.push(...(await terminateServerInstanceTree(record, bounds, runtime)));
|
|
393
|
-
}
|
|
394
|
-
catch {
|
|
395
|
-
continue;
|
|
396
|
-
}
|
|
397
|
-
summary.reaped += 1;
|
|
398
|
-
if (readBirthState(record) === "stale")
|
|
399
|
-
rmSync(path, { force: true });
|
|
400
|
-
process.stderr.write(`[trusty-squire] reaped stale prior server pid=${record.pid} ` +
|
|
401
|
-
`identity=${record.agent_identity} v${record.server_version}\n`);
|
|
402
|
-
}
|
|
403
|
-
return summary;
|
|
404
|
-
}
|
|
405
|
-
//# sourceMappingURL=server-instance-registry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server-instance-registry.js","sourceRoot":"","sources":["../src/server-instance-registry.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,EAAE;AACF,uEAAuE;AACvE,sEAAsE;AACtE,yEAAyE;AACzE,yEAAyE;AACzE,yEAAyE;AACzE,4EAA4E;AAC5E,sBAAsB;AACtB,EAAE;AACF,4EAA4E;AAC5E,0EAA0E;AAC1E,2EAA2E;A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