@ken-jo/agent-connector 0.3.0 → 0.3.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.
Files changed (36) hide show
  1. package/README.md +12 -8
  2. package/dist/{chunk-DS3LUFVN.js → chunk-3RBLIHPZ.js} +15 -15
  3. package/dist/{chunk-44HUXXC6.js → chunk-G5CQHVQG.js} +232 -5
  4. package/dist/chunk-G5CQHVQG.js.map +1 -0
  5. package/dist/{chunk-QADSG2JY.js → chunk-KMAKDD3Z.js} +1130 -109
  6. package/dist/chunk-KMAKDD3Z.js.map +1 -0
  7. package/dist/cli/sdk.js +1 -1
  8. package/dist/cli.js +1 -1
  9. package/dist/{detect-MNDHGLSV.js → detect-U3E7NVNW.js} +2 -2
  10. package/dist/{doctor-N5KZDD55.js → doctor-DZTWED4O.js} +4 -4
  11. package/dist/{hook-7LUOKIXH.js → hook-EVY7LOUQ.js} +2 -2
  12. package/dist/{install-TQTT4F3I.js → install-OWAS5UIE.js} +4 -4
  13. package/dist/{leaderboard-MUJ7DURM.js → leaderboard-CSWHI4UY.js} +2 -2
  14. package/dist/{package-SYPA5POO.js → package-WFOS4QVU.js} +2 -2
  15. package/dist/{serve-XJOSA7BY.js → serve-3C2VFPAY.js} +2 -2
  16. package/dist/{status-DYSS6BOR.js → status-MKQYX5MW.js} +3 -3
  17. package/dist/{telemetry-IJ4GP2Q3.js → telemetry-3DN6XGYB.js} +2 -2
  18. package/dist/{uninstall-3DXIBRCV.js → uninstall-WG6PFWF3.js} +4 -4
  19. package/dist/{upgrade-GJEB3ITY.js → upgrade-32NC2RKI.js} +4 -4
  20. package/dist/{usage-2BJLM3GJ.js → usage-CJOM2WQM.js} +2 -2
  21. package/package.json +1 -1
  22. package/dist/chunk-44HUXXC6.js.map +0 -1
  23. package/dist/chunk-QADSG2JY.js.map +0 -1
  24. /package/dist/{chunk-DS3LUFVN.js.map → chunk-3RBLIHPZ.js.map} +0 -0
  25. /package/dist/{detect-MNDHGLSV.js.map → detect-U3E7NVNW.js.map} +0 -0
  26. /package/dist/{doctor-N5KZDD55.js.map → doctor-DZTWED4O.js.map} +0 -0
  27. /package/dist/{hook-7LUOKIXH.js.map → hook-EVY7LOUQ.js.map} +0 -0
  28. /package/dist/{install-TQTT4F3I.js.map → install-OWAS5UIE.js.map} +0 -0
  29. /package/dist/{leaderboard-MUJ7DURM.js.map → leaderboard-CSWHI4UY.js.map} +0 -0
  30. /package/dist/{package-SYPA5POO.js.map → package-WFOS4QVU.js.map} +0 -0
  31. /package/dist/{serve-XJOSA7BY.js.map → serve-3C2VFPAY.js.map} +0 -0
  32. /package/dist/{status-DYSS6BOR.js.map → status-MKQYX5MW.js.map} +0 -0
  33. /package/dist/{telemetry-IJ4GP2Q3.js.map → telemetry-3DN6XGYB.js.map} +0 -0
  34. /package/dist/{uninstall-3DXIBRCV.js.map → uninstall-WG6PFWF3.js.map} +0 -0
  35. /package/dist/{upgrade-GJEB3ITY.js.map → upgrade-32NC2RKI.js.map} +0 -0
  36. /package/dist/{usage-2BJLM3GJ.js.map → usage-CJOM2WQM.js.map} +0 -0
