@mcpjam/inspector 3.13.0 → 3.14.0
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/bin/runtime-profile.mjs +774 -0
- package/bin/start.js +117 -24
- package/dist/client/assets/{OAuthDesktopReturnNotice-D5tJNqny.js → OAuthDesktopReturnNotice-D7d-faB1.js} +2 -2
- package/dist/client/assets/{app-bootstrap-baadQQNk.js → app-bootstrap-BtDjj9nz.js} +350 -350
- package/dist/client/assets/{button-DHPqnOj6.js → button-B99pZFz_.js} +2 -2
- package/dist/client/assets/{chunk-D32TOXHM-BPB6AqSK.js → chunk-D32TOXHM-Bcyg0ZVj.js} +5 -5
- package/dist/client/assets/{dead-clicks-autocapture-Cbczl2El.js → dead-clicks-autocapture-CnUHv5CB.js} +2 -2
- package/dist/client/assets/{error-reporting-CORfsjyM.js → error-reporting-BohBwcQQ.js} +4 -4
- package/dist/client/assets/{error-reporting-B4hGM_ob.js → error-reporting-p6G1ojum.js} +1 -1
- package/dist/client/assets/{exception-autocapture-CMOUrnel.js → exception-autocapture-Q-isBTHp.js} +2 -2
- package/dist/client/assets/{failed-request-tracker-DoQRXuIy.js → failed-request-tracker-BBJW8izb.js} +2 -2
- package/dist/client/assets/{highlighted-body-KQOG7T2V-_ljE4u1k.js → highlighted-body-KQOG7T2V-zsXWRnSM.js} +2 -2
- package/dist/client/assets/{index-BBr8TZVx.js → index-C9oFRqoK.js} +3 -3
- package/dist/client/assets/{jszip.min-C-vIQbxH.js → jszip.min-C86zG41a.js} +2 -2
- package/dist/client/assets/{mermaid-MCJ5UELQ-DTJaEEBm.js → mermaid-MCJ5UELQ-DAW4LYwz.js} +1 -1
- package/dist/client/assets/{posthog-recorder-Dby9Z8HR.js → posthog-recorder-trUd0BXy.js} +2 -2
- package/dist/client/assets/{preload-helper-Dvt1a6xa.js → preload-helper-Buauuydw.js} +2 -2
- package/dist/client/assets/{react-CD7Pk4KS.js → react-CZb-kDOs.js} +2 -2
- package/dist/client/assets/{rolldown-runtime-mzU9SaVm.js → rolldown-runtime-Bkua2_Tb.js} +1 -1
- package/dist/client/assets/{surveys-DYqpu8xl.js → surveys-BISK_WOT.js} +2 -2
- package/dist/client/assets/{trace-timeline-PnE1ouRj.js → trace-timeline-CRewsP1E.js} +2 -2
- package/dist/client/assets/{trace-timeline-WXINST5z.js → trace-timeline-D-DWE-sO.js} +1 -1
- package/dist/client/assets/{web-vitals-BLq6M5vx.js → web-vitals-DqmZ9w02.js} +2 -2
- package/dist/client/index.html +7 -7
- package/dist/server/authorization-MA42CNYT.js +22 -0
- package/dist/server/chunk-7M3XVZCQ.js +381 -0
- package/dist/server/{chunk-MBS3EZ3U.js → chunk-7ZIR7SX7.js} +5 -44
- package/dist/server/chunk-C47PTIDS.js +487 -0
- package/dist/server/chunk-DHRTCKJA.js +3979 -0
- package/dist/server/chunk-HJTKF2X6.js +45 -0
- package/dist/server/{chunk-2FVSBJQF.js → chunk-KNO4KZJF.js} +224 -758
- package/dist/server/{chunk-QHYREDE3.js → chunk-RWFTW2EW.js} +7 -5
- package/dist/server/chunk-SDWJSPSI.js +252 -0
- package/dist/server/chunk-VFRLMHOC.js +33 -0
- package/dist/server/chunk-XSQ2GC45.js +438 -0
- package/dist/server/chunk-YQ2BTE46.js +88 -0
- package/dist/server/{consent-lifetime-TYLDY64H.js → consent-lifetime-OXQM37RV.js} +4 -3
- package/dist/server/grants-UVE62NGN.js +37 -0
- package/dist/server/harness-install-cli.js +239 -4
- package/dist/server/index.js +9044 -9216
- package/dist/server/local-turn-XSUGEKTL.js +19 -0
- package/dist/server/runtime-health-TCF3ZEKS.js +28 -0
- package/dist/server/runtime-lifecycle-YQ3KWDLJ.js +53 -0
- package/package.json +26 -23
- package/dist/server/chunk-I7ZVTBZP.js +0 -3100
- package/dist/server/local-turn-VQDSTY6T.js +0 -12
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createLocalStateMutationLock,
|
|
3
|
+
logger
|
|
4
|
+
} from "./chunk-C47PTIDS.js";
|
|
5
|
+
|
|
6
|
+
// server/utils/harness/local/runtime-lifecycle.ts
|
|
7
|
+
import { randomUUID } from "crypto";
|
|
8
|
+
import {
|
|
9
|
+
mkdir,
|
|
10
|
+
readdir,
|
|
11
|
+
readFile,
|
|
12
|
+
rename,
|
|
13
|
+
rm,
|
|
14
|
+
stat,
|
|
15
|
+
writeFile
|
|
16
|
+
} from "fs/promises";
|
|
17
|
+
import { join } from "path";
|
|
18
|
+
var OPERATION_PREFIX = ".mcpjam-operation-";
|
|
19
|
+
function operationFileName(key) {
|
|
20
|
+
const version = key.packVersion.replace(/[^A-Za-z0-9._-]/g, "_");
|
|
21
|
+
return `${OPERATION_PREFIX}${version}-${key.treeDigest.replace(/^sha256:/, "").slice(0, 16)}.json`;
|
|
22
|
+
}
|
|
23
|
+
var USE_DIR = ".mcpjam-inuse";
|
|
24
|
+
var STAGING_PREFIX = ".mcpjam-tmp-";
|
|
25
|
+
var STAGING_OWNER_FILE = ".mcpjam-staging-owner.json";
|
|
26
|
+
function operationKeyString(key) {
|
|
27
|
+
return [
|
|
28
|
+
key.runtimeRoot,
|
|
29
|
+
key.harnessId,
|
|
30
|
+
key.target,
|
|
31
|
+
key.packVersion,
|
|
32
|
+
key.treeDigest
|
|
33
|
+
].join("\0");
|
|
34
|
+
}
|
|
35
|
+
function harnessTargetInstallRoot(runtimeRoot, harnessId, target) {
|
|
36
|
+
return harnessId === "claude-code" ? join(runtimeRoot, target) : join(runtimeRoot, harnessId, target);
|
|
37
|
+
}
|
|
38
|
+
function installRootOf(key) {
|
|
39
|
+
return harnessTargetInstallRoot(key.runtimeRoot, key.harnessId, key.target);
|
|
40
|
+
}
|
|
41
|
+
var locksByRoot = /* @__PURE__ */ new Map();
|
|
42
|
+
function lockFor(key) {
|
|
43
|
+
const root = installRootOf(key);
|
|
44
|
+
let lock = locksByRoot.get(root);
|
|
45
|
+
if (lock === void 0) {
|
|
46
|
+
lock = createLocalStateMutationLock({
|
|
47
|
+
rootDir: () => root,
|
|
48
|
+
lockFileName: ".mcpjam-runtime-lifecycle.lock",
|
|
49
|
+
resourceLabel: "runtime lifecycle",
|
|
50
|
+
// Short by construction: every critical section here is a read, a
|
|
51
|
+
// compare and an atomic write. A caller waiting longer than this is
|
|
52
|
+
// waiting on something that is not doing that.
|
|
53
|
+
timeoutMs: 15e3
|
|
54
|
+
});
|
|
55
|
+
locksByRoot.set(root, lock);
|
|
56
|
+
}
|
|
57
|
+
return lock;
|
|
58
|
+
}
|
|
59
|
+
function resetRuntimeLifecycleForTests() {
|
|
60
|
+
locksByRoot.clear();
|
|
61
|
+
}
|
|
62
|
+
function ownerProvablyGone(record) {
|
|
63
|
+
if (record.ownerPid === process.pid) {
|
|
64
|
+
return record.ownerStartedAt !== processStartedAt();
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
process.kill(record.ownerPid, 0);
|
|
68
|
+
return false;
|
|
69
|
+
} catch (error) {
|
|
70
|
+
return error.code === "ESRCH";
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
var cachedStartedAt = null;
|
|
74
|
+
function processStartedAt() {
|
|
75
|
+
if (cachedStartedAt === null) {
|
|
76
|
+
cachedStartedAt = Math.floor((Date.now() - process.uptime() * 1e3) / 1e3);
|
|
77
|
+
}
|
|
78
|
+
return cachedStartedAt;
|
|
79
|
+
}
|
|
80
|
+
async function writeJsonAtomic(file, value) {
|
|
81
|
+
const tmp = `${file}.${process.pid}.${randomUUID()}.tmp`;
|
|
82
|
+
await writeFile(tmp, `${JSON.stringify(value, null, 2)}
|
|
83
|
+
`, { mode: 384 });
|
|
84
|
+
await rename(tmp, file);
|
|
85
|
+
}
|
|
86
|
+
async function readJson(file) {
|
|
87
|
+
try {
|
|
88
|
+
return JSON.parse(await readFile(file, "utf8"));
|
|
89
|
+
} catch {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async function readRuntimeOperation(key) {
|
|
94
|
+
const file = join(installRootOf(key), operationFileName(key));
|
|
95
|
+
const record = await readJson(file);
|
|
96
|
+
if (record === null) return null;
|
|
97
|
+
if (record.packVersion !== key.packVersion || record.treeDigest !== key.treeDigest || record.harnessId !== key.harnessId) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
const terminal = record.state === "ready" || record.state === "failed" || record.state === "interrupted";
|
|
101
|
+
if (terminal || !ownerProvablyGone(record)) return record;
|
|
102
|
+
return lockFor(key)(async () => {
|
|
103
|
+
const fresh = await readJson(file);
|
|
104
|
+
if (fresh === null) return null;
|
|
105
|
+
if (fresh.attemptId !== record.attemptId) return fresh;
|
|
106
|
+
if (fresh.state === "ready" || fresh.state === "failed" || fresh.state === "interrupted") {
|
|
107
|
+
return fresh;
|
|
108
|
+
}
|
|
109
|
+
if (!ownerProvablyGone(fresh)) return fresh;
|
|
110
|
+
const reconciled = {
|
|
111
|
+
...fresh,
|
|
112
|
+
state: "interrupted",
|
|
113
|
+
message: "the Inspector that started this install is no longer running, so the attempt was abandoned partway through",
|
|
114
|
+
updatedAt: Date.now()
|
|
115
|
+
};
|
|
116
|
+
await writeJsonAtomic(file, reconciled);
|
|
117
|
+
logger.info("[local-harness] recovered an interrupted install attempt", {
|
|
118
|
+
attemptId: reconciled.attemptId,
|
|
119
|
+
packVersion: reconciled.packVersion
|
|
120
|
+
});
|
|
121
|
+
return reconciled;
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
async function beginInstallAttempt(key, extras = {}) {
|
|
125
|
+
const root = installRootOf(key);
|
|
126
|
+
await mkdir(root, { recursive: true, mode: 448 });
|
|
127
|
+
const file = join(root, operationFileName(key));
|
|
128
|
+
return lockFor(key)(async () => {
|
|
129
|
+
const existing = await readJson(file);
|
|
130
|
+
if (existing !== null && existing.packVersion === key.packVersion && existing.treeDigest === key.treeDigest && existing.harnessId === key.harnessId) {
|
|
131
|
+
const live = existing.state !== "ready" && existing.state !== "failed" && existing.state !== "interrupted";
|
|
132
|
+
if (live && !ownerProvablyGone(existing)) {
|
|
133
|
+
return { kind: "joined", record: existing };
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const record = {
|
|
137
|
+
attemptId: `att_${randomUUID()}`,
|
|
138
|
+
ownerPid: process.pid,
|
|
139
|
+
ownerStartedAt: processStartedAt(),
|
|
140
|
+
harnessId: key.harnessId,
|
|
141
|
+
target: key.target,
|
|
142
|
+
packVersion: key.packVersion,
|
|
143
|
+
treeDigest: key.treeDigest,
|
|
144
|
+
state: "reserved",
|
|
145
|
+
...extras.trigger ? { trigger: extras.trigger } : {},
|
|
146
|
+
startedAt: Date.now(),
|
|
147
|
+
updatedAt: Date.now()
|
|
148
|
+
};
|
|
149
|
+
await writeJsonAtomic(file, record);
|
|
150
|
+
return { kind: "started", record };
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
async function updateInstallAttempt(key, attemptId, patch) {
|
|
154
|
+
const file = join(installRootOf(key), operationFileName(key));
|
|
155
|
+
return lockFor(key)(async () => {
|
|
156
|
+
const existing = await readJson(file);
|
|
157
|
+
if (existing === null || existing.attemptId !== attemptId) return false;
|
|
158
|
+
await writeJsonAtomic(file, {
|
|
159
|
+
...existing,
|
|
160
|
+
...patch,
|
|
161
|
+
updatedAt: Date.now()
|
|
162
|
+
});
|
|
163
|
+
return true;
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
async function attemptStillOwns(key, attemptId) {
|
|
167
|
+
const record = await readJson(
|
|
168
|
+
join(installRootOf(key), operationFileName(key))
|
|
169
|
+
);
|
|
170
|
+
return record?.attemptId === attemptId;
|
|
171
|
+
}
|
|
172
|
+
async function reserveRuntimeUse(args) {
|
|
173
|
+
const dir = join(installRootOf(args.key), USE_DIR);
|
|
174
|
+
await mkdir(dir, { recursive: true, mode: 448 });
|
|
175
|
+
const file = join(dir, `${process.pid}-${randomUUID()}.json`);
|
|
176
|
+
const record = {
|
|
177
|
+
pid: process.pid,
|
|
178
|
+
startedAt: processStartedAt(),
|
|
179
|
+
runtimeRoot: args.runtimeRoot,
|
|
180
|
+
at: Date.now(),
|
|
181
|
+
...args.label ? { label: args.label } : {}
|
|
182
|
+
};
|
|
183
|
+
await lockFor(args.key)(() => writeJsonAtomic(file, record));
|
|
184
|
+
let released = false;
|
|
185
|
+
return {
|
|
186
|
+
release: async () => {
|
|
187
|
+
if (released) return;
|
|
188
|
+
released = true;
|
|
189
|
+
await rm(file, { force: true }).catch(() => {
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
async function runtimeUseState(args) {
|
|
195
|
+
const dir = join(installRootOf(args.key), USE_DIR);
|
|
196
|
+
let entries;
|
|
197
|
+
try {
|
|
198
|
+
entries = await readdir(dir);
|
|
199
|
+
} catch {
|
|
200
|
+
return { busy: false, holders: [] };
|
|
201
|
+
}
|
|
202
|
+
const holders = [];
|
|
203
|
+
for (const entry of entries) {
|
|
204
|
+
if (!entry.endsWith(".json")) continue;
|
|
205
|
+
const file = join(dir, entry);
|
|
206
|
+
const record = await readJson(file);
|
|
207
|
+
if (record === null) {
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
if (record.runtimeRoot !== args.runtimeRoot) continue;
|
|
211
|
+
if (ownerProvablyGone({ ownerPid: record.pid, ownerStartedAt: record.startedAt })) {
|
|
212
|
+
await rm(file, { force: true }).catch(() => {
|
|
213
|
+
});
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
holders.push(record.pid);
|
|
217
|
+
}
|
|
218
|
+
return { busy: holders.length > 0, holders };
|
|
219
|
+
}
|
|
220
|
+
async function claimStagingDirectory(args) {
|
|
221
|
+
await writeJsonAtomic(join(args.staging, STAGING_OWNER_FILE), {
|
|
222
|
+
pid: process.pid,
|
|
223
|
+
startedAt: processStartedAt(),
|
|
224
|
+
attemptId: args.attemptId,
|
|
225
|
+
at: Date.now()
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
async function sweepAbandonedStaging(key) {
|
|
229
|
+
const root = installRootOf(key);
|
|
230
|
+
let entries;
|
|
231
|
+
try {
|
|
232
|
+
entries = await readdir(root);
|
|
233
|
+
} catch {
|
|
234
|
+
return { removed: 0, left: 0 };
|
|
235
|
+
}
|
|
236
|
+
let removed = 0;
|
|
237
|
+
let left = 0;
|
|
238
|
+
for (const entry of entries) {
|
|
239
|
+
if (!entry.startsWith(STAGING_PREFIX)) continue;
|
|
240
|
+
const path = join(root, entry);
|
|
241
|
+
const owner = await readJson(join(path, STAGING_OWNER_FILE));
|
|
242
|
+
if (owner === null) {
|
|
243
|
+
left += 1;
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
if (!ownerProvablyGone({ ownerPid: owner.pid, ownerStartedAt: owner.startedAt })) {
|
|
247
|
+
left += 1;
|
|
248
|
+
continue;
|
|
249
|
+
}
|
|
250
|
+
await rm(path, { recursive: true, force: true }).catch(() => {
|
|
251
|
+
});
|
|
252
|
+
removed += 1;
|
|
253
|
+
}
|
|
254
|
+
if (removed > 0 || left > 0) {
|
|
255
|
+
logger.debug("[local-harness] staging sweep", { removed, left });
|
|
256
|
+
}
|
|
257
|
+
return { removed, left };
|
|
258
|
+
}
|
|
259
|
+
async function recoverInterruptedActivation(args) {
|
|
260
|
+
const previous = `${args.versionRoot}${PREVIOUS_SUFFIX}`;
|
|
261
|
+
const hasPrevious = await stat(previous).then(
|
|
262
|
+
(info) => info.isDirectory(),
|
|
263
|
+
() => false
|
|
264
|
+
);
|
|
265
|
+
if (!hasPrevious) return false;
|
|
266
|
+
return lockFor(args.key)(async () => {
|
|
267
|
+
const current = await stat(args.versionRoot).then(
|
|
268
|
+
(info) => info.isDirectory(),
|
|
269
|
+
() => false
|
|
270
|
+
);
|
|
271
|
+
if (current) {
|
|
272
|
+
await rm(previous, { recursive: true, force: true }).catch(() => {
|
|
273
|
+
});
|
|
274
|
+
return false;
|
|
275
|
+
}
|
|
276
|
+
await rename(previous, args.versionRoot);
|
|
277
|
+
logger.warn("[local-harness] restored a runtime after an interrupted activation", {
|
|
278
|
+
packVersion: args.key.packVersion
|
|
279
|
+
});
|
|
280
|
+
return true;
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
var PREVIOUS_SUFFIX = ".mcpjam-previous";
|
|
284
|
+
var RETIRING_PREFIX = ".mcpjam-retiring-";
|
|
285
|
+
function installRootKey(runtimeRoot, harnessId, target) {
|
|
286
|
+
return { runtimeRoot, harnessId, target, packVersion: "", treeDigest: "" };
|
|
287
|
+
}
|
|
288
|
+
async function retireVersionDirectory(args) {
|
|
289
|
+
const retired = await lockFor(args.key)(async () => {
|
|
290
|
+
const use = await runtimeUseState({ key: args.key, runtimeRoot: args.versionRoot });
|
|
291
|
+
if (use.busy) return null;
|
|
292
|
+
if (args.stillUnwanted && !await args.stillUnwanted()) return null;
|
|
293
|
+
const present = await stat(args.versionRoot).then(
|
|
294
|
+
() => true,
|
|
295
|
+
() => false
|
|
296
|
+
);
|
|
297
|
+
if (!present) return null;
|
|
298
|
+
const parent = installRootOf(args.key);
|
|
299
|
+
const claimed = join(parent, `${RETIRING_PREFIX}${randomUUID()}`);
|
|
300
|
+
await rename(args.versionRoot, claimed);
|
|
301
|
+
return claimed;
|
|
302
|
+
});
|
|
303
|
+
if (retired === null) return false;
|
|
304
|
+
await rm(retired, { recursive: true, force: true }).catch(() => {
|
|
305
|
+
});
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
async function sweepRetired(key) {
|
|
309
|
+
const root = installRootOf(key);
|
|
310
|
+
let entries;
|
|
311
|
+
try {
|
|
312
|
+
entries = await readdir(root);
|
|
313
|
+
} catch {
|
|
314
|
+
return 0;
|
|
315
|
+
}
|
|
316
|
+
let removed = 0;
|
|
317
|
+
for (const entry of entries) {
|
|
318
|
+
if (entry.startsWith(RETIRING_PREFIX)) {
|
|
319
|
+
await rm(join(root, entry), { recursive: true, force: true }).catch(() => {
|
|
320
|
+
});
|
|
321
|
+
removed += 1;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return removed;
|
|
325
|
+
}
|
|
326
|
+
async function listOperationRecords(key) {
|
|
327
|
+
const root = installRootOf(key);
|
|
328
|
+
let entries;
|
|
329
|
+
try {
|
|
330
|
+
entries = await readdir(root);
|
|
331
|
+
} catch {
|
|
332
|
+
return [];
|
|
333
|
+
}
|
|
334
|
+
const records = [];
|
|
335
|
+
for (const entry of entries) {
|
|
336
|
+
if (!entry.startsWith(OPERATION_PREFIX) || !entry.endsWith(".json")) continue;
|
|
337
|
+
const record = await readJson(join(root, entry));
|
|
338
|
+
if (record !== null) records.push(record);
|
|
339
|
+
}
|
|
340
|
+
return records;
|
|
341
|
+
}
|
|
342
|
+
async function forgetOperationRecord(key) {
|
|
343
|
+
const file = join(installRootOf(key), operationFileName(key));
|
|
344
|
+
await lockFor(key)(async () => {
|
|
345
|
+
const record = await readJson(file);
|
|
346
|
+
if (record === null) return;
|
|
347
|
+
const terminal = record.state === "ready" || record.state === "failed" || record.state === "interrupted";
|
|
348
|
+
if (terminal || ownerProvablyGone(record)) await rm(file, { force: true }).catch(() => {
|
|
349
|
+
});
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
function withRuntimeLifecycleLock(key, operation) {
|
|
353
|
+
return lockFor(key)(operation);
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
export {
|
|
357
|
+
STAGING_PREFIX,
|
|
358
|
+
operationKeyString,
|
|
359
|
+
harnessTargetInstallRoot,
|
|
360
|
+
resetRuntimeLifecycleForTests,
|
|
361
|
+
ownerProvablyGone,
|
|
362
|
+
processStartedAt,
|
|
363
|
+
readRuntimeOperation,
|
|
364
|
+
beginInstallAttempt,
|
|
365
|
+
updateInstallAttempt,
|
|
366
|
+
attemptStillOwns,
|
|
367
|
+
reserveRuntimeUse,
|
|
368
|
+
runtimeUseState,
|
|
369
|
+
claimStagingDirectory,
|
|
370
|
+
sweepAbandonedStaging,
|
|
371
|
+
recoverInterruptedActivation,
|
|
372
|
+
PREVIOUS_SUFFIX,
|
|
373
|
+
RETIRING_PREFIX,
|
|
374
|
+
installRootKey,
|
|
375
|
+
retireVersionDirectory,
|
|
376
|
+
sweepRetired,
|
|
377
|
+
listOperationRecords,
|
|
378
|
+
forgetOperationRecord,
|
|
379
|
+
withRuntimeLifecycleLock
|
|
380
|
+
};
|
|
381
|
+
//# sourceMappingURL=chunk-7M3XVZCQ.js.map
|
|
@@ -46,6 +46,9 @@ var DEFAULT_CORS_ORIGINS = [
|
|
|
46
46
|
// Hono server
|
|
47
47
|
`http://127.0.0.1:${SERVER_PORT}`,
|
|
48
48
|
// Hono server production
|
|
49
|
+
`http://[::1]:${CLIENT_PORT}`,
|
|
50
|
+
// IPv6 loopback, same two ports
|
|
51
|
+
`http://[::1]:${SERVER_PORT}`,
|
|
49
52
|
"https://staging.mcpjam.com"
|
|
50
53
|
// Hosted deployment
|
|
51
54
|
];
|
|
@@ -112,43 +115,6 @@ function resolveSandboxIsolation(sandboxHosts = SANDBOX_HOSTS, hostedOrigin = MC
|
|
|
112
115
|
return sandboxHosts.has(appHost) ? "same-origin" : "ok";
|
|
113
116
|
}
|
|
114
117
|
|
|
115
|
-
// server/utils/local-capability.ts
|
|
116
|
-
import { createHash, randomBytes, timingSafeEqual } from "crypto";
|
|
117
|
-
import { mkdir, writeFile, rename, chmod } from "fs/promises";
|
|
118
|
-
import { dirname } from "path";
|
|
119
|
-
function mintCapabilityToken() {
|
|
120
|
-
return randomBytes(32).toString("base64url");
|
|
121
|
-
}
|
|
122
|
-
function capabilityFingerprint(token) {
|
|
123
|
-
return createHash("sha256").update(token, "utf8").digest("hex");
|
|
124
|
-
}
|
|
125
|
-
function capabilityMatches(token, hash) {
|
|
126
|
-
if (typeof token !== "string" || token.length < 16 || token.length > 256 || !/^[0-9a-f]{64}$/.test(hash))
|
|
127
|
-
return false;
|
|
128
|
-
return timingSafeEqual(
|
|
129
|
-
Buffer.from(capabilityFingerprint(token), "hex"),
|
|
130
|
-
Buffer.from(hash, "hex")
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
function createCapabilityMutationLock() {
|
|
134
|
-
let chain = Promise.resolve();
|
|
135
|
-
return function withLock(op) {
|
|
136
|
-
const run = chain.then(op, op);
|
|
137
|
-
chain = run.then(
|
|
138
|
-
() => void 0,
|
|
139
|
-
() => void 0
|
|
140
|
-
);
|
|
141
|
-
return run;
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
async function persistCapabilityState(file, state) {
|
|
145
|
-
await mkdir(dirname(file), { recursive: true, mode: 448 });
|
|
146
|
-
const tmp = `${file}.tmp`;
|
|
147
|
-
await writeFile(tmp, JSON.stringify(state), { mode: 384 });
|
|
148
|
-
await chmod(tmp, 384);
|
|
149
|
-
await rename(tmp, file);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
118
|
export {
|
|
153
119
|
WEB_CONNECT_TIMEOUT_MS,
|
|
154
120
|
WEB_CALL_TIMEOUT_MS,
|
|
@@ -195,11 +161,6 @@ export {
|
|
|
195
161
|
CANIUSE_LANDING_HOSTS,
|
|
196
162
|
SCORE_LANDING_HOSTS,
|
|
197
163
|
SANDBOX_HOSTS,
|
|
198
|
-
resolveSandboxIsolation
|
|
199
|
-
mintCapabilityToken,
|
|
200
|
-
capabilityFingerprint,
|
|
201
|
-
capabilityMatches,
|
|
202
|
-
createCapabilityMutationLock,
|
|
203
|
-
persistCapabilityState
|
|
164
|
+
resolveSandboxIsolation
|
|
204
165
|
};
|
|
205
|
-
//# sourceMappingURL=chunk-
|
|
166
|
+
//# sourceMappingURL=chunk-7ZIR7SX7.js.map
|