bruce-models 6.8.5 → 6.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.
@@ -16190,7 +16190,10 @@
16190
16190
  }, auth);
16191
16191
  const data = yield this.parseJson(response);
16192
16192
  const text = (_b = (_a = data === null || data === void 0 ? void 0 : data.Text) !== null && _a !== void 0 ? _a : data === null || data === void 0 ? void 0 : data.text) !== null && _b !== void 0 ? _b : "";
16193
- const steps = Array.isArray(data === null || data === void 0 ? void 0 : data.steps) ? data.steps : [];
16193
+ const rawSteps = Array.isArray(data === null || data === void 0 ? void 0 : data.steps) ? data.steps : [];
16194
+ const steps = rawSteps
16195
+ .filter((step) => step)
16196
+ .map((step, idx) => (Object.assign(Object.assign({}, step), { index: typeof (step === null || step === void 0 ? void 0 : step.index) === "number" ? step.index : idx })));
16194
16197
  return {
16195
16198
  text,
16196
16199
  steps,
@@ -16218,10 +16221,8 @@
16218
16221
  if (path.startsWith("http://") || path.startsWith("https://")) {
16219
16222
  return path;
16220
16223
  }
16221
- if (!path.startsWith("/")) {
16222
- path = `/${path}`;
16223
- }
16224
- return `${this.baseUrl}${path}`;
16224
+ // Use URL constructor to properly handle path joining and avoid double slashes
16225
+ return new URL(path, this.baseUrl).toString();
16225
16226
  }
16226
16227
  fetchFromEndpoint(path, init, auth) {
16227
16228
  var _a;
@@ -16383,20 +16384,25 @@
16383
16384
  return urlInstance.toString();
16384
16385
  }
16385
16386
  handleMessage(raw) {
16386
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
16387
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
16387
16388
  return __awaiter(this, void 0, void 0, function* () {
16388
16389
  try {
16389
16390
  const message = typeof raw === "string" ? JSON.parse(raw) : raw;
16390
16391
  const method = message === null || message === void 0 ? void 0 : message.method;
16392
+ if (method === "chat/event") {
16393
+ const payload = ((_a = message === null || message === void 0 ? void 0 : message.params) !== null && _a !== void 0 ? _a : {});
16394
+ (_c = (_b = this.options).onChatEvent) === null || _c === void 0 ? void 0 : _c.call(_b, payload);
16395
+ return;
16396
+ }
16391
16397
  if (method !== "tools/call") {
16392
- (_b = (_a = this.logger()).debug) === null || _b === void 0 ? void 0 : _b.call(_a, "[NavigatorMcpWS] Ignoring non tool-call message", message);
16398
+ (_e = (_d = this.logger()).debug) === null || _e === void 0 ? void 0 : _e.call(_d, "[NavigatorMcpWS] Ignoring unsupported message", message);
16393
16399
  return;
16394
16400
  }
16395
- const toolName = (_c = message === null || message === void 0 ? void 0 : message.params) === null || _c === void 0 ? void 0 : _c.name;
16396
- const toolArgs = (_d = message === null || message === void 0 ? void 0 : message.params) === null || _d === void 0 ? void 0 : _d.arguments;
16401
+ const toolName = (_f = message === null || message === void 0 ? void 0 : message.params) === null || _f === void 0 ? void 0 : _f.name;
16402
+ const toolArgs = (_g = message === null || message === void 0 ? void 0 : message.params) === null || _g === void 0 ? void 0 : _g.arguments;
16397
16403
  const messageId = message === null || message === void 0 ? void 0 : message.id;
16398
16404
  if (!toolName) {
16399
- (_f = (_e = this.logger()).warn) === null || _f === void 0 ? void 0 : _f.call(_e, "[NavigatorMcpWS] Received tool call without name", message);
16405
+ (_j = (_h = this.logger()).warn) === null || _j === void 0 ? void 0 : _j.call(_h, "[NavigatorMcpWS] Received tool call without name", message);
16400
16406
  return;
16401
16407
  }
16402
16408
  let result;
@@ -16408,7 +16414,7 @@
16408
16414
  });
16409
16415
  }
16410
16416
  catch (error) {
16411
- (_h = (_g = this.logger()).error) === null || _h === void 0 ? void 0 : _h.call(_g, "[NavigatorMcpWS] Tool handler threw", error);
16417
+ (_l = (_k = this.logger()).error) === null || _l === void 0 ? void 0 : _l.call(_k, "[NavigatorMcpWS] Tool handler threw", error);
16412
16418
  result = `Error: ${error instanceof Error ? error.message : String(error)}`;
16413
16419
  }
16414
16420
  this.send({
@@ -16418,7 +16424,7 @@
16418
16424
  });
16419
16425
  }
16420
16426
  catch (error) {
16421
- (_k = (_j = this.logger()).error) === null || _k === void 0 ? void 0 : _k.call(_j, "[NavigatorMcpWS] Invalid message", error);
16427
+ (_o = (_m = this.logger()).error) === null || _o === void 0 ? void 0 : _o.call(_m, "[NavigatorMcpWS] Invalid message", error);
16422
16428
  }
16423
16429
  });
16424
16430
  }
@@ -16430,7 +16436,7 @@
16430
16436
  }
16431
16437
 
16432
16438
  // This is updated with the package.json version on build.
16433
- const VERSION = "6.8.5";
16439
+ const VERSION = "6.8.7";
16434
16440
 
16435
16441
  exports.VERSION = VERSION;
16436
16442
  exports.AbstractApi = AbstractApi;