@introspection-ai/recipes 0.18.1 → 0.19.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/dist/inspect.d.ts +1 -0
- package/dist/inspect.d.ts.map +1 -1
- package/dist/inspect.js +3 -0
- package/dist/inspect.js.map +1 -1
- package/dist/mcp-chunks/{auth-command-ZLGYIEUY.js → auth-command-3K7V3VCW.js} +31 -35
- package/dist/mcp-chunks/call-arguments-TX3F2TEE.js +15 -0
- package/dist/mcp-chunks/{call-command-LKTKSYTH.js → call-command-OFPHPFM5.js} +36 -34
- package/dist/mcp-chunks/chunk-2FSDGCHW.js +3299 -0
- package/dist/mcp-chunks/{chunk-BV56DXPW.js → chunk-2JHHONW4.js} +1 -1
- package/dist/mcp-chunks/chunk-2MEHGB7D.js +63 -0
- package/dist/mcp-chunks/chunk-3IZQW4H4.js +929 -0
- package/dist/mcp-chunks/{chunk-MZ2NARG7.js → chunk-54EWGONA.js} +5 -5
- package/dist/mcp-chunks/{chunk-LQQEYD76.js → chunk-55JIHDU3.js} +1 -1
- package/dist/mcp-chunks/chunk-64EP2BVO.js +39 -0
- package/dist/mcp-chunks/{chunk-LS7PMWSR.js → chunk-6D6KPSXN.js} +1 -1
- package/dist/mcp-chunks/{chunk-2XL7MG7R.js → chunk-7A63PAGP.js} +15 -9
- package/dist/mcp-chunks/chunk-7DH57OKF.js +28 -0
- package/dist/mcp-chunks/{chunk-BTLAWHTA.js → chunk-7RDLPFIO.js} +2 -2
- package/dist/mcp-chunks/chunk-C2PQFLWS.js +422 -0
- package/dist/mcp-chunks/chunk-CA5WFJZA.js +197 -0
- package/dist/mcp-chunks/{chunk-LNH5LAJD.js → chunk-CNDY7WB4.js} +2 -2
- package/dist/mcp-chunks/{chunk-UKYNQGNE.js → chunk-DEUU7WSN.js} +34 -8
- package/dist/mcp-chunks/{chunk-LKIBAYKU.js → chunk-DXPHJFSA.js} +25 -35
- package/dist/mcp-chunks/{chunk-J6LYIZXN.js → chunk-E6RVTWJY.js} +1 -1
- package/dist/mcp-chunks/{chunk-7FHEBT5G.js → chunk-E6T37ED6.js} +18 -13
- package/dist/mcp-chunks/chunk-ETWN4IIA.js +57 -0
- package/dist/mcp-chunks/{chunk-YVZKMV5H.js → chunk-F3LL4EBL.js} +1 -1
- package/dist/mcp-chunks/chunk-FWP4RACK.js +42 -0
- package/dist/mcp-chunks/{chunk-6W5QFASN.js → chunk-GFYTST6N.js} +1 -1
- package/dist/mcp-chunks/{chunk-TEUKFFQL.js → chunk-GIF7LOYU.js} +2 -2
- package/dist/mcp-chunks/{chunk-QXJUA3ND.js → chunk-GSZOK5TS.js} +828 -7
- package/dist/mcp-chunks/chunk-H7F5RZXS.js +26 -0
- package/dist/mcp-chunks/{chunk-ECIVB7P4.js → chunk-HAO6PL7Z.js} +2 -37
- package/dist/mcp-chunks/{chunk-WQJZMCJN.js → chunk-HTZ2URXW.js} +5 -3
- package/dist/mcp-chunks/{chunk-BWHIA4PC.js → chunk-JAKI24KR.js} +1 -1
- package/dist/mcp-chunks/{chunk-PWYFKGKG.js → chunk-KSGYBW3F.js} +180 -89
- package/dist/mcp-chunks/{chunk-SJCCBNZ4.js → chunk-KSMY7PXI.js} +1 -1
- package/dist/mcp-chunks/{chunk-2U4BSDC4.js → chunk-L4VKBFYI.js} +48 -29
- package/dist/mcp-chunks/{chunk-LEZSACDE.js → chunk-LICH4Q7A.js} +4 -4
- package/dist/mcp-chunks/{chunk-PIIYJR44.js → chunk-LNSUME65.js} +29 -33
- package/dist/mcp-chunks/{chunk-D3MRAZ6H.js → chunk-LWVFSQYX.js} +13974 -15562
- package/dist/mcp-chunks/{chunk-7KA2VJVZ.js → chunk-NCXEJ35U.js} +10 -5
- package/dist/mcp-chunks/{chunk-5QOSCSQB.js → chunk-NZOIX6XW.js} +2 -2
- package/dist/mcp-chunks/{chunk-XANPGTLI.js → chunk-P3RN22HQ.js} +11 -4
- package/dist/mcp-chunks/{chunk-IABRYROW.js → chunk-PKOJCYNA.js} +3 -3
- package/dist/mcp-chunks/{chunk-BNV3TPE4.js → chunk-QJACOI2W.js} +5 -13
- package/dist/mcp-chunks/{chunk-UNKB4SBV.js → chunk-RBVYCKCD.js} +2 -2
- package/dist/mcp-chunks/{chunk-DHBE7UBH.js → chunk-SB2UUURE.js} +12 -42
- package/dist/mcp-chunks/{chunk-4SQKWYFF.js → chunk-SFREPU3D.js} +1 -1
- package/dist/mcp-chunks/{chunk-BZIQOWE6.js → chunk-SRZZQ6TL.js} +35 -36
- package/dist/mcp-chunks/{chunk-M3TPODXI.js → chunk-UENXT3NE.js} +1 -1
- package/dist/mcp-chunks/chunk-UHOKCTZT.js +37 -0
- package/dist/mcp-chunks/{chunk-E22DYOW5.js → chunk-WWO5WGH5.js} +5 -5
- package/dist/mcp-chunks/{chunk-6XCZGU3G.js → chunk-WXBPMFSN.js} +149 -192
- package/dist/mcp-chunks/{chunk-XQK2JSW4.js → chunk-XRGLP3Z2.js} +14 -2
- package/dist/mcp-chunks/{chunk-L7NTQVYN.js → chunk-XTL4MHFH.js} +28 -10
- package/dist/mcp-chunks/{chunk-N46NEFAF.js → chunk-XUF6KARU.js} +1 -1
- package/dist/mcp-chunks/{chunk-WD6BOD24.js → chunk-YCYSQA5V.js} +23 -4
- package/dist/mcp-chunks/chunk-YPJ5EHXR.js +17394 -0
- package/dist/mcp-chunks/{chunk-NRAJX5E4.js → chunk-YSPT6F7K.js} +3 -3
- package/dist/mcp-chunks/{chunk-7UDVSOOF.js → chunk-YTKRAHO6.js} +54 -46
- package/dist/mcp-chunks/chunk-ZBFZ5UFE.js +67 -0
- package/dist/mcp-chunks/{cli-UV4QJZZM.js → cli-E4P6SZLQ.js} +89 -76
- package/dist/mcp-chunks/client-2EJC4PLL.js +18 -0
- package/dist/mcp-chunks/{config-command-NLAGKID5.js → config-command-MWF3RHPQ.js} +38 -59
- package/dist/mcp-chunks/daemon-command-6CJ26MKI.js +33 -0
- package/dist/mcp-chunks/{dist-LK3SHAMX.js → dist-ZIPUENTM.js} +527 -469
- package/dist/mcp-chunks/{emit-ts-command-VBXVXO6V.js → emit-ts-command-GOVJJ64A.js} +16 -13
- package/dist/mcp-chunks/{generate-cli-runner-6CAZZA3P.js → generate-cli-runner-L5OQIMEY.js} +242 -247
- package/dist/mcp-chunks/{inspect-cli-command-3ZORTOR7.js → inspect-cli-command-7OMMREPE.js} +10 -9
- package/dist/mcp-chunks/{launch-YKRXHXJI.js → launch-BWXPLPB7.js} +1 -1
- package/dist/mcp-chunks/{lifecycle-XVKRHPH3.js → lifecycle-B5UC65PT.js} +1 -1
- package/dist/mcp-chunks/{list-command-2MEGGNFQ.js → list-command-ZO4HVFQK.js} +74 -43
- package/dist/mcp-chunks/{output-utils-NKESLAJ6.js → output-utils-M3TJ2N4M.js} +3 -3
- package/dist/mcp-chunks/{prompt-B1Yc1NPt-VGOTWJMN.js → prompt-CH6TK0bC-C7OTKGRD.js} +1 -3
- package/dist/mcp-chunks/{record-command-YXHTTTT5.js → record-command-VD3HUQIC.js} +5 -4
- package/dist/mcp-chunks/replay-command-AX6IN7YD.js +42 -0
- package/dist/mcp-chunks/{resource-command-OO4NYF5C.js → resource-command-JEZ2DW2G.js} +10 -10
- package/dist/mcp-chunks/{result-utils-MOHHLNM7.js → result-utils-3YHYGS45.js} +4 -4
- package/dist/mcp-chunks/runtime-HSYVOME7.js +37 -0
- package/dist/mcp-chunks/{runtime-wrapper-RPWDIDBF.js → runtime-wrapper-UREU7GC3.js} +7 -3
- package/dist/mcp-chunks/serve-command-M47YZ6JN.js +16018 -0
- package/dist/mcp-chunks/{timeouts-W2XWCCXR.js → timeouts-THZRYP4B.js} +3 -1
- package/dist/mcp-chunks/{vault-command-PIYIUEZL.js → vault-command-53P7MLCB.js} +7 -6
- package/dist/mcp-chunks/webapi-PHEQZQKH.js +3316 -0
- package/dist/mcp-client.js +11 -1
- package/dist/mcp-client.js.map +1 -1
- package/dist/mcp-daemon-client.d.ts.map +1 -1
- package/dist/mcp-daemon-client.js +3 -0
- package/dist/mcp-daemon-client.js.map +1 -1
- package/dist/mcp-daemon-protocol.d.ts +6 -0
- package/dist/mcp-daemon-protocol.d.ts.map +1 -1
- package/dist/mcp-daemon-protocol.js.map +1 -1
- package/dist/mcp-daemon.js +43 -22
- package/dist/mcp-daemon.js.map +1 -1
- package/dist/mcp-run-worker.js +29 -22
- package/dist/mcp-trace-context.d.ts +6 -0
- package/dist/mcp-trace-context.d.ts.map +1 -0
- package/dist/mcp-trace-context.js +31 -0
- package/dist/mcp-trace-context.js.map +1 -0
- package/dist/model-binding.d.ts.map +1 -1
- package/dist/model-binding.js +8 -4
- package/dist/model-binding.js.map +1 -1
- package/dist/pi-extension.d.ts.map +1 -1
- package/dist/pi-extension.js +12 -0
- package/dist/pi-extension.js.map +1 -1
- package/dist/recipe/resolve.d.ts +2 -0
- package/dist/recipe/resolve.d.ts.map +1 -1
- package/dist/recipe/resolve.js +2 -1
- package/dist/recipe/resolve.js.map +1 -1
- package/dist/recipe-agent.d.ts +5 -2
- package/dist/recipe-agent.d.ts.map +1 -1
- package/dist/recipe-agent.js +20 -4
- package/dist/recipe-agent.js.map +1 -1
- package/dist/recipe-model.d.ts +7 -1
- package/dist/recipe-model.d.ts.map +1 -1
- package/dist/recipe-model.js +89 -20
- package/dist/recipe-model.js.map +1 -1
- package/dist/recipe-session.d.ts +14 -0
- package/dist/recipe-session.d.ts.map +1 -0
- package/dist/recipe-session.js +181 -0
- package/dist/recipe-session.js.map +1 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +23 -1
- package/dist/session.js.map +1 -1
- package/docs/agent-composition.md +46 -22
- package/docs/pi-extension.md +9 -3
- package/docs/recipe-format.md +41 -5
- package/package.json +6 -6
- package/vendor/introspection-recipe-check/darwin-arm64/introspection-recipe-check +0 -0
- package/vendor/introspection-recipe-check/darwin-x64/introspection-recipe-check +0 -0
- package/vendor/introspection-recipe-check/linux-arm64/introspection-recipe-check +0 -0
- package/vendor/introspection-recipe-check/linux-x64/introspection-recipe-check +0 -0
- package/vendor/introspection-recipe-check/linux-x64-musl/introspection-recipe-check +0 -0
- package/vendor/introspection-recipe-check/win32-x64/introspection-recipe-check.exe +0 -0
- package/dist/mcp-chunks/call-arguments-LU3W6D3K.js +0 -13
- package/dist/mcp-chunks/chunk-HKRJ6O36.js +0 -1076
- package/dist/mcp-chunks/chunk-NNOEGEUZ.js +0 -17273
- package/dist/mcp-chunks/chunk-P3PSC54P.js +0 -869
- package/dist/mcp-chunks/chunk-TATVT5IT.js +0 -194
- package/dist/mcp-chunks/chunk-YHQUTU6L.js +0 -571
- package/dist/mcp-chunks/client-S7RQUG5U.js +0 -13
- package/dist/mcp-chunks/daemon-command-U242Z6VY.js +0 -26
- package/dist/mcp-chunks/replay-command-25HJ6AQU.js +0 -85
- package/dist/mcp-chunks/runtime-5WJ3G25Y.js +0 -33
- package/dist/mcp-chunks/serve-command-DHXJZMMN.js +0 -3302
|
@@ -1,105 +1,89 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
configureAutoSelectFamilyAttemptTimeout
|
|
4
|
+
} from "./chunk-64EP2BVO.js";
|
|
5
|
+
import {
|
|
6
|
+
stableJsonStringify
|
|
7
|
+
} from "./chunk-UHOKCTZT.js";
|
|
2
8
|
import {
|
|
3
9
|
createRuntime
|
|
4
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-2FSDGCHW.js";
|
|
11
|
+
import {
|
|
12
|
+
NON_INTERACTIVE_ELICITATION_HINT,
|
|
13
|
+
createNonInteractiveElicitationResponder
|
|
14
|
+
} from "./chunk-CA5WFJZA.js";
|
|
5
15
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "./chunk-
|
|
16
|
+
OAuthTimeoutError,
|
|
17
|
+
resolveOAuthTimeoutFromEnv
|
|
18
|
+
} from "./chunk-SRZZQ6TL.js";
|
|
19
|
+
import {
|
|
20
|
+
raceWithTimeout
|
|
21
|
+
} from "./chunk-ETWN4IIA.js";
|
|
22
|
+
import {
|
|
23
|
+
DEFAULT_REQUEST_TIMEOUT_MSEC,
|
|
24
|
+
SdkErrorCode
|
|
25
|
+
} from "./chunk-YPJ5EHXR.js";
|
|
9
26
|
import {
|
|
10
27
|
launchDaemonDetached
|
|
11
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-YSPT6F7K.js";
|
|
12
29
|
import {
|
|
13
30
|
DaemonClient,
|
|
31
|
+
buildErrorResponse,
|
|
32
|
+
collectConfigLayers,
|
|
33
|
+
daemonIdleWatcherInterval,
|
|
34
|
+
delay,
|
|
35
|
+
ensureManaged,
|
|
36
|
+
evictIdleServers,
|
|
14
37
|
getDaemonLogPath,
|
|
15
|
-
|
|
16
|
-
|
|
38
|
+
markActivity,
|
|
39
|
+
normalizeConfigLayers,
|
|
40
|
+
resolveDaemonPaths,
|
|
41
|
+
shouldShutdownDaemonForIdle,
|
|
42
|
+
statConfigMtime
|
|
43
|
+
} from "./chunk-KSGYBW3F.js";
|
|
44
|
+
import {
|
|
45
|
+
DAEMON_OPERATION_TIMEOUT_CODE,
|
|
46
|
+
DAEMON_PROGRESS_INTERVAL_MS,
|
|
47
|
+
DAEMON_PROTOCOL_VERSION,
|
|
48
|
+
encodeDaemonFrame
|
|
49
|
+
} from "./chunk-ZBFZ5UFE.js";
|
|
17
50
|
import {
|
|
51
|
+
loadConfigSnapshot
|
|
52
|
+
} from "./chunk-L4VKBFYI.js";
|
|
53
|
+
import {
|
|
54
|
+
isProcessRunning,
|
|
18
55
|
readJsonFile,
|
|
19
56
|
withFileLock,
|
|
20
57
|
writeJsonFile
|
|
21
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-7A63PAGP.js";
|
|
22
59
|
import {
|
|
23
60
|
expandHome
|
|
24
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-HAO6PL7Z.js";
|
|
25
62
|
import {
|
|
26
|
-
isKeepAliveServer
|
|
27
|
-
|
|
28
|
-
} from "./chunk-LS7PMWSR.js";
|
|
63
|
+
isKeepAliveServer
|
|
64
|
+
} from "./chunk-6D6KPSXN.js";
|
|
29
65
|
|
|
30
|
-
// node_modules/.pnpm/mcporter@0.
|
|
66
|
+
// node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/daemon-command.js
|
|
31
67
|
import fsPromises from "node:fs/promises";
|
|
32
|
-
import path4 from "node:path";
|
|
33
|
-
|
|
34
|
-
// node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/daemon/host.js
|
|
35
|
-
import { randomUUID } from "node:crypto";
|
|
36
|
-
import fs2 from "node:fs/promises";
|
|
37
|
-
import net from "node:net";
|
|
38
68
|
import path3 from "node:path";
|
|
39
69
|
|
|
40
|
-
// node_modules/.pnpm/mcporter@0.
|
|
70
|
+
// node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/daemon/host.js
|
|
71
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
72
|
+
import { randomUUID } from "node:crypto";
|
|
41
73
|
import fs from "node:fs/promises";
|
|
42
|
-
import
|
|
43
|
-
|
|
44
|
-
try {
|
|
45
|
-
const stats = await fs.stat(configPath);
|
|
46
|
-
return stats.mtimeMs;
|
|
47
|
-
} catch {
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
async function collectConfigLayers(options) {
|
|
52
|
-
const layerPaths = await listConfigLayerPaths(options, options.rootDir ?? process.cwd());
|
|
53
|
-
const entries = [];
|
|
54
|
-
for (const layerPath of layerPaths) {
|
|
55
|
-
entries.push({ path: layerPath, mtimeMs: await statConfigMtime(layerPath) });
|
|
56
|
-
}
|
|
57
|
-
if (entries.length === 0 && options.configPath) {
|
|
58
|
-
entries.push({ path: path.resolve(options.configPath), mtimeMs: await statConfigMtime(options.configPath) });
|
|
59
|
-
}
|
|
60
|
-
return entries;
|
|
61
|
-
}
|
|
74
|
+
import net from "node:net";
|
|
75
|
+
import path2 from "node:path";
|
|
62
76
|
|
|
63
|
-
// node_modules/.pnpm/mcporter@0.
|
|
77
|
+
// node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/daemon/definition-hash.js
|
|
64
78
|
import { createHash } from "node:crypto";
|
|
65
79
|
function hashDaemonDefinitions(definitions) {
|
|
66
80
|
const sorted = definitions.toSorted((a, b) => a.name.localeCompare(b.name));
|
|
67
81
|
return createHash("sha256").update(stableJsonStringify(sorted)).digest("hex").slice(0, 16);
|
|
68
82
|
}
|
|
69
|
-
function stableJsonStringify(value) {
|
|
70
|
-
const json = JSON.stringify(sortJsonValue(value));
|
|
71
|
-
if (json === void 0) {
|
|
72
|
-
throw new TypeError("Cannot serialize unsupported JSON root value.");
|
|
73
|
-
}
|
|
74
|
-
return json;
|
|
75
|
-
}
|
|
76
|
-
function sortJsonValue(value) {
|
|
77
|
-
if (Array.isArray(value)) {
|
|
78
|
-
return value.map((entry) => sortJsonValue(entry));
|
|
79
|
-
}
|
|
80
|
-
if (!isPlainObject(value)) {
|
|
81
|
-
return value;
|
|
82
|
-
}
|
|
83
|
-
const result = {};
|
|
84
|
-
for (const key of Object.keys(value).toSorted()) {
|
|
85
|
-
const entry = value[key];
|
|
86
|
-
if (entry !== void 0) {
|
|
87
|
-
result[key] = sortJsonValue(entry);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return result;
|
|
91
|
-
}
|
|
92
|
-
function isPlainObject(value) {
|
|
93
|
-
if (!value || typeof value !== "object") {
|
|
94
|
-
return false;
|
|
95
|
-
}
|
|
96
|
-
const prototype = Object.getPrototypeOf(value);
|
|
97
|
-
return prototype === Object.prototype || prototype === null;
|
|
98
|
-
}
|
|
99
83
|
|
|
100
|
-
// node_modules/.pnpm/mcporter@0.
|
|
84
|
+
// node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/daemon/log-context.js
|
|
101
85
|
import fsSync from "node:fs";
|
|
102
|
-
import
|
|
86
|
+
import path from "node:path";
|
|
103
87
|
function createLogContext(options) {
|
|
104
88
|
const derivedEnabled = options.enabled || options.logAllServers || options.servers.size > 0;
|
|
105
89
|
const context = {
|
|
@@ -109,7 +93,7 @@ function createLogContext(options) {
|
|
|
109
93
|
};
|
|
110
94
|
if (derivedEnabled && options.logPath) {
|
|
111
95
|
try {
|
|
112
|
-
fsSync.mkdirSync(
|
|
96
|
+
fsSync.mkdirSync(path.dirname(options.logPath), { recursive: true });
|
|
113
97
|
context.writer = fsSync.createWriteStream(options.logPath, {
|
|
114
98
|
flags: "a"
|
|
115
99
|
});
|
|
@@ -160,80 +144,19 @@ function formatError(error) {
|
|
|
160
144
|
return "unknown";
|
|
161
145
|
}
|
|
162
146
|
|
|
163
|
-
// node_modules/.pnpm/mcporter@0.
|
|
164
|
-
|
|
165
|
-
if (!managedServers.has(server)) {
|
|
166
|
-
throw new Error(`Server '${server}' is not managed by the daemon.`);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
function markActivity(server, activity) {
|
|
170
|
-
const entry = activity.get(server);
|
|
171
|
-
if (entry) {
|
|
172
|
-
entry.connected = true;
|
|
173
|
-
entry.lastUsedAt = Date.now();
|
|
174
|
-
} else {
|
|
175
|
-
activity.set(server, { connected: true, lastUsedAt: Date.now() });
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
async function evictIdleServers(runtime, managedServers, activity) {
|
|
179
|
-
const now = Date.now();
|
|
180
|
-
await Promise.all(Array.from(managedServers.entries()).map(async ([name, definition]) => {
|
|
181
|
-
const timeout = keepAliveIdleTimeout(definition);
|
|
182
|
-
if (!timeout) {
|
|
183
|
-
return;
|
|
184
|
-
}
|
|
185
|
-
const entry = activity.get(name);
|
|
186
|
-
if (!entry?.lastUsedAt) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
if (now - entry.lastUsedAt < timeout) {
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
await runtime.close(name).catch(() => {
|
|
193
|
-
});
|
|
194
|
-
activity.set(name, { connected: false });
|
|
195
|
-
}));
|
|
196
|
-
}
|
|
197
|
-
function shouldShutdownDaemonForIdle(lastActivityAt, now, idleTimeoutMs, activeRequests = 0) {
|
|
198
|
-
return activeRequests <= 0 && typeof idleTimeoutMs === "number" && idleTimeoutMs > 0 && now - lastActivityAt >= idleTimeoutMs;
|
|
199
|
-
}
|
|
200
|
-
function daemonIdleWatcherInterval(idleTimeoutMs) {
|
|
201
|
-
if (!idleTimeoutMs) {
|
|
202
|
-
return 3e4;
|
|
203
|
-
}
|
|
204
|
-
return Math.min(3e4, Math.max(100, Math.floor(idleTimeoutMs / 2)));
|
|
205
|
-
}
|
|
206
|
-
function buildErrorResponse(id, code, error) {
|
|
207
|
-
let message = code;
|
|
208
|
-
if (error instanceof Error) {
|
|
209
|
-
message = error.message;
|
|
210
|
-
} else if (typeof error === "string") {
|
|
211
|
-
message = error;
|
|
212
|
-
}
|
|
213
|
-
return {
|
|
214
|
-
id,
|
|
215
|
-
ok: false,
|
|
216
|
-
error: {
|
|
217
|
-
code,
|
|
218
|
-
message
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
// node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/daemon/host.js
|
|
147
|
+
// node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/daemon/host.js
|
|
148
|
+
var daemonRequestNotices = new AsyncLocalStorage();
|
|
224
149
|
async function runDaemonHost(options) {
|
|
150
|
+
configureAutoSelectFamilyAttemptTimeout();
|
|
225
151
|
const configLayers = await collectConfigLayers({
|
|
226
152
|
configPath: options.configExplicit ? options.configPath : void 0,
|
|
227
153
|
rootDir: options.rootDir
|
|
228
154
|
});
|
|
229
|
-
const
|
|
230
|
-
configPath: options.configExplicit ? options.configPath : void 0,
|
|
231
|
-
rootDir: options.rootDir
|
|
232
|
-
});
|
|
233
|
-
const runtime = await createRuntime({
|
|
155
|
+
const startup = await loadDaemonRuntimeState({
|
|
234
156
|
configPath: options.configExplicit ? options.configPath : void 0,
|
|
235
157
|
rootDir: options.rootDir
|
|
236
158
|
});
|
|
159
|
+
const { daemonConfig, runtime } = startup;
|
|
237
160
|
const keepAliveDefinitions = runtime.getDefinitions().filter(isKeepAliveServer);
|
|
238
161
|
const definitionHash = hashDaemonDefinitions(keepAliveDefinitions);
|
|
239
162
|
if (keepAliveDefinitions.length === 0) {
|
|
@@ -259,7 +182,7 @@ async function runDaemonHost(options) {
|
|
|
259
182
|
servers: combinedServerLogs,
|
|
260
183
|
logPath: options.logPath
|
|
261
184
|
});
|
|
262
|
-
await
|
|
185
|
+
await fs.mkdir(path2.dirname(options.metadataPath), { recursive: true });
|
|
263
186
|
const configMtimeMs = await statConfigMtime(options.configPath);
|
|
264
187
|
const activity = /* @__PURE__ */ new Map();
|
|
265
188
|
for (const definition of keepAliveDefinitions) {
|
|
@@ -323,6 +246,7 @@ async function runDaemonHost(options) {
|
|
|
323
246
|
configPath: options.configPath,
|
|
324
247
|
configLayers,
|
|
325
248
|
socketPath: options.socketPath,
|
|
249
|
+
protocolVersion: DAEMON_PROTOCOL_VERSION,
|
|
326
250
|
startedAt,
|
|
327
251
|
logPath: options.logPath ?? null,
|
|
328
252
|
configMtimeMs,
|
|
@@ -367,6 +291,7 @@ async function runDaemonHost(options) {
|
|
|
367
291
|
});
|
|
368
292
|
await writeJsonFile(options.metadataPath, {
|
|
369
293
|
pid: process.pid,
|
|
294
|
+
protocolVersion: DAEMON_PROTOCOL_VERSION,
|
|
370
295
|
socketPath: options.socketPath,
|
|
371
296
|
configPath: options.configPath,
|
|
372
297
|
configLayers,
|
|
@@ -390,10 +315,20 @@ async function runDaemonHost(options) {
|
|
|
390
315
|
process.once("SIGTERM", shutdown);
|
|
391
316
|
process.once("SIGQUIT", shutdown);
|
|
392
317
|
}
|
|
318
|
+
async function loadDaemonRuntimeState(options) {
|
|
319
|
+
const snapshot = await loadConfigSnapshot(options);
|
|
320
|
+
const elicitation = createNonInteractiveElicitationResponder({
|
|
321
|
+
onDecline: () => daemonRequestNotices.getStore()?.add(NON_INTERACTIVE_ELICITATION_HINT)
|
|
322
|
+
});
|
|
323
|
+
return {
|
|
324
|
+
daemonConfig: snapshot.daemon,
|
|
325
|
+
runtime: await createRuntime({ servers: snapshot.servers, elicitationHandler: elicitation.handler })
|
|
326
|
+
};
|
|
327
|
+
}
|
|
393
328
|
var DAEMON_PROBE_TIMEOUT_MS = 2e3;
|
|
394
329
|
async function probeLiveDaemon(socketPath) {
|
|
395
330
|
const status = await probeDaemonStatus(socketPath);
|
|
396
|
-
if (!status || status.socketPath !== socketPath || !
|
|
331
|
+
if (!status || status.socketPath !== socketPath || !isProcessRunning(status.pid)) {
|
|
397
332
|
return null;
|
|
398
333
|
}
|
|
399
334
|
return status;
|
|
@@ -409,6 +344,7 @@ async function metadataMatches(metadataPath, live) {
|
|
|
409
344
|
function metadataFromStatus(status, fallbackConfigLayers) {
|
|
410
345
|
return {
|
|
411
346
|
pid: status.pid,
|
|
347
|
+
protocolVersion: status.protocolVersion,
|
|
412
348
|
socketPath: status.socketPath,
|
|
413
349
|
configPath: status.configPath,
|
|
414
350
|
configLayers: status.configLayers && status.configLayers.length > 0 ? status.configLayers : fallbackConfigLayers,
|
|
@@ -422,8 +358,8 @@ function daemonConfigMatches(live, currentLayers, currentConfigPath, currentConf
|
|
|
422
358
|
if (live.definitionHash !== currentDefinitionHash) {
|
|
423
359
|
return false;
|
|
424
360
|
}
|
|
425
|
-
const liveLayers =
|
|
426
|
-
const expectedLayers =
|
|
361
|
+
const liveLayers = normalizeConfigLayers(live.configLayers && live.configLayers.length > 0 ? live.configLayers : [{ path: live.configPath, mtimeMs: live.configMtimeMs ?? null }]);
|
|
362
|
+
const expectedLayers = normalizeConfigLayers(currentLayers.length > 0 ? currentLayers : [{ path: currentConfigPath, mtimeMs: currentConfigMtimeMs }]);
|
|
427
363
|
if (liveLayers.length !== expectedLayers.length) {
|
|
428
364
|
return false;
|
|
429
365
|
}
|
|
@@ -432,16 +368,6 @@ function daemonConfigMatches(live, currentLayers, currentConfigPath, currentConf
|
|
|
432
368
|
return Boolean(expected && entry.path === expected.path && entry.mtimeMs === expected.mtimeMs);
|
|
433
369
|
});
|
|
434
370
|
}
|
|
435
|
-
function normalizeLayers(layers) {
|
|
436
|
-
const normalized = layers.map((entry) => ({
|
|
437
|
-
path: path3.isAbsolute(entry.path) ? entry.path : path3.resolve(entry.path),
|
|
438
|
-
mtimeMs: entry.mtimeMs ?? null
|
|
439
|
-
}));
|
|
440
|
-
if (normalized.length < 2) {
|
|
441
|
-
return normalized;
|
|
442
|
-
}
|
|
443
|
-
return normalized.toSorted((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
444
|
-
}
|
|
445
371
|
async function stopLiveDaemon(socketPath, livePid) {
|
|
446
372
|
const stopped = await sendDaemonStop(socketPath);
|
|
447
373
|
if (!stopped) {
|
|
@@ -449,7 +375,7 @@ async function stopLiveDaemon(socketPath, livePid) {
|
|
|
449
375
|
}
|
|
450
376
|
const deadline = Date.now() + 5e3;
|
|
451
377
|
while (Date.now() < deadline) {
|
|
452
|
-
if (!
|
|
378
|
+
if (!isProcessRunning(livePid)) {
|
|
453
379
|
return;
|
|
454
380
|
}
|
|
455
381
|
await delay(100);
|
|
@@ -493,22 +419,6 @@ async function sendDaemonStop(socketPath) {
|
|
|
493
419
|
socket.once("error", () => finish(false));
|
|
494
420
|
});
|
|
495
421
|
}
|
|
496
|
-
function delay(ms) {
|
|
497
|
-
return new Promise((resolve) => {
|
|
498
|
-
setTimeout(resolve, ms);
|
|
499
|
-
});
|
|
500
|
-
}
|
|
501
|
-
function isProcessAlive(pid) {
|
|
502
|
-
if (!Number.isInteger(pid) || pid <= 0) {
|
|
503
|
-
return false;
|
|
504
|
-
}
|
|
505
|
-
try {
|
|
506
|
-
process.kill(pid, 0);
|
|
507
|
-
return true;
|
|
508
|
-
} catch (error) {
|
|
509
|
-
return error.code === "EPERM";
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
422
|
async function probeDaemonStatus(socketPath) {
|
|
513
423
|
return await new Promise((resolve) => {
|
|
514
424
|
const probe = net.createConnection(socketPath);
|
|
@@ -551,13 +461,13 @@ async function prepareSocket(socketPath) {
|
|
|
551
461
|
return;
|
|
552
462
|
}
|
|
553
463
|
try {
|
|
554
|
-
await
|
|
464
|
+
await fs.unlink(socketPath);
|
|
555
465
|
} catch (error) {
|
|
556
466
|
if (error.code !== "ENOENT") {
|
|
557
467
|
throw error;
|
|
558
468
|
}
|
|
559
469
|
}
|
|
560
|
-
await
|
|
470
|
+
await fs.mkdir(path2.dirname(socketPath), { recursive: true });
|
|
561
471
|
}
|
|
562
472
|
async function cleanupArtifacts(options) {
|
|
563
473
|
await cleanupDaemonArtifactsIfOwned(options, process.pid);
|
|
@@ -568,15 +478,22 @@ async function cleanupDaemonArtifactsIfOwned(paths, ownerPid) {
|
|
|
568
478
|
return;
|
|
569
479
|
}
|
|
570
480
|
if (process.platform !== "win32") {
|
|
571
|
-
await
|
|
481
|
+
await fs.unlink(paths.socketPath).catch(() => {
|
|
572
482
|
});
|
|
573
483
|
}
|
|
574
|
-
await
|
|
484
|
+
await fs.unlink(paths.metadataPath).catch(() => {
|
|
575
485
|
});
|
|
576
486
|
}
|
|
577
487
|
async function handleSocketRequest(rawPayload, socket, runtime, managedServers, activity, metadata, logContext, shutdown, preParsedRequest) {
|
|
578
|
-
const
|
|
579
|
-
|
|
488
|
+
const stopProgress = startProgressFrames(socket, preParsedRequest);
|
|
489
|
+
let response;
|
|
490
|
+
let shouldShutdown;
|
|
491
|
+
try {
|
|
492
|
+
({ response, shouldShutdown } = await processRequestWithNotices(rawPayload, runtime, managedServers, activity, metadata, logContext, preParsedRequest));
|
|
493
|
+
} finally {
|
|
494
|
+
stopProgress();
|
|
495
|
+
}
|
|
496
|
+
socket.write(encodeDaemonFrame(response), () => {
|
|
580
497
|
socket.end(() => {
|
|
581
498
|
if (shouldShutdown) {
|
|
582
499
|
void shutdown();
|
|
@@ -584,9 +501,47 @@ async function handleSocketRequest(rawPayload, socket, runtime, managedServers,
|
|
|
584
501
|
});
|
|
585
502
|
});
|
|
586
503
|
}
|
|
504
|
+
function startProgressFrames(socket, request) {
|
|
505
|
+
if (request?.protocolVersion !== DAEMON_PROTOCOL_VERSION || typeof request.progressIntervalMs !== "number" || !Number.isFinite(request.progressIntervalMs) || request.progressIntervalMs <= 0) {
|
|
506
|
+
return () => {
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
const intervalMs = Math.min(request.progressIntervalMs, DAEMON_PROGRESS_INTERVAL_MS);
|
|
510
|
+
const emit = () => {
|
|
511
|
+
if (!socket.destroyed && !socket.writableEnded) {
|
|
512
|
+
socket.write(encodeDaemonFrame({ type: "progress", id: request.id }));
|
|
513
|
+
}
|
|
514
|
+
};
|
|
515
|
+
emit();
|
|
516
|
+
const timer = setInterval(emit, intervalMs);
|
|
517
|
+
timer.unref();
|
|
518
|
+
return () => clearInterval(timer);
|
|
519
|
+
}
|
|
587
520
|
function normalizeDaemonDisableOAuth(value) {
|
|
588
521
|
return value === true;
|
|
589
522
|
}
|
|
523
|
+
function operationCeilingMs(requestTimeoutMs) {
|
|
524
|
+
const requestPhase = typeof requestTimeoutMs === "number" && Number.isFinite(requestTimeoutMs) && requestTimeoutMs > 0 ? requestTimeoutMs : DEFAULT_REQUEST_TIMEOUT_MSEC;
|
|
525
|
+
return resolveOAuthTimeoutFromEnv() + requestPhase;
|
|
526
|
+
}
|
|
527
|
+
function daemonRuntimeErrorCode(error) {
|
|
528
|
+
const errorCode = error && typeof error === "object" ? error.code : void 0;
|
|
529
|
+
if (error instanceof OAuthTimeoutError || errorCode === SdkErrorCode.RequestTimeout || error instanceof Error && error.message === "Timeout") {
|
|
530
|
+
return DAEMON_OPERATION_TIMEOUT_CODE;
|
|
531
|
+
}
|
|
532
|
+
return "runtime_error";
|
|
533
|
+
}
|
|
534
|
+
async function processRequestWithNotices(...args) {
|
|
535
|
+
const notices = /* @__PURE__ */ new Set();
|
|
536
|
+
const processed = await daemonRequestNotices.run(notices, () => processRequest(...args));
|
|
537
|
+
if (notices.size === 0) {
|
|
538
|
+
return processed;
|
|
539
|
+
}
|
|
540
|
+
return {
|
|
541
|
+
...processed,
|
|
542
|
+
response: { ...processed.response, notices: [...notices] }
|
|
543
|
+
};
|
|
544
|
+
}
|
|
590
545
|
async function processRequest(rawPayload, runtime, managedServers, activity, metadata, logContext, preParsedRequest) {
|
|
591
546
|
const trimmed = rawPayload.trim();
|
|
592
547
|
if (!trimmed && !preParsedRequest) {
|
|
@@ -619,11 +574,11 @@ async function processRequest(rawPayload, runtime, managedServers, activity, met
|
|
|
619
574
|
logEvent(logContext, `callTool start server=${params.server} tool=${params.tool}`);
|
|
620
575
|
}
|
|
621
576
|
try {
|
|
622
|
-
const result = await runtime.callTool(params.server, params.tool, {
|
|
577
|
+
const result = await raceWithTimeout(runtime.callTool(params.server, params.tool, {
|
|
623
578
|
args: params.args ?? {},
|
|
624
579
|
timeoutMs: params.timeoutMs,
|
|
625
580
|
disableOAuth: normalizeDaemonDisableOAuth(params.disableOAuth)
|
|
626
|
-
});
|
|
581
|
+
}), operationCeilingMs(params.timeoutMs));
|
|
627
582
|
markActivity(params.server, activity);
|
|
628
583
|
if (loggable) {
|
|
629
584
|
logEvent(logContext, `callTool success server=${params.server} tool=${params.tool}`);
|
|
@@ -646,12 +601,13 @@ async function processRequest(rawPayload, runtime, managedServers, activity, met
|
|
|
646
601
|
logEvent(logContext, `listTools start server=${params.server}`);
|
|
647
602
|
}
|
|
648
603
|
try {
|
|
649
|
-
const result = await runtime.listTools(params.server, {
|
|
604
|
+
const result = await raceWithTimeout(runtime.listTools(params.server, {
|
|
650
605
|
includeSchema: params.includeSchema,
|
|
651
606
|
autoAuthorize: resolveDaemonListToolsAutoAuthorize(params, definition),
|
|
652
607
|
allowCachedAuth: params.allowCachedAuth ?? true,
|
|
653
|
-
disableOAuth: normalizeDaemonDisableOAuth(params.disableOAuth)
|
|
654
|
-
|
|
608
|
+
disableOAuth: normalizeDaemonDisableOAuth(params.disableOAuth),
|
|
609
|
+
timeoutMs: params.timeoutMs
|
|
610
|
+
}), operationCeilingMs(params.timeoutMs));
|
|
655
611
|
markActivity(params.server, activity);
|
|
656
612
|
if (loggable) {
|
|
657
613
|
logEvent(logContext, `listTools success server=${params.server}`);
|
|
@@ -673,11 +629,11 @@ async function processRequest(rawPayload, runtime, managedServers, activity, met
|
|
|
673
629
|
logEvent(logContext, `listResources start server=${params.server}`);
|
|
674
630
|
}
|
|
675
631
|
try {
|
|
676
|
-
const result = await runtime.listResources(params.server, {
|
|
632
|
+
const result = await raceWithTimeout(runtime.listResources(params.server, {
|
|
677
633
|
...params.params,
|
|
678
634
|
allowCachedAuth: params.allowCachedAuth,
|
|
679
635
|
disableOAuth: normalizeDaemonDisableOAuth(params.disableOAuth)
|
|
680
|
-
});
|
|
636
|
+
}), operationCeilingMs());
|
|
681
637
|
markActivity(params.server, activity);
|
|
682
638
|
if (loggable) {
|
|
683
639
|
logEvent(logContext, `listResources success server=${params.server}`);
|
|
@@ -699,10 +655,10 @@ async function processRequest(rawPayload, runtime, managedServers, activity, met
|
|
|
699
655
|
logEvent(logContext, `readResource start server=${params.server} uri=${params.uri}`);
|
|
700
656
|
}
|
|
701
657
|
try {
|
|
702
|
-
const result = await runtime.readResource(params.server, params.uri, {
|
|
658
|
+
const result = await raceWithTimeout(runtime.readResource(params.server, params.uri, {
|
|
703
659
|
allowCachedAuth: params.allowCachedAuth,
|
|
704
660
|
disableOAuth: normalizeDaemonDisableOAuth(params.disableOAuth)
|
|
705
|
-
});
|
|
661
|
+
}), operationCeilingMs());
|
|
706
662
|
markActivity(params.server, activity);
|
|
707
663
|
if (loggable) {
|
|
708
664
|
logEvent(logContext, `readResource success server=${params.server}`);
|
|
@@ -724,7 +680,7 @@ async function processRequest(rawPayload, runtime, managedServers, activity, met
|
|
|
724
680
|
logEvent(logContext, `closeServer start server=${params.server}`);
|
|
725
681
|
}
|
|
726
682
|
try {
|
|
727
|
-
await runtime.close(params.server);
|
|
683
|
+
await raceWithTimeout(runtime.close(params.server), operationCeilingMs());
|
|
728
684
|
activity.set(params.server, { connected: false });
|
|
729
685
|
if (loggable) {
|
|
730
686
|
logEvent(logContext, `closeServer success server=${params.server}`);
|
|
@@ -744,6 +700,7 @@ async function processRequest(rawPayload, runtime, managedServers, activity, met
|
|
|
744
700
|
case "status": {
|
|
745
701
|
const result = {
|
|
746
702
|
pid: process.pid,
|
|
703
|
+
protocolVersion: metadata.protocolVersion ?? DAEMON_PROTOCOL_VERSION,
|
|
747
704
|
startedAt: metadata.startedAt,
|
|
748
705
|
configPath: metadata.configPath,
|
|
749
706
|
configLayers: metadata.configLayers,
|
|
@@ -777,7 +734,7 @@ async function processRequest(rawPayload, runtime, managedServers, activity, met
|
|
|
777
734
|
}
|
|
778
735
|
} catch (error) {
|
|
779
736
|
return {
|
|
780
|
-
response: buildErrorResponse(id,
|
|
737
|
+
response: buildErrorResponse(id, daemonRuntimeErrorCode(error), error),
|
|
781
738
|
shouldShutdown: false
|
|
782
739
|
};
|
|
783
740
|
}
|
|
@@ -789,7 +746,7 @@ function resolveDaemonListToolsAutoAuthorize(params, definition) {
|
|
|
789
746
|
return params.autoAuthorize;
|
|
790
747
|
}
|
|
791
748
|
|
|
792
|
-
// node_modules/.pnpm/mcporter@0.
|
|
749
|
+
// node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/daemon-command.js
|
|
793
750
|
async function handleDaemonCli(args, options) {
|
|
794
751
|
const subcommand = args.shift();
|
|
795
752
|
if (!subcommand || subcommand === "help" || subcommand === "--help") {
|
|
@@ -971,8 +928,8 @@ async function resolveDaemonLoggingOptions(args, configKey) {
|
|
|
971
928
|
const envLogServers = process.env.MCPORTER_DAEMON_LOG_SERVERS;
|
|
972
929
|
const serverFilter = parseServerList(logServersValue ?? envLogServers);
|
|
973
930
|
const explicitServerLogging = serverFilter.size > 0;
|
|
974
|
-
const resolvedFileFlag = logFileValue ?
|
|
975
|
-
const resolvedEnvFile = envLogPath ?
|
|
931
|
+
const resolvedFileFlag = logFileValue ? path3.resolve(expandHome(logFileValue)) : void 0;
|
|
932
|
+
const resolvedEnvFile = envLogPath ? path3.resolve(expandHome(envLogPath)) : void 0;
|
|
976
933
|
const enabled = logFlag || Boolean(resolvedFileFlag) || envLogEnabled || Boolean(resolvedEnvFile) || explicitServerLogging;
|
|
977
934
|
if (!enabled) {
|
|
978
935
|
return {
|
|
@@ -983,7 +940,7 @@ async function resolveDaemonLoggingOptions(args, configKey) {
|
|
|
983
940
|
};
|
|
984
941
|
}
|
|
985
942
|
const logPath = resolvedFileFlag ?? resolvedEnvFile ?? getDaemonLogPath(configKey);
|
|
986
|
-
await fsPromises.mkdir(
|
|
943
|
+
await fsPromises.mkdir(path3.dirname(logPath), { recursive: true });
|
|
987
944
|
return {
|
|
988
945
|
enabled: true,
|
|
989
946
|
logPath,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
|
|
3
|
-
// node_modules/.pnpm/mcporter@0.
|
|
3
|
+
// node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/flag-utils.js
|
|
4
4
|
function extractFlags(args, keys) {
|
|
5
5
|
const flags = {};
|
|
6
6
|
let index = 0;
|
|
@@ -28,8 +28,20 @@ function expectValue(flag, value) {
|
|
|
28
28
|
}
|
|
29
29
|
return value;
|
|
30
30
|
}
|
|
31
|
+
function consumeMatchingTokens(args, predicate) {
|
|
32
|
+
let found = false;
|
|
33
|
+
for (let index = args.length - 1; index >= 0; index -= 1) {
|
|
34
|
+
const token = args[index];
|
|
35
|
+
if (token && predicate(token)) {
|
|
36
|
+
args.splice(index, 1);
|
|
37
|
+
found = true;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return found;
|
|
41
|
+
}
|
|
31
42
|
|
|
32
43
|
export {
|
|
33
44
|
extractFlags,
|
|
34
|
-
expectValue
|
|
45
|
+
expectValue,
|
|
46
|
+
consumeMatchingTokens
|
|
35
47
|
};
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "./chunk-
|
|
3
|
+
isUnauthorizedError
|
|
4
|
+
} from "./chunk-7DH57OKF.js";
|
|
5
|
+
import {
|
|
6
|
+
ProtocolErrorCode
|
|
7
|
+
} from "./chunk-YPJ5EHXR.js";
|
|
8
|
+
import {
|
|
9
|
+
DAEMON_OPERATION_TIMEOUT_CODE
|
|
10
|
+
} from "./chunk-ZBFZ5UFE.js";
|
|
5
11
|
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "./chunk-D3MRAZ6H.js";
|
|
12
|
+
isKeepAliveServer
|
|
13
|
+
} from "./chunk-6D6KPSXN.js";
|
|
9
14
|
|
|
10
|
-
// node_modules/.pnpm/mcporter@0.
|
|
15
|
+
// node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/daemon/runtime-wrapper.js
|
|
11
16
|
function createKeepAliveRuntime(base, options) {
|
|
12
17
|
if (!options.daemonClient || options.keepAliveServers.size === 0) {
|
|
13
18
|
return base;
|
|
@@ -54,7 +59,8 @@ var KeepAliveRuntime = class {
|
|
|
54
59
|
includeSchema: options?.includeSchema,
|
|
55
60
|
autoAuthorize: options?.autoAuthorize,
|
|
56
61
|
allowCachedAuth: options?.allowCachedAuth ?? true,
|
|
57
|
-
disableOAuth: options?.disableOAuth
|
|
62
|
+
disableOAuth: options?.disableOAuth,
|
|
63
|
+
timeoutMs: options?.timeoutMs
|
|
58
64
|
}));
|
|
59
65
|
}
|
|
60
66
|
return this.base.listTools(server, options);
|
|
@@ -141,16 +147,28 @@ var KeepAliveRuntime = class {
|
|
|
141
147
|
}
|
|
142
148
|
}
|
|
143
149
|
};
|
|
144
|
-
var NON_FATAL_CODES = /* @__PURE__ */ new Set([
|
|
150
|
+
var NON_FATAL_CODES = /* @__PURE__ */ new Set([ProtocolErrorCode.InvalidRequest, ProtocolErrorCode.MethodNotFound, ProtocolErrorCode.InvalidParams]);
|
|
145
151
|
function shouldRestartDaemonServer(error) {
|
|
146
152
|
if (!error) {
|
|
147
153
|
return false;
|
|
148
154
|
}
|
|
149
|
-
if (error
|
|
150
|
-
return
|
|
155
|
+
if (typeof error === "object" && error.code === DAEMON_OPERATION_TIMEOUT_CODE) {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
if (isUnauthorizedError(error)) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
const code = protocolErrorCode(error);
|
|
162
|
+
if (code !== void 0) {
|
|
163
|
+
return !NON_FATAL_CODES.has(code);
|
|
151
164
|
}
|
|
152
165
|
return true;
|
|
153
166
|
}
|
|
167
|
+
function protocolErrorCode(error) {
|
|
168
|
+
if (!error || typeof error !== "object" || !("code" in error))
|
|
169
|
+
return void 0;
|
|
170
|
+
return typeof error.code === "number" ? error.code : void 0;
|
|
171
|
+
}
|
|
154
172
|
function logDaemonRetry(server, operation, error) {
|
|
155
173
|
const reason = error instanceof Error ? error.message : String(error);
|
|
156
174
|
console.error(`[mcporter] Restarting '${server}' before retrying ${operation}: ${reason}`);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
|
|
3
|
-
// node_modules/.pnpm/mcporter@0.
|
|
3
|
+
// node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/cli/terminal.js
|
|
4
4
|
var forceColorRaw = process.env.FORCE_COLOR?.toLowerCase();
|
|
5
5
|
var forceDisableColor = forceColorRaw === "0" || forceColorRaw === "false";
|
|
6
6
|
var forceEnableColor = forceColorRaw === "1" || forceColorRaw === "true" || forceColorRaw === "2" || forceColorRaw === "3";
|