package/README.md CHANGED
@@ -14,7 +14,7 @@
14
14
  ![install verified](https://img.shields.io/badge/install%20verified-29%2F29-22c55e)
15
15
  ![headless runtime](https://img.shields.io/badge/headless%20runtime-10%20CLIs%20activated-22c55e)
16
16
  ![marketplace](https://img.shields.io/badge/package-9%20marketplace%20formats-2563eb)
17
- ![tests](https://img.shields.io/badge/tests-1438%20passing-22c55e)
17
+ ![tests](https://img.shields.io/badge/tests-1483%20passing-22c55e)
18
18
 
19
19
  ## Who this is for
20
20
 
@@ -102,7 +102,7 @@ installed into an isolated environment for every adapter and inspected on disk:
102
102
  - **Clean uninstall + `--purge`.** Every installed surface reverses; `--purge`
103
103
  deregisters the connector record and tears down the home binary when no
104
104
  connectors remain (29 / 29).
105
- - **1438 tests passing** · `tsc` clean · build green.
105
+ - **1483 tests passing** · `tsc` clean · build green.
106
106
 
107
107
  The 0.2.0 additions — the `memory` surface, the `nativeHooks` passthrough, and
108
108
  `configPatch` — went through the same bar: dogfooded against real connector
@@ -261,12 +261,16 @@ Same one definition, your choice of distribution:
261
261
  - **Direct install** (above) — `install` writes each host's native MCP + plugin/
262
262
  extension config in place; no per-platform marketplace submission or review.
263
263
  - **Marketplace install** — `install --method marketplace` drives the host's own
264
- plugin flow end-to-end for **Claude Code, codex, and agy/Antigravity** (stages
265
- the bundle, registers a local marketplace where the host has one, then runs the
266
- host's plugin-install verb; headless, idempotent verified live on Linux and
267
- native Windows). `uninstall --method auto` reverses whichever method is actually
268
- installed, a guard refuses installing the same connector by BOTH methods
269
- (duplicated hooks/servers), and `doctor` checks registration drift.
264
+ plugin flow end-to-end for **10 hosts**: Claude Code, Codex, OpenCode, Kilo
265
+ (CLI + ext), Antigravity (CLI + IDE) live-verified on Linux, Windows, and
266
+ macOS plus Droid and Qwen Code (driver shipped, pending a live host) and
267
+ Gemini CLI (legacy sunsetting toward Antigravity; driver kept for existing
268
+ installs). It stages the bundle, registers a local marketplace where the host
269
+ has one, then runs the host's plugin-install verb (or, for npm-plugin hosts,
270
+ writes a local `file://` entry); headless and idempotent. `uninstall --method
271
+ auto` reverses whichever method is installed, a guard refuses installing the
272
+ same connector by BOTH methods, and `doctor` checks registration drift. Other
273
+ marketplace-format hosts print the exact manual commands.
270
274
  - **Marketplace package** — `agent-connector package` turns the connector into a
271
275
  marketplace/extension bundle (manifest + bundled commands, agents, skills,
272
276
  hooks, MCP) for **9 host formats** (plus 2 official MCP standard artifacts —
@@ -73,24 +73,24 @@ function renderInstallResult(result, verb) {
73
73
  return lines.join("\n");
74
74
  }
75
75
  var COMMANDS = {
76
- detect: () => import("./detect-MNDHGLSV.js"),
77
- install: () => import("./install-TQTT4F3I.js"),
78
- uninstall: () => import("./uninstall-3DXIBRCV.js"),
76
+ detect: () => import("./detect-U3E7NVNW.js"),
77
+ install: () => import("./install-OWAS5UIE.js"),
78
+ uninstall: () => import("./uninstall-WG6PFWF3.js"),
79
79
  // `upgrade` is the single "bring everything current" verb (re-render host
80
80
  // config + refresh the home pointer + managed channel guidance). `sync` and
81
81
  // `update` are kept as back-compat aliases that route to the same module so
82
82
  // existing scripts/docs keep working without a second concept to learn.
83
- upgrade: () => import("./upgrade-GJEB3ITY.js"),
84
- sync: () => import("./upgrade-GJEB3ITY.js"),
85
- update: () => import("./upgrade-GJEB3ITY.js"),
86
- package: () => import("./package-SYPA5POO.js"),
87
- doctor: () => import("./doctor-N5KZDD55.js"),
88
- status: () => import("./status-DYSS6BOR.js"),
89
- telemetry: () => import("./telemetry-IJ4GP2Q3.js"),
90
- usage: () => import("./usage-2BJLM3GJ.js"),
91
- leaderboard: () => import("./leaderboard-MUJ7DURM.js"),
92
- hook: () => import("./hook-7LUOKIXH.js"),
93
- serve: () => import("./serve-XJOSA7BY.js"),
83
+ upgrade: () => import("./upgrade-32NC2RKI.js"),
84
+ sync: () => import("./upgrade-32NC2RKI.js"),
85
+ update: () => import("./upgrade-32NC2RKI.js"),
86
+ package: () => import("./package-WFOS4QVU.js"),
87
+ doctor: () => import("./doctor-DZTWED4O.js"),
88
+ status: () => import("./status-MKQYX5MW.js"),
89
+ telemetry: () => import("./telemetry-3DN6XGYB.js"),
90
+ usage: () => import("./usage-CJOM2WQM.js"),
91
+ leaderboard: () => import("./leaderboard-CSWHI4UY.js"),
92
+ hook: () => import("./hook-EVY7LOUQ.js"),
93
+ serve: () => import("./serve-3C2VFPAY.js"),
94
94
  // Hidden (omitted from USAGE): the opt-in host-native turn-usage entrypoint an
95
95
  // AfterModel / PostInvocation hook points at. Always exits 0; records a
96
96
  // distinct `model_turn` row. See cli/commands/usage-event.ts.
@@ -188,4 +188,4 @@ export {
188
188
  renderInstallResult,
189
189
  main
190
190
  };
191
- //# sourceMappingURL=chunk-DS3LUFVN.js.map
191
+ //# sourceMappingURL=chunk-3RBLIHPZ.js.map
@@ -12,12 +12,14 @@ import {
12
12
  existsSync,
13
13
  readdirSync,
14
14
  readFileSync,
15
+ realpathSync,
15
16
  rmSync,
16
17
  statSync,
17
18
  writeFileSync
18
19
  } from "fs";
19
20
  import { homedir } from "os";
20
21
  import { dirname, join, relative, resolve } from "path";
22
+ import { fileURLToPath } from "url";
21
23
  import TOML from "@iarna/toml";
22
24
  var MARKETPLACE_NAME = "agent-connector";
23
25
  function marketplaceInstallsPath(connectorId) {
@@ -72,6 +74,18 @@ function codexStagingRoot() {
72
74
  function agyStagingRoot() {
73
75
  return join(marketplaceRoot(), "agy");
74
76
  }
77
+ function geminiStagingRoot() {
78
+ return join(marketplaceRoot(), "gemini");
79
+ }
80
+ function qwenStagingRoot() {
81
+ return join(marketplaceRoot(), "qwen");
82
+ }
83
+ function droidStagingRoot() {
84
+ return join(marketplaceRoot(), "droid");
85
+ }
86
+ function npmStagingRoot() {
87
+ return join(marketplaceRoot(), "npm");
88
+ }
75
89
  function claudeConfigDir() {
76
90
  const override = process.env.CLAUDE_CONFIG_DIR;
77
91
  if (override && override.trim() !== "") return resolve(override);
@@ -166,6 +180,46 @@ function codexMarketplaceSource(name) {
166
180
  const source = entry.source;
167
181
  return typeof source === "string" ? source : null;
168
182
  }
183
+ function factorySettingsPath() {
184
+ return join(homedir(), ".factory", "settings.json");
185
+ }
186
+ function droidPluginKey(connectorId) {
187
+ return `${connectorId}@${MARKETPLACE_NAME}`;
188
+ }
189
+ function readDroidEnabledPlugins() {
190
+ const parsed = readJsonFile(factorySettingsPath());
191
+ const plugins = parsed?.enabledPlugins;
192
+ if (plugins && typeof plugins === "object" && !Array.isArray(plugins)) {
193
+ return plugins;
194
+ }
195
+ return null;
196
+ }
197
+ function droidPluginInstalled(connectorId) {
198
+ const plugins = readDroidEnabledPlugins();
199
+ if (!plugins) return false;
200
+ return plugins[droidPluginKey(connectorId)] === true;
201
+ }
202
+ function anyDroidAgentConnectorPlugins() {
203
+ const plugins = readDroidEnabledPlugins();
204
+ if (!plugins) return false;
205
+ return Object.entries(plugins).some(
206
+ ([key, value]) => key.endsWith(`@${MARKETPLACE_NAME}`) && value === true
207
+ );
208
+ }
209
+ function droidMarketplaceSource(name) {
210
+ const parsed = readJsonFile(factorySettingsPath());
211
+ const known = parsed?.extraKnownMarketplaces;
212
+ if (!known || typeof known !== "object" || Array.isArray(known)) return null;
213
+ const entry = known[name];
214
+ if (entry == null) return null;
215
+ if (typeof entry === "string") return entry;
216
+ if (typeof entry === "object" && !Array.isArray(entry)) {
217
+ const e = entry;
218
+ if (typeof e.source === "string") return e.source;
219
+ if (typeof e.path === "string") return e.path;
220
+ }
221
+ return null;
222
+ }
169
223
  function agyConfigDir() {
170
224
  return join(homedir(), ".gemini", "config");
171
225
  }
@@ -195,6 +249,159 @@ function agyPluginInstalled(connectorId) {
195
249
  }
196
250
  return existsSync(join(agyPluginsDir(), connectorId, "plugin.json"));
197
251
  }
252
+ function geminiConfigDir() {
253
+ return join(homedir(), ".gemini");
254
+ }
255
+ function geminiExtensionInstalled(connectorId) {
256
+ return existsSync(
257
+ join(geminiConfigDir(), "extensions", connectorId, "gemini-extension.json")
258
+ );
259
+ }
260
+ function qwenConfigDir() {
261
+ return join(homedir(), ".qwen");
262
+ }
263
+ function qwenExtensionInstalled(connectorId) {
264
+ return existsSync(
265
+ join(qwenConfigDir(), "extensions", connectorId, "qwen-extension.json")
266
+ );
267
+ }
268
+ function xdgConfigHome() {
269
+ const xdg = process.env.XDG_CONFIG_HOME;
270
+ return xdg && xdg.trim() !== "" ? resolve(xdg) : join(homedir(), ".config");
271
+ }
272
+ function opencodeConfigDir() {
273
+ return join(xdgConfigHome(), "opencode");
274
+ }
275
+ function kiloConfigDir() {
276
+ return join(xdgConfigHome(), "kilo");
277
+ }
278
+ function npmConfigCandidates(platform) {
279
+ return platform === "opencode" ? ["opencode.jsonc", "opencode.json", "config.json"] : ["opencode.json"];
280
+ }
281
+ function npmConfigDir(platform) {
282
+ return platform === "opencode" ? opencodeConfigDir() : kiloConfigDir();
283
+ }
284
+ function npmConfigFilePath(platform) {
285
+ const dir = npmConfigDir(platform);
286
+ const candidates = npmConfigCandidates(platform);
287
+ for (const name of candidates) {
288
+ if (existsSync(join(dir, name))) return join(dir, name);
289
+ }
290
+ return join(dir, candidates[0]);
291
+ }
292
+ function stripFileScheme(entry) {
293
+ let s = entry;
294
+ if (s.startsWith("file://localhost/")) s = s.slice("file://localhost".length);
295
+ else if (s.startsWith("file://")) s = s.slice("file://".length);
296
+ return s;
297
+ }
298
+ function stripJsoncComments(text) {
299
+ let out = "";
300
+ let inString = false;
301
+ let inLine = false;
302
+ let inBlock = false;
303
+ for (let i = 0; i < text.length; i++) {
304
+ const c = text[i];
305
+ const next = i + 1 < text.length ? text[i + 1] : "";
306
+ if (inLine) {
307
+ if (c === "\n") {
308
+ inLine = false;
309
+ out += c;
310
+ }
311
+ continue;
312
+ }
313
+ if (inBlock) {
314
+ if (c === "*" && next === "/") {
315
+ inBlock = false;
316
+ i++;
317
+ }
318
+ continue;
319
+ }
320
+ if (inString) {
321
+ out += c;
322
+ if (c === "\\") {
323
+ if (next !== "") {
324
+ out += next;
325
+ i++;
326
+ }
327
+ } else if (c === '"') {
328
+ inString = false;
329
+ }
330
+ continue;
331
+ }
332
+ if (c === '"') {
333
+ inString = true;
334
+ out += c;
335
+ continue;
336
+ }
337
+ if (c === "/" && next === "/") {
338
+ inLine = true;
339
+ i++;
340
+ continue;
341
+ }
342
+ if (c === "/" && next === "*") {
343
+ inBlock = true;
344
+ i++;
345
+ continue;
346
+ }
347
+ out += c;
348
+ }
349
+ return out;
350
+ }
351
+ function parseJsonc(text) {
352
+ try {
353
+ const parsed = JSON.parse(stripJsoncComments(text));
354
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
355
+ return parsed;
356
+ }
357
+ } catch {
358
+ }
359
+ return null;
360
+ }
361
+ function readNpmConfig(platform) {
362
+ const file = npmConfigFilePath(platform);
363
+ try {
364
+ return parseJsonc(readFileSync(file, "utf8"));
365
+ } catch {
366
+ return null;
367
+ }
368
+ }
369
+ function npmEntryToPath(entry) {
370
+ if (/^file:\/\//i.test(entry)) {
371
+ try {
372
+ return fileURLToPath(entry);
373
+ } catch {
374
+ }
375
+ }
376
+ return stripFileScheme(entry);
377
+ }
378
+ function npmPathEquals(a, b) {
379
+ const norm = (p) => {
380
+ let s;
381
+ try {
382
+ s = realpathSync.native(p);
383
+ } catch {
384
+ s = resolve(p);
385
+ }
386
+ return process.platform === "win32" ? s.toLowerCase() : s;
387
+ };
388
+ return norm(a) === norm(b);
389
+ }
390
+ function npmPluginArrayEntry(platform, connectorId) {
391
+ const cfg = readNpmConfig(platform);
392
+ if (!cfg) return null;
393
+ const arr = cfg["plugin"];
394
+ if (!Array.isArray(arr)) return null;
395
+ const target = join(npmStagingRoot(), connectorId);
396
+ for (const raw of arr) {
397
+ if (typeof raw !== "string") continue;
398
+ if (npmPathEquals(npmEntryToPath(raw), target)) return raw;
399
+ }
400
+ return null;
401
+ }
402
+ function npmPluginInstalled(platform, connectorId) {
403
+ return npmPluginArrayEntry(platform, connectorId) != null;
404
+ }
198
405
  function marketplaceEvidence(connectorId, platform) {
199
406
  if (readMarketplaceInstalls(connectorId)[platform]) {
200
407
  return "recorded in marketplace-installs.json";
@@ -205,15 +412,21 @@ function marketplaceEvidence(connectorId, platform) {
205
412
  return `${claudePluginKey(connectorId)} listed in Claude's installed_plugins.json`;
206
413
  }
207
414
  return null;
208
- case "gemini-cli": {
209
- const dir = join(homedir(), ".gemini", "extensions", connectorId);
210
- return existsSync(dir) ? `extension dir ${dir} exists` : null;
211
- }
415
+ case "gemini-cli":
416
+ return geminiExtensionInstalled(connectorId) ? `extension ${connectorId} listed in Gemini's extensions store` : null;
417
+ case "qwen-code":
418
+ return qwenExtensionInstalled(connectorId) ? `extension ${connectorId} listed in Qwen's extensions store` : null;
419
+ case "droid":
420
+ return droidPluginInstalled(connectorId) ? `${droidPluginKey(connectorId)} enabled in droid's settings.json` : null;
212
421
  case "antigravity":
213
422
  case "antigravity-cli": {
214
423
  const dir = join(homedir(), ".gemini", "config", "plugins", connectorId);
215
424
  return existsSync(dir) ? `plugin dir ${dir} exists` : null;
216
425
  }
426
+ case "opencode":
427
+ case "kilo":
428
+ case "kilo-cli":
429
+ return npmPluginInstalled(platform, connectorId) ? `${connectorId} listed in ${platform}'s config plugin array` : null;
217
430
  case "codex": {
218
431
  const codexHome = process.env.CODEX_HOME && process.env.CODEX_HOME.trim() !== "" ? resolve(process.env.CODEX_HOME) : join(homedir(), ".codex");
219
432
  const dir = join(codexHome, "plugins", "cache", MARKETPLACE_NAME, connectorId);
@@ -269,6 +482,10 @@ export {
269
482
  claudeStagingRoot,
270
483
  codexStagingRoot,
271
484
  agyStagingRoot,
485
+ geminiStagingRoot,
486
+ qwenStagingRoot,
487
+ droidStagingRoot,
488
+ npmStagingRoot,
272
489
  claudePluginKey,
273
490
  claudePluginInstalled,
274
491
  anyClaudeAgentConnectorPlugins,
@@ -277,8 +494,18 @@ export {
277
494
  codexPluginInstalled,
278
495
  anyCodexAgentConnectorPlugins,
279
496
  codexMarketplaceSource,
497
+ droidPluginKey,
498
+ droidPluginInstalled,
499
+ anyDroidAgentConnectorPlugins,
500
+ droidMarketplaceSource,
280
501
  agyPluginInstalled,
502
+ geminiExtensionInstalled,
503
+ qwenExtensionInstalled,
504
+ npmConfigFilePath,
505
+ readNpmConfig,
506
+ npmPluginArrayEntry,
507
+ npmPluginInstalled,
281
508
  marketplaceEvidence,
282
509
  hashDirectory
283
510
  };
284
- //# sourceMappingURL=chunk-44HUXXC6.js.map
511
+ //# sourceMappingURL=chunk-G5CQHVQG.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/marketplace-state.ts"],"sourcesContent":["/**\n * core/marketplace-state — pure read/write helpers for MARKETPLACE-method\n * install state. A LEAF module (fs + paths only, no adapters, no spawning) so\n * the installer, the marketplace orchestration, doctor, and status can all\n * import it without cycles.\n *\n * Two kinds of state live here:\n *\n * 1. The per-connector state record `connectorDir(id)/marketplace-installs.json`\n * — one entry per platform a connector was marketplace-installed on\n * ({ format, bundleDir, marketplace, scope, version, contentHash,\n * installedAt }). It drives `uninstall --method auto`, upgrade staleness\n * warnings, doctor, and the double-install guard.\n *\n * 2. Read-only fs EVIDENCE probes of the hosts' own plugin state (e.g.\n * Claude Code's `$CLAUDE_CONFIG_DIR/plugins/installed_plugins.json`).\n * These catch installs the user performed manually from `package`'s\n * printed instructions, which the state record alone would miss. Probes\n * read undocumented host internals, so every reader degrades to null/false\n * on absence or parse failure — the guard convention is \"refuse only on\n * positive evidence\" (docs: design risk 4).\n */\n\nimport { createHash } from \"node:crypto\";\nimport {\n existsSync,\n readdirSync,\n readFileSync,\n realpathSync,\n rmSync,\n statSync,\n writeFileSync,\n} from \"node:fs\";\nimport { homedir } from \"node:os\";\nimport { dirname, join, relative, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport TOML from \"@iarna/toml\";\n\nimport type { InstallScope, PlatformId } from \"./types.js\";\nimport type { PackageFormat } from \"./package.js\";\nimport { connectorDir, connectorsDir, dataRoot, ensureDir } from \"./paths.js\";\n\n// ─────────────────────────────────────────────────────────────────────────\n// State record: connectorDir(id)/marketplace-installs.json\n// ─────────────────────────────────────────────────────────────────────────\n\n/** The catalog name every staged local marketplace is registered under. */\nexport const MARKETPLACE_NAME = \"agent-connector\";\n\n/** One marketplace install of one connector on one platform. */\nexport interface MarketplaceInstallRecord {\n /** Bundle format that was staged + installed (e.g. \"claude-plugin\"). */\n format: PackageFormat;\n /** Absolute path of the staged plugin dir the host references/copied. */\n bundleDir: string;\n /** Marketplace/catalog name the install is keyed under ({@link MARKETPLACE_NAME}). */\n marketplace: string;\n /** Install scope (v1: always \"user\"). */\n scope: InstallScope;\n /** connector.version at install time (staleness warnings key off this). */\n version: string;\n /** sha256 over the staged plugin dir at install time (drift detection). */\n contentHash: string;\n /** ISO timestamp of the recorded install. */\n installedAt: string;\n}\n\n/** platform → record map persisted per connector. */\nexport type MarketplaceInstalls = Partial<\n Record<PlatformId, MarketplaceInstallRecord>\n>;\n\n/** Path of the per-connector marketplace state record. */\nexport function marketplaceInstallsPath(connectorId: string): string {\n return join(connectorDir(connectorId), \"marketplace-installs.json\");\n}\n\n/** Read the state record ({} on absence/parse failure — never throws). */\nexport function readMarketplaceInstalls(connectorId: string): MarketplaceInstalls {\n try {\n const raw = readFileSync(marketplaceInstallsPath(connectorId), \"utf8\");\n const parsed = JSON.parse(raw) as unknown;\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n return parsed as MarketplaceInstalls;\n }\n } catch {\n /* absent / unreadable → empty */\n }\n return {};\n}\n\n/** Write the state record; an empty map DELETES the file (uninstall leaves no husk). */\nexport function writeMarketplaceInstalls(\n connectorId: string,\n installs: MarketplaceInstalls,\n): void {\n const path = marketplaceInstallsPath(connectorId);\n if (Object.keys(installs).length === 0) {\n rmSync(path, { force: true });\n return;\n }\n ensureDir(dirname(path));\n writeFileSync(path, `${JSON.stringify(installs, null, 2)}\\n`, \"utf8\");\n}\n\n/** True when THIS connector has any recorded marketplace install. */\nexport function connectorHasMarketplaceRecords(connectorId: string): boolean {\n return Object.keys(readMarketplaceInstalls(connectorId)).length > 0;\n}\n\n/**\n * True when ANY registered connector (optionally excluding one) still records a\n * marketplace install. Guards home-bin removal on purge: an installed plugin's\n * hooks exec the home-bin OUTSIDE any adapter-managed config, so removing the\n * launcher while a marketplace install survives would silently kill its hooks.\n */\nexport function anyMarketplaceRecordsRemain(excludeConnectorId?: string): boolean {\n const dir = connectorsDir();\n if (!existsSync(dir)) return false;\n let entries: string[];\n try {\n entries = readdirSync(dir);\n } catch {\n return false;\n }\n return entries.some(\n (id) => id !== excludeConnectorId && connectorHasMarketplaceRecords(id),\n );\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Staging roots — bundles staged by-reference must survive cwd changes and\n// `rm -rf dist-plugin`, so they live under the data-root, one shared root per\n// host family, holding every marketplace-installed connector's bundle plus ONE\n// regenerated catalog named \"agent-connector\" listing them all.\n// ─────────────────────────────────────────────────────────────────────────\n\n/** Root for every marketplace staging tree: <dataRoot>/marketplace. */\nexport function marketplaceRoot(): string {\n return join(dataRoot(), \"marketplace\");\n}\n\n/** Shared Claude-family staging root: <dataRoot>/marketplace/claude. */\nexport function claudeStagingRoot(): string {\n return join(marketplaceRoot(), \"claude\");\n}\n\n/** Shared Codex-family staging root: <dataRoot>/marketplace/codex. */\nexport function codexStagingRoot(): string {\n return join(marketplaceRoot(), \"codex\");\n}\n\n/** Shared agy (Antigravity) staging root: <dataRoot>/marketplace/agy. */\nexport function agyStagingRoot(): string {\n return join(marketplaceRoot(), \"agy\");\n}\n\n/** Shared Gemini-CLI staging root: <dataRoot>/marketplace/gemini. */\nexport function geminiStagingRoot(): string {\n return join(marketplaceRoot(), \"gemini\");\n}\n\n/** Shared Qwen-Code staging root: <dataRoot>/marketplace/qwen. */\nexport function qwenStagingRoot(): string {\n return join(marketplaceRoot(), \"qwen\");\n}\n\n/** Shared droid (Factory) staging root: <dataRoot>/marketplace/droid. */\nexport function droidStagingRoot(): string {\n return join(marketplaceRoot(), \"droid\");\n}\n\n/**\n * Shared npm-local staging root: <dataRoot>/marketplace/npm. Every npm-plugin\n * host (opencode / kilo / kilo-cli) stages here; the host config's `plugin`\n * array references the bundle by `file://<this>/<id>`, so it MUST live under the\n * stable data-root (it survives cwd changes and `rm -rf dist-plugin`).\n */\nexport function npmStagingRoot(): string {\n return join(marketplaceRoot(), \"npm\");\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Claude Code host-state readers ($CLAUDE_CONFIG_DIR || ~/.claude)\n// ─────────────────────────────────────────────────────────────────────────\n\n/** Claude Code's config dir, honoring the CLAUDE_CONFIG_DIR override. */\nexport function claudeConfigDir(): string {\n const override = process.env.CLAUDE_CONFIG_DIR;\n if (override && override.trim() !== \"\") return resolve(override);\n return join(homedir(), \".claude\");\n}\n\n/** The installed_plugins.json key our marketplace install creates for `id`. */\nexport function claudePluginKey(connectorId: string): string {\n return `${connectorId}@${MARKETPLACE_NAME}`;\n}\n\nfunction readJsonFile(path: string): Record<string, unknown> | null {\n try {\n const parsed = JSON.parse(readFileSync(path, \"utf8\")) as unknown;\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n return parsed as Record<string, unknown>;\n }\n } catch {\n /* absent / unreadable → null */\n }\n return null;\n}\n\n/** The `plugins` map from Claude's installed_plugins.json (null when unreadable). */\nexport function readClaudeInstalledPlugins(): Record<string, unknown> | null {\n const file = join(claudeConfigDir(), \"plugins\", \"installed_plugins.json\");\n const parsed = readJsonFile(file);\n const plugins = parsed?.plugins;\n if (plugins && typeof plugins === \"object\" && !Array.isArray(plugins)) {\n return plugins as Record<string, unknown>;\n }\n return null;\n}\n\n/** True when Claude's own state lists `<id>@agent-connector` as installed. */\nexport function claudePluginInstalled(connectorId: string): boolean {\n const plugins = readClaudeInstalledPlugins();\n if (!plugins) return false;\n const entry = plugins[claudePluginKey(connectorId)];\n return Array.isArray(entry) ? entry.length > 0 : entry != null;\n}\n\n/** True when ANY `*@agent-connector` plugin remains in Claude's state. */\nexport function anyClaudeAgentConnectorPlugins(): boolean {\n const plugins = readClaudeInstalledPlugins();\n if (!plugins) return false;\n return Object.entries(plugins).some(\n ([key, entry]) =>\n key.endsWith(`@${MARKETPLACE_NAME}`) &&\n (Array.isArray(entry) ? entry.length > 0 : entry != null),\n );\n}\n\n/**\n * The directory Claude's known_marketplaces.json records for `name`, or null\n * when not registered / unreadable. Used both as a presence probe and as the\n * NAME-COLLISION check: a registration pointing somewhere other than our\n * staging root belongs to the user and must never be touched.\n */\nexport function claudeKnownMarketplacePath(name: string): string | null {\n const file = join(claudeConfigDir(), \"plugins\", \"known_marketplaces.json\");\n const parsed = readJsonFile(file);\n const entry = parsed?.[name];\n if (!entry || typeof entry !== \"object\") return null;\n const e = entry as { installLocation?: unknown; source?: { path?: unknown } };\n if (typeof e.installLocation === \"string\") return e.installLocation;\n const sourcePath = e.source?.path;\n return typeof sourcePath === \"string\" ? sourcePath : null;\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Codex host-state readers ($CODEX_HOME || ~/.codex → config.toml)\n// ─────────────────────────────────────────────────────────────────────────\n\n/** Codex's config home, honoring the CODEX_HOME override (defaults to ~/.codex). */\nexport function codexConfigHome(): string {\n const env = process.env.CODEX_HOME;\n if (env && env.trim() !== \"\") {\n if (env.startsWith(\"~\")) return join(homedir(), env.replace(/^~[/\\\\]?/, \"\"));\n return resolve(env);\n }\n return join(homedir(), \".codex\");\n}\n\n/** The config.toml key our marketplace install creates for `id` (== claude's). */\nexport function codexPluginKey(connectorId: string): string {\n return `${connectorId}@${MARKETPLACE_NAME}`;\n}\n\n/** Parse <CODEX_HOME>/config.toml ({} on absence/parse failure — never throws). */\nfunction readCodexConfig(): Record<string, unknown> {\n const file = join(codexConfigHome(), \"config.toml\");\n try {\n return TOML.parse(readFileSync(file, \"utf8\")) as Record<string, unknown>;\n } catch {\n return {};\n }\n}\n\n/**\n * True when Codex's config.toml carries the `[plugins.\"<id>@agent-connector\"]`\n * table. The DEFINITIVE install probe — empty `plugins/cache/...` dirs linger\n * after uninstall, so the cache dir must NOT be used (docs: codex quirk).\n */\nexport function codexPluginInstalled(connectorId: string): boolean {\n const cfg = readCodexConfig();\n const plugins = cfg[\"plugins\"];\n if (!plugins || typeof plugins !== \"object\" || Array.isArray(plugins)) return false;\n return codexPluginKey(connectorId) in (plugins as Record<string, unknown>);\n}\n\n/** True when ANY `*@agent-connector` plugin remains in Codex's config.toml. */\nexport function anyCodexAgentConnectorPlugins(): boolean {\n const cfg = readCodexConfig();\n const plugins = cfg[\"plugins\"];\n if (!plugins || typeof plugins !== \"object\" || Array.isArray(plugins)) return false;\n return Object.keys(plugins as Record<string, unknown>).some((k) =>\n k.endsWith(`@${MARKETPLACE_NAME}`),\n );\n}\n\n/**\n * The directory config.toml records as `[marketplaces.agent-connector].source`,\n * or null when not registered / unreadable. Both a presence probe and the\n * NAME-COLLISION check: a registration pointing somewhere other than our\n * staging root belongs to the user and must never be touched.\n */\nexport function codexMarketplaceSource(name: string): string | null {\n const cfg = readCodexConfig();\n const marketplaces = cfg[\"marketplaces\"];\n if (!marketplaces || typeof marketplaces !== \"object\" || Array.isArray(marketplaces)) {\n return null;\n }\n const entry = (marketplaces as Record<string, unknown>)[name];\n if (!entry || typeof entry !== \"object\") return null;\n const source = (entry as { source?: unknown }).source;\n return typeof source === \"string\" ? source : null;\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// droid (Factory) host-state readers (~/.factory/settings.json, JSON, NO env)\n//\n// DOCS-ONLY: no droid binary is present on this box. The settings.json key\n// shapes below (`enabledPlugins[\"<id>@agent-connector\"] === true` +\n// `extraKnownMarketplaces[\"agent-connector\"].source`) follow the documented\n// factory plugin model — confirm the exact JSON shapes live when a droid binary\n// is available. Both readers read defensively (refuse only on positive evidence).\n// ─────────────────────────────────────────────────────────────────────────\n\n/** Factory's settings file: ~/.factory/settings.json (NO dedicated env). */\nexport function factorySettingsPath(): string {\n return join(homedir(), \".factory\", \"settings.json\");\n}\n\n/** The settings.json key our marketplace install creates for `id` (== codex's). */\nexport function droidPluginKey(connectorId: string): string {\n return `${connectorId}@${MARKETPLACE_NAME}`;\n}\n\n/** The `enabledPlugins` map from droid's settings.json (null when unreadable). */\nfunction readDroidEnabledPlugins(): Record<string, unknown> | null {\n const parsed = readJsonFile(factorySettingsPath());\n const plugins = parsed?.enabledPlugins;\n if (plugins && typeof plugins === \"object\" && !Array.isArray(plugins)) {\n return plugins as Record<string, unknown>;\n }\n return null;\n}\n\n/**\n * True when droid's settings.json carries\n * `enabledPlugins[\"<id>@agent-connector\"] === true`. DOCS-only: the strict\n * `=== true` value shape is unverified live (a future droid may store an object).\n */\nexport function droidPluginInstalled(connectorId: string): boolean {\n const plugins = readDroidEnabledPlugins();\n if (!plugins) return false;\n return plugins[droidPluginKey(connectorId)] === true;\n}\n\n/** True when ANY `*@agent-connector` plugin remains enabled in droid's settings. */\nexport function anyDroidAgentConnectorPlugins(): boolean {\n const plugins = readDroidEnabledPlugins();\n if (!plugins) return false;\n return Object.entries(plugins).some(\n ([key, value]) => key.endsWith(`@${MARKETPLACE_NAME}`) && value === true,\n );\n}\n\n/**\n * The directory droid's settings.json records as\n * `extraKnownMarketplaces[\"<name>\"].source`, or null when not registered /\n * unreadable. Both a presence probe and the NAME-COLLISION check (a registration\n * pointing somewhere other than our staging root belongs to the user). DOCS-only:\n * the local-path `source` field shape is undocumented, so this reads defensively\n * — accepts either a bare string source or an object carrying a `path`/`source`\n * string, and NORMALIZES to a single string for the samePath compare.\n */\nexport function droidMarketplaceSource(name: string): string | null {\n const parsed = readJsonFile(factorySettingsPath());\n const known = parsed?.extraKnownMarketplaces;\n if (!known || typeof known !== \"object\" || Array.isArray(known)) return null;\n const entry = (known as Record<string, unknown>)[name];\n if (entry == null) return null;\n if (typeof entry === \"string\") return entry;\n if (typeof entry === \"object\" && !Array.isArray(entry)) {\n const e = entry as { source?: unknown; path?: unknown };\n if (typeof e.source === \"string\") return e.source;\n if (typeof e.path === \"string\") return e.path;\n }\n return null;\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// agy (Antigravity) host-state readers (~/.gemini/config/plugins, NO env)\n// ─────────────────────────────────────────────────────────────────────────\n\n/** agy's config dir: ~/.gemini/config (NO dedicated env — HOME isolation). */\nexport function agyConfigDir(): string {\n return join(homedir(), \".gemini\", \"config\");\n}\n\n/** agy's plugins dir: ~/.gemini/config/plugins. */\nexport function agyPluginsDir(): string {\n return join(agyConfigDir(), \"plugins\");\n}\n\n/**\n * Candidate `import_manifest.json` locations. agy 1.0.7 records the manifest at\n * `<config>/plugins/import_manifest.json` on POSIX but at\n * `<config>/import_manifest.json` on Windows (live-confirmed on the my-window\n * box) — both are probed, then the copied plugin dir is the final fallback.\n */\nexport function agyImportManifestPaths(): string[] {\n return [\n join(agyConfigDir(), \"import_manifest.json\"), // win32 location\n join(agyPluginsDir(), \"import_manifest.json\"), // posix location\n ];\n}\n\n/** @deprecated single-location accessor — prefer {@link agyImportManifestPaths}. */\nexport function agyImportManifestPath(): string {\n return join(agyPluginsDir(), \"import_manifest.json\");\n}\n\n/**\n * True when `id` is installed per agy's import manifest (`imports[].name`),\n * checking BOTH the win32 and posix manifest locations, with a fallback probe of\n * the copied plugin dir's plugin.json. agy's uninstall removes the plugin dir\n * and clears the manifest entry (live-verified on Windows: install → dir +\n * manifest present, uninstall → both gone, re-install idempotent).\n */\nexport function agyPluginInstalled(connectorId: string): boolean {\n for (const manifest of agyImportManifestPaths()) {\n try {\n const parsed = JSON.parse(readFileSync(manifest, \"utf8\")) as {\n imports?: unknown;\n };\n const imports = parsed.imports;\n if (\n Array.isArray(imports) &&\n imports.some(\n (e) =>\n e != null &&\n typeof e === \"object\" &&\n (e as { name?: unknown }).name === connectorId,\n )\n ) {\n return true;\n }\n } catch {\n /* absent / unreadable manifest → try the next candidate */\n }\n }\n return existsSync(join(agyPluginsDir(), connectorId, \"plugin.json\"));\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Gemini CLI host-state readers (~/.gemini/extensions, NO env — HOME isolation)\n// ─────────────────────────────────────────────────────────────────────────\n\n/**\n * Gemini CLI's config dir: ~/.gemini (NO dedicated config-dir env — isolation is\n * via HOME, live-confirmed on gemini 0.36.0). DISTINCT from agy's ~/.gemini/config\n * tree: gemini extensions land under ~/.gemini/extensions/<id>/.\n */\nexport function geminiConfigDir(): string {\n return join(homedir(), \".gemini\");\n}\n\n/**\n * True when `id` is installed per Gemini's own extension store: the marker file\n * ~/.gemini/extensions/<id>/gemini-extension.json exists. Gemini exits 0 even on\n * a logical failure, so this fs probe — not the exit code — is the source of\n * truth (the driver re-probes after every spawn).\n */\nexport function geminiExtensionInstalled(connectorId: string): boolean {\n return existsSync(\n join(geminiConfigDir(), \"extensions\", connectorId, \"gemini-extension.json\"),\n );\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Qwen Code host-state readers (~/.qwen/extensions, NO env — HOME isolation)\n//\n// DOCS-ONLY: no qwen binary is present on this box. qwen-code is a gemini-cli\n// fork, so the extension store SHAPE (~/.qwen/extensions/<id>/qwen-extension.json)\n// mirrors gemini's — confirm the marker filename live when a qwen binary lands.\n// ─────────────────────────────────────────────────────────────────────────\n\n/**\n * Qwen Code's config dir: ~/.qwen (NO dedicated config-dir env — isolation is\n * via HOME, like its gemini-cli parent). DOCS-only: confirm live when a qwen\n * binary is available. DISTINCT from ~/.gemini (the gemini-cli store).\n */\nexport function qwenConfigDir(): string {\n return join(homedir(), \".qwen\");\n}\n\n/**\n * True when `id` is installed per Qwen's own extension store: the marker file\n * ~/.qwen/extensions/<id>/qwen-extension.json exists. Mirrors gemini's fs probe\n * (qwen is a gemini fork); the driver re-probes after every spawn. DOCS-only:\n * the marker filename (`qwen-extension.json`) is unverified live.\n */\nexport function qwenExtensionInstalled(connectorId: string): boolean {\n return existsSync(\n join(qwenConfigDir(), \"extensions\", connectorId, \"qwen-extension.json\"),\n );\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// npm-local host-state readers (opencode / kilo / kilo-cli — XDG_CONFIG_HOME)\n//\n// These hosts have NO uninstall verb; installs are recorded as `file://<dir>`\n// entries in a `plugin` array inside an opencode-style config file, which the\n// driver EDITS to remove. This module is a spawn/shared-free LEAF, so a tiny\n// posix-resolve path comparison is inlined here rather than importing\n// shared.ts's samePath (and samePath does not strip the `file://` scheme).\n// ─────────────────────────────────────────────────────────────────────────\n\n/** $XDG_CONFIG_HOME when set & non-empty, else ~/.config (matches the adapters). */\nfunction xdgConfigHome(): string {\n const xdg = process.env.XDG_CONFIG_HOME;\n return xdg && xdg.trim() !== \"\" ? resolve(xdg) : join(homedir(), \".config\");\n}\n\n/** opencode's config dir: $XDG_CONFIG_HOME/opencode (or ~/.config/opencode). */\nexport function opencodeConfigDir(): string {\n return join(xdgConfigHome(), \"opencode\");\n}\n\n/** kilo / kilo-cli's config dir: $XDG_CONFIG_HOME/kilo (or ~/.config/kilo). */\nexport function kiloConfigDir(): string {\n return join(xdgConfigHome(), \"kilo\");\n}\n\n/**\n * Candidate config filenames per npm-local host, most-preferred first. opencode\n * accepts opencode.jsonc / opencode.json / config.json (JSONC — comments\n * tolerated); kilo / kilo-cli use opencode.json (plain JSON).\n */\nfunction npmConfigCandidates(platform: PlatformId): string[] {\n return platform === \"opencode\"\n ? [\"opencode.jsonc\", \"opencode.json\", \"config.json\"]\n : [\"opencode.json\"];\n}\n\n/** The config DIR for an npm-local host (opencode vs kilo/kilo-cli). */\nfunction npmConfigDir(platform: PlatformId): string {\n return platform === \"opencode\" ? opencodeConfigDir() : kiloConfigDir();\n}\n\n/**\n * The config FILE path for `platform`: the first existing candidate, else the\n * most-preferred candidate (the path a fresh install would write). Never throws.\n */\nexport function npmConfigFilePath(platform: PlatformId): string {\n const dir = npmConfigDir(platform);\n const candidates = npmConfigCandidates(platform);\n for (const name of candidates) {\n if (existsSync(join(dir, name))) return join(dir, name);\n }\n return join(dir, candidates[0]!);\n}\n\n/** Strip a single leading `file://` (and `file://localhost/`) scheme prefix. */\nexport function stripFileScheme(entry: string): string {\n let s = entry;\n if (s.startsWith(\"file://localhost/\")) s = s.slice(\"file://localhost\".length);\n else if (s.startsWith(\"file://\")) s = s.slice(\"file://\".length);\n return s;\n}\n\n/**\n * Strip `//` line and `/* *​/` block comments from JSONC, STRING-AWARE: a `//`\n * or `/*` inside a JSON string literal (e.g. the `file://` in a plugin entry) is\n * left intact. Scans char-by-char tracking string + escape state — a naive\n * regex would corrupt `\"file:///dir\"` by eating from the embedded `//`.\n */\nfunction stripJsoncComments(text: string): string {\n let out = \"\";\n let inString = false;\n let inLine = false;\n let inBlock = false;\n for (let i = 0; i < text.length; i++) {\n const c = text[i]!;\n const next = i + 1 < text.length ? text[i + 1]! : \"\";\n if (inLine) {\n if (c === \"\\n\") {\n inLine = false;\n out += c;\n }\n continue;\n }\n if (inBlock) {\n if (c === \"*\" && next === \"/\") {\n inBlock = false;\n i++;\n }\n continue;\n }\n if (inString) {\n out += c;\n if (c === \"\\\\\") {\n // Copy the escaped char verbatim (covers \\\" and \\\\).\n if (next !== \"\") {\n out += next;\n i++;\n }\n } else if (c === '\"') {\n inString = false;\n }\n continue;\n }\n if (c === '\"') {\n inString = true;\n out += c;\n continue;\n }\n if (c === \"/\" && next === \"/\") {\n inLine = true;\n i++;\n continue;\n }\n if (c === \"/\" && next === \"*\") {\n inBlock = true;\n i++;\n continue;\n }\n out += c;\n }\n return out;\n}\n\n/** Tolerant JSONC → object: strip // line and block comments, then JSON.parse. */\nfunction parseJsonc(text: string): Record<string, unknown> | null {\n // A parse failure degrades to null (the \"refuse only on positive evidence\"\n // convention) rather than throwing.\n try {\n const parsed = JSON.parse(stripJsoncComments(text)) as unknown;\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n return parsed as Record<string, unknown>;\n }\n } catch {\n /* unreadable / not JSONC → null */\n }\n return null;\n}\n\n/** Read + parse an npm-local host's config file ({}-shaped or null). Never throws. */\nexport function readNpmConfig(platform: PlatformId): Record<string, unknown> | null {\n const file = npmConfigFilePath(platform);\n try {\n return parseJsonc(readFileSync(file, \"utf8\"));\n } catch {\n return null;\n }\n}\n\n/**\n * Convert an npm `plugin`-array entry to a native absolute path. opencode/kilo\n * record a proper `file://` URL — on Windows that is `file:///C:/Users/…` (drive\n * letter + forward slashes), which a textual `file://`-strip leaves as the broken\n * `/C:/Users/…`. `fileURLToPath` does the correct cross-platform decode\n * (`file:///C:/x`→`C:\\x`, `file:///tmp/x`→`/tmp/x`). Bare-path entries (also\n * accepted by the hosts) and any malformed URL fall back to a textual strip.\n */\nfunction npmEntryToPath(entry: string): string {\n if (/^file:\\/\\//i.test(entry)) {\n try {\n return fileURLToPath(entry);\n } catch {\n /* malformed file URL (e.g. backslashes) → manual strip below */\n }\n }\n return stripFileScheme(entry);\n}\n\n/**\n * Path equality for the npm probe. Resolve symlinks with `realpathSync.native`\n * when the path exists (catches macOS `/var/folders`→`/private/var/folders` and\n * win32 8.3 short paths — the host records the realpath, we hold the symlink),\n * else lexical `resolve()`; case-fold on win32. Inlined here (leaf module)\n * rather than importing shared.ts's samePath, which pulls in the spawn layer.\n */\nfunction npmPathEquals(a: string, b: string): boolean {\n const norm = (p: string): string => {\n let s: string;\n try {\n s = realpathSync.native(p);\n } catch {\n s = resolve(p);\n }\n return process.platform === \"win32\" ? s.toLowerCase() : s;\n };\n return norm(a) === norm(b);\n}\n\n/**\n * The `plugin`-array ENTRY (the raw string, including any `file://`) whose value\n * — after stripping a leading `file://` — path-equals `id`'s staged bundle dir,\n * or null when no entry references it. Used both as the install probe and to\n * locate the exact entry the uninstall edit must drop.\n */\nexport function npmPluginArrayEntry(\n platform: PlatformId,\n connectorId: string,\n): string | null {\n const cfg = readNpmConfig(platform);\n if (!cfg) return null;\n const arr = cfg[\"plugin\"];\n if (!Array.isArray(arr)) return null;\n const target = join(npmStagingRoot(), connectorId);\n for (const raw of arr) {\n if (typeof raw !== \"string\") continue;\n if (npmPathEquals(npmEntryToPath(raw), target)) return raw;\n }\n return null;\n}\n\n/** True when `platform`'s config `plugin` array references `id`'s staged bundle. */\nexport function npmPluginInstalled(platform: PlatformId, connectorId: string): boolean {\n return npmPluginArrayEntry(platform, connectorId) != null;\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Cross-host marketplace-install EVIDENCE (the double-install guard's probe)\n// ─────────────────────────────────────────────────────────────────────────\n\n/**\n * Read-only evidence that `connectorId` is marketplace/plugin-installed on\n * `platform`: the state record first, then a cheap fs probe of the host's own\n * plugin state (catches manual installs from `package`'s printed instructions).\n * Returns a human-readable description of the evidence, or null when none.\n */\nexport function marketplaceEvidence(\n connectorId: string,\n platform: PlatformId,\n): string | null {\n if (readMarketplaceInstalls(connectorId)[platform]) {\n return \"recorded in marketplace-installs.json\";\n }\n switch (platform) {\n case \"claude-code\":\n if (claudePluginInstalled(connectorId)) {\n return `${claudePluginKey(connectorId)} listed in Claude's installed_plugins.json`;\n }\n return null;\n case \"gemini-cli\":\n return geminiExtensionInstalled(connectorId)\n ? `extension ${connectorId} listed in Gemini's extensions store`\n : null;\n case \"qwen-code\":\n return qwenExtensionInstalled(connectorId)\n ? `extension ${connectorId} listed in Qwen's extensions store`\n : null;\n case \"droid\":\n return droidPluginInstalled(connectorId)\n ? `${droidPluginKey(connectorId)} enabled in droid's settings.json`\n : null;\n case \"antigravity\":\n case \"antigravity-cli\": {\n const dir = join(homedir(), \".gemini\", \"config\", \"plugins\", connectorId);\n return existsSync(dir) ? `plugin dir ${dir} exists` : null;\n }\n case \"opencode\":\n case \"kilo\":\n case \"kilo-cli\":\n return npmPluginInstalled(platform, connectorId)\n ? `${connectorId} listed in ${platform}'s config plugin array`\n : null;\n case \"codex\": {\n const codexHome =\n process.env.CODEX_HOME && process.env.CODEX_HOME.trim() !== \"\"\n ? resolve(process.env.CODEX_HOME)\n : join(homedir(), \".codex\");\n const dir = join(codexHome, \"plugins\", \"cache\", MARKETPLACE_NAME, connectorId);\n return existsSync(dir) ? `codex plugin cache ${dir} exists` : null;\n }\n default:\n return null;\n }\n}\n\n// ─────────────────────────────────────────────────────────────────────────\n// Content hashing — staged-bundle drift detection\n// ─────────────────────────────────────────────────────────────────────────\n\n/**\n * Deterministic sha256 over every file under `dir` (sorted relative paths +\n * bytes). Empty string when the dir is missing/unreadable. Used to record the\n * staged bundle's content at install time and detect drift later (claude caches\n * a versioned COPY, so an edited connector goes silently stale without this).\n */\nexport function hashDirectory(dir: string): string {\n if (!existsSync(dir)) return \"\";\n const files: string[] = [];\n const walk = (d: string): void => {\n let entries: string[];\n try {\n entries = readdirSync(d);\n } catch {\n return;\n }\n for (const name of entries.sort()) {\n const full = join(d, name);\n let st;\n try {\n st = statSync(full);\n } catch {\n continue;\n }\n if (st.isDirectory()) walk(full);\n else if (st.isFile()) files.push(full);\n }\n };\n walk(dir);\n const hash = createHash(\"sha256\");\n for (const file of files.sort()) {\n hash.update(relative(dir, file).split(\"\\\\\").join(\"/\"));\n hash.update(\"\\0\");\n try {\n hash.update(readFileSync(file));\n } catch {\n /* unreadable file contribut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