@skilder-ai/runtime 0.8.6 → 0.8.7
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 +23 -17
- package/dist/index.js.map +2 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -138096,10 +138096,10 @@ var SkillCallToolRequest = class extends NatsRequest {
|
|
|
138096
138096
|
return `*.${type9}.>`;
|
|
138097
138097
|
}
|
|
138098
138098
|
/**
|
|
138099
|
-
* Subscribe to a specific static tool by name
|
|
138099
|
+
* Subscribe to a specific static tool by name, scoped to a workspace.
|
|
138100
138100
|
*/
|
|
138101
|
-
static subscribeToStaticTool(toolName) {
|
|
138102
|
-
return
|
|
138101
|
+
static subscribeToStaticTool(toolName, workspaceId) {
|
|
138102
|
+
return `${workspaceId}.${type9}.static.${toolName}.*`;
|
|
138103
138103
|
}
|
|
138104
138104
|
/**
|
|
138105
138105
|
* Subscribe to all script execution calls
|
|
@@ -138108,20 +138108,21 @@ var SkillCallToolRequest = class extends NatsRequest {
|
|
|
138108
138108
|
return `*.${type9}.script.>`;
|
|
138109
138109
|
}
|
|
138110
138110
|
/**
|
|
138111
|
-
* Subscribe to a specific script by ID
|
|
138111
|
+
* Subscribe to a specific script by ID, scoped to a workspace.
|
|
138112
138112
|
*/
|
|
138113
|
-
static subscribeToScript(scriptId) {
|
|
138114
|
-
return
|
|
138113
|
+
static subscribeToScript(scriptId, workspaceId) {
|
|
138114
|
+
return `${workspaceId}.${type9}.script.${scriptId}.*.*`;
|
|
138115
138115
|
}
|
|
138116
138116
|
/**
|
|
138117
|
-
* Subscribe to all script execution calls for a specific runtime
|
|
138117
|
+
* Subscribe to all script execution calls for a specific runtime, scoped to a workspace.
|
|
138118
138118
|
* Format: {workspaceId}.call-tool.script.{scriptId}.{targetRuntimeId}.{from}
|
|
138119
|
+
* When workspaceId is empty (system runtimes that are cross-workspace), uses a wildcard.
|
|
138119
138120
|
*/
|
|
138120
|
-
static subscribeToScriptsForRuntime(runtimeId) {
|
|
138121
|
-
return `*.${type9}.script.*.${runtimeId}.*`;
|
|
138121
|
+
static subscribeToScriptsForRuntime(runtimeId, workspaceId) {
|
|
138122
|
+
return workspaceId ? `${workspaceId}.${type9}.script.*.${runtimeId}.*` : `*.${type9}.script.*.${runtimeId}.*`;
|
|
138122
138123
|
}
|
|
138123
|
-
static subscribeToTool(toolId) {
|
|
138124
|
-
return
|
|
138124
|
+
static subscribeToTool(toolId, workspaceId) {
|
|
138125
|
+
return `${workspaceId}.${type9}.${toolId}.*`;
|
|
138125
138126
|
}
|
|
138126
138127
|
static subscribeToToolOnOneRuntime(toolId, workspaceId, runtimeId) {
|
|
138127
138128
|
return `${workspaceId}.${type9}.${toolId}.${runtimeId}`;
|
|
@@ -153069,7 +153070,7 @@ var RuntimeBusService = class RuntimeBusService2 {
|
|
|
153069
153070
|
return;
|
|
153070
153071
|
}
|
|
153071
153072
|
for (const runtimeId of toSubscribe) {
|
|
153072
|
-
this.subscribeRuntime(runtimeId);
|
|
153073
|
+
this.subscribeRuntime(runtimeId, workspaceId);
|
|
153073
153074
|
}
|
|
153074
153075
|
}
|
|
153075
153076
|
async drain() {
|
|
@@ -153086,10 +153087,10 @@ var RuntimeBusService = class RuntimeBusService2 {
|
|
|
153086
153087
|
}
|
|
153087
153088
|
/** Subscribe a single runtimeId. If the handler exits, drop from observed so the next
|
|
153088
153089
|
* syncSubscriptions() resubscribes (no exponential-backoff resurrection). */
|
|
153089
|
-
subscribeRuntime(runtimeId) {
|
|
153090
|
+
subscribeRuntime(runtimeId, workspaceId) {
|
|
153090
153091
|
if (!this.natsService || !this.onMessage)
|
|
153091
153092
|
return;
|
|
153092
|
-
const subject = SkillCallToolRequest.subscribeToScriptsForRuntime(runtimeId);
|
|
153093
|
+
const subject = SkillCallToolRequest.subscribeToScriptsForRuntime(runtimeId, workspaceId);
|
|
153093
153094
|
const subscription = this.natsService.subscribe(subject);
|
|
153094
153095
|
this.observed.set(runtimeId, { unsubscribe: () => subscription.unsubscribe() });
|
|
153095
153096
|
Promise.resolve(this.onMessage(subscription)).catch((err) => {
|
|
@@ -153654,8 +153655,8 @@ var ToolService = class ToolService2 extends Service {
|
|
|
153654
153655
|
}
|
|
153655
153656
|
}
|
|
153656
153657
|
// Subscribe to a tool and return the subscription
|
|
153657
|
-
subscribeToTool(tool2) {
|
|
153658
|
-
const subject = SkillCallToolRequest.subscribeToTool(tool2.id);
|
|
153658
|
+
subscribeToTool(tool2, workspaceId) {
|
|
153659
|
+
const subject = SkillCallToolRequest.subscribeToTool(tool2.id, workspaceId);
|
|
153659
153660
|
this.logger.debug(`Subscribing to tool ${tool2.id} on subject: ${subject}`);
|
|
153660
153661
|
const subscription = this.natsService.subscribe(subject);
|
|
153661
153662
|
this.handleToolCall(subscription).catch((err) => {
|
|
@@ -154380,6 +154381,11 @@ ${cleanError}` : cleanError;
|
|
|
154380
154381
|
*/
|
|
154381
154382
|
ensureToolsSubscribed(mcpServerId, tools) {
|
|
154382
154383
|
this.mcpTools.set(mcpServerId, tools.filter((tool2) => !!tool2));
|
|
154384
|
+
const workspaceId = this.mcpServerWorkspaces.get(mcpServerId);
|
|
154385
|
+
if (!workspaceId) {
|
|
154386
|
+
this.logger.warn({ event: "tool_subscribe_no_workspace", mcpServerId }, "Cannot subscribe to tools: workspace not registered for MCP server");
|
|
154387
|
+
return;
|
|
154388
|
+
}
|
|
154383
154389
|
if (!this.toolSubscriptions.has(mcpServerId)) {
|
|
154384
154390
|
this.toolSubscriptions.set(mcpServerId, /* @__PURE__ */ new Map());
|
|
154385
154391
|
}
|
|
@@ -154387,7 +154393,7 @@ ${cleanError}` : cleanError;
|
|
|
154387
154393
|
for (const tool2 of tools) {
|
|
154388
154394
|
if (tool2 && !serverToolSubs.has(tool2.id)) {
|
|
154389
154395
|
this.logger.debug(`Subscribing to tool ${tool2.name} (${tool2.id})`);
|
|
154390
|
-
const subscription = this.subscribeToTool(tool2);
|
|
154396
|
+
const subscription = this.subscribeToTool(tool2, workspaceId);
|
|
154391
154397
|
serverToolSubs.set(tool2.id, subscription);
|
|
154392
154398
|
} else if (tool2) {
|
|
154393
154399
|
this.logger.debug(`Tool ${tool2.name} (${tool2.id}) already subscribed -> skipping`);
|