@skilder-ai/runtime 0.7.7 → 0.7.8
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 +30 -4
- package/dist/index.js.map +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -152421,6 +152421,8 @@ var ToolServerService = class ToolServerService2 extends Service {
|
|
|
152421
152421
|
this.isPythonServer = false;
|
|
152422
152422
|
this.onShutdownCallback = async () => {
|
|
152423
152423
|
};
|
|
152424
|
+
this.debounceTimer = null;
|
|
152425
|
+
this.pendingTools = null;
|
|
152424
152426
|
this.logger.info(`Initializing MCP server service for ${this.config.name}`);
|
|
152425
152427
|
this.client = new Client({
|
|
152426
152428
|
name: this.config.name,
|
|
@@ -152511,12 +152513,28 @@ var ToolServerService = class ToolServerService2 extends Service {
|
|
|
152511
152513
|
throw error48;
|
|
152512
152514
|
}
|
|
152513
152515
|
this.logger.debug("Connected to MCP server");
|
|
152514
|
-
const
|
|
152515
|
-
|
|
152516
|
+
const emitTools = (tools) => {
|
|
152517
|
+
this.pendingTools = tools;
|
|
152518
|
+
if (this.debounceTimer)
|
|
152519
|
+
clearTimeout(this.debounceTimer);
|
|
152520
|
+
this.debounceTimer = setTimeout(() => {
|
|
152521
|
+
if (this.pendingTools) {
|
|
152522
|
+
this.tools.next(this.pendingTools);
|
|
152523
|
+
this.pendingTools = null;
|
|
152524
|
+
}
|
|
152525
|
+
this.debounceTimer = null;
|
|
152526
|
+
}, 200);
|
|
152527
|
+
};
|
|
152516
152528
|
this.client.setNotificationHandler(ToolListChangedNotificationSchema, async () => {
|
|
152517
|
-
|
|
152518
|
-
|
|
152529
|
+
try {
|
|
152530
|
+
const updatedTools = await this.client.listTools();
|
|
152531
|
+
emitTools(updatedTools.tools);
|
|
152532
|
+
} catch (error48) {
|
|
152533
|
+
this.logger.error({ err: error48 }, "Failed to refresh tool list after ToolListChanged notification");
|
|
152534
|
+
}
|
|
152519
152535
|
});
|
|
152536
|
+
const originalTools = await this.client.listTools();
|
|
152537
|
+
emitTools(originalTools.tools);
|
|
152520
152538
|
}
|
|
152521
152539
|
/**
|
|
152522
152540
|
* Extract the most relevant error line from stderr output.
|
|
@@ -152536,6 +152554,14 @@ var ToolServerService = class ToolServerService2 extends Service {
|
|
|
152536
152554
|
}
|
|
152537
152555
|
async shutdown() {
|
|
152538
152556
|
this.logger.info("Stopping");
|
|
152557
|
+
if (this.debounceTimer) {
|
|
152558
|
+
clearTimeout(this.debounceTimer);
|
|
152559
|
+
this.debounceTimer = null;
|
|
152560
|
+
if (this.pendingTools) {
|
|
152561
|
+
this.tools.next(this.pendingTools);
|
|
152562
|
+
this.pendingTools = null;
|
|
152563
|
+
}
|
|
152564
|
+
}
|
|
152539
152565
|
this.tools.complete();
|
|
152540
152566
|
await this.onShutdownCallback();
|
|
152541
152567
|
if (this.transport instanceof StdioClientTransport) {
|