@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.
- package/dist/adapters/codex.d.ts +2 -0
- package/dist/adapters/index.d.ts +2 -1
- package/dist/adapters/json.d.ts +26 -0
- package/dist/adapters/pi.d.ts +9 -0
- package/dist/chunk-0xt563m1.js +126 -0
- package/dist/{chunk-btbww96n.js → chunk-1mrkz29t.js} +69 -56
- package/dist/{chunk-6mxr34tc.js → chunk-1v66g9d6.js} +4 -3
- package/dist/chunk-1yq3yb66.js +126 -0
- package/dist/chunk-27mq4agf.js +33 -0
- package/dist/{chunk-t4hqf6yh.js → chunk-4aafp444.js} +8136 -8262
- package/dist/chunk-4xym942z.js +36 -0
- package/dist/{chunk-tnhekcpv.js → chunk-56z18csx.js} +1 -1
- package/dist/{chunk-bnbz55g6.js → chunk-65kshh9w.js} +1 -1
- package/dist/{chunk-xydajvzg.js → chunk-7ky3rsw9.js} +1 -1
- package/dist/chunk-7rq88hb3.js +563 -0
- package/dist/chunk-8v13hqrp.js +825 -0
- package/dist/chunk-a2gen8bn.js +730 -0
- package/dist/{chunk-01s7rhx3.js → chunk-brxwa30j.js} +130 -113
- package/dist/chunk-chaj8a8b.js +45 -0
- package/dist/chunk-e96643mj.js +26 -0
- package/dist/{chunk-d2v9rxy0.js → chunk-ew06e41w.js} +12 -6
- package/dist/chunk-ezk8txcy.js +23 -0
- package/dist/{chunk-4y0t0tfj.js → chunk-grkz21sq.js} +29 -3
- package/dist/{chunk-12vgqm89.js → chunk-gvjxpk98.js} +1 -1
- package/dist/chunk-h9kp47rp.js +18 -0
- package/dist/chunk-hahs24dv.js +127 -0
- package/dist/{chunk-y9a1rx7j.js → chunk-jv0s0cp6.js} +5 -3
- package/dist/{chunk-enzmq965.js → chunk-n0462d52.js} +1 -1
- package/dist/chunk-nh6hhv29.js +138 -0
- package/dist/chunk-p7yzyt87.js +19426 -0
- package/dist/chunk-q86c5s6r.js +7 -0
- package/dist/chunk-qf8bj9y7.js +254 -0
- package/dist/chunk-t20f49g3.js +30 -0
- package/dist/{chunk-am903qjk.js → chunk-v041118a.js} +11 -5
- package/dist/{chunk-91vcwk5m.js → chunk-v14bg5yp.js} +1 -1
- package/dist/chunk-wvzap0na.js +18166 -0
- package/dist/chunk-wztmp5b4.js +30479 -0
- package/dist/chunk-xvqr1q9b.js +14 -0
- package/dist/{chunk-h158rkts.js → chunk-yj7mpczw.js} +17 -5
- package/dist/chunk-yr0txkw0.js +31 -0
- package/dist/cli.js +3879 -1061
- package/dist/core/adoption.d.ts +62 -0
- package/dist/core/analytics.d.ts +17 -0
- package/dist/core/consumers.d.ts +8 -0
- package/dist/core/control.d.ts +12 -0
- package/dist/core/daemon.d.ts +2 -2
- package/dist/core/file-state.d.ts +5 -0
- package/dist/core/harnesses.d.ts +25 -0
- package/dist/core/index.d.ts +12 -4
- package/dist/core/index.js +109 -71
- package/dist/core/managed-index-lock.d.ts +1 -1
- package/dist/core/management.d.ts +32 -0
- package/dist/core/native-document.d.ts +4 -0
- package/dist/core/operations.d.ts +52 -0
- package/dist/core/plugin-projections.d.ts +1 -0
- package/dist/core/runtime-entry.d.ts +6 -0
- package/dist/core/runtime-snapshot.d.ts +6 -0
- package/dist/core/secret-keychain.d.ts +31 -0
- package/dist/core/secrets.d.ts +12 -2
- package/dist/core/served-skills.d.ts +62 -0
- package/dist/core/status.d.ts +1 -0
- package/dist/core/sync-plan.d.ts +14 -0
- package/dist/core/sync.d.ts +3 -0
- package/dist/core/telemetry.d.ts +2 -2
- package/dist/core/tui.d.ts +20 -0
- package/dist/core/verify-upstreams.d.ts +4 -0
- package/dist/core/work-limiter.d.ts +10 -0
- package/dist/gateway/server.d.ts +2 -0
- package/dist/types.d.ts +62 -1
- package/dist/util/fs.d.ts +2 -0
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/dist/adapters/opencode.d.ts +0 -11
- package/dist/chunk-56whm3hm.js +0 -4055
- 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-
|
|
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 =
|
|
432
|
-
status:
|
|
433
|
-
lastSyncAt:
|
|
434
|
-
message:
|
|
435
|
-
configPath:
|
|
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 =
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
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 =
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
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 =
|
|
452
|
-
var projectEntrySchema =
|
|
453
|
-
name:
|
|
454
|
-
path:
|
|
455
|
-
disabledServers:
|
|
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 =
|
|
458
|
-
var discoveredComponentSchema =
|
|
459
|
-
id:
|
|
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:
|
|
462
|
-
description:
|
|
465
|
+
path: exports_external.string(),
|
|
466
|
+
description: exports_external.string().optional()
|
|
463
467
|
});
|
|
464
|
-
var discoveredMcpServerSchema =
|
|
465
|
-
id:
|
|
466
|
-
transport:
|
|
467
|
-
command:
|
|
468
|
-
args:
|
|
469
|
-
env:
|
|
470
|
-
cwd:
|
|
471
|
-
url:
|
|
472
|
-
oauthResource:
|
|
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 =
|
|
475
|
-
skills:
|
|
476
|
-
commands:
|
|
477
|
-
agents:
|
|
478
|
-
hooks:
|
|
479
|
-
mcpServers:
|
|
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 =
|
|
482
|
-
id:
|
|
483
|
-
name:
|
|
484
|
-
source:
|
|
485
|
-
version:
|
|
486
|
-
ref:
|
|
487
|
-
resolvedSha:
|
|
488
|
-
installedAt:
|
|
489
|
-
root:
|
|
490
|
-
dataDir:
|
|
491
|
-
components:
|
|
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:
|
|
494
|
-
status:
|
|
495
|
-
error:
|
|
496
|
-
serverNames:
|
|
497
|
-
projectedClients:
|
|
498
|
-
approvals:
|
|
499
|
-
mcpServers:
|
|
500
|
-
skills:
|
|
501
|
-
hooks:
|
|
502
|
-
agents:
|
|
503
|
-
commands:
|
|
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:
|
|
506
|
-
name:
|
|
507
|
-
pluginName:
|
|
508
|
-
sourceFingerprint:
|
|
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:
|
|
511
|
-
pinned:
|
|
512
|
-
previous:
|
|
513
|
-
projectOverrides:
|
|
514
|
-
enabled:
|
|
515
|
-
components:
|
|
516
|
-
config:
|
|
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 =
|
|
520
|
-
name:
|
|
521
|
-
displayName:
|
|
522
|
-
source:
|
|
523
|
-
sourceType:
|
|
524
|
-
manifestPath:
|
|
525
|
-
format:
|
|
526
|
-
builtIn:
|
|
527
|
-
autoUpdate:
|
|
528
|
-
addedAt:
|
|
529
|
-
lastCheckedAt:
|
|
530
|
-
lastUpdatedAt:
|
|
531
|
-
resolvedRevision:
|
|
532
|
-
status:
|
|
533
|
-
error:
|
|
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 =
|
|
536
|
-
schemaVersion:
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
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:
|
|
547
|
-
clients:
|
|
548
|
-
projects:
|
|
549
|
-
plugins:
|
|
550
|
-
marketplaces:
|
|
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 =
|
|
553
|
-
name:
|
|
554
|
-
servers:
|
|
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
|
-
|
|
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=
|
|
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-
|
|
15
|
-
import"./chunk-
|
|
16
|
-
import"./chunk-
|
|
17
|
-
import"./chunk-
|
|
18
|
-
import"./chunk-
|
|
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=
|
|
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.
|
|
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=
|
|
169
|
+
//# debugId=40EB4EBB6125E60564756E2164756E21
|
|
@@ -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
|