@kwonye/mcpx 0.1.105 → 0.1.107
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-131c6axh.js +127 -0
- package/dist/chunk-1yq3yb66.js +126 -0
- package/dist/chunk-2qbt2pxv.js +755 -0
- package/dist/chunk-3j4g9141.js +18 -0
- package/dist/{chunk-tnhekcpv.js → chunk-56z18csx.js} +1 -1
- package/dist/chunk-5r4vs8ct.js +18166 -0
- package/dist/{chunk-bnbz55g6.js → chunk-65kshh9w.js} +1 -1
- package/dist/{chunk-xydajvzg.js → chunk-7ky3rsw9.js} +1 -1
- package/dist/chunk-9bjabsqb.js +563 -0
- package/dist/chunk-9jqdtz2y.js +26 -0
- package/dist/{chunk-y9a1rx7j.js → chunk-ad74zhbk.js} +5 -3
- package/dist/chunk-eqcsd1kw.js +33 -0
- package/dist/chunk-ezk8txcy.js +23 -0
- package/dist/chunk-f7w0a9nn.js +30542 -0
- package/dist/{chunk-12vgqm89.js → chunk-gvjxpk98.js} +1 -1
- package/dist/{chunk-am903qjk.js → chunk-h2ex6pmn.js} +11 -5
- package/dist/chunk-jncje8g1.js +60 -0
- package/dist/{chunk-h158rkts.js → chunk-kjd00ez5.js} +17 -5
- package/dist/{chunk-6mxr34tc.js → chunk-mazydv41.js} +4 -3
- package/dist/chunk-mkf7gc7q.js +14 -0
- package/dist/{chunk-btbww96n.js → chunk-mztnw25b.js} +69 -56
- package/dist/{chunk-enzmq965.js → chunk-n0462d52.js} +1 -1
- package/dist/chunk-n5ahyh0j.js +254 -0
- package/dist/{chunk-t4hqf6yh.js → chunk-naeqpnmf.js} +8136 -8262
- package/dist/chunk-nx22h1y3.js +33 -0
- package/dist/chunk-p7yzyt87.js +19426 -0
- package/dist/chunk-q86c5s6r.js +7 -0
- package/dist/chunk-qg1rbk0d.js +825 -0
- package/dist/chunk-r1aebtwm.js +36 -0
- package/dist/{chunk-01s7rhx3.js → chunk-rbra8ws6.js} +130 -113
- package/dist/{chunk-91vcwk5m.js → chunk-v14bg5yp.js} +1 -1
- package/dist/{chunk-4y0t0tfj.js → chunk-vnka4jbe.js} +39 -3
- package/dist/chunk-z4j5q2x0.js +30 -0
- package/dist/chunk-z7ykm4da.js +138 -0
- package/dist/{chunk-d2v9rxy0.js → chunk-zmf014br.js} +12 -6
- 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 +18 -0
- package/dist/core/daemon.d.ts +2 -2
- package/dist/core/file-state.d.ts +7 -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
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildDaemonChildEnv,
|
|
3
|
+
getDaemonStatus,
|
|
4
|
+
readDaemonLogs,
|
|
5
|
+
resolveGatewayPort,
|
|
6
|
+
restartDaemon,
|
|
7
|
+
runDaemonForeground,
|
|
8
|
+
startDaemon,
|
|
9
|
+
stopDaemon
|
|
10
|
+
} from "./chunk-5r4vs8ct.js";
|
|
11
|
+
import"./chunk-mztnw25b.js";
|
|
12
|
+
import"./chunk-naeqpnmf.js";
|
|
13
|
+
import"./chunk-2qbt2pxv.js";
|
|
14
|
+
import"./chunk-f7w0a9nn.js";
|
|
15
|
+
import"./chunk-qg1rbk0d.js";
|
|
16
|
+
import"./chunk-z4j5q2x0.js";
|
|
17
|
+
import"./chunk-131c6axh.js";
|
|
18
|
+
import"./chunk-jncje8g1.js";
|
|
19
|
+
import"./chunk-9bjabsqb.js";
|
|
20
|
+
import"./chunk-rbra8ws6.js";
|
|
21
|
+
import"./chunk-p7yzyt87.js";
|
|
22
|
+
import"./chunk-vnka4jbe.js";
|
|
23
|
+
import"./chunk-bjw71y54.js";
|
|
24
|
+
import"./chunk-wj4tjacg.js";
|
|
25
|
+
export {
|
|
26
|
+
buildDaemonChildEnv,
|
|
27
|
+
getDaemonStatus,
|
|
28
|
+
readDaemonLogs,
|
|
29
|
+
resolveGatewayPort,
|
|
30
|
+
restartDaemon,
|
|
31
|
+
runDaemonForeground,
|
|
32
|
+
startDaemon,
|
|
33
|
+
stopDaemon
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
//# debugId=7E85224A0D63747064756E2164756E21
|
|
@@ -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-vnka4jbe.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
|
|
@@ -126,18 +126,54 @@ function readJsonFile(filePath, fallback) {
|
|
|
126
126
|
return fallback;
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
+
function fsyncBestEffort(descriptor) {
|
|
130
|
+
try {
|
|
131
|
+
fs2.fsyncSync(descriptor);
|
|
132
|
+
} catch (error) {
|
|
133
|
+
const code = error.code;
|
|
134
|
+
if (code === "EPERM" || code === "EINVAL" || code === "ENOTSUP")
|
|
135
|
+
return;
|
|
136
|
+
throw error;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
129
139
|
function writeJsonAtomic(filePath, data) {
|
|
130
140
|
fs2.mkdirSync(path2.dirname(filePath), { recursive: true });
|
|
131
141
|
const tempPath = `${filePath}.tmp-${process.pid}-${Date.now()}`;
|
|
132
142
|
const content = `${JSON.stringify(data, null, 2)}
|
|
133
143
|
`;
|
|
134
|
-
fs2.
|
|
144
|
+
const descriptor = fs2.openSync(tempPath, "w", 384);
|
|
145
|
+
try {
|
|
146
|
+
fs2.writeFileSync(descriptor, content);
|
|
147
|
+
fsyncBestEffort(descriptor);
|
|
148
|
+
} finally {
|
|
149
|
+
fs2.closeSync(descriptor);
|
|
150
|
+
}
|
|
135
151
|
fs2.renameSync(tempPath, filePath);
|
|
152
|
+
if (process.platform !== "win32") {
|
|
153
|
+
const directory = fs2.openSync(path2.dirname(filePath), "r");
|
|
154
|
+
try {
|
|
155
|
+
fsyncBestEffort(directory);
|
|
156
|
+
} finally {
|
|
157
|
+
fs2.closeSync(directory);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
136
160
|
}
|
|
137
161
|
function sha256(value) {
|
|
138
162
|
return crypto2.createHash("sha256").update(value).digest("hex");
|
|
139
163
|
}
|
|
164
|
+
function readJsonStrict(filePath, fallback) {
|
|
165
|
+
if (!fs2.existsSync(filePath))
|
|
166
|
+
return fallback;
|
|
167
|
+
try {
|
|
168
|
+
const value = JSON.parse(fs2.readFileSync(filePath, "utf8"));
|
|
169
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
170
|
+
throw new Error("Expected an object");
|
|
171
|
+
return value;
|
|
172
|
+
} catch {
|
|
173
|
+
throw new Error(`Native configuration is invalid JSON: ${filePath}`);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
140
176
|
|
|
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 };
|
|
177
|
+
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
178
|
|
|
143
|
-
//# debugId=
|
|
179
|
+
//# debugId=4649C9BC7E52DA8164756E2164756E21
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getManagedIndexPath,
|
|
3
|
+
readJsonFile,
|
|
4
|
+
writeJsonAtomic
|
|
5
|
+
} from "./chunk-vnka4jbe.js";
|
|
6
|
+
|
|
7
|
+
// src/core/managed-index.ts
|
|
8
|
+
function defaultManagedIndex() {
|
|
9
|
+
return {
|
|
10
|
+
schemaVersion: 1,
|
|
11
|
+
managed: {}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function loadManagedIndex(filePath = getManagedIndexPath()) {
|
|
15
|
+
const raw = readJsonFile(filePath, defaultManagedIndex());
|
|
16
|
+
if (!raw || typeof raw !== "object") {
|
|
17
|
+
return defaultManagedIndex();
|
|
18
|
+
}
|
|
19
|
+
if (raw.schemaVersion !== 1) {
|
|
20
|
+
return defaultManagedIndex();
|
|
21
|
+
}
|
|
22
|
+
return raw;
|
|
23
|
+
}
|
|
24
|
+
function saveManagedIndex(index, filePath = getManagedIndexPath()) {
|
|
25
|
+
writeJsonAtomic(filePath, index);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { defaultManagedIndex, loadManagedIndex, saveManagedIndex };
|
|
29
|
+
|
|
30
|
+
//# debugId=3E2C9A4BFDB1663764756E2164756E21
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import {
|
|
2
|
+
listAuthBindings,
|
|
3
|
+
secretRefName
|
|
4
|
+
} from "./chunk-0xt563m1.js";
|
|
5
|
+
import {
|
|
6
|
+
getDaemonStatus
|
|
7
|
+
} from "./chunk-5r4vs8ct.js";
|
|
8
|
+
import {
|
|
9
|
+
getAdapters,
|
|
10
|
+
getGatewayInternalUrl,
|
|
11
|
+
getGatewayUrl,
|
|
12
|
+
installationAdapters
|
|
13
|
+
} from "./chunk-f7w0a9nn.js";
|
|
14
|
+
import {
|
|
15
|
+
SecretsManager,
|
|
16
|
+
ensureGatewayToken
|
|
17
|
+
} from "./chunk-qg1rbk0d.js";
|
|
18
|
+
import {
|
|
19
|
+
isServerEnabled
|
|
20
|
+
} from "./chunk-bjw71y54.js";
|
|
21
|
+
|
|
22
|
+
// src/core/status.ts
|
|
23
|
+
var STATUS_CLIENTS = getAdapters().map((adapter) => adapter.id);
|
|
24
|
+
function describeServerTarget(spec) {
|
|
25
|
+
if (spec.transport === "http") {
|
|
26
|
+
return spec.url;
|
|
27
|
+
}
|
|
28
|
+
const args = (spec.args ?? []).join(" ");
|
|
29
|
+
const command = `${spec.command}${args ? ` ${args}` : ""}`;
|
|
30
|
+
return spec.cwd ? `${command} (cwd: ${spec.cwd})` : command;
|
|
31
|
+
}
|
|
32
|
+
function deriveClientStatus(managed, configured) {
|
|
33
|
+
if (configured) {
|
|
34
|
+
return configured;
|
|
35
|
+
}
|
|
36
|
+
return managed ? "SYNCED" : "SKIPPED";
|
|
37
|
+
}
|
|
38
|
+
function buildClientMappings(config, managedIndex, serverName) {
|
|
39
|
+
return installationAdapters(config).map(({ adapter }) => {
|
|
40
|
+
const clientId = adapter.id;
|
|
41
|
+
const configState = config.clients[clientId];
|
|
42
|
+
const managedClient = managedIndex.managed[clientId];
|
|
43
|
+
const managedEntry = managedClient?.entries?.[adapter.managedName?.(serverName) ?? `${serverName} (mcpx)`];
|
|
44
|
+
const managed = Boolean(managedEntry);
|
|
45
|
+
return {
|
|
46
|
+
clientId,
|
|
47
|
+
managed,
|
|
48
|
+
status: deriveClientStatus(managed, configState?.status),
|
|
49
|
+
configPath: managedClient?.configPath ?? configState?.configPath,
|
|
50
|
+
message: configState?.message,
|
|
51
|
+
lastSyncAt: managedEntry?.lastSyncedAt ?? configState?.lastSyncAt
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function buildAuthBindings(spec) {
|
|
56
|
+
return listAuthBindings(spec).map((binding) => ({
|
|
57
|
+
kind: binding.kind,
|
|
58
|
+
key: binding.key,
|
|
59
|
+
value: binding.value,
|
|
60
|
+
secretName: secretRefName(binding.value) ?? undefined
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
async function fetchTokenCounts(gatewayUrl, token) {
|
|
64
|
+
try {
|
|
65
|
+
const res = await fetch(gatewayUrl, {
|
|
66
|
+
method: "POST",
|
|
67
|
+
headers: {
|
|
68
|
+
authorization: `Bearer ${token}`
|
|
69
|
+
},
|
|
70
|
+
signal: AbortSignal.timeout(65000)
|
|
71
|
+
});
|
|
72
|
+
if (!res.ok) {
|
|
73
|
+
return { counts: {}, fetchError: `HTTP ${res.status}` };
|
|
74
|
+
}
|
|
75
|
+
const data = await res.json();
|
|
76
|
+
return { counts: data?.counts ?? {} };
|
|
77
|
+
} catch (error) {
|
|
78
|
+
return { counts: {}, fetchError: error instanceof Error ? error.message : String(error) };
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async function buildStatusReport(config, managedIndex, daemon = getDaemonStatus(config)) {
|
|
82
|
+
const secrets = new SecretsManager;
|
|
83
|
+
const token = ensureGatewayToken(config, secrets);
|
|
84
|
+
const gatewayUrl = getGatewayUrl(config);
|
|
85
|
+
let tokenCounts = {};
|
|
86
|
+
let tokenCountFetchError;
|
|
87
|
+
if (daemon.running) {
|
|
88
|
+
const result = await fetchTokenCounts(getGatewayInternalUrl(config, "/internal/token-counts"), token);
|
|
89
|
+
tokenCounts = result.counts;
|
|
90
|
+
tokenCountFetchError = result.fetchError;
|
|
91
|
+
}
|
|
92
|
+
const projectEntries = Object.values(config.projects ?? {});
|
|
93
|
+
let totalGlobalTokens = 0;
|
|
94
|
+
const totalProjectTokens = {};
|
|
95
|
+
const serverNames = Object.keys(config.servers).sort((left, right) => left.localeCompare(right));
|
|
96
|
+
const servers = serverNames.map((name) => {
|
|
97
|
+
const spec = config.servers[name];
|
|
98
|
+
let tokenCount = tokenCounts[name];
|
|
99
|
+
if (tokenCount?.error && buildAuthBindings(spec).length > 0 && tokenCount.total > 0) {
|
|
100
|
+
tokenCount = { ...tokenCount, error: undefined };
|
|
101
|
+
}
|
|
102
|
+
const health = tokenCount ? tokenCount.error || tokenCount.runtimeError ? "error" : "ok" : "unknown";
|
|
103
|
+
const serverEntry = {
|
|
104
|
+
name,
|
|
105
|
+
enabled: isServerEnabled(spec),
|
|
106
|
+
transport: spec.transport,
|
|
107
|
+
target: describeServerTarget(spec),
|
|
108
|
+
authBindings: buildAuthBindings(spec),
|
|
109
|
+
clients: buildClientMappings(config, managedIndex, name),
|
|
110
|
+
tokenCount,
|
|
111
|
+
health
|
|
112
|
+
};
|
|
113
|
+
if (serverEntry.enabled && tokenCount) {
|
|
114
|
+
totalGlobalTokens += tokenCount.total;
|
|
115
|
+
for (const projectEntry of projectEntries) {
|
|
116
|
+
if (!(projectEntry.disabledServers ?? []).includes(name)) {
|
|
117
|
+
totalProjectTokens[projectEntry.path] = (totalProjectTokens[projectEntry.path] ?? 0) + tokenCount.total;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return serverEntry;
|
|
122
|
+
});
|
|
123
|
+
return {
|
|
124
|
+
gatewayUrl,
|
|
125
|
+
fetchError: tokenCountFetchError,
|
|
126
|
+
daemon,
|
|
127
|
+
upstreamCount: servers.length,
|
|
128
|
+
servers,
|
|
129
|
+
clients: config.clients,
|
|
130
|
+
projects: config.projects,
|
|
131
|
+
totalGlobalTokens,
|
|
132
|
+
totalProjectTokens
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export { STATUS_CLIENTS, buildStatusReport };
|
|
137
|
+
|
|
138
|
+
//# debugId=5813D4CDEF97EC7C64756E2164756E21
|
|
@@ -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-mztnw25b.js";
|
|
15
|
+
import"./chunk-naeqpnmf.js";
|
|
16
|
+
import"./chunk-f7w0a9nn.js";
|
|
17
|
+
import"./chunk-qg1rbk0d.js";
|
|
18
|
+
import"./chunk-z4j5q2x0.js";
|
|
19
|
+
import"./chunk-131c6axh.js";
|
|
20
|
+
import"./chunk-jncje8g1.js";
|
|
21
|
+
import"./chunk-9bjabsqb.js";
|
|
22
|
+
import"./chunk-rbra8ws6.js";
|
|
23
|
+
import"./chunk-p7yzyt87.js";
|
|
24
|
+
import"./chunk-vnka4jbe.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
|