@introspection-ai/recipes 0.18.0 → 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 +7 -7
- 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
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/definition-fields.js
|
|
4
|
+
var SHARED_DEFINITION_FIELDS = [
|
|
5
|
+
"auth",
|
|
6
|
+
"tokenCacheDir",
|
|
7
|
+
"clientName",
|
|
8
|
+
"protocolVersion",
|
|
9
|
+
"oauthClientId",
|
|
10
|
+
"oauthClientSecretEnv",
|
|
11
|
+
"oauthTokenEndpointAuthMethod",
|
|
12
|
+
"oauthRedirectUrl",
|
|
13
|
+
"oauthClientMetadataUrl",
|
|
14
|
+
"oauthScope",
|
|
15
|
+
"refresh",
|
|
16
|
+
"httpFetch",
|
|
17
|
+
"allowedTools",
|
|
18
|
+
"blockedTools"
|
|
19
|
+
];
|
|
20
|
+
function pickSharedDefinitionFields(definition) {
|
|
21
|
+
return Object.fromEntries(SHARED_DEFINITION_FIELDS.map((field) => [field, definition[field]]));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
pickSharedDefinitionFields
|
|
26
|
+
};
|
|
@@ -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/env.js
|
|
4
4
|
import os from "node:os";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
var ENV_DEFAULT_PATTERN = /^\$\{([A-Za-z_][A-Za-z0-9_]*)(?::-|:|-)?([^}]*)\}$/;
|
|
@@ -96,44 +96,9 @@ async function withEnvOverrides(envOverrides, fn) {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
// node_modules/.pnpm/mcporter@0.12.3/node_modules/mcporter/dist/paths.js
|
|
100
|
-
import os2 from "node:os";
|
|
101
|
-
import path2 from "node:path";
|
|
102
|
-
var XDG_HOME_ENV = {
|
|
103
|
-
config: "XDG_CONFIG_HOME",
|
|
104
|
-
data: "XDG_DATA_HOME",
|
|
105
|
-
state: "XDG_STATE_HOME",
|
|
106
|
-
cache: "XDG_CACHE_HOME"
|
|
107
|
-
};
|
|
108
|
-
function legacyMcporterDir() {
|
|
109
|
-
return path2.join(os2.homedir(), ".mcporter");
|
|
110
|
-
}
|
|
111
|
-
function mcporterDir(kind) {
|
|
112
|
-
const raw = process.env[XDG_HOME_ENV[kind]];
|
|
113
|
-
if (raw && raw.trim().length > 0) {
|
|
114
|
-
const resolved = expandHome(raw.trim());
|
|
115
|
-
if (path2.isAbsolute(resolved)) {
|
|
116
|
-
return path2.join(resolved, "mcporter");
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return legacyMcporterDir();
|
|
120
|
-
}
|
|
121
|
-
function mcporterConfigCandidates() {
|
|
122
|
-
const base = mcporterDir("config");
|
|
123
|
-
const candidates = [path2.join(base, "mcporter.json"), path2.join(base, "mcporter.jsonc")];
|
|
124
|
-
if (base !== legacyMcporterDir()) {
|
|
125
|
-
const legacy = legacyMcporterDir();
|
|
126
|
-
candidates.push(path2.join(legacy, "mcporter.json"), path2.join(legacy, "mcporter.jsonc"));
|
|
127
|
-
}
|
|
128
|
-
return candidates;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
99
|
export {
|
|
132
100
|
expandHome,
|
|
133
101
|
resolveEnvValue,
|
|
134
102
|
resolveEnvPlaceholders,
|
|
135
|
-
withEnvOverrides
|
|
136
|
-
legacyMcporterDir,
|
|
137
|
-
mcporterDir,
|
|
138
|
-
mcporterConfigCandidates
|
|
103
|
+
withEnvOverrides
|
|
139
104
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
expandHome,
|
|
4
3
|
mcporterConfigCandidates
|
|
5
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FWP4RACK.js";
|
|
5
|
+
import {
|
|
6
|
+
expandHome
|
|
7
|
+
} from "./chunk-HAO6PL7Z.js";
|
|
6
8
|
|
|
7
|
-
// node_modules/.pnpm/mcporter@0.
|
|
9
|
+
// node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/config/path-discovery.js
|
|
8
10
|
import fsSync from "node:fs";
|
|
9
11
|
import fs from "node:fs/promises";
|
|
10
12
|
import path from "node:path";
|
|
@@ -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/identifier-helpers.js
|
|
4
4
|
var AUTO_THRESHOLD_RATIO = 0.3;
|
|
5
5
|
var AUTO_THRESHOLD_MIN = 2;
|
|
6
6
|
function chooseClosestIdentifier(input, candidates) {
|
|
@@ -1,48 +1,156 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from "node:module"; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
DAEMON_PROTOCOL_VERSION,
|
|
4
|
+
DaemonFrameDecoder,
|
|
5
|
+
isDaemonProgressFrame,
|
|
6
|
+
resolveProgressInterval
|
|
7
|
+
} from "./chunk-ZBFZ5UFE.js";
|
|
5
8
|
import {
|
|
6
9
|
listConfigLayerPaths
|
|
7
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-L4VKBFYI.js";
|
|
11
|
+
import {
|
|
12
|
+
isProcessRunning,
|
|
13
|
+
withFileLock
|
|
14
|
+
} from "./chunk-7A63PAGP.js";
|
|
8
15
|
import {
|
|
9
|
-
expandHome,
|
|
10
16
|
mcporterDir
|
|
11
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-FWP4RACK.js";
|
|
18
|
+
import {
|
|
19
|
+
expandHome
|
|
20
|
+
} from "./chunk-HAO6PL7Z.js";
|
|
21
|
+
import {
|
|
22
|
+
keepAliveIdleTimeout
|
|
23
|
+
} from "./chunk-6D6KPSXN.js";
|
|
12
24
|
|
|
13
|
-
// node_modules/.pnpm/mcporter@0.
|
|
25
|
+
// node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/daemon/client.js
|
|
14
26
|
import crypto, { randomUUID } from "node:crypto";
|
|
15
|
-
import
|
|
27
|
+
import fs2 from "node:fs/promises";
|
|
16
28
|
import net from "node:net";
|
|
17
|
-
import
|
|
29
|
+
import path3 from "node:path";
|
|
18
30
|
|
|
19
|
-
// node_modules/.pnpm/mcporter@0.
|
|
31
|
+
// node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/daemon/config-layers.js
|
|
32
|
+
import fs from "node:fs/promises";
|
|
20
33
|
import path from "node:path";
|
|
34
|
+
async function statConfigMtime(configPath) {
|
|
35
|
+
try {
|
|
36
|
+
const stats = await fs.stat(configPath);
|
|
37
|
+
return stats.mtimeMs;
|
|
38
|
+
} catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function collectConfigLayers(options, fallbackConfigPath) {
|
|
43
|
+
const layerPaths = await listConfigLayerPaths(options, options.rootDir ?? process.cwd());
|
|
44
|
+
const entries = await Promise.all(layerPaths.map(async (layerPath) => ({ path: layerPath, mtimeMs: await statConfigMtime(layerPath) })));
|
|
45
|
+
const fallback = fallbackConfigPath ?? options.configPath;
|
|
46
|
+
if (entries.length === 0 && fallback) {
|
|
47
|
+
entries.push({ path: path.resolve(fallback), mtimeMs: await statConfigMtime(fallback) });
|
|
48
|
+
}
|
|
49
|
+
return entries;
|
|
50
|
+
}
|
|
51
|
+
function normalizeConfigLayers(layers) {
|
|
52
|
+
const normalized = layers.map((entry) => ({
|
|
53
|
+
path: path.isAbsolute(entry.path) ? entry.path : path.resolve(entry.path),
|
|
54
|
+
mtimeMs: entry.mtimeMs ?? null
|
|
55
|
+
}));
|
|
56
|
+
if (normalized.length < 2) {
|
|
57
|
+
return normalized;
|
|
58
|
+
}
|
|
59
|
+
return normalized.toSorted((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/daemon/paths.js
|
|
63
|
+
import path2 from "node:path";
|
|
21
64
|
function resolveBaseDir() {
|
|
22
65
|
const override = process.env.MCPORTER_DAEMON_DIR;
|
|
23
66
|
if (override && override.trim().length > 0) {
|
|
24
|
-
return
|
|
67
|
+
return path2.resolve(expandHome(override.trim()));
|
|
25
68
|
}
|
|
26
69
|
return mcporterDir("state");
|
|
27
70
|
}
|
|
28
71
|
function ensureRunDir() {
|
|
29
|
-
return
|
|
72
|
+
return path2.join(resolveBaseDir(), "daemon");
|
|
30
73
|
}
|
|
31
74
|
function getDaemonMetadataPath(configKey) {
|
|
32
|
-
return
|
|
75
|
+
return path2.join(ensureRunDir(), `daemon-${configKey}.json`);
|
|
33
76
|
}
|
|
34
77
|
function getDaemonSocketPath(configKey) {
|
|
35
78
|
const runDir = ensureRunDir();
|
|
36
79
|
if (process.platform === "win32") {
|
|
37
80
|
return `\\\\.\\pipe\\mcporter-daemon-${configKey}`;
|
|
38
81
|
}
|
|
39
|
-
return
|
|
82
|
+
return path2.join(runDir, `daemon-${configKey}.sock`);
|
|
40
83
|
}
|
|
41
84
|
function getDaemonLogPath(configKey) {
|
|
42
|
-
return
|
|
85
|
+
return path2.join(ensureRunDir(), `daemon-${configKey}.log`);
|
|
43
86
|
}
|
|
44
87
|
|
|
45
|
-
// node_modules/.pnpm/mcporter@0.
|
|
88
|
+
// node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/daemon/request-utils.js
|
|
89
|
+
function delay(ms) {
|
|
90
|
+
return new Promise((resolve) => {
|
|
91
|
+
setTimeout(resolve, ms);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function ensureManaged(server, managedServers) {
|
|
95
|
+
if (!managedServers.has(server)) {
|
|
96
|
+
throw new Error(`Server '${server}' is not managed by the daemon.`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function markActivity(server, activity) {
|
|
100
|
+
const entry = activity.get(server);
|
|
101
|
+
if (entry) {
|
|
102
|
+
entry.connected = true;
|
|
103
|
+
entry.lastUsedAt = Date.now();
|
|
104
|
+
} else {
|
|
105
|
+
activity.set(server, { connected: true, lastUsedAt: Date.now() });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
async function evictIdleServers(runtime, managedServers, activity) {
|
|
109
|
+
const now = Date.now();
|
|
110
|
+
await Promise.all(Array.from(managedServers.entries()).map(async ([name, definition]) => {
|
|
111
|
+
const timeout = keepAliveIdleTimeout(definition);
|
|
112
|
+
if (!timeout) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const entry = activity.get(name);
|
|
116
|
+
if (!entry?.lastUsedAt) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if (now - entry.lastUsedAt < timeout) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
await runtime.close(name).catch(() => {
|
|
123
|
+
});
|
|
124
|
+
activity.set(name, { connected: false });
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
127
|
+
function shouldShutdownDaemonForIdle(lastActivityAt, now, idleTimeoutMs, activeRequests = 0) {
|
|
128
|
+
return activeRequests <= 0 && typeof idleTimeoutMs === "number" && idleTimeoutMs > 0 && now - lastActivityAt >= idleTimeoutMs;
|
|
129
|
+
}
|
|
130
|
+
function daemonIdleWatcherInterval(idleTimeoutMs) {
|
|
131
|
+
if (!idleTimeoutMs) {
|
|
132
|
+
return 3e4;
|
|
133
|
+
}
|
|
134
|
+
return Math.min(3e4, Math.max(100, Math.floor(idleTimeoutMs / 2)));
|
|
135
|
+
}
|
|
136
|
+
function buildErrorResponse(id, code, error) {
|
|
137
|
+
let message = code;
|
|
138
|
+
if (error instanceof Error) {
|
|
139
|
+
message = error.message;
|
|
140
|
+
} else if (typeof error === "string") {
|
|
141
|
+
message = error;
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
id,
|
|
145
|
+
ok: false,
|
|
146
|
+
error: {
|
|
147
|
+
code,
|
|
148
|
+
message
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// node_modules/.pnpm/mcporter@0.13.0/node_modules/mcporter/dist/daemon/client.js
|
|
46
154
|
var DEFAULT_DAEMON_TIMEOUT_MS = 3e4;
|
|
47
155
|
var MIN_DAEMON_STATUS_TIMEOUT_MS = 1e3;
|
|
48
156
|
function resolveDaemonPaths(configPath) {
|
|
@@ -68,7 +176,7 @@ var DaemonClient = class {
|
|
|
68
176
|
return this.invoke("callTool", params, params.timeoutMs);
|
|
69
177
|
}
|
|
70
178
|
async listTools(params) {
|
|
71
|
-
return this.invoke("listTools", params);
|
|
179
|
+
return this.invoke("listTools", params, params.timeoutMs);
|
|
72
180
|
}
|
|
73
181
|
async listResources(params) {
|
|
74
182
|
return this.invoke("listResources", params);
|
|
@@ -155,7 +263,7 @@ var DaemonClient = class {
|
|
|
155
263
|
await this.startingPromise;
|
|
156
264
|
}
|
|
157
265
|
async launchDaemonAndWait() {
|
|
158
|
-
const { launchDaemonDetached } = await import("./launch-
|
|
266
|
+
const { launchDaemonDetached } = await import("./launch-BWXPLPB7.js");
|
|
159
267
|
launchDaemonDetached({
|
|
160
268
|
configPath: this.options.configPath,
|
|
161
269
|
configExplicit: this.options.configExplicit,
|
|
@@ -211,8 +319,11 @@ var DaemonClient = class {
|
|
|
211
319
|
if (!metadata) {
|
|
212
320
|
return "missing";
|
|
213
321
|
}
|
|
214
|
-
const currentLayers =
|
|
215
|
-
|
|
322
|
+
const currentLayers = normalizeConfigLayers(await collectConfigLayers({
|
|
323
|
+
configPath: this.options.configExplicit ? this.options.configPath : void 0,
|
|
324
|
+
rootDir: this.options.rootDir
|
|
325
|
+
}, this.options.configPath));
|
|
326
|
+
const metadataLayers = normalizeConfigLayers(metadata.configLayers ?? [{ path: metadata.configPath, mtimeMs: metadata.configMtimeMs ?? null }]);
|
|
216
327
|
if (currentLayers.length !== metadataLayers.length) {
|
|
217
328
|
return "stale";
|
|
218
329
|
}
|
|
@@ -226,15 +337,19 @@ var DaemonClient = class {
|
|
|
226
337
|
return "fresh";
|
|
227
338
|
}
|
|
228
339
|
async sendRequest(method, params, timeoutOverrideMs) {
|
|
340
|
+
const idleTimeoutMs = resolveDaemonTimeout(timeoutOverrideMs);
|
|
229
341
|
const request = {
|
|
230
342
|
id: randomUUID(),
|
|
231
343
|
method,
|
|
232
|
-
params
|
|
344
|
+
params,
|
|
345
|
+
protocolVersion: DAEMON_PROTOCOL_VERSION,
|
|
346
|
+
progressIntervalMs: resolveProgressInterval(idleTimeoutMs)
|
|
233
347
|
};
|
|
234
348
|
const payload = JSON.stringify(request);
|
|
235
|
-
const
|
|
236
|
-
const response = await new Promise((resolve, reject) => {
|
|
349
|
+
const parsed = await new Promise((resolve, reject) => {
|
|
237
350
|
const socket = net.createConnection(this.socketPath);
|
|
351
|
+
const decoder = new DaemonFrameDecoder();
|
|
352
|
+
let response;
|
|
238
353
|
let settled = false;
|
|
239
354
|
const finishReject = (error) => {
|
|
240
355
|
if (settled) {
|
|
@@ -250,12 +365,22 @@ var DaemonClient = class {
|
|
|
250
365
|
settled = true;
|
|
251
366
|
resolve(value);
|
|
252
367
|
};
|
|
253
|
-
socket.setTimeout(
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}));
|
|
368
|
+
socket.setTimeout(idleTimeoutMs);
|
|
369
|
+
socket.on("timeout", () => {
|
|
370
|
+
socket.destroy(transportError("Daemon request timed out.", "ETIMEDOUT"));
|
|
257
371
|
});
|
|
258
|
-
|
|
372
|
+
const consume = (frames) => {
|
|
373
|
+
for (const frame of frames) {
|
|
374
|
+
if (isDaemonProgressFrame(frame)) {
|
|
375
|
+
if (frame.id === request.id) {
|
|
376
|
+
socket.setTimeout(idleTimeoutMs);
|
|
377
|
+
}
|
|
378
|
+
continue;
|
|
379
|
+
}
|
|
380
|
+
response = frame;
|
|
381
|
+
socket.setTimeout(0);
|
|
382
|
+
}
|
|
383
|
+
};
|
|
259
384
|
socket.on("connect", () => {
|
|
260
385
|
socket.write(payload, (error) => {
|
|
261
386
|
if (error) {
|
|
@@ -264,26 +389,22 @@ var DaemonClient = class {
|
|
|
264
389
|
});
|
|
265
390
|
});
|
|
266
391
|
socket.on("data", (chunk) => {
|
|
267
|
-
|
|
392
|
+
consume(decoder.push(chunk.toString()));
|
|
393
|
+
});
|
|
394
|
+
socket.on("end", () => {
|
|
395
|
+
consume(decoder.flush());
|
|
396
|
+
if (response) {
|
|
397
|
+
finishResolve(response);
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
finishReject(decoder.malformed ? transportError("Failed to parse daemon response.", "ECONNRESET") : transportError("Empty daemon response.", "ECONNRESET"));
|
|
268
401
|
});
|
|
269
|
-
socket.on("end", () => finishResolve(buffer));
|
|
270
402
|
socket.on("error", (error) => {
|
|
271
403
|
finishReject(error);
|
|
272
404
|
});
|
|
273
405
|
});
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
const error = new Error("Empty daemon response.");
|
|
277
|
-
error.code = "ECONNRESET";
|
|
278
|
-
throw error;
|
|
279
|
-
}
|
|
280
|
-
let parsed;
|
|
281
|
-
try {
|
|
282
|
-
parsed = JSON.parse(trimmed);
|
|
283
|
-
} catch {
|
|
284
|
-
const parseError = new Error("Failed to parse daemon response.");
|
|
285
|
-
parseError.code = "ECONNRESET";
|
|
286
|
-
throw parseError;
|
|
406
|
+
for (const notice of parsed.notices ?? []) {
|
|
407
|
+
console.warn(`[mcporter] ${notice}`);
|
|
287
408
|
}
|
|
288
409
|
if (!parsed.ok) {
|
|
289
410
|
const error = new Error(parsed.error?.message ?? "Daemon error");
|
|
@@ -293,8 +414,13 @@ var DaemonClient = class {
|
|
|
293
414
|
return parsed.result;
|
|
294
415
|
}
|
|
295
416
|
};
|
|
417
|
+
function transportError(message, code) {
|
|
418
|
+
const error = new Error(message);
|
|
419
|
+
error.code = code;
|
|
420
|
+
return error;
|
|
421
|
+
}
|
|
296
422
|
function deriveConfigKey(configPath) {
|
|
297
|
-
const absolute =
|
|
423
|
+
const absolute = path3.resolve(configPath);
|
|
298
424
|
return crypto.createHash("sha1").update(absolute).digest("hex").slice(0, 12);
|
|
299
425
|
}
|
|
300
426
|
function isTransportError(error) {
|
|
@@ -304,17 +430,6 @@ function isTransportError(error) {
|
|
|
304
430
|
const code = error.code;
|
|
305
431
|
return code === "ECONNREFUSED" || code === "ENOENT" || code === "ETIMEDOUT" || code === "ECONNRESET";
|
|
306
432
|
}
|
|
307
|
-
function isProcessRunning(pid) {
|
|
308
|
-
if (!Number.isInteger(pid) || pid <= 0) {
|
|
309
|
-
return false;
|
|
310
|
-
}
|
|
311
|
-
try {
|
|
312
|
-
process.kill(pid, 0);
|
|
313
|
-
return true;
|
|
314
|
-
} catch (error) {
|
|
315
|
-
return error.code === "EPERM";
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
433
|
function resolveDaemonTimeout(override) {
|
|
319
434
|
if (typeof override === "number" && Number.isFinite(override) && override > 0) {
|
|
320
435
|
return override;
|
|
@@ -335,51 +450,27 @@ function resolveDaemonStatusTimeout(override) {
|
|
|
335
450
|
}
|
|
336
451
|
return Math.max(override, MIN_DAEMON_STATUS_TIMEOUT_MS);
|
|
337
452
|
}
|
|
338
|
-
async function statConfigMtime(configPath) {
|
|
339
|
-
try {
|
|
340
|
-
const stats = await fs.stat(configPath);
|
|
341
|
-
return stats.mtimeMs;
|
|
342
|
-
} catch {
|
|
343
|
-
return null;
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
async function collectConfigLayers(options) {
|
|
347
|
-
const layerPaths = await listConfigLayerPaths(options.configExplicit ? { configPath: options.configPath } : {}, options.rootDir ?? process.cwd());
|
|
348
|
-
const layers = [];
|
|
349
|
-
for (const layerPath of layerPaths) {
|
|
350
|
-
layers.push({ path: layerPath, mtimeMs: await statConfigMtime(layerPath) });
|
|
351
|
-
}
|
|
352
|
-
if (layers.length === 0) {
|
|
353
|
-
layers.push({ path: path2.resolve(options.configPath), mtimeMs: await statConfigMtime(options.configPath) });
|
|
354
|
-
}
|
|
355
|
-
return layers;
|
|
356
|
-
}
|
|
357
453
|
async function readDaemonMetadata(metadataPath) {
|
|
358
454
|
try {
|
|
359
|
-
const raw = await
|
|
455
|
+
const raw = await fs2.readFile(metadataPath, "utf8");
|
|
360
456
|
return JSON.parse(raw);
|
|
361
457
|
} catch {
|
|
362
458
|
return null;
|
|
363
459
|
}
|
|
364
460
|
}
|
|
365
|
-
function delay(ms) {
|
|
366
|
-
return new Promise((resolve) => {
|
|
367
|
-
setTimeout(resolve, ms);
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
function normalizeLayers(layers) {
|
|
371
|
-
const normalized = layers.map((entry) => ({
|
|
372
|
-
path: path2.isAbsolute(entry.path) ? entry.path : path2.resolve(entry.path),
|
|
373
|
-
mtimeMs: entry.mtimeMs ?? null
|
|
374
|
-
}));
|
|
375
|
-
if (normalized.length < 2) {
|
|
376
|
-
return normalized;
|
|
377
|
-
}
|
|
378
|
-
return normalized.toSorted((a, b) => a.path < b.path ? -1 : a.path > b.path ? 1 : 0);
|
|
379
|
-
}
|
|
380
461
|
|
|
381
462
|
export {
|
|
463
|
+
statConfigMtime,
|
|
464
|
+
collectConfigLayers,
|
|
465
|
+
normalizeConfigLayers,
|
|
382
466
|
getDaemonLogPath,
|
|
467
|
+
delay,
|
|
468
|
+
ensureManaged,
|
|
469
|
+
markActivity,
|
|
470
|
+
evictIdleServers,
|
|
471
|
+
shouldShutdownDaemonForIdle,
|
|
472
|
+
daemonIdleWatcherInterval,
|
|
473
|
+
buildErrorResponse,
|
|
383
474
|
resolveDaemonPaths,
|
|
384
475
|
DaemonClient
|
|
385
476
|
};
|
|
@@ -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/json-output.js
|
|
4
4
|
function buildConnectionIssueEnvelope(params) {
|
|
5
5
|
return {
|
|
6
6
|
server: params.server,
|