@kwonye/mcpx 0.1.105 → 0.1.106

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 (75) hide show
  1. package/dist/adapters/codex.d.ts +2 -0
  2. package/dist/adapters/index.d.ts +2 -1
  3. package/dist/adapters/json.d.ts +26 -0
  4. package/dist/adapters/pi.d.ts +9 -0
  5. package/dist/chunk-0xt563m1.js +126 -0
  6. package/dist/{chunk-btbww96n.js → chunk-1mrkz29t.js} +69 -56
  7. package/dist/{chunk-6mxr34tc.js → chunk-1v66g9d6.js} +4 -3
  8. package/dist/chunk-1yq3yb66.js +126 -0
  9. package/dist/chunk-27mq4agf.js +33 -0
  10. package/dist/{chunk-t4hqf6yh.js → chunk-4aafp444.js} +8136 -8262
  11. package/dist/chunk-4xym942z.js +36 -0
  12. package/dist/{chunk-tnhekcpv.js → chunk-56z18csx.js} +1 -1
  13. package/dist/{chunk-bnbz55g6.js → chunk-65kshh9w.js} +1 -1
  14. package/dist/{chunk-xydajvzg.js → chunk-7ky3rsw9.js} +1 -1
  15. package/dist/chunk-7rq88hb3.js +563 -0
  16. package/dist/chunk-8v13hqrp.js +825 -0
  17. package/dist/chunk-a2gen8bn.js +730 -0
  18. package/dist/{chunk-01s7rhx3.js → chunk-brxwa30j.js} +130 -113
  19. package/dist/chunk-chaj8a8b.js +45 -0
  20. package/dist/chunk-e96643mj.js +26 -0
  21. package/dist/{chunk-d2v9rxy0.js → chunk-ew06e41w.js} +12 -6
  22. package/dist/chunk-ezk8txcy.js +23 -0
  23. package/dist/{chunk-4y0t0tfj.js → chunk-grkz21sq.js} +29 -3
  24. package/dist/{chunk-12vgqm89.js → chunk-gvjxpk98.js} +1 -1
  25. package/dist/chunk-h9kp47rp.js +18 -0
  26. package/dist/chunk-hahs24dv.js +127 -0
  27. package/dist/{chunk-y9a1rx7j.js → chunk-jv0s0cp6.js} +5 -3
  28. package/dist/{chunk-enzmq965.js → chunk-n0462d52.js} +1 -1
  29. package/dist/chunk-nh6hhv29.js +138 -0
  30. package/dist/chunk-p7yzyt87.js +19426 -0
  31. package/dist/chunk-q86c5s6r.js +7 -0
  32. package/dist/chunk-qf8bj9y7.js +254 -0
  33. package/dist/chunk-t20f49g3.js +30 -0
  34. package/dist/{chunk-am903qjk.js → chunk-v041118a.js} +11 -5
  35. package/dist/{chunk-91vcwk5m.js → chunk-v14bg5yp.js} +1 -1
  36. package/dist/chunk-wvzap0na.js +18166 -0
  37. package/dist/chunk-wztmp5b4.js +30479 -0
  38. package/dist/chunk-xvqr1q9b.js +14 -0
  39. package/dist/{chunk-h158rkts.js → chunk-yj7mpczw.js} +17 -5
  40. package/dist/chunk-yr0txkw0.js +31 -0
  41. package/dist/cli.js +3879 -1061
  42. package/dist/core/adoption.d.ts +62 -0
  43. package/dist/core/analytics.d.ts +17 -0
  44. package/dist/core/consumers.d.ts +8 -0
  45. package/dist/core/control.d.ts +12 -0
  46. package/dist/core/daemon.d.ts +2 -2
  47. package/dist/core/file-state.d.ts +5 -0
  48. package/dist/core/harnesses.d.ts +25 -0
  49. package/dist/core/index.d.ts +12 -4
  50. package/dist/core/index.js +109 -71
  51. package/dist/core/managed-index-lock.d.ts +1 -1
  52. package/dist/core/management.d.ts +32 -0
  53. package/dist/core/native-document.d.ts +4 -0
  54. package/dist/core/operations.d.ts +52 -0
  55. package/dist/core/plugin-projections.d.ts +1 -0
  56. package/dist/core/runtime-entry.d.ts +6 -0
  57. package/dist/core/runtime-snapshot.d.ts +6 -0
  58. package/dist/core/secret-keychain.d.ts +31 -0
  59. package/dist/core/secrets.d.ts +12 -2
  60. package/dist/core/served-skills.d.ts +62 -0
  61. package/dist/core/status.d.ts +1 -0
  62. package/dist/core/sync-plan.d.ts +14 -0
  63. package/dist/core/sync.d.ts +3 -0
  64. package/dist/core/telemetry.d.ts +2 -2
  65. package/dist/core/tui.d.ts +20 -0
  66. package/dist/core/verify-upstreams.d.ts +4 -0
  67. package/dist/core/work-limiter.d.ts +10 -0
  68. package/dist/gateway/server.d.ts +2 -0
  69. package/dist/types.d.ts +62 -1
  70. package/dist/util/fs.d.ts +2 -0
  71. package/dist/version.d.ts +1 -1
  72. package/package.json +1 -1
  73. package/dist/adapters/opencode.d.ts +0 -11
  74. package/dist/chunk-56whm3hm.js +0 -4055
  75. package/dist/chunk-fw8dyt89.js +0 -344
@@ -1,15 +1,17 @@
1
+ import {
2
+ exports_external
3
+ } from "./chunk-p7yzyt87.js";
1
4
  import {
2
5
  findProjectConfigPath,
3
6
  getConfigPath,
4
7
  readJsonFile,
5
8
  writeJsonAtomic
6
- } from "./chunk-4y0t0tfj.js";
9
+ } from "./chunk-grkz21sq.js";
7
10
  import {
8
11
  normalizeServerSpecEnabled
9
12
  } from "./chunk-bjw71y54.js";
10
13
 
11
14
  // src/core/config.ts
12
- import { z } from "zod";
13
15
  import path from "node:path";
14
16
  import fs from "node:fs";
15
17
 
@@ -321,7 +323,7 @@ function isHttpUrl2(value) {
321
323
  }
322
324
  }
323
325
  function isClientInternalCommand(command) {
324
- return /\.app\/Contents\//.test(command);
326
+ return /\.app\/Contents\//.test(command) && !/mcpx(?:-dev)?\.app\/Contents\//.test(command);
325
327
  }
326
328
  function repairServerSpec(spec) {
327
329
  if (spec.transport !== "stdio") {
@@ -428,130 +430,140 @@ class ConfigLoadError extends Error {
428
430
  this.issues = issues;
429
431
  }
430
432
  }
431
- var clientStateSchema = z.object({
432
- status: z.enum(["SYNCED", "UNSUPPORTED_HTTP", "ERROR", "SKIPPED"]),
433
- lastSyncAt: z.string().optional(),
434
- message: z.string().optional(),
435
- configPath: z.string().optional()
433
+ var clientStateSchema = exports_external.object({
434
+ status: exports_external.enum(["SYNCED", "UNSUPPORTED_HTTP", "ERROR", "SKIPPED"]),
435
+ lastSyncAt: exports_external.string().optional(),
436
+ message: exports_external.string().optional(),
437
+ configPath: exports_external.string().optional()
436
438
  });
437
- var httpServerSchema = z.object({
438
- transport: z.literal("http"),
439
- url: z.url(),
440
- headers: z.record(z.string(), z.string()).optional(),
441
- enabled: z.boolean().default(true)
439
+ var httpServerSchema = exports_external.object({
440
+ scope: exports_external.string().optional(),
441
+ transport: exports_external.literal("http"),
442
+ url: exports_external.url(),
443
+ headers: exports_external.record(exports_external.string(), exports_external.string()).optional(),
444
+ enabled: exports_external.boolean().default(true)
442
445
  });
443
- var stdioServerSchema = z.object({
444
- transport: z.literal("stdio"),
445
- command: z.string().min(1),
446
- args: z.array(z.string()).optional(),
447
- env: z.record(z.string(), z.string()).optional(),
448
- cwd: z.string().min(1).optional(),
449
- enabled: z.boolean().default(true)
446
+ var stdioServerSchema = exports_external.object({
447
+ scope: exports_external.string().optional(),
448
+ transport: exports_external.literal("stdio"),
449
+ command: exports_external.string().min(1),
450
+ args: exports_external.array(exports_external.string()).optional(),
451
+ env: exports_external.record(exports_external.string(), exports_external.string()).optional(),
452
+ cwd: exports_external.string().min(1).optional(),
453
+ enabled: exports_external.boolean().default(true)
450
454
  });
451
- var serverSchema = z.discriminatedUnion("transport", [httpServerSchema, stdioServerSchema]);
452
- var projectEntrySchema = z.object({
453
- name: z.string(),
454
- path: z.string(),
455
- disabledServers: z.array(z.string()).default([])
455
+ var serverSchema = exports_external.discriminatedUnion("transport", [httpServerSchema, stdioServerSchema]);
456
+ var projectEntrySchema = exports_external.object({
457
+ name: exports_external.string(),
458
+ path: exports_external.string(),
459
+ disabledServers: exports_external.array(exports_external.string()).default([])
456
460
  });
457
- var pluginComponentSchema = z.enum(["mcpServers", "skills", "hooks", "agents", "commands"]);
458
- var discoveredComponentSchema = z.object({
459
- id: z.string(),
461
+ var pluginComponentSchema = exports_external.enum(["mcpServers", "skills", "hooks", "agents", "commands"]);
462
+ var discoveredComponentSchema = exports_external.object({
463
+ id: exports_external.string(),
460
464
  type: pluginComponentSchema,
461
- path: z.string(),
462
- description: z.string().optional()
465
+ path: exports_external.string(),
466
+ description: exports_external.string().optional()
463
467
  });
464
- var discoveredMcpServerSchema = z.object({
465
- id: z.string(),
466
- transport: z.enum(["stdio", "http"]).optional(),
467
- command: z.string(),
468
- args: z.array(z.string()).optional(),
469
- env: z.record(z.string(), z.string()).optional(),
470
- cwd: z.string().optional(),
471
- url: z.string().optional(),
472
- oauthResource: z.string().optional()
468
+ var discoveredMcpServerSchema = exports_external.object({
469
+ id: exports_external.string(),
470
+ transport: exports_external.enum(["stdio", "http"]).optional(),
471
+ command: exports_external.string(),
472
+ args: exports_external.array(exports_external.string()).optional(),
473
+ env: exports_external.record(exports_external.string(), exports_external.string()).optional(),
474
+ cwd: exports_external.string().optional(),
475
+ url: exports_external.string().optional(),
476
+ oauthResource: exports_external.string().optional()
473
477
  });
474
- var discoveredComponentsSchema = z.object({
475
- skills: z.array(discoveredComponentSchema).default([]),
476
- commands: z.array(discoveredComponentSchema).default([]),
477
- agents: z.array(discoveredComponentSchema).default([]),
478
- hooks: z.array(discoveredComponentSchema).default([]),
479
- mcpServers: z.array(discoveredMcpServerSchema).default([])
478
+ var discoveredComponentsSchema = exports_external.object({
479
+ skills: exports_external.array(discoveredComponentSchema).default([]),
480
+ commands: exports_external.array(discoveredComponentSchema).default([]),
481
+ agents: exports_external.array(discoveredComponentSchema).default([]),
482
+ hooks: exports_external.array(discoveredComponentSchema).default([]),
483
+ mcpServers: exports_external.array(discoveredMcpServerSchema).default([])
480
484
  });
481
- var managedPluginSchema = z.object({
482
- id: z.string(),
483
- name: z.string(),
484
- source: z.string(),
485
- version: z.string(),
486
- ref: z.string(),
487
- resolvedSha: z.string(),
488
- installedAt: z.string(),
489
- root: z.string(),
490
- dataDir: z.string(),
491
- components: z.record(pluginComponentSchema, z.boolean()).default({}),
485
+ var managedPluginSchema = exports_external.object({
486
+ id: exports_external.string(),
487
+ name: exports_external.string(),
488
+ source: exports_external.string(),
489
+ version: exports_external.string(),
490
+ ref: exports_external.string(),
491
+ resolvedSha: exports_external.string(),
492
+ installedAt: exports_external.string(),
493
+ root: exports_external.string(),
494
+ dataDir: exports_external.string(),
495
+ components: exports_external.record(pluginComponentSchema, exports_external.boolean()).default({}),
492
496
  discovered: discoveredComponentsSchema.default({}),
493
- enabled: z.boolean().default(true),
494
- status: z.enum(["healthy", "unhealthy", "preparing", "updating", "error"]).default("healthy"),
495
- error: z.string().optional(),
496
- serverNames: z.array(z.string()).default([]),
497
- projectedClients: z.array(z.string()).default([]),
498
- approvals: z.object({
499
- mcpServers: z.boolean().optional(),
500
- skills: z.boolean().optional(),
501
- hooks: z.boolean().optional(),
502
- agents: z.boolean().optional(),
503
- commands: z.boolean().optional()
497
+ enabled: exports_external.boolean().default(true),
498
+ status: exports_external.enum(["healthy", "unhealthy", "preparing", "updating", "error"]).default("healthy"),
499
+ error: exports_external.string().optional(),
500
+ serverNames: exports_external.array(exports_external.string()).default([]),
501
+ projectedClients: exports_external.array(exports_external.string()).default([]),
502
+ approvals: exports_external.object({
503
+ mcpServers: exports_external.boolean().optional(),
504
+ skills: exports_external.boolean().optional(),
505
+ hooks: exports_external.boolean().optional(),
506
+ agents: exports_external.boolean().optional(),
507
+ commands: exports_external.boolean().optional()
504
508
  }).optional(),
505
- marketplace: z.object({
506
- name: z.string(),
507
- pluginName: z.string(),
508
- sourceFingerprint: z.string()
509
+ marketplace: exports_external.object({
510
+ name: exports_external.string(),
511
+ pluginName: exports_external.string(),
512
+ sourceFingerprint: exports_external.string()
509
513
  }).optional(),
510
- updateError: z.string().optional(),
511
- pinned: z.boolean().default(false),
512
- previous: z.object({ version: z.string(), resolvedSha: z.string(), root: z.string() }).optional(),
513
- projectOverrides: z.record(z.string(), z.object({
514
- enabled: z.boolean().optional(),
515
- components: z.record(pluginComponentSchema, z.boolean()).optional(),
516
- config: z.record(z.string(), z.unknown()).optional()
514
+ updateError: exports_external.string().optional(),
515
+ pinned: exports_external.boolean().default(false),
516
+ previous: exports_external.object({ version: exports_external.string(), resolvedSha: exports_external.string(), root: exports_external.string() }).optional(),
517
+ projectOverrides: exports_external.record(exports_external.string(), exports_external.object({
518
+ enabled: exports_external.boolean().optional(),
519
+ components: exports_external.partialRecord(pluginComponentSchema, exports_external.boolean()).optional(),
520
+ config: exports_external.record(exports_external.string(), exports_external.unknown()).optional()
517
521
  })).optional()
518
522
  });
519
- var managedMarketplaceSchema = z.object({
520
- name: z.string(),
521
- displayName: z.string(),
522
- source: z.string(),
523
- sourceType: z.enum(["github", "git", "local", "hosted-json"]).default("github"),
524
- manifestPath: z.string().optional(),
525
- format: z.enum(["claude", "codex"]).optional(),
526
- builtIn: z.boolean().default(false),
527
- autoUpdate: z.boolean().default(false),
528
- addedAt: z.string(),
529
- lastCheckedAt: z.string().optional(),
530
- lastUpdatedAt: z.string().optional(),
531
- resolvedRevision: z.string().optional(),
532
- status: z.enum(["ready", "stale", "error", "unavailable"]).default("unavailable"),
533
- error: z.string().optional()
523
+ var managedMarketplaceSchema = exports_external.object({
524
+ name: exports_external.string(),
525
+ displayName: exports_external.string(),
526
+ source: exports_external.string(),
527
+ sourceType: exports_external.enum(["github", "git", "local", "hosted-json"]).default("github"),
528
+ manifestPath: exports_external.string().optional(),
529
+ format: exports_external.enum(["claude", "codex"]).optional(),
530
+ builtIn: exports_external.boolean().default(false),
531
+ autoUpdate: exports_external.boolean().default(false),
532
+ addedAt: exports_external.string(),
533
+ lastCheckedAt: exports_external.string().optional(),
534
+ lastUpdatedAt: exports_external.string().optional(),
535
+ resolvedRevision: exports_external.string().optional(),
536
+ status: exports_external.enum(["ready", "stale", "error", "unavailable"]).default("unavailable"),
537
+ error: exports_external.string().optional()
534
538
  });
535
- var configSchema = z.object({
536
- schemaVersion: z.literal(1).default(1),
537
- gateway: z.object({
538
- port: z.number().int().min(1).max(65535).default(37373),
539
- tokenRef: z.string().default("secret://local_gateway_token"),
540
- autoStart: z.boolean().default(true)
539
+ var configSchema = exports_external.object({
540
+ schemaVersion: exports_external.literal(1).default(1),
541
+ consumers: exports_external.record(exports_external.string(), exports_external.object({ tokenRef: exports_external.string().regex(/^secret:\/\/[A-Za-z0-9._-]+$/), projectPath: exports_external.string().optional() })).default({}),
542
+ packages: exports_external.record(exports_external.string(), exports_external.object({ id: exports_external.string(), root: exports_external.string(), source: exports_external.string(), harness: exports_external.string(), fingerprint: exports_external.string(), pinned: exports_external.boolean(), name: exports_external.string().optional(), identity: exports_external.string().optional(), servers: exports_external.array(exports_external.string()).optional(), skills: exports_external.array(exports_external.object({ id: exports_external.string(), path: exports_external.string(), projectionPath: exports_external.string() })).optional(), scope: exports_external.string().optional(), previous: exports_external.object({ root: exports_external.string(), fingerprint: exports_external.string() }).optional() })).default({}),
543
+ revision: exports_external.number().int().nonnegative().default(0),
544
+ harnesses: exports_external.record(exports_external.string(), exports_external.object({ mode: exports_external.enum(["observe", "selected", "automatic"]) })).default({}),
545
+ origins: exports_external.record(exports_external.string(), exports_external.object({ id: exports_external.string(), kind: exports_external.string(), harness: exports_external.string(), source: exports_external.string(), nativeKey: exports_external.string(), fingerprint: exports_external.string(), operationId: exports_external.string() })).default({}),
546
+ gateway: exports_external.object({
547
+ port: exports_external.number().int().min(1).max(65535).default(37373),
548
+ tokenRef: exports_external.string().regex(/^secret:\/\/[A-Za-z0-9._-]+$/).default("secret://local_gateway_token"),
549
+ autoStart: exports_external.boolean().default(true)
541
550
  }).default({
542
551
  port: 37373,
543
552
  tokenRef: "secret://local_gateway_token",
544
553
  autoStart: true
545
554
  }),
546
- servers: z.record(z.string(), serverSchema).default({}),
547
- clients: z.record(z.string(), clientStateSchema).default({}),
548
- projects: z.record(z.string(), projectEntrySchema).default({}),
549
- plugins: z.record(z.string(), managedPluginSchema).default({}),
550
- marketplaces: z.record(z.string(), managedMarketplaceSchema).default({})
555
+ servers: exports_external.record(exports_external.string(), serverSchema).default({}),
556
+ clients: exports_external.record(exports_external.string(), clientStateSchema).default({}),
557
+ projects: exports_external.record(exports_external.string(), projectEntrySchema).default({}),
558
+ plugins: exports_external.record(exports_external.string(), managedPluginSchema).default({}),
559
+ marketplaces: exports_external.record(exports_external.string(), managedMarketplaceSchema).default({}),
560
+ secrets: exports_external.object({
561
+ backend: exports_external.enum(["file", "keychain"]).default("file")
562
+ }).default({ backend: "file" })
551
563
  });
552
- var projectConfigSchema = z.object({
553
- name: z.string().min(1).optional(),
554
- servers: z.record(z.string(), serverSchema).default({})
564
+ var projectConfigSchema = exports_external.object({
565
+ name: exports_external.string().min(1).optional(),
566
+ servers: exports_external.record(exports_external.string(), serverSchema).default({})
555
567
  });
556
568
  function defaultConfig() {
557
569
  return {
@@ -565,7 +577,8 @@ function defaultConfig() {
565
577
  clients: {},
566
578
  projects: {},
567
579
  plugins: {},
568
- marketplaces: ensureDefaultMarketplaces(undefined)
580
+ marketplaces: ensureDefaultMarketplaces(undefined),
581
+ secrets: { backend: "file" }
569
582
  };
570
583
  }
571
584
  function loadConfig(configPath = getConfigPath()) {
@@ -596,19 +609,23 @@ function loadConfig(configPath = getConfigPath()) {
596
609
  }
597
610
  const clientEntries = {};
598
611
  for (const [key, value] of Object.entries(parsed.data.clients)) {
599
- if (["claude", "claude-desktop", "codex", "cursor", "cline", "opencode", "kiro", "vscode", "qwen", "openclaw", "hermes"].includes(key)) {
600
- clientEntries[key] = value;
601
- }
612
+ clientEntries[key] = value;
602
613
  }
603
614
  const servers = Object.fromEntries(Object.entries(parsed.data.servers).map(([name, spec]) => [name, normalizeServerSpecEnabled(spec)]));
604
615
  return repairConfig({
605
616
  schemaVersion: 1,
617
+ consumers: parsed.data.consumers,
618
+ packages: parsed.data.packages,
619
+ revision: parsed.data.revision,
620
+ harnesses: parsed.data.harnesses,
621
+ origins: parsed.data.origins,
606
622
  gateway: parsed.data.gateway,
607
623
  servers,
608
624
  clients: clientEntries,
609
625
  projects: parsed.data.projects,
610
626
  plugins: parsed.data.plugins,
611
- marketplaces: ensureDefaultMarketplaces(parsed.data.marketplaces)
627
+ marketplaces: ensureDefaultMarketplaces(parsed.data.marketplaces),
628
+ secrets: parsed.data.secrets
612
629
  });
613
630
  }
614
631
  function saveConfig(config, configPath = getConfigPath()) {
@@ -737,4 +754,4 @@ function resolveActiveConfig(options = {}) {
737
754
 
738
755
  export { tokenizeCommandLine, parseCliAddCommand, ConfigLoadError, defaultConfig, loadConfig, saveConfig, loadProjectConfig, saveProjectConfig, loadMergedConfig, migrateProjectServers, resolveActiveConfig };
739
756
 
740
- //# debugId=5F19AEF9E1E9E38564756E2164756E21
757
+ //# debugId=E2636B557C478E8864756E2164756E21
@@ -0,0 +1,45 @@
1
+ import {
2
+ sha256
3
+ } from "./chunk-grkz21sq.js";
4
+
5
+ // src/core/file-state.ts
6
+ import fs from "node:fs";
7
+ import path from "node:path";
8
+ function pathFingerprint(target) {
9
+ try {
10
+ const stat = fs.lstatSync(target);
11
+ if (stat.isSymbolicLink())
12
+ return sha256(`link:${fs.readlinkSync(target)}`);
13
+ if (stat.isDirectory())
14
+ return sha256(JSON.stringify(fs.readdirSync(target).sort().map((name) => [name, pathFingerprint(path.join(target, name))])));
15
+ return sha256(fs.readFileSync(target).toString("base64"));
16
+ } catch (error) {
17
+ if (error.code === "ENOENT")
18
+ return null;
19
+ throw error;
20
+ }
21
+ }
22
+ function processAlive(pid) {
23
+ if (!Number.isSafeInteger(pid) || pid <= 0)
24
+ return false;
25
+ try {
26
+ process.kill(pid, 0);
27
+ return true;
28
+ } catch (error) {
29
+ return error.code === "EPERM";
30
+ }
31
+ }
32
+ function lockOwnerAlive(lockPath) {
33
+ try {
34
+ const owner = Number(fs.readFileSync(lockPath, "utf8").trim());
35
+ if (!owner && Date.now() - fs.statSync(lockPath).mtimeMs < 2000)
36
+ return true;
37
+ return processAlive(owner);
38
+ } catch {
39
+ return false;
40
+ }
41
+ }
42
+
43
+ export { pathFingerprint, processAlive, lockOwnerAlive };
44
+
45
+ //# debugId=95EF3C9852F8B9B864756E2164756E21
@@ -0,0 +1,26 @@
1
+ import {
2
+ STATUS_CLIENTS,
3
+ buildStatusReport
4
+ } from "./chunk-nh6hhv29.js";
5
+ import"./chunk-0xt563m1.js";
6
+ import"./chunk-wvzap0na.js";
7
+ import"./chunk-1mrkz29t.js";
8
+ import"./chunk-4aafp444.js";
9
+ import"./chunk-a2gen8bn.js";
10
+ import"./chunk-wztmp5b4.js";
11
+ import"./chunk-8v13hqrp.js";
12
+ import"./chunk-t20f49g3.js";
13
+ import"./chunk-hahs24dv.js";
14
+ import"./chunk-chaj8a8b.js";
15
+ import"./chunk-7rq88hb3.js";
16
+ import"./chunk-brxwa30j.js";
17
+ import"./chunk-p7yzyt87.js";
18
+ import"./chunk-grkz21sq.js";
19
+ import"./chunk-bjw71y54.js";
20
+ import"./chunk-wj4tjacg.js";
21
+ export {
22
+ STATUS_CLIENTS,
23
+ buildStatusReport
24
+ };
25
+
26
+ //# debugId=770606CBE047940064756E2164756E21
@@ -11,11 +11,17 @@ import {
11
11
  resolveMarketplacePluginSource,
12
12
  setMarketplaceAutoUpdate,
13
13
  updateMarketplaceInstalledPlugin
14
- } from "./chunk-btbww96n.js";
15
- import"./chunk-56whm3hm.js";
16
- import"./chunk-01s7rhx3.js";
17
- import"./chunk-fw8dyt89.js";
18
- import"./chunk-4y0t0tfj.js";
14
+ } from "./chunk-1mrkz29t.js";
15
+ import"./chunk-4aafp444.js";
16
+ import"./chunk-wztmp5b4.js";
17
+ import"./chunk-8v13hqrp.js";
18
+ import"./chunk-t20f49g3.js";
19
+ import"./chunk-hahs24dv.js";
20
+ import"./chunk-chaj8a8b.js";
21
+ import"./chunk-7rq88hb3.js";
22
+ import"./chunk-brxwa30j.js";
23
+ import"./chunk-p7yzyt87.js";
24
+ import"./chunk-grkz21sq.js";
19
25
  import"./chunk-bjw71y54.js";
20
26
  import"./chunk-wj4tjacg.js";
21
27
  export {
@@ -33,4 +39,4 @@ export {
33
39
  updateMarketplaceInstalledPlugin
34
40
  };
35
41
 
36
- //# debugId=AB01773EEA66F21764756E2164756E21
42
+ //# debugId=76A638EA438F529364756E2164756E21
@@ -0,0 +1,23 @@
1
+ import {
2
+ applyAuthReference,
3
+ defaultAuthSecretName,
4
+ listAuthBindings,
5
+ maybePrefixBearer,
6
+ removeAuthReference,
7
+ resolveAuthTarget,
8
+ secretRefName,
9
+ toSecretRef
10
+ } from "./chunk-0xt563m1.js";
11
+ import"./chunk-wj4tjacg.js";
12
+ export {
13
+ applyAuthReference,
14
+ defaultAuthSecretName,
15
+ listAuthBindings,
16
+ maybePrefixBearer,
17
+ removeAuthReference,
18
+ resolveAuthTarget,
19
+ secretRefName,
20
+ toSecretRef
21
+ };
22
+
23
+ //# debugId=E513FBA6B876E2F964756E2164756E21
@@ -131,13 +131,39 @@ function writeJsonAtomic(filePath, data) {
131
131
  const tempPath = `${filePath}.tmp-${process.pid}-${Date.now()}`;
132
132
  const content = `${JSON.stringify(data, null, 2)}
133
133
  `;
134
- fs2.writeFileSync(tempPath, content, { mode: 384 });
134
+ const descriptor = fs2.openSync(tempPath, "w", 384);
135
+ try {
136
+ fs2.writeFileSync(descriptor, content);
137
+ fs2.fsyncSync(descriptor);
138
+ } finally {
139
+ fs2.closeSync(descriptor);
140
+ }
135
141
  fs2.renameSync(tempPath, filePath);
142
+ if (process.platform !== "win32") {
143
+ const directory = fs2.openSync(path2.dirname(filePath), "r");
144
+ try {
145
+ fs2.fsyncSync(directory);
146
+ } finally {
147
+ fs2.closeSync(directory);
148
+ }
149
+ }
136
150
  }
137
151
  function sha256(value) {
138
152
  return crypto2.createHash("sha256").update(value).digest("hex");
139
153
  }
154
+ function readJsonStrict(filePath, fallback) {
155
+ if (!fs2.existsSync(filePath))
156
+ return fallback;
157
+ try {
158
+ const value = JSON.parse(fs2.readFileSync(filePath, "utf8"));
159
+ if (!value || typeof value !== "object" || Array.isArray(value))
160
+ throw new Error("Expected an object");
161
+ return value;
162
+ } catch {
163
+ throw new Error(`Native configuration is invalid JSON: ${filePath}`);
164
+ }
165
+ }
140
166
 
141
- export { homeDir, getConfigPath, getTelemetryPath, getSkillsDir, getSkillPackagesRoot, getSkillStatePath, getManagedIndexPath, getSecretsStorePath, getSecretsKeyPath, getPidPath, getLogPath, getGatewayTokenPath, getUpdatesDir, getStagedVersionPath, getUpdateLockPath, getOAuthLockPath, getPluginCacheRoot, getPluginDataRoot, getMarketplaceCacheRoot, getMarketplaceUpdateStatePath, getMarketplaceUpdateLockPath, ensureDir, ensureParentDir, findProjectConfigPath, readJsonFile, writeJsonAtomic, sha256 };
167
+ export { homeDir, getConfigRoot, getDataRoot, getStateRoot, getConfigPath, getTelemetryPath, getSkillsDir, getSkillPackagesRoot, getSkillStatePath, getManagedIndexPath, getSecretsStorePath, getSecretsKeyPath, getRuntimeDir, getPidPath, getLogPath, getGatewayTokenPath, getUpdatesDir, getStagedVersionPath, getUpdateLockPath, getOAuthLockPath, getPluginCacheRoot, getPluginDataRoot, getMarketplaceCacheRoot, getMarketplaceUpdateStatePath, getMarketplaceUpdateLockPath, ensureDir, ensureParentDir, findProjectConfigPath, readJsonFile, writeJsonAtomic, sha256, readJsonStrict };
142
168
 
143
- //# debugId=BCB55F79AB94B71A64756E2164756E21
169
+ //# debugId=40EB4EBB6125E60564756E2164756E21
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  require_src
3
- } from "./chunk-tnhekcpv.js";
3
+ } from "./chunk-56z18csx.js";
4
4
  import {
5
5
  __commonJS,
6
6
  __require
@@ -0,0 +1,18 @@
1
+ import {
2
+ exportEnvironment,
3
+ importEnvironment
4
+ } from "./chunk-qf8bj9y7.js";
5
+ import"./chunk-hahs24dv.js";
6
+ import"./chunk-chaj8a8b.js";
7
+ import"./chunk-7rq88hb3.js";
8
+ import"./chunk-brxwa30j.js";
9
+ import"./chunk-p7yzyt87.js";
10
+ import"./chunk-grkz21sq.js";
11
+ import"./chunk-bjw71y54.js";
12
+ import"./chunk-wj4tjacg.js";
13
+ export {
14
+ exportEnvironment,
15
+ importEnvironment
16
+ };
17
+
18
+ //# debugId=6F722CF50728EEF764756E2164756E21
@@ -0,0 +1,127 @@
1
+ import {
2
+ lockOwnerAlive
3
+ } from "./chunk-chaj8a8b.js";
4
+ import {
5
+ loadConfig,
6
+ loadProjectConfig,
7
+ saveConfig,
8
+ saveProjectConfig
9
+ } from "./chunk-brxwa30j.js";
10
+ import {
11
+ findProjectConfigPath,
12
+ getConfigPath
13
+ } from "./chunk-grkz21sq.js";
14
+
15
+ // src/core/config-store.ts
16
+ import fs from "node:fs";
17
+ import path from "node:path";
18
+ var LOCK_RETRY_MS = 50;
19
+ var LOCK_MAX_RETRIES = 40;
20
+ var inProcessQueues = new Map;
21
+ function getLockPath(filePath) {
22
+ return `${filePath}.lock`;
23
+ }
24
+ function acquireLock(filePath) {
25
+ const lockPath = getLockPath(filePath);
26
+ try {
27
+ fs.mkdirSync(path.dirname(lockPath), { recursive: true });
28
+ const fd = fs.openSync(lockPath, "wx");
29
+ fs.writeSync(fd, String(process.pid));
30
+ fs.closeSync(fd);
31
+ return true;
32
+ } catch (err) {
33
+ if (err.code !== "EEXIST") {
34
+ return false;
35
+ }
36
+ try {
37
+ if (!lockOwnerAlive(lockPath)) {
38
+ fs.unlinkSync(lockPath);
39
+ return acquireLock(filePath);
40
+ }
41
+ } catch {
42
+ return acquireLock(filePath);
43
+ }
44
+ return false;
45
+ }
46
+ }
47
+ function releaseLock(filePath) {
48
+ try {
49
+ fs.unlinkSync(getLockPath(filePath));
50
+ } catch {}
51
+ }
52
+ function mutateFile(filePath, load, save, fn) {
53
+ const prevQueue = inProcessQueues.get(filePath) ?? Promise.resolve();
54
+ const nextQueue = prevQueue.then(() => executeWithLock(filePath, load, save, fn), () => executeWithLock(filePath, load, save, fn));
55
+ inProcessQueues.set(filePath, nextQueue.catch(() => {
56
+ return;
57
+ }));
58
+ return nextQueue;
59
+ }
60
+ async function executeWithLock(filePath, load, save, fn) {
61
+ let acquired = false;
62
+ for (let attempt = 0;attempt < LOCK_MAX_RETRIES; attempt++) {
63
+ acquired = acquireLock(filePath);
64
+ if (acquired)
65
+ break;
66
+ await new Promise((r) => setTimeout(r, LOCK_RETRY_MS));
67
+ }
68
+ if (!acquired) {
69
+ throw new Error(`Could not acquire lock for ${filePath}.`);
70
+ }
71
+ try {
72
+ const data = load(filePath);
73
+ const result = await fn(data);
74
+ save(data, filePath);
75
+ return result;
76
+ } finally {
77
+ releaseLock(filePath);
78
+ }
79
+ }
80
+ function mutateConfig(fn, configPath) {
81
+ return mutateFile(configPath ?? getConfigPath(), loadConfig, saveConfig, async (config) => {
82
+ const result = await fn(config);
83
+ config.revision = (config.revision ?? 0) + 1;
84
+ return result;
85
+ });
86
+ }
87
+ function mutateProjectConfig(projectConfigPath, fn) {
88
+ return mutateFile(projectConfigPath, (p) => loadProjectConfig(p), saveProjectConfig, fn);
89
+ }
90
+ async function mutateActiveConfig(options, mutator) {
91
+ const globalPath = getConfigPath();
92
+ if (!options.global) {
93
+ const projectConfigPath = findProjectConfigPath();
94
+ if (options.local) {
95
+ const projectPath = projectConfigPath ? path.dirname(projectConfigPath) : process.cwd();
96
+ const localPath = path.join(projectPath, ".mcpx.json");
97
+ const globalConfig = loadConfig(globalPath);
98
+ const result2 = await mutateProjectConfig(localPath, async (projectConfig) => {
99
+ const mergedConfig = {
100
+ ...globalConfig,
101
+ servers: { ...globalConfig.servers, ...projectConfig.servers }
102
+ };
103
+ const mutatorResult = await mutator(mergedConfig, { type: "project", projectPath });
104
+ const localServers = {};
105
+ for (const [name, spec] of Object.entries(mergedConfig.servers)) {
106
+ if (!(name in globalConfig.servers)) {
107
+ localServers[name] = spec;
108
+ }
109
+ }
110
+ projectConfig.servers = localServers;
111
+ return mutatorResult;
112
+ });
113
+ return { type: "project", configPath: localPath, projectPath, result: result2 };
114
+ }
115
+ if (projectConfigPath) {
116
+ const projectPath = path.dirname(projectConfigPath);
117
+ const result2 = await mutateConfig((config) => mutator(config, { type: "project", projectPath }), globalPath);
118
+ return { type: "project", configPath: globalPath, projectPath, result: result2 };
119
+ }
120
+ }
121
+ const result = await mutateConfig((config) => mutator(config, { type: "global" }), globalPath);
122
+ return { type: "global", configPath: globalPath, result };
123
+ }
124
+
125
+ export { mutateConfig, mutateProjectConfig, mutateActiveConfig };
126
+
127
+ //# debugId=F410213A0C687F0164756E2164756E21