@daeda/mcp-pro 0.1.27 → 0.1.28
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/index.js +67 -50
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1333,7 +1333,7 @@ var ClientStateSchema = z12.object({
|
|
|
1333
1333
|
selectedPortalId: z12.number().nullable()
|
|
1334
1334
|
});
|
|
1335
1335
|
var SyncStatusSchema = z12.enum(["NOT_STARTED", "DOWNLOADING", "PROCESSING", "PARTIAL", "SYNCED", "FAILED"]);
|
|
1336
|
-
var PluginSyncStatusSchema = z12.enum(["NOT_STARTED", "SYNCING", "SYNCED", "FAILED"]);
|
|
1336
|
+
var PluginSyncStatusSchema = z12.enum(["NOT_STARTED", "SYNCING", "SYNCED", "PARTIAL", "FAILED"]);
|
|
1337
1337
|
var SyncPluginItemSchema = z12.object({
|
|
1338
1338
|
name: z12.string(),
|
|
1339
1339
|
status: PluginSyncStatusSchema,
|
|
@@ -3989,7 +3989,7 @@ var upsertArtifact = (artifacts, input, updatedAt) => {
|
|
|
3989
3989
|
];
|
|
3990
3990
|
};
|
|
3991
3991
|
var upsertPlugin = (plugins, input, updatedAt) => {
|
|
3992
|
-
const errorValue = input.status === "FAILED" ? input.error ?? null : null;
|
|
3992
|
+
const errorValue = input.status === "FAILED" || input.status === "PARTIAL" ? input.error ?? null : null;
|
|
3993
3993
|
let didUpdate = false;
|
|
3994
3994
|
const nextPlugins = plugins.map((plugin) => {
|
|
3995
3995
|
if (plugin.name !== input.pluginName) {
|
|
@@ -4000,7 +4000,7 @@ var upsertPlugin = (plugins, input, updatedAt) => {
|
|
|
4000
4000
|
name: input.pluginName,
|
|
4001
4001
|
status: input.status,
|
|
4002
4002
|
error: errorValue,
|
|
4003
|
-
lastSynced: input.lastSynced !== void 0 ? input.lastSynced : input.status === "SYNCED" ? updatedAt : plugin.lastSynced ?? null,
|
|
4003
|
+
lastSynced: input.lastSynced !== void 0 ? input.lastSynced : input.status === "SYNCED" || input.status === "PARTIAL" ? updatedAt : plugin.lastSynced ?? null,
|
|
4004
4004
|
sourcePath: input.sourcePath ?? plugin.sourcePath ?? null,
|
|
4005
4005
|
updatedAt
|
|
4006
4006
|
};
|
|
@@ -4014,7 +4014,7 @@ var upsertPlugin = (plugins, input, updatedAt) => {
|
|
|
4014
4014
|
name: input.pluginName,
|
|
4015
4015
|
status: input.status,
|
|
4016
4016
|
error: errorValue,
|
|
4017
|
-
lastSynced: input.lastSynced !== void 0 ? input.lastSynced : input.status === "SYNCED" ? updatedAt : null,
|
|
4017
|
+
lastSynced: input.lastSynced !== void 0 ? input.lastSynced : input.status === "SYNCED" || input.status === "PARTIAL" ? updatedAt : null,
|
|
4018
4018
|
sourcePath: input.sourcePath ?? null,
|
|
4019
4019
|
updatedAt
|
|
4020
4020
|
}
|
|
@@ -4433,31 +4433,11 @@ var PortalDataLiveBase = Layer7.effect(
|
|
|
4433
4433
|
requireMasterConnection(input.portalId, `syncPluginPayload:${input.pluginName}`),
|
|
4434
4434
|
Effect33.flatMap(
|
|
4435
4435
|
() => pipe21(
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
sourcePath: input.source.kind === "jsonPath" ? input.source.jsonPath : null
|
|
4442
|
-
})
|
|
4443
|
-
),
|
|
4444
|
-
Effect33.flatMap(
|
|
4445
|
-
() => duckDb.syncPlugin({
|
|
4446
|
-
portalId: input.portalId,
|
|
4447
|
-
pluginName: input.pluginName,
|
|
4448
|
-
source: input.source
|
|
4449
|
-
})
|
|
4450
|
-
),
|
|
4451
|
-
Effect33.flatMap(
|
|
4452
|
-
() => swallowPortalFileStateError(
|
|
4453
|
-
portalFileState.updatePluginStatus({
|
|
4454
|
-
portalId: input.portalId,
|
|
4455
|
-
pluginName: input.pluginName,
|
|
4456
|
-
status: "SYNCED",
|
|
4457
|
-
sourcePath: input.source.kind === "jsonPath" ? input.source.jsonPath : null
|
|
4458
|
-
})
|
|
4459
|
-
)
|
|
4460
|
-
),
|
|
4436
|
+
duckDb.syncPlugin({
|
|
4437
|
+
portalId: input.portalId,
|
|
4438
|
+
pluginName: input.pluginName,
|
|
4439
|
+
source: input.source
|
|
4440
|
+
}),
|
|
4461
4441
|
Effect33.flatMap(
|
|
4462
4442
|
() => swallowPortalFileStateError(portalFileState.touchSyncedAt(input.portalId))
|
|
4463
4443
|
),
|
|
@@ -4467,23 +4447,9 @@ var PortalDataLiveBase = Layer7.effect(
|
|
|
4467
4447
|
})),
|
|
4468
4448
|
Effect33.catchAllCause((cause) => {
|
|
4469
4449
|
const error = squashError(cause);
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
portalFileState.updatePluginStatus({
|
|
4474
|
-
portalId: input.portalId,
|
|
4475
|
-
pluginName: input.pluginName,
|
|
4476
|
-
status: "FAILED",
|
|
4477
|
-
error: message,
|
|
4478
|
-
sourcePath: input.source.kind === "jsonPath" ? input.source.jsonPath : null
|
|
4479
|
-
})
|
|
4480
|
-
),
|
|
4481
|
-
Effect33.flatMap(
|
|
4482
|
-
() => toSyncFailure(
|
|
4483
|
-
`Failed to sync plugin ${input.pluginName} for portal ${input.portalId}`,
|
|
4484
|
-
cause
|
|
4485
|
-
)
|
|
4486
|
-
)
|
|
4450
|
+
return toSyncFailure(
|
|
4451
|
+
`Failed to sync plugin ${input.pluginName} for portal ${input.portalId}: ${formatErrorMessage(error)}`,
|
|
4452
|
+
cause
|
|
4487
4453
|
);
|
|
4488
4454
|
})
|
|
4489
4455
|
)
|
|
@@ -4674,6 +4640,7 @@ var extractMessage = (value) => {
|
|
|
4674
4640
|
return null;
|
|
4675
4641
|
};
|
|
4676
4642
|
var isReadOnlySkipError = (error) => error instanceof ReadOnlyClientSkipError;
|
|
4643
|
+
var getPluginTerminalStatus = (response) => response.plugin_status === "PARTIAL" ? "PARTIAL" : "SYNCED";
|
|
4677
4644
|
var formatPluginError2 = (error, pluginName) => {
|
|
4678
4645
|
const messages = [];
|
|
4679
4646
|
let current = error;
|
|
@@ -4711,14 +4678,31 @@ var syncMessagePlugin = (ws, portalData, portalFileState, portalId, plugin) => p
|
|
|
4711
4678
|
() => ws.requestPluginData(portalId, plugin.name, plugin.timeoutSeconds)
|
|
4712
4679
|
),
|
|
4713
4680
|
Effect35.flatMap(
|
|
4714
|
-
(
|
|
4681
|
+
(response) => portalData.syncPluginPayload({
|
|
4715
4682
|
portalId,
|
|
4716
4683
|
pluginName: plugin.name,
|
|
4717
4684
|
source: {
|
|
4718
4685
|
kind: "payload",
|
|
4719
|
-
payload
|
|
4686
|
+
payload: response.data
|
|
4720
4687
|
}
|
|
4721
|
-
})
|
|
4688
|
+
}).pipe(
|
|
4689
|
+
Effect35.flatMap(() => {
|
|
4690
|
+
const terminalStatus = getPluginTerminalStatus(response);
|
|
4691
|
+
const message = response.warning ?? null;
|
|
4692
|
+
return pipe23(
|
|
4693
|
+
portalData.setMetadata(portalId, PLUGIN_ERROR_KEY2(plugin.name), message ?? ""),
|
|
4694
|
+
Effect35.catchAll(() => Effect35.void),
|
|
4695
|
+
Effect35.flatMap(
|
|
4696
|
+
() => portalFileState.updatePluginStatus({
|
|
4697
|
+
portalId,
|
|
4698
|
+
pluginName: plugin.name,
|
|
4699
|
+
status: terminalStatus,
|
|
4700
|
+
error: message
|
|
4701
|
+
}).pipe(Effect35.catchAll(() => Effect35.void))
|
|
4702
|
+
)
|
|
4703
|
+
);
|
|
4704
|
+
})
|
|
4705
|
+
)
|
|
4722
4706
|
),
|
|
4723
4707
|
Effect35.asVoid
|
|
4724
4708
|
);
|
|
@@ -4991,7 +4975,7 @@ var handlePluginDataResponse = (payload, ctx) => pipe35(
|
|
|
4991
4975
|
return Effect47.void;
|
|
4992
4976
|
}
|
|
4993
4977
|
if (payload.success) {
|
|
4994
|
-
return Effect47.sync(() => pending.resolve(payload
|
|
4978
|
+
return Effect47.sync(() => pending.resolve(payload));
|
|
4995
4979
|
}
|
|
4996
4980
|
return Effect47.sync(
|
|
4997
4981
|
() => pending.reject(
|
|
@@ -16641,6 +16625,30 @@ var makeEnsureFresh = (deps, options2) => createEnsureFresh(
|
|
|
16641
16625
|
options2
|
|
16642
16626
|
);
|
|
16643
16627
|
|
|
16628
|
+
// src/pure/stdio-lifecycle.ts
|
|
16629
|
+
var registerStdioShutdownHooks = ({
|
|
16630
|
+
stdin,
|
|
16631
|
+
stderr,
|
|
16632
|
+
exit
|
|
16633
|
+
}) => {
|
|
16634
|
+
let shuttingDown = false;
|
|
16635
|
+
const shutdown = (reason) => {
|
|
16636
|
+
if (shuttingDown) return;
|
|
16637
|
+
shuttingDown = true;
|
|
16638
|
+
stderr.write(`[stdio] stdin ${reason} received, shutting down MCP client
|
|
16639
|
+
`);
|
|
16640
|
+
exit(0);
|
|
16641
|
+
};
|
|
16642
|
+
const onEnd = () => shutdown("end");
|
|
16643
|
+
const onClose = () => shutdown("close");
|
|
16644
|
+
stdin.on("end", onEnd);
|
|
16645
|
+
stdin.on("close", onClose);
|
|
16646
|
+
return () => {
|
|
16647
|
+
stdin.off("end", onEnd);
|
|
16648
|
+
stdin.off("close", onClose);
|
|
16649
|
+
};
|
|
16650
|
+
};
|
|
16651
|
+
|
|
16644
16652
|
// src/index.ts
|
|
16645
16653
|
process.on("uncaughtException", (err) => {
|
|
16646
16654
|
console.error("[fatal:uncaughtException]", err);
|
|
@@ -16662,6 +16670,15 @@ var isEnvFlagEnabled = (name) => {
|
|
|
16662
16670
|
var DISABLE_PLUGIN_SYNC = isEnvFlagEnabled("MCP_CLIENT_DISABLE_PLUGIN_SYNC");
|
|
16663
16671
|
var DISABLE_DIFF_FOLLOWUP = isEnvFlagEnabled("MCP_CLIENT_DISABLE_DIFF_FOLLOWUP");
|
|
16664
16672
|
var TEST_HEADLESS_MODE = isEnvFlagEnabled("MCP_CLIENT_TEST_HEADLESS");
|
|
16673
|
+
if (!TEST_HEADLESS_MODE) {
|
|
16674
|
+
registerStdioShutdownHooks({
|
|
16675
|
+
stdin: process.stdin,
|
|
16676
|
+
stderr: process.stderr,
|
|
16677
|
+
exit: (code) => {
|
|
16678
|
+
process.exit(code);
|
|
16679
|
+
}
|
|
16680
|
+
});
|
|
16681
|
+
}
|
|
16665
16682
|
var mainProgram = Effect108.gen(function* () {
|
|
16666
16683
|
const ws = yield* WebSocketService;
|
|
16667
16684
|
const config = yield* ConfigService;
|