@ken-jo/agent-connector 0.4.0 → 0.4.1
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/README.md +8 -8
- package/dist/{action-PLZW5BGX.js → action-WT7GVRCC.js} +11 -10
- package/dist/{action-PLZW5BGX.js.map → action-WT7GVRCC.js.map} +1 -1
- package/dist/amazon-q-COAL3764.js +276 -0
- package/dist/amazon-q-COAL3764.js.map +1 -0
- package/dist/{amp-B524U6LO.js → amp-4U33CU7E.js} +3 -3
- package/dist/{antigravity-ANDKF3K7.js → antigravity-AMKKKHS4.js} +4 -4
- package/dist/{antigravity-cli-LLRPDDOT.js → antigravity-cli-XERXEH5W.js} +4 -4
- package/dist/{chunk-KGJWE6A2.js → chunk-24IDL5RW.js} +2 -2
- package/dist/{chunk-CIRDOY2V.js → chunk-2AVLX7GH.js} +3 -3
- package/dist/{chunk-ADTHT2FN.js → chunk-4ENJK5S2.js} +10 -173
- package/dist/chunk-4ENJK5S2.js.map +1 -0
- package/dist/{chunk-BHUCB6LY.js → chunk-5OWS5CMA.js} +8 -7
- package/dist/{chunk-BHUCB6LY.js.map → chunk-5OWS5CMA.js.map} +1 -1
- package/dist/{chunk-IW77FFNX.js → chunk-CPLK7GTE.js} +41 -5
- package/dist/chunk-CPLK7GTE.js.map +1 -0
- package/dist/chunk-DCKFYWGM.js +237 -0
- package/dist/chunk-DCKFYWGM.js.map +1 -0
- package/dist/{chunk-J3D5W5T2.js → chunk-EGCBZ2DC.js} +2 -2
- package/dist/{chunk-22Y24V7O.js → chunk-F5RX62T7.js} +2 -2
- package/dist/chunk-FAHIMJRU.js +177 -0
- package/dist/chunk-FAHIMJRU.js.map +1 -0
- package/dist/{chunk-BXGFUENQ.js → chunk-I5MLE6S7.js} +14 -1
- package/dist/{chunk-BXGFUENQ.js.map → chunk-I5MLE6S7.js.map} +1 -1
- package/dist/{chunk-LL4OBGRU.js → chunk-LQRAPXS4.js} +3 -3
- package/dist/{chunk-KGXDYGNJ.js → chunk-O5TWCIJN.js} +19 -19
- package/dist/{chunk-KGXDYGNJ.js.map → chunk-O5TWCIJN.js.map} +1 -1
- package/dist/{chunk-MAH6QQTO.js → chunk-QREL7LZJ.js} +5 -4
- package/dist/chunk-QREL7LZJ.js.map +1 -0
- package/dist/{chunk-G3ER4SY5.js → chunk-RIMVWCZY.js} +9 -9
- package/dist/{chunk-6XHB6BE3.js → chunk-SCVBYSF7.js} +1 -1
- package/dist/{chunk-KGGBNKI4.js → chunk-URHQMFB3.js} +90 -13
- package/dist/chunk-URHQMFB3.js.map +1 -0
- package/dist/chunk-WZA4CSGJ.js +28 -0
- package/dist/chunk-WZA4CSGJ.js.map +1 -0
- package/dist/{chunk-76FUSVIA.js → chunk-XJ4S47CT.js} +6 -5
- package/dist/chunk-XJ4S47CT.js.map +1 -0
- package/dist/{claude-code-MLWS7CW6.js → claude-code-W4PUFZL5.js} +20 -30
- package/dist/claude-code-W4PUFZL5.js.map +1 -0
- package/dist/cli/sdk.js +5 -4
- package/dist/cli/sdk.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cline-WRYMNS7Z.js +442 -0
- package/dist/cline-WRYMNS7Z.js.map +1 -0
- package/dist/{codebuff-SH2S3QAN.js → codebuff-DH5Y7GAT.js} +8 -4
- package/dist/codebuff-DH5Y7GAT.js.map +1 -0
- package/dist/{codex-BXA4FIF4.js → codex-DDHIV767.js} +43 -11
- package/dist/codex-DDHIV767.js.map +1 -0
- package/dist/continue-K43SUHLQ.js +790 -0
- package/dist/continue-K43SUHLQ.js.map +1 -0
- package/dist/{copilot-cli-ROIBTTDT.js → copilot-cli-Q3SSPT4V.js} +70 -12
- package/dist/copilot-cli-Q3SSPT4V.js.map +1 -0
- package/dist/{crush-QLEFLHUC.js → crush-MBEH2R3I.js} +130 -6
- package/dist/crush-MBEH2R3I.js.map +1 -0
- package/dist/{cursor-ASJPWZ4R.js → cursor-TMBXDYR4.js} +119 -19
- package/dist/cursor-TMBXDYR4.js.map +1 -0
- package/dist/{detect-ZIIS55LD.js → detect-KG5FG3EV.js} +5 -4
- package/dist/{detect-ZIIS55LD.js.map → detect-KG5FG3EV.js.map} +1 -1
- package/dist/{doctor-TJUGSQ5C.js → doctor-FLZF34Y3.js} +221 -95
- package/dist/doctor-FLZF34Y3.js.map +1 -0
- package/dist/{droid-NCSS3B5Y.js → droid-JC2NT6S4.js} +135 -13
- package/dist/droid-JC2NT6S4.js.map +1 -0
- package/dist/{gemini-cli-SLVWLXJW.js → gemini-cli-ILR7M5X3.js} +62 -10
- package/dist/gemini-cli-ILR7M5X3.js.map +1 -0
- package/dist/{goose-PBA7KTE5.js → goose-SFO5BBGW.js} +15 -8
- package/dist/goose-SFO5BBGW.js.map +1 -0
- package/dist/{hermes-ONDCECP2.js → hermes-3N7WN4WS.js} +329 -15
- package/dist/hermes-3N7WN4WS.js.map +1 -0
- package/dist/{hook-OU522ABV.js → hook-XR3Z45FB.js} +14 -11
- package/dist/hook-XR3Z45FB.js.map +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -2
- package/dist/{install-UDCBL7HP.js → install-BSR62UHJ.js} +11 -10
- package/dist/{install-UDCBL7HP.js.map → install-BSR62UHJ.js.map} +1 -1
- package/dist/{introspect-DuZSPSHB.d.ts → introspect-Nw8hTReX.d.ts} +1 -1
- package/dist/{jetbrains-copilot-YABZ3HFA.js → jetbrains-copilot-NRZHI5PC.js} +85 -18
- package/dist/jetbrains-copilot-NRZHI5PC.js.map +1 -0
- package/dist/{kilo-F3ZDZKCT.js → kilo-5NWOXVSD.js} +16 -16
- package/dist/kilo-5NWOXVSD.js.map +1 -0
- package/dist/{kilo-cli-3HWPWBY4.js → kilo-cli-UZ7R5UOP.js} +3 -3
- package/dist/{kimi-NV72FVAO.js → kimi-2YFK2GBA.js} +87 -25
- package/dist/kimi-2YFK2GBA.js.map +1 -0
- package/dist/{kiro-C5W6AGDR.js → kiro-YL6AWUYG.js} +3 -3
- package/dist/{leaderboard-TIBVONVT.js → leaderboard-MJG24O35.js} +3 -3
- package/dist/{mimo-code-IMM5YM3M.js → mimo-code-FTMGSKMQ.js} +41 -5
- package/dist/mimo-code-FTMGSKMQ.js.map +1 -0
- package/dist/{mux-DSSH4AFS.js → mux-5XZFB44C.js} +156 -6
- package/dist/mux-5XZFB44C.js.map +1 -0
- package/dist/{nemoclaw-3EVNKD3I.js → nemoclaw-W5KEJ3WX.js} +4 -4
- package/dist/{omp-Z6FRNDPN.js → omp-2QMEY6HD.js} +138 -18
- package/dist/omp-2QMEY6HD.js.map +1 -0
- package/dist/{openclaw-7G437NT7.js → openclaw-EXJEFNZI.js} +4 -4
- package/dist/{opencode-Q6KBSAKW.js → opencode-WNXYJR4X.js} +84 -27
- package/dist/opencode-WNXYJR4X.js.map +1 -0
- package/dist/{package-RMPN57YZ.js → package-ACZXJHWB.js} +8 -7
- package/dist/{package-RMPN57YZ.js.map → package-ACZXJHWB.js.map} +1 -1
- package/dist/{pi-LZT6WWAZ.js → pi-PVVPVWKG.js} +3 -2
- package/dist/{pi-LZT6WWAZ.js.map → pi-PVVPVWKG.js.map} +1 -1
- package/dist/{qwen-code-WQBKRPWJ.js → qwen-code-G4CXKUHR.js} +426 -10
- package/dist/qwen-code-G4CXKUHR.js.map +1 -0
- package/dist/{roo-code-GWSNU3OW.js → roo-code-67TYJIQR.js} +3 -3
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +9 -8
- package/dist/sdk/index.d.ts +3 -3
- package/dist/sdk/index.js +4 -3
- package/dist/sdk/index.js.map +1 -1
- package/dist/sdk/test.d.ts +2 -2
- package/dist/sdk/test.js +6 -5
- package/dist/sdk/test.js.map +1 -1
- package/dist/{serve-D3GO36UT.js → serve-GER7URPR.js} +11 -10
- package/dist/{serve-D3GO36UT.js.map → serve-GER7URPR.js.map} +1 -1
- package/dist/{status-KOSKCETC.js → status-LAJE3BM5.js} +7 -6
- package/dist/{status-KOSKCETC.js.map → status-LAJE3BM5.js.map} +1 -1
- package/dist/{statusline-ZNTCL5YC.js → statusline-L376ZPZU.js} +10 -9
- package/dist/{statusline-ZNTCL5YC.js.map → statusline-L376ZPZU.js.map} +1 -1
- package/dist/{telemetry-XIKUUGTQ.js → telemetry-B3DX3PWU.js} +6 -5
- package/dist/{telemetry-XIKUUGTQ.js.map → telemetry-B3DX3PWU.js.map} +1 -1
- package/dist/{trae-NWT3TMSZ.js → trae-7CZZGOGI.js} +3 -3
- package/dist/{types-BEKsAium.d.ts → types-CRVrFWeU.d.ts} +64 -22
- package/dist/{uninstall-2LBLQVFA.js → uninstall-ZYTW7YMZ.js} +11 -10
- package/dist/{uninstall-2LBLQVFA.js.map → uninstall-ZYTW7YMZ.js.map} +1 -1
- package/dist/{upgrade-ZC2S7VRN.js → upgrade-4LUEEOZW.js} +11 -10
- package/dist/{upgrade-ZC2S7VRN.js.map → upgrade-4LUEEOZW.js.map} +1 -1
- package/dist/{usage-E2A4O2CY.js → usage-ZFBVQF3H.js} +3 -3
- package/dist/{usage-event-JKMC4QC4.js → usage-event-GZ32AGEB.js} +10 -9
- package/dist/{usage-event-JKMC4QC4.js.map → usage-event-GZ32AGEB.js.map} +1 -1
- package/dist/{vscode-copilot-ALV45XF6.js → vscode-copilot-MF2CDNMT.js} +23 -10
- package/dist/vscode-copilot-MF2CDNMT.js.map +1 -0
- package/dist/{warp-H6IX4U3J.js → warp-VKG55TAT.js} +55 -4
- package/dist/warp-VKG55TAT.js.map +1 -0
- package/dist/windsurf-FU5G4SHF.js +443 -0
- package/dist/windsurf-FU5G4SHF.js.map +1 -0
- package/dist/{zed-RH34TNSW.js → zed-SFUHL3GS.js} +3 -3
- package/package.json +2 -2
- package/dist/chunk-3PFFTFCU.js +0 -190
- package/dist/chunk-3PFFTFCU.js.map +0 -1
- package/dist/chunk-76FUSVIA.js.map +0 -1
- package/dist/chunk-ADTHT2FN.js.map +0 -1
- package/dist/chunk-IW77FFNX.js.map +0 -1
- package/dist/chunk-KGGBNKI4.js.map +0 -1
- package/dist/chunk-MAH6QQTO.js.map +0 -1
- package/dist/claude-code-MLWS7CW6.js.map +0 -1
- package/dist/codebuff-SH2S3QAN.js.map +0 -1
- package/dist/codex-BXA4FIF4.js.map +0 -1
- package/dist/copilot-cli-ROIBTTDT.js.map +0 -1
- package/dist/crush-QLEFLHUC.js.map +0 -1
- package/dist/cursor-ASJPWZ4R.js.map +0 -1
- package/dist/doctor-TJUGSQ5C.js.map +0 -1
- package/dist/droid-NCSS3B5Y.js.map +0 -1
- package/dist/gemini-cli-SLVWLXJW.js.map +0 -1
- package/dist/goose-PBA7KTE5.js.map +0 -1
- package/dist/hermes-ONDCECP2.js.map +0 -1
- package/dist/hook-OU522ABV.js.map +0 -1
- package/dist/jetbrains-copilot-YABZ3HFA.js.map +0 -1
- package/dist/kilo-F3ZDZKCT.js.map +0 -1
- package/dist/kimi-NV72FVAO.js.map +0 -1
- package/dist/mimo-code-IMM5YM3M.js.map +0 -1
- package/dist/mux-DSSH4AFS.js.map +0 -1
- package/dist/omp-Z6FRNDPN.js.map +0 -1
- package/dist/opencode-Q6KBSAKW.js.map +0 -1
- package/dist/qwen-code-WQBKRPWJ.js.map +0 -1
- package/dist/vscode-copilot-ALV45XF6.js.map +0 -1
- package/dist/warp-H6IX4U3J.js.map +0 -1
- /package/dist/{amp-B524U6LO.js.map → amp-4U33CU7E.js.map} +0 -0
- /package/dist/{antigravity-ANDKF3K7.js.map → antigravity-AMKKKHS4.js.map} +0 -0
- /package/dist/{antigravity-cli-LLRPDDOT.js.map → antigravity-cli-XERXEH5W.js.map} +0 -0
- /package/dist/{chunk-KGJWE6A2.js.map → chunk-24IDL5RW.js.map} +0 -0
- /package/dist/{chunk-CIRDOY2V.js.map → chunk-2AVLX7GH.js.map} +0 -0
- /package/dist/{chunk-J3D5W5T2.js.map → chunk-EGCBZ2DC.js.map} +0 -0
- /package/dist/{chunk-22Y24V7O.js.map → chunk-F5RX62T7.js.map} +0 -0
- /package/dist/{chunk-LL4OBGRU.js.map → chunk-LQRAPXS4.js.map} +0 -0
- /package/dist/{chunk-G3ER4SY5.js.map → chunk-RIMVWCZY.js.map} +0 -0
- /package/dist/{chunk-6XHB6BE3.js.map → chunk-SCVBYSF7.js.map} +0 -0
- /package/dist/{kilo-cli-3HWPWBY4.js.map → kilo-cli-UZ7R5UOP.js.map} +0 -0
- /package/dist/{kiro-C5W6AGDR.js.map → kiro-YL6AWUYG.js.map} +0 -0
- /package/dist/{leaderboard-TIBVONVT.js.map → leaderboard-MJG24O35.js.map} +0 -0
- /package/dist/{nemoclaw-3EVNKD3I.js.map → nemoclaw-W5KEJ3WX.js.map} +0 -0
- /package/dist/{openclaw-7G437NT7.js.map → openclaw-EXJEFNZI.js.map} +0 -0
- /package/dist/{roo-code-GWSNU3OW.js.map → roo-code-67TYJIQR.js.map} +0 -0
- /package/dist/{trae-NWT3TMSZ.js.map → trae-7CZZGOGI.js.map} +0 -0
- /package/dist/{usage-E2A4O2CY.js.map → usage-ZFBVQF3H.js.map} +0 -0
- /package/dist/{zed-RH34TNSW.js.map → zed-SFUHL3GS.js.map} +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
-
marketplaceDoctorChecks
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
marketplaceDoctorChecks,
|
|
4
|
+
syncConnector
|
|
5
|
+
} from "./chunk-RIMVWCZY.js";
|
|
6
|
+
import "./chunk-QREL7LZJ.js";
|
|
6
7
|
import {
|
|
7
8
|
readMarketplaceInstalls
|
|
8
9
|
} from "./chunk-G5CQHVQG.js";
|
|
@@ -11,7 +12,7 @@ import {
|
|
|
11
12
|
parseScope,
|
|
12
13
|
parseTargets,
|
|
13
14
|
print
|
|
14
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-O5TWCIJN.js";
|
|
15
16
|
import {
|
|
16
17
|
LineBuffer,
|
|
17
18
|
idKey,
|
|
@@ -19,26 +20,28 @@ import {
|
|
|
19
20
|
} from "./chunk-OP4KBXUO.js";
|
|
20
21
|
import {
|
|
21
22
|
spawnChild
|
|
22
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-F5RX62T7.js";
|
|
23
24
|
import {
|
|
24
25
|
detectInstalledPlatforms
|
|
25
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-EGCBZ2DC.js";
|
|
26
27
|
import "./chunk-KHO5WNTP.js";
|
|
27
28
|
import {
|
|
28
29
|
findConnectorConfig,
|
|
29
30
|
listRegisteredConnectors,
|
|
30
|
-
loadConnectorFromPath
|
|
31
|
-
|
|
31
|
+
loadConnectorFromPath,
|
|
32
|
+
readRegisteredMeta
|
|
33
|
+
} from "./chunk-24IDL5RW.js";
|
|
32
34
|
import {
|
|
33
35
|
MCP_PROTOCOL_VERSION
|
|
34
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-4ENJK5S2.js";
|
|
35
37
|
import {
|
|
36
38
|
REGISTERED_PLATFORM_IDS,
|
|
37
39
|
loadAdapter
|
|
38
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-DCKFYWGM.js";
|
|
41
|
+
import "./chunk-FAHIMJRU.js";
|
|
39
42
|
import "./chunk-OPXAP3AC.js";
|
|
40
43
|
import "./chunk-7L6ITC4T.js";
|
|
41
|
-
import "./chunk-
|
|
44
|
+
import "./chunk-I5MLE6S7.js";
|
|
42
45
|
import "./chunk-N6HH7K6P.js";
|
|
43
46
|
import {
|
|
44
47
|
dataRoot,
|
|
@@ -228,37 +231,41 @@ async function resolveDoctorConnectors(connectorPath, projectDir) {
|
|
|
228
231
|
const configPath = connectorPath ?? findConnectorConfig(projectDir);
|
|
229
232
|
if (configPath) {
|
|
230
233
|
try {
|
|
231
|
-
const { connector } = await loadConnectorFromPath(configPath);
|
|
232
|
-
return [connector];
|
|
234
|
+
const { connector, modulePath } = await loadConnectorFromPath(configPath);
|
|
235
|
+
return [{ connector, modulePath }];
|
|
233
236
|
} catch {
|
|
234
237
|
}
|
|
235
238
|
}
|
|
236
239
|
const registered = listRegisteredConnectors();
|
|
237
|
-
if (registered.length > 0)
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
240
|
+
if (registered.length > 0) {
|
|
241
|
+
return registered.map((connector) => {
|
|
242
|
+
const meta = readRegisteredMeta(connector.id);
|
|
243
|
+
return { connector, modulePath: meta?.modulePath ?? "" };
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
const fallback = {
|
|
247
|
+
id: "agent-connector",
|
|
248
|
+
displayName: "agent-connector",
|
|
249
|
+
version: "0.0.0",
|
|
250
|
+
hooks: {},
|
|
251
|
+
hookEvents: [],
|
|
252
|
+
telemetry: {
|
|
253
|
+
enabled: true,
|
|
254
|
+
modelFamilyHint: "auto",
|
|
255
|
+
measureToolDefs: true,
|
|
256
|
+
hostNativeUsage: false,
|
|
257
|
+
store: "ndjson",
|
|
258
|
+
calibration: { anthropicCountTokens: false }
|
|
259
|
+
},
|
|
260
|
+
commands: [],
|
|
261
|
+
skills: [],
|
|
262
|
+
subagents: [],
|
|
263
|
+
memory: [],
|
|
264
|
+
actions: [],
|
|
265
|
+
platforms: {},
|
|
266
|
+
targets: "auto"
|
|
267
|
+
};
|
|
268
|
+
return [{ connector: fallback, modulePath: "" }];
|
|
262
269
|
}
|
|
263
270
|
function buildContext(connector, id, scope, projectDir) {
|
|
264
271
|
return {
|
|
@@ -270,6 +277,67 @@ function buildContext(connector, id, scope, projectDir) {
|
|
|
270
277
|
dryRun: true
|
|
271
278
|
};
|
|
272
279
|
}
|
|
280
|
+
async function collectDiagnostics(entries, ids, scope, projectDir) {
|
|
281
|
+
const multi = entries.length > 1;
|
|
282
|
+
const byPlatform = [];
|
|
283
|
+
const tagged = [];
|
|
284
|
+
let anyFail = false;
|
|
285
|
+
for (const id of ids) {
|
|
286
|
+
const adapter = await loadAdapter(id);
|
|
287
|
+
if (!adapter) {
|
|
288
|
+
const r = {
|
|
289
|
+
check: `${id}: adapter`,
|
|
290
|
+
status: "fail",
|
|
291
|
+
message: `no adapter registered for ${id}`
|
|
292
|
+
};
|
|
293
|
+
byPlatform.push({ platform: id, results: [r] });
|
|
294
|
+
anyFail = true;
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
const results = [];
|
|
298
|
+
for (let i = 0; i < entries.length; i++) {
|
|
299
|
+
const { connector } = entries[i];
|
|
300
|
+
if (connector.targets !== "auto" && !connector.targets.includes(id)) continue;
|
|
301
|
+
if (readMarketplaceInstalls(connector.id)[id]) {
|
|
302
|
+
const note = {
|
|
303
|
+
check: `${connector.id}: ${id} delivery`,
|
|
304
|
+
status: "pass",
|
|
305
|
+
message: "surfaces delivered via the marketplace plugin \u2014 see marketplace checks"
|
|
306
|
+
};
|
|
307
|
+
const tagged_note = multi ? { ...note, check: `(${connector.id}) ${note.check}` } : note;
|
|
308
|
+
results.push(tagged_note);
|
|
309
|
+
tagged.push({ result: tagged_note, entryIndex: i });
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
const ctx = buildContext(connector, id, scope, projectDir);
|
|
313
|
+
let r;
|
|
314
|
+
try {
|
|
315
|
+
r = adapter.doctor(ctx);
|
|
316
|
+
} catch (err) {
|
|
317
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
318
|
+
r = [{ check: `${adapter.name}: doctor`, status: "fail", message }];
|
|
319
|
+
}
|
|
320
|
+
const tagged_r = multi ? r.map((d) => ({ ...d, check: `(${connector.id}) ${d.check}` })) : r;
|
|
321
|
+
results.push(...tagged_r);
|
|
322
|
+
for (const tr of tagged_r) tagged.push({ result: tr, entryIndex: i });
|
|
323
|
+
}
|
|
324
|
+
if (results.some((d) => d.status === "fail")) anyFail = true;
|
|
325
|
+
byPlatform.push({ platform: id, results });
|
|
326
|
+
}
|
|
327
|
+
for (let i = 0; i < entries.length; i++) {
|
|
328
|
+
const { connector } = entries[i];
|
|
329
|
+
const groups = await marketplaceDoctorChecks(connector, scope, projectDir);
|
|
330
|
+
for (const group of groups) {
|
|
331
|
+
const tagged_g = multi ? group.results.map((d) => ({ ...d, check: `(${connector.id}) ${d.check}` })) : group.results;
|
|
332
|
+
if (tagged_g.some((d) => d.status === "fail")) anyFail = true;
|
|
333
|
+
for (const tg of tagged_g) tagged.push({ result: tg, entryIndex: i });
|
|
334
|
+
const bucket = byPlatform.find((b) => b.platform === group.platform);
|
|
335
|
+
if (bucket) bucket.results.push(...tagged_g);
|
|
336
|
+
else byPlatform.push({ platform: group.platform, results: tagged_g });
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return { byPlatform, tagged, anyFail };
|
|
340
|
+
}
|
|
273
341
|
async function run(argv) {
|
|
274
342
|
const { values } = parseArgs({
|
|
275
343
|
args: argv,
|
|
@@ -279,15 +347,17 @@ async function run(argv) {
|
|
|
279
347
|
connector: { type: "string" },
|
|
280
348
|
project: { type: "string" },
|
|
281
349
|
json: { type: "boolean", default: false },
|
|
282
|
-
probe: { type: "boolean", default: false }
|
|
350
|
+
probe: { type: "boolean", default: false },
|
|
351
|
+
heal: { type: "boolean", default: false },
|
|
352
|
+
"dry-run": { type: "boolean", default: false }
|
|
283
353
|
},
|
|
284
354
|
allowPositionals: false
|
|
285
355
|
});
|
|
286
356
|
const projectDir = values.project ?? process.cwd();
|
|
287
357
|
const scope = parseScope(values.scope);
|
|
288
358
|
if (scope == null) return fail(`invalid --scope "${values.scope}" (use user|project)`);
|
|
289
|
-
const
|
|
290
|
-
const
|
|
359
|
+
const entries = await resolveDoctorConnectors(values.connector, projectDir);
|
|
360
|
+
const connectors = entries.map((e) => e.connector);
|
|
291
361
|
const explicit = parseTargets(values.targets);
|
|
292
362
|
let ids;
|
|
293
363
|
if (explicit && explicit.length > 0) {
|
|
@@ -305,64 +375,120 @@ async function run(argv) {
|
|
|
305
375
|
print("doctor: no target platforms (none detected; pass --targets to force).");
|
|
306
376
|
return 0;
|
|
307
377
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
]
|
|
378
|
+
if (values.heal) {
|
|
379
|
+
const { tagged, anyFail: preFail } = await collectDiagnostics(
|
|
380
|
+
entries,
|
|
381
|
+
ids,
|
|
382
|
+
scope,
|
|
383
|
+
projectDir
|
|
384
|
+
);
|
|
385
|
+
const fixableByEntry = /* @__PURE__ */ new Map();
|
|
386
|
+
const deferredByEntry = /* @__PURE__ */ new Map();
|
|
387
|
+
for (const { result, entryIndex } of tagged) {
|
|
388
|
+
if (result.status === "pass") continue;
|
|
389
|
+
const canSync = !!entries[entryIndex].modulePath;
|
|
390
|
+
if (result.fixable && canSync) {
|
|
391
|
+
if (!fixableByEntry.has(entryIndex)) fixableByEntry.set(entryIndex, []);
|
|
392
|
+
fixableByEntry.get(entryIndex).push(result);
|
|
393
|
+
} else {
|
|
394
|
+
if (!deferredByEntry.has(entryIndex)) deferredByEntry.set(entryIndex, []);
|
|
395
|
+
deferredByEntry.get(entryIndex).push(result);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
if (values["dry-run"]) {
|
|
399
|
+
for (const [idx, fixable] of fixableByEntry) {
|
|
400
|
+
const { connector } = entries[idx];
|
|
401
|
+
print(
|
|
402
|
+
`would heal via sync (${connector.id}): ${fixable.map((r) => r.check).join(", ")}`
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
for (const [idx, deferred2] of deferredByEntry) {
|
|
406
|
+
const { connector } = entries[idx];
|
|
407
|
+
for (const r of deferred2) {
|
|
408
|
+
print(
|
|
409
|
+
`would defer (${connector.id}): ${r.check} \u2014 ${r.fix ?? "no auto-fix available"}`
|
|
410
|
+
);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
if (fixableByEntry.size === 0 && deferredByEntry.size === 0) {
|
|
414
|
+
print("doctor --heal --dry-run: nothing to heal.");
|
|
415
|
+
}
|
|
416
|
+
return 0;
|
|
417
|
+
}
|
|
418
|
+
for (const [idx] of fixableByEntry) {
|
|
419
|
+
const { connector, modulePath } = entries[idx];
|
|
420
|
+
await syncConnector({
|
|
421
|
+
connector,
|
|
422
|
+
modulePath,
|
|
423
|
+
scope,
|
|
424
|
+
projectDir,
|
|
425
|
+
targets: ids,
|
|
426
|
+
dryRun: false
|
|
322
427
|
});
|
|
323
|
-
anyFail = true;
|
|
324
|
-
continue;
|
|
325
428
|
}
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
429
|
+
const { tagged: postTagged, anyFail: postFail } = await collectDiagnostics(
|
|
430
|
+
entries,
|
|
431
|
+
ids,
|
|
432
|
+
scope,
|
|
433
|
+
projectDir
|
|
434
|
+
);
|
|
435
|
+
const preNonPass = new Set(
|
|
436
|
+
tagged.filter((t) => t.result.status !== "pass").map((t) => t.result.check)
|
|
437
|
+
);
|
|
438
|
+
const postNonPass = new Set(
|
|
439
|
+
postTagged.filter((t) => t.result.status !== "pass").map((t) => t.result.check)
|
|
440
|
+
);
|
|
441
|
+
const healed = [];
|
|
442
|
+
const stillFailing = [];
|
|
443
|
+
const deferred = [];
|
|
444
|
+
for (const check of preNonPass) {
|
|
445
|
+
if (!postNonPass.has(check)) healed.push(check);
|
|
446
|
+
}
|
|
447
|
+
for (const { result, entryIndex } of postTagged) {
|
|
448
|
+
if (result.status === "pass") continue;
|
|
449
|
+
const canSync = !!entries[entryIndex].modulePath;
|
|
450
|
+
if (result.fixable && canSync) {
|
|
451
|
+
stillFailing.push(result);
|
|
452
|
+
} else {
|
|
453
|
+
deferred.push(result);
|
|
337
454
|
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
455
|
+
}
|
|
456
|
+
if (values.json) {
|
|
457
|
+
print(JSON.stringify({ healed, deferred, stillFailing }, null, 2));
|
|
458
|
+
return postFail ? 1 : 0;
|
|
459
|
+
}
|
|
460
|
+
if (healed.length > 0) {
|
|
461
|
+
print(`healed (${healed.length}):`);
|
|
462
|
+
for (const c of healed) print(` [pass] ${c}`);
|
|
463
|
+
print("");
|
|
464
|
+
}
|
|
465
|
+
if (stillFailing.length > 0) {
|
|
466
|
+
print(`still failing after sync (${stillFailing.length}):`);
|
|
467
|
+
for (const r of stillFailing) {
|
|
468
|
+
print(` ${STATUS_GLYPH[r.status]} ${r.check} \u2014 ${r.message}`);
|
|
469
|
+
if (r.fix) print(` fix: ${r.fix}`);
|
|
345
470
|
}
|
|
346
|
-
|
|
347
|
-
...multi ? r.map((d) => ({ ...d, check: `(${connector.id}) ${d.check}` })) : r
|
|
348
|
-
);
|
|
471
|
+
print("");
|
|
349
472
|
}
|
|
350
|
-
if (
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
473
|
+
if (deferred.length > 0) {
|
|
474
|
+
print(`deferred \u2014 requires manual action (${deferred.length}):`);
|
|
475
|
+
for (const r of deferred) {
|
|
476
|
+
print(` ${STATUS_GLYPH[r.status]} ${r.check} \u2014 ${r.message}`);
|
|
477
|
+
if (r.fix) print(` fix: ${r.fix}`);
|
|
478
|
+
}
|
|
479
|
+
print("");
|
|
480
|
+
}
|
|
481
|
+
if (healed.length === 0 && stillFailing.length === 0 && deferred.length === 0 && !preFail) {
|
|
482
|
+
print("doctor --heal: nothing to heal, all checks passed.");
|
|
483
|
+
} else if (stillFailing.length === 0 && deferred.length === 0) {
|
|
484
|
+
print("doctor --heal: all fixable findings resolved.");
|
|
361
485
|
}
|
|
486
|
+
return postFail ? 1 : 0;
|
|
362
487
|
}
|
|
488
|
+
const { byPlatform, anyFail } = await collectDiagnostics(entries, ids, scope, projectDir);
|
|
363
489
|
const probes = [];
|
|
364
490
|
if (values.probe) {
|
|
365
|
-
for (const connector of
|
|
491
|
+
for (const { connector } of entries) {
|
|
366
492
|
const s = connector.server;
|
|
367
493
|
if (!s || s.transport !== "stdio" || !s.command) {
|
|
368
494
|
probes.push({
|
|
@@ -381,13 +507,13 @@ async function run(argv) {
|
|
|
381
507
|
label: connector.id,
|
|
382
508
|
...s.env ? { env: s.env } : {}
|
|
383
509
|
});
|
|
384
|
-
if (results.some((d) => d.status === "fail")) anyFail = true;
|
|
385
510
|
probes.push({ connector: connector.id, results });
|
|
386
511
|
}
|
|
387
512
|
}
|
|
513
|
+
const probesFail = probes.some((p) => p.results.some((r) => r.status === "fail"));
|
|
388
514
|
if (values.json) {
|
|
389
515
|
print(JSON.stringify(values.probe ? { platforms: byPlatform, probes } : byPlatform, null, 2));
|
|
390
|
-
return anyFail ? 1 : 0;
|
|
516
|
+
return anyFail || probesFail ? 1 : 0;
|
|
391
517
|
}
|
|
392
518
|
for (const { platform, results } of byPlatform) {
|
|
393
519
|
print(`${platform}:`);
|
|
@@ -405,10 +531,10 @@ async function run(argv) {
|
|
|
405
531
|
}
|
|
406
532
|
print("");
|
|
407
533
|
}
|
|
408
|
-
print(anyFail ? "doctor: one or more checks FAILED." : "doctor: all checks passed.");
|
|
409
|
-
return anyFail ? 1 : 0;
|
|
534
|
+
print(anyFail || probesFail ? "doctor: one or more checks FAILED." : "doctor: all checks passed.");
|
|
535
|
+
return anyFail || probesFail ? 1 : 0;
|
|
410
536
|
}
|
|
411
537
|
export {
|
|
412
538
|
run
|
|
413
539
|
};
|
|
414
|
-
//# sourceMappingURL=doctor-
|
|
540
|
+
//# sourceMappingURL=doctor-FLZF34Y3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/commands/doctor.ts","../src/runtime/probe.ts"],"sourcesContent":["/**\n * cli/commands/doctor — health-check every detected platform.\n *\n * For each detected host (or the explicit --targets list) we load its adapter,\n * build a uniform InstallContext, and run adapter.doctor(ctx). Results are\n * printed as pass/warn/fail with any suggested fix. Exit code is non-zero when\n * any check fails (warns alone do not fail the command).\n *\n * The connector context comes from the local config when present; otherwise a\n * minimal id-only connector is used so path-only checks still run.\n */\n\nimport { parseArgs } from \"node:util\";\n\nimport type {\n DiagnosticResult,\n InstallScope,\n PlatformId,\n ResolvedConnector,\n} from \"../../core/types.js\";\nimport type { InstallContext } from \"../../adapters/spi.js\";\nimport { detectInstalledPlatforms } from \"../../adapters/detect.js\";\nimport { loadAdapter, REGISTERED_PLATFORM_IDS } from \"../../adapters/registry.js\";\nimport {\n findConnectorConfig,\n listRegisteredConnectors,\n loadConnectorFromPath,\n readRegisteredMeta,\n} from \"../../core/load-connector.js\";\nimport { syncConnector } from \"../../core/installer.js\";\nimport { marketplaceDoctorChecks } from \"../../core/marketplace.js\";\nimport { readMarketplaceInstalls } from \"../../core/marketplace-state.js\";\nimport { dataRoot, homeBinPath } from \"../../core/paths.js\";\nimport { probeStdioServer } from \"../../runtime/probe.js\";\nimport { fail, parseScope, parseTargets, print } from \"../app.js\";\n\nconst STATUS_GLYPH: Record<DiagnosticResult[\"status\"], string> = {\n pass: \"[pass]\",\n warn: \"[warn]\",\n fail: \"[FAIL]\",\n};\n\n/** A resolved connector together with the path to its source module. */\ninterface ConnectorEntry {\n connector: ResolvedConnector;\n /** Absolute path to the connector source (JSON or JS/TS). Used by syncConnector. */\n modulePath: string;\n}\n\n/**\n * Resolve which connector(s) doctor should health-check, in precedence order:\n * 1. An explicit --connector path, or a local agent-connector.config.* file.\n * 2. Every connector registered under the data-root (what is actually\n * installed). This is the common case — `doctor` from anywhere reports on\n * the real installs, not a guess from the working directory.\n * 3. A minimal id-only placeholder so path-only checks still run.\n */\nasync function resolveDoctorConnectors(\n connectorPath: string | undefined,\n projectDir: string,\n): Promise<ConnectorEntry[]> {\n const configPath = connectorPath ?? findConnectorConfig(projectDir);\n if (configPath) {\n try {\n const { connector, modulePath } = await loadConnectorFromPath(configPath);\n return [{ connector, modulePath }];\n } catch {\n /* fall through */\n }\n }\n\n const registered = listRegisteredConnectors();\n if (registered.length > 0) {\n return registered.map((connector) => {\n const meta = readRegisteredMeta(connector.id);\n return { connector, modulePath: meta?.modulePath ?? \"\" };\n });\n }\n\n const fallback: ResolvedConnector = {\n id: \"agent-connector\",\n displayName: \"agent-connector\",\n version: \"0.0.0\",\n hooks: {},\n hookEvents: [],\n telemetry: {\n enabled: true,\n modelFamilyHint: \"auto\",\n measureToolDefs: true,\n hostNativeUsage: false,\n store: \"ndjson\",\n calibration: { anthropicCountTokens: false },\n },\n commands: [],\n skills: [],\n subagents: [],\n memory: [],\n actions: [],\n platforms: {},\n targets: \"auto\",\n };\n return [{ connector: fallback, modulePath: \"\" }];\n}\n\nfunction buildContext(\n connector: ResolvedConnector,\n id: PlatformId,\n scope: InstallScope,\n projectDir: string,\n): InstallContext {\n return {\n connector,\n scope: connector.platforms[id]?.scope ?? scope,\n projectDir,\n homeBinPath: homeBinPath(),\n dataRoot: dataRoot(),\n dryRun: true,\n };\n}\n\n/** Collected diagnostics tagged with the connector entry they came from. */\ninterface TaggedResult {\n result: DiagnosticResult;\n /** Index into the entries array — used to group by connector for heal. */\n entryIndex: number;\n}\n\n/**\n * Run all diagnostic checks for the given entries/ids and return tagged results\n * plus the flat byPlatform buckets for display.\n */\nasync function collectDiagnostics(\n entries: ConnectorEntry[],\n ids: PlatformId[],\n scope: InstallScope,\n projectDir: string,\n): Promise<{\n byPlatform: { platform: PlatformId; results: DiagnosticResult[] }[];\n tagged: TaggedResult[];\n anyFail: boolean;\n}> {\n const multi = entries.length > 1;\n const byPlatform: { platform: PlatformId; results: DiagnosticResult[] }[] = [];\n const tagged: TaggedResult[] = [];\n let anyFail = false;\n\n for (const id of ids) {\n const adapter = await loadAdapter(id);\n if (!adapter) {\n const r: DiagnosticResult = {\n check: `${id}: adapter`,\n status: \"fail\",\n message: `no adapter registered for ${id}`,\n };\n byPlatform.push({ platform: id, results: [r] });\n anyFail = true;\n continue;\n }\n const results: DiagnosticResult[] = [];\n for (let i = 0; i < entries.length; i++) {\n const { connector } = entries[i]!;\n // A connector with an explicit target list is only checked on those hosts.\n if (connector.targets !== \"auto\" && !connector.targets.includes(id)) continue;\n\n // MARKETPLACE-installed on this host: its surfaces are delivered via the\n // host's plugin (in the plugin cache), NOT the direct-config locations the\n // adapter's doctor() inspects — so the direct checks would falsely FAIL\n // (mcp_servers/command/skill \"not found\"). Skip them; the marketplace-method\n // checks below cover this install's real health.\n if (readMarketplaceInstalls(connector.id)[id]) {\n const note: DiagnosticResult = {\n check: `${connector.id}: ${id} delivery`,\n status: \"pass\",\n message: \"surfaces delivered via the marketplace plugin — see marketplace checks\",\n };\n const tagged_note = multi ? { ...note, check: `(${connector.id}) ${note.check}` } : note;\n results.push(tagged_note);\n tagged.push({ result: tagged_note, entryIndex: i });\n continue;\n }\n\n const ctx = buildContext(connector, id, scope, projectDir);\n let r: DiagnosticResult[];\n try {\n r = adapter.doctor(ctx);\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n r = [{ check: `${adapter.name}: doctor`, status: \"fail\", message }];\n }\n // When checking multiple connectors, tag each check with the connector id.\n const tagged_r = multi ? r.map((d) => ({ ...d, check: `(${connector.id}) ${d.check}` })) : r;\n results.push(...tagged_r);\n for (const tr of tagged_r) tagged.push({ result: tr, entryIndex: i });\n }\n if (results.some((d) => d.status === \"fail\")) anyFail = true;\n byPlatform.push({ platform: id, results });\n }\n\n // ── Marketplace-method checks ─────────────────────────────────────────────\n for (let i = 0; i < entries.length; i++) {\n const { connector } = entries[i]!;\n const groups = await marketplaceDoctorChecks(connector, scope, projectDir);\n for (const group of groups) {\n const tagged_g = multi\n ? group.results.map((d) => ({ ...d, check: `(${connector.id}) ${d.check}` }))\n : group.results;\n if (tagged_g.some((d) => d.status === \"fail\")) anyFail = true;\n for (const tg of tagged_g) tagged.push({ result: tg, entryIndex: i });\n const bucket = byPlatform.find((b) => b.platform === group.platform);\n if (bucket) bucket.results.push(...tagged_g);\n else byPlatform.push({ platform: group.platform, results: tagged_g });\n }\n }\n\n return { byPlatform, tagged, anyFail };\n}\n\nexport async function run(argv: string[]): Promise<number> {\n const { values } = parseArgs({\n args: argv,\n options: {\n scope: { type: \"string\", default: \"user\" },\n targets: { type: \"string\" },\n connector: { type: \"string\" },\n project: { type: \"string\" },\n json: { type: \"boolean\", default: false },\n probe: { type: \"boolean\", default: false },\n heal: { type: \"boolean\", default: false },\n \"dry-run\": { type: \"boolean\", default: false },\n },\n allowPositionals: false,\n });\n\n const projectDir = values.project ?? process.cwd();\n\n const scope = parseScope(values.scope);\n if (scope == null) return fail(`invalid --scope \"${values.scope}\" (use user|project)`);\n\n const entries = await resolveDoctorConnectors(values.connector, projectDir);\n const connectors = entries.map((e) => e.connector);\n\n // Target set: explicit --targets (intersected with the registry), else the\n // same chain install uses — connector-declared targets ∩ detected platforms\n // (\"auto\" = everything detected). Without this, doctor red-flags every\n // detected host the connector never targeted (found dogfooding context-mode:\n // targets:[5 ids] installed clean, doctor FAILed the other 9 detected hosts).\n const explicit = parseTargets(values.targets);\n let ids: PlatformId[];\n if (explicit && explicit.length > 0) {\n ids = explicit.filter((id) => REGISTERED_PLATFORM_IDS.has(id));\n } else {\n const detected = await detectInstalledPlatforms(projectDir);\n ids = detected.map((p) => p.id);\n const anyAuto = connectors.some((c) => c.targets === \"auto\");\n if (!anyAuto) {\n const targeted = new Set(connectors.flatMap((c) => c.targets as PlatformId[]));\n ids = ids.filter((id) => targeted.has(id));\n }\n }\n\n if (ids.length === 0 && !values.probe) {\n print(\"doctor: no target platforms (none detected; pass --targets to force).\");\n return 0;\n }\n\n // ── Heal path ─────────────────────────────────────────────────────────────\n if (values.heal) {\n const { tagged, anyFail: preFail } = await collectDiagnostics(\n entries,\n ids,\n scope,\n projectDir,\n );\n\n // Partition: fixable vs deferred (non-pass, not fixable)\n const fixableByEntry = new Map<number, DiagnosticResult[]>();\n const deferredByEntry = new Map<number, DiagnosticResult[]>();\n for (const { result, entryIndex } of tagged) {\n if (result.status === \"pass\") continue;\n // A finding is only HEALABLE if it is fixable AND its connector has a\n // module path we can re-sync from. A placeholder/unregistered connector\n // (empty modulePath) must NEVER be synced — doing so would fabricate a\n // bogus registry record via registerConnector(connector, \"\"). Route its\n // fixable findings to deferred instead.\n const canSync = !!entries[entryIndex]!.modulePath;\n if (result.fixable && canSync) {\n if (!fixableByEntry.has(entryIndex)) fixableByEntry.set(entryIndex, []);\n fixableByEntry.get(entryIndex)!.push(result);\n } else {\n if (!deferredByEntry.has(entryIndex)) deferredByEntry.set(entryIndex, []);\n deferredByEntry.get(entryIndex)!.push(result);\n }\n }\n\n if (values[\"dry-run\"]) {\n // Dry-run: print what would happen, write nothing.\n for (const [idx, fixable] of fixableByEntry) {\n const { connector } = entries[idx]!;\n print(\n `would heal via sync (${connector.id}): ${fixable.map((r) => r.check).join(\", \")}`,\n );\n }\n for (const [idx, deferred] of deferredByEntry) {\n const { connector } = entries[idx]!;\n for (const r of deferred) {\n print(\n `would defer (${connector.id}): ${r.check} — ${r.fix ?? \"no auto-fix available\"}`,\n );\n }\n }\n if (fixableByEntry.size === 0 && deferredByEntry.size === 0) {\n print(\"doctor --heal --dry-run: nothing to heal.\");\n }\n return 0;\n }\n\n // Real heal: sync each connector that has fixable findings.\n for (const [idx] of fixableByEntry) {\n const { connector, modulePath } = entries[idx]!;\n await syncConnector({\n connector,\n modulePath,\n scope,\n projectDir,\n targets: ids,\n dryRun: false,\n });\n }\n\n // Re-run diagnostics to compute what changed.\n const { tagged: postTagged, anyFail: postFail } = await collectDiagnostics(\n entries,\n ids,\n scope,\n projectDir,\n );\n\n // Classify post-heal results.\n const preNonPass = new Set(\n tagged\n .filter((t) => t.result.status !== \"pass\")\n .map((t) => t.result.check),\n );\n const postNonPass = new Set(\n postTagged\n .filter((t) => t.result.status !== \"pass\")\n .map((t) => t.result.check),\n );\n\n const healed: string[] = [];\n const stillFailing: DiagnosticResult[] = [];\n const deferred: DiagnosticResult[] = [];\n\n // Healed = was non-pass before, now pass\n for (const check of preNonPass) {\n if (!postNonPass.has(check)) healed.push(check);\n }\n // Post-heal non-pass findings. Classify consistently with the pre-heal\n // partition: a fixable finding we could not sync (no modulePath) is deferred,\n // not \"still failing after sync\" — we never attempted a sync for it.\n for (const { result, entryIndex } of postTagged) {\n if (result.status === \"pass\") continue;\n const canSync = !!entries[entryIndex]!.modulePath;\n if (result.fixable && canSync) {\n stillFailing.push(result);\n } else {\n deferred.push(result);\n }\n }\n\n if (values.json) {\n print(JSON.stringify({ healed, deferred, stillFailing }, null, 2));\n return postFail ? 1 : 0;\n }\n\n if (healed.length > 0) {\n print(`healed (${healed.length}):`);\n for (const c of healed) print(` [pass] ${c}`);\n print(\"\");\n }\n if (stillFailing.length > 0) {\n print(`still failing after sync (${stillFailing.length}):`);\n for (const r of stillFailing) {\n print(` ${STATUS_GLYPH[r.status]} ${r.check} — ${r.message}`);\n if (r.fix) print(` fix: ${r.fix}`);\n }\n print(\"\");\n }\n if (deferred.length > 0) {\n print(`deferred — requires manual action (${deferred.length}):`);\n for (const r of deferred) {\n print(` ${STATUS_GLYPH[r.status]} ${r.check} — ${r.message}`);\n if (r.fix) print(` fix: ${r.fix}`);\n }\n print(\"\");\n }\n if (healed.length === 0 && stillFailing.length === 0 && deferred.length === 0 && !preFail) {\n print(\"doctor --heal: nothing to heal, all checks passed.\");\n } else if (stillFailing.length === 0 && deferred.length === 0) {\n print(\"doctor --heal: all fixable findings resolved.\");\n }\n return postFail ? 1 : 0;\n }\n\n // ── Normal diagnose path (no --heal) ─────────────────────────────────────\n const { byPlatform, anyFail } = await collectDiagnostics(entries, ids, scope, projectDir);\n\n // ── Live MCP probe (--probe): connector-scoped, not platform-scoped ──────\n // Spawns each connector's REAL stdio server and runs initialize → ping →\n // tools/list. Probe FAILs fold into the doctor exit code.\n const probes: { connector: string; results: DiagnosticResult[] }[] = [];\n if (values.probe) {\n for (const { connector } of entries) {\n const s = connector.server;\n if (!s || s.transport !== \"stdio\" || !s.command) {\n probes.push({\n connector: connector.id,\n results: [\n {\n check: `${connector.id}: MCP probe`,\n status: \"warn\",\n message: s\n ? `transport \"${s.transport}\" is not stdio — live probe skipped`\n : \"no server to probe\",\n },\n ],\n });\n continue;\n }\n const results = await probeStdioServer(s.command, s.args ?? [], {\n label: connector.id,\n ...(s.env ? { env: s.env } : {}),\n });\n probes.push({ connector: connector.id, results });\n }\n }\n\n const probesFail = probes.some((p) => p.results.some((r) => r.status === \"fail\"));\n\n if (values.json) {\n print(JSON.stringify(values.probe ? { platforms: byPlatform, probes } : byPlatform, null, 2));\n return anyFail || probesFail ? 1 : 0;\n }\n\n for (const { platform, results } of byPlatform) {\n print(`${platform}:`);\n for (const r of results) {\n print(` ${STATUS_GLYPH[r.status]} ${r.check} — ${r.message}`);\n if (r.fix) print(` fix: ${r.fix}`);\n }\n print(\"\");\n }\n for (const { connector, results } of probes) {\n print(`probe ${connector}:`);\n for (const r of results) {\n print(` ${STATUS_GLYPH[r.status]} ${r.check} — ${r.message}`);\n if (r.fix) print(` fix: ${r.fix}`);\n }\n print(\"\");\n }\n print(anyFail || probesFail ? \"doctor: one or more checks FAILED.\" : \"doctor: all checks passed.\");\n return anyFail || probesFail ? 1 : 0;\n}\n","/**\n * runtime/probe — a live MCP connection-lifecycle probe for `doctor --probe`.\n *\n * Where `doctor` checks files on disk, this spawns the connector's REAL stdio\n * server and speaks the MCP wire protocol to it: initialize → (read negotiated\n * protocolVersion + capabilities + serverInfo) → notifications/initialized →\n * ping (liveness) → tools/list (gated on the tools capability). It reuses the\n * SAME newline-delimited JSON-RPC framing + id-correlation as the telemetry\n * proxy (telemetry/jsonrpc), so the probe and the serve path read the wire\n * identically. Each step becomes a DiagnosticResult so doctor renders/aggregates\n * it uniformly; a dead/unlaunchable server FAILs (non-zero doctor exit).\n *\n * Negotiation rule: we OFFER {@link MCP_PROTOCOL_VERSION} but ACCEPT whatever\n * version the server returns (we only report it), per the spec — never a\n * hardcoded equality. There is no MCP shutdown message; we close stdin then\n * SIGTERM/SIGKILL.\n */\n\nimport type { DiagnosticResult } from \"../core/types.js\";\nimport { MCP_PROTOCOL_VERSION } from \"../core/mcp-standard.js\";\nimport { spawnChild } from \"../core/spawn-child.js\";\nimport { type JsonRpcMessage, LineBuffer, idKey, isObject } from \"../telemetry/jsonrpc.js\";\n\nconst DEFAULT_TIMEOUT_MS = 5000;\n\nexport interface ProbeOptions {\n /** Per-step timeout in ms (default 5000). */\n timeoutMs?: number;\n /** Prefix for each DiagnosticResult.check (e.g. the connector id). */\n label?: string;\n /** Env merged over process.env for the spawned server (${env:VAR} resolved). */\n env?: Record<string, string>;\n /** Protocol version offered in initialize. Default {@link MCP_PROTOCOL_VERSION}. */\n protocolVersion?: string;\n}\n\nfunction diag(\n status: DiagnosticResult[\"status\"],\n check: string,\n message: string,\n fix?: string,\n): DiagnosticResult {\n return { check, status, message, ...(fix ? { fix } : {}) };\n}\n\nfunction errMsg(e: unknown): string {\n return e instanceof Error ? e.message : String(e);\n}\n\n/** Resolve `${env:VAR}` references in env values against the current process env. */\nfunction resolveEnv(env: Record<string, string> | undefined): Record<string, string> {\n const out: Record<string, string> = {};\n for (const [k, v] of Object.entries(env ?? {})) {\n out[k] = v.replace(/\\$\\{env:([A-Za-z_][A-Za-z0-9_]*)\\}/g, (_m, name) => process.env[name] ?? \"\");\n }\n return out;\n}\n\n/**\n * Spawn the stdio MCP server `command args` and run a real lifecycle probe.\n * Always resolves (never rejects) with one DiagnosticResult per step.\n */\nexport async function probeStdioServer(\n command: string,\n args: string[],\n opts: ProbeOptions = {},\n): Promise<DiagnosticResult[]> {\n const label = opts.label ? `${opts.label}: ` : \"\";\n const timeoutMs = opts.timeoutMs ?? DEFAULT_TIMEOUT_MS;\n const protocolVersion = opts.protocolVersion ?? MCP_PROTOCOL_VERSION;\n const results: DiagnosticResult[] = [];\n\n // spawnChild resolves a bare Windows package runner (npx/uvx → .cmd/.exe) so\n // the probe agrees with the live serve path; no-op on macOS/Linux.\n const child = spawnChild(command, args, {\n stdio: [\"pipe\", \"pipe\", \"inherit\"],\n env: { ...process.env, ...resolveEnv(opts.env) },\n });\n\n interface Pending {\n resolve: (m: JsonRpcMessage) => void;\n reject: (e: Error) => void;\n }\n const pending = new Map<string, Pending>();\n let spawnErr: Error | null = null;\n let exitCode: number | null = null;\n\n const rejectAll = (e: Error): void => {\n for (const p of pending.values()) p.reject(e);\n pending.clear();\n };\n child.on(\"error\", (e) => {\n spawnErr = e;\n rejectAll(e);\n });\n child.on(\"exit\", (code) => {\n exitCode = code ?? 0;\n rejectAll(new Error(`server exited (code ${exitCode}) before responding`));\n });\n\n const lines = new LineBuffer((line) => {\n let parsed: unknown;\n try {\n parsed = JSON.parse(line);\n } catch {\n return; // non-JSON stdout noise — ignore\n }\n if (!isObject(parsed)) return;\n const k = idKey((parsed as JsonRpcMessage).id);\n if (k && pending.has(k)) {\n const p = pending.get(k)!;\n pending.delete(k);\n p.resolve(parsed as JsonRpcMessage);\n }\n });\n child.stdout?.on(\"data\", (c: Buffer) => lines.push(c));\n\n const send = (m: JsonRpcMessage): void => {\n if (child.stdin && child.stdin.writable) child.stdin.write(`${JSON.stringify(m)}\\n`);\n };\n const request = (id: number | string, method: string, params?: unknown): Promise<JsonRpcMessage> => {\n const key = idKey(id)!;\n return new Promise<JsonRpcMessage>((resolve, reject) => {\n const timer = setTimeout(() => {\n pending.delete(key);\n reject(new Error(`no response within ${timeoutMs}ms`));\n }, timeoutMs);\n if (typeof timer.unref === \"function\") timer.unref();\n pending.set(key, {\n resolve: (m) => {\n clearTimeout(timer);\n resolve(m);\n },\n reject: (e) => {\n clearTimeout(timer);\n reject(e);\n },\n });\n send({ jsonrpc: \"2.0\", id, method, ...(params !== undefined ? { params } : {}) });\n });\n };\n\n const cleanup = (): DiagnosticResult[] => {\n try {\n if (child.stdin && child.stdin.writable) child.stdin.end();\n } catch {\n /* ignore */\n }\n try {\n child.kill(\"SIGTERM\");\n } catch {\n /* ignore */\n }\n const killTimer = setTimeout(() => {\n try {\n child.kill(\"SIGKILL\");\n } catch {\n /* ignore */\n }\n }, 500);\n if (typeof killTimer.unref === \"function\") killTimer.unref();\n return results;\n };\n\n // 1. initialize\n let initResult: Record<string, unknown>;\n try {\n const res = await request(1, \"initialize\", {\n protocolVersion,\n capabilities: {},\n clientInfo: { name: \"agent-connector-probe\", version: \"1\" },\n });\n if (isObject(res.error)) {\n results.push(\n diag(\"fail\", `${label}MCP initialize`, `server returned error: ${JSON.stringify(res.error)}`),\n );\n return cleanup();\n }\n initResult = isObject(res.result) ? res.result : {};\n } catch (e) {\n if (spawnErr) {\n results.push(\n diag(\n \"fail\",\n `${label}MCP initialize`,\n `server not launchable: ${errMsg(spawnErr)}`,\n `check that \"${command}\" is installed and on PATH`,\n ),\n );\n } else if (exitCode !== null) {\n // On Windows an unresolvable command surfaces as an early non-zero exit\n // (cmd.exe \"command not found\") rather than a spawn 'error' event, so fold\n // the not-launchable hint in here too — useful whether the command is\n // missing or the server genuinely crashed before initialize.\n results.push(\n diag(\n \"fail\",\n `${label}MCP initialize`,\n `server not launchable, or it exited (code ${exitCode}) before initialize`,\n `check that \"${command}\" is installed and on PATH`,\n ),\n );\n } else {\n results.push(diag(\"fail\", `${label}MCP initialize`, errMsg(e)));\n }\n return cleanup();\n }\n\n const serverInfo = isObject(initResult.serverInfo) ? initResult.serverInfo : {};\n const sName = typeof serverInfo.name === \"string\" ? serverInfo.name : \"unknown\";\n const sVer = typeof serverInfo.version === \"string\" ? serverInfo.version : \"?\";\n const negotiated =\n typeof initResult.protocolVersion === \"string\" ? initResult.protocolVersion : \"(none)\";\n results.push(diag(\"pass\", `${label}MCP initialize`, `serverInfo ${sName}@${sVer}, protocol ${negotiated}`));\n\n // capabilities (presence = feature offered)\n const caps = isObject(initResult.capabilities) ? initResult.capabilities : {};\n const capNames = [\"tools\", \"resources\", \"prompts\", \"logging\", \"completions\"].filter((c) => c in caps);\n results.push(\n diag(\"pass\", `${label}capabilities`, capNames.length > 0 ? capNames.join(\", \") : \"(none advertised)\"),\n );\n\n // 2. initialized notification (required before normal requests)\n send({ jsonrpc: \"2.0\", method: \"notifications/initialized\" });\n\n // 3. ping — liveness confirm (warn, not fail, on timeout)\n try {\n await request(\"probe-ping\", \"ping\");\n results.push(diag(\"pass\", `${label}ping`, \"alive\"));\n } catch (e) {\n results.push(diag(\"warn\", `${label}ping`, `no ping response (${errMsg(e)})`));\n }\n\n // 4. tools/list — only if the server advertised a tools capability\n if (\"tools\" in caps) {\n try {\n const res = await request(2, \"tools/list\", {});\n const r = isObject(res.result) ? res.result : {};\n const tools = Array.isArray(r.tools) ? r.tools : [];\n results.push(diag(\"pass\", `${label}tools/list`, `${tools.length} tool(s)`));\n } catch (e) {\n results.push(diag(\"fail\", `${label}tools/list`, `no tools/list response (${errMsg(e)})`));\n }\n } else {\n results.push(\n diag(\"warn\", `${label}tools/list`, \"skipped — server advertised no tools capability\"),\n );\n }\n\n return cleanup();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,SAAS,iBAAiB;;;ACW1B,IAAM,qBAAqB;AAa3B,SAAS,KACP,QACA,OACA,SACA,KACkB;AAClB,SAAO,EAAE,OAAO,QAAQ,SAAS,GAAI,MAAM,EAAE,IAAI,IAAI,CAAC,EAAG;AAC3D;AAEA,SAAS,OAAO,GAAoB;AAClC,SAAO,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC;AAClD;AAGA,SAAS,WAAW,KAAiE;AACnF,QAAM,MAA8B,CAAC;AACrC,aAAW,C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