@skilder-ai/runtime 0.9.5 → 0.9.6

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 CHANGED
@@ -21889,7 +21889,7 @@ var require_transport = __commonJS({
21889
21889
  "use strict";
21890
21890
  var { createRequire: createRequire2 } = require("module");
21891
21891
  var getCallers = require_caller();
21892
- var { join: join6, isAbsolute: isAbsolute3, sep: sep3 } = require("node:path");
21892
+ var { join: join6, isAbsolute: isAbsolute4, sep: sep3 } = require("node:path");
21893
21893
  var sleep = require_atomic_sleep();
21894
21894
  var onExit = require_on_exit_leak_free();
21895
21895
  var ThreadStream = require_thread_stream();
@@ -21988,7 +21988,7 @@ var require_transport = __commonJS({
21988
21988
  return buildStream(fixTarget(target), options, worker, sync);
21989
21989
  function fixTarget(origin) {
21990
21990
  origin = bundlerOverrides[origin] || origin;
21991
- if (isAbsolute3(origin) || origin.indexOf("file://") === 0) {
21991
+ if (isAbsolute4(origin) || origin.indexOf("file://") === 0) {
21992
21992
  return origin;
21993
21993
  }
21994
21994
  if (origin === "pino/file") {
@@ -138862,6 +138862,7 @@ var OAuthProviderType = /* @__PURE__ */ ((OAuthProviderType2) => {
138862
138862
  OAuthProviderType2["GithubSignin"] = "GITHUB_SIGNIN";
138863
138863
  OAuthProviderType2["Google"] = "GOOGLE";
138864
138864
  OAuthProviderType2["GoogleSignin"] = "GOOGLE_SIGNIN";
138865
+ OAuthProviderType2["Infomaniak"] = "INFOMANIAK";
138865
138866
  OAuthProviderType2["McpOauth"] = "MCP_OAUTH";
138866
138867
  OAuthProviderType2["Microsoft"] = "MICROSOFT";
138867
138868
  OAuthProviderType2["Zoho"] = "ZOHO";
@@ -153626,15 +153627,14 @@ var ToolServerService = class ToolServerService2 extends LifecycleService {
153626
153627
  * while Node.js errors appear on the first line.
153627
153628
  */
153628
153629
  extractStderrMessage(stderr) {
153629
- const lines = stderr.split("\n");
153630
+ const lines = stderr.split("\n").map((l2) => l2.trim()).filter(Boolean);
153631
+ if (lines.length === 0)
153632
+ return "";
153630
153633
  if (this.isPythonServer) {
153631
- for (let i2 = lines.length - 1; i2 >= 0; i2--) {
153632
- const line = lines[i2].trim();
153633
- if (line)
153634
- return line;
153635
- }
153634
+ return lines[lines.length - 1];
153636
153635
  }
153637
- return lines[0].trim();
153636
+ const messageLine = lines.find((l2) => /^(?:[A-Z][\w]*Error|Error)\b/.test(l2));
153637
+ return messageLine ?? lines[0];
153638
153638
  }
153639
153639
  async shutdown() {
153640
153640
  this.logger.info("Stopping");
@@ -154743,14 +154743,27 @@ var ToolService = class ToolService2 extends LifecycleService {
154743
154743
  this.mcpTools.delete(mcpServerId);
154744
154744
  this.mcpServerWorkspaces.delete(mcpServerId);
154745
154745
  }
154746
- // Subscribe to a tool and return the subscription
154747
- subscribeToTool(tool2, workspaceId) {
154746
+ // Subscribe to a tool and return the subscription.
154747
+ // Self-heal: if the consumer loop exits (normally or via throw), drop our
154748
+ // bookkeeping entry so the next ensureToolsSubscribed() reconcile re-subscribes
154749
+ // instead of skipping the tool as "already subscribed" while no one reads from
154750
+ // the subject — that mismatch causes silent NATS request timeouts on the caller.
154751
+ subscribeToTool(tool2, workspaceId, mcpServerId) {
154748
154752
  const subject = SkillCallToolRequest.subscribeToTool(tool2.id, workspaceId);
154749
154753
  this.logger.debug(`Subscribing to tool ${tool2.id} on subject: ${subject}`);
154750
154754
  const subscription = this.natsService.subscribe(subject);
154751
- this.handleToolCall(subscription).catch((err) => {
154752
- this.logger.error({ event: "tool_call_subscription_died", toolId: tool2.id, err }, "Tool call subscription loop terminated unexpectedly");
154753
- });
154755
+ const onLoopEnd = (err) => {
154756
+ if (err) {
154757
+ this.logger.error({ event: "tool_call_subscription_died", toolId: tool2.id, mcpServerId, err }, "Tool call subscription loop terminated unexpectedly");
154758
+ } else {
154759
+ this.logger.debug({ event: "tool_call_subscription_ended", toolId: tool2.id, mcpServerId }, "Tool call subscription loop ended");
154760
+ }
154761
+ const serverToolSubs = this.toolSubscriptions.get(mcpServerId);
154762
+ if (serverToolSubs && serverToolSubs.get(tool2.id) === subscription) {
154763
+ serverToolSubs.delete(tool2.id);
154764
+ }
154765
+ };
154766
+ this.handleToolCall(subscription).then(() => onLoopEnd(), (err) => onLoopEnd(err));
154754
154767
  return subscription;
154755
154768
  }
154756
154769
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -155605,7 +155618,7 @@ ${result.stdout}
155605
155618
  for (const tool2 of tools) {
155606
155619
  if (tool2 && !serverToolSubs.has(tool2.id)) {
155607
155620
  this.logger.debug(`Subscribing to tool ${tool2.name} (${tool2.id})`);
155608
- const subscription = this.subscribeToTool(tool2, workspaceId);
155621
+ const subscription = this.subscribeToTool(tool2, workspaceId, mcpServerId);
155609
155622
  serverToolSubs.set(tool2.id, subscription);
155610
155623
  } else if (tool2) {
155611
155624
  this.logger.debug(`Tool ${tool2.name} (${tool2.id}) already subscribed -> skipping`);
@@ -156458,6 +156471,9 @@ var start = () => {
156458
156471
  var projectRoot = (0, import_path4.resolve)(__dirname, "../../..");
156459
156472
  var packagePath = (0, import_path4.resolve)(__dirname, "../");
156460
156473
  loadEnv(projectRoot, packagePath, process.env.FORWARD_STDERR !== "false");
156474
+ if (process.env.MCP_SERVERS_PATH && !(0, import_path4.isAbsolute)(process.env.MCP_SERVERS_PATH)) {
156475
+ process.env.MCP_SERVERS_PATH = (0, import_path4.resolve)(process.cwd(), process.env.MCP_SERVERS_PATH);
156476
+ }
156461
156477
  start();
156462
156478
  var mainService = container.get(MainService);
156463
156479
  mainService.start("index");