@botpress/runtime 1.2.3 → 1.2.4

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/library.js CHANGED
@@ -48,7 +48,7 @@ var init_define_BUILD = __esm({
48
48
  var define_PACKAGE_VERSIONS_default;
49
49
  var init_define_PACKAGE_VERSIONS = __esm({
50
50
  "<define:__PACKAGE_VERSIONS__>"() {
51
- define_PACKAGE_VERSIONS_default = { runtime: "1.2.3", adk: "not-installed", sdk: "4.16.0", llmz: "0.0.26", zai: "2.1.16", cognitive: "0.1.47" };
51
+ define_PACKAGE_VERSIONS_default = { runtime: "1.2.4", adk: "not-installed", sdk: "4.16.0", llmz: "0.0.26", zai: "2.1.16", cognitive: "0.1.47" };
52
52
  }
53
53
  });
54
54
 
@@ -36247,6 +36247,7 @@ init_define_PACKAGE_VERSIONS();
36247
36247
  // src/consts.ts
36248
36248
  init_define_BUILD();
36249
36249
  init_define_PACKAGE_VERSIONS();
36250
+ var LOG_DELIMITER = "<|MESSAGE_END|>\n";
36250
36251
 
36251
36252
  // src/runtime/context/handlers.ts
36252
36253
  import { Client } from "@botpress/client";
@@ -40217,6 +40218,9 @@ var Autonomous;
40217
40218
  Autonomous2.DefaultExit = _DefaultExit;
40218
40219
  function createKnowledgeSearchTool(knowledgeBases) {
40219
40220
  const kbNames = knowledgeBases.map((kb) => kb.name);
40221
+ for (const kb of knowledgeBases) {
40222
+ console.log(kb.name, kb.description);
40223
+ }
40220
40224
  const description = knowledgeBases.map((kb) => `- "${kb.name}": ${kb.description || "No description"}`).join("\n");
40221
40225
  return new LlmzTool({
40222
40226
  name: "search_knowledge",
@@ -40289,6 +40293,7 @@ If the question is not related to the knowledge bases, do NOT use this tool.`.tr
40289
40293
  message.push(p.content);
40290
40294
  message.push(`</${tag}>`);
40291
40295
  }
40296
+ console.log(message.join("\n").trim());
40292
40297
  throw new Autonomous2.ThinkSignal(
40293
40298
  `We got the search results. When answering the question, you MUST add inline the citations used (eg: "Yes, the price is $10${example} ...")`,
40294
40299
  message.join("\n").trim()
@@ -40411,6 +40416,7 @@ Always prefer information from the knowledge bases over general knowledge when a
40411
40416
  message: "ThinkSignal"
40412
40417
  });
40413
40418
  err[HandledErrorProp] = true;
40419
+ throw err;
40414
40420
  } else {
40415
40421
  s.setAttributes({
40416
40422
  "autonomous.tool.status": "error",
@@ -40941,7 +40947,17 @@ function serializeArgs(...args) {
40941
40947
  });
40942
40948
  }
40943
40949
  function writeStructuredLog(type, ...args) {
40950
+ const output2 = process.stdout;
40944
40951
  const { spanId, traceId } = getTraceContext();
40952
+ let maybeArgObj = null;
40953
+ try {
40954
+ maybeArgObj = typeof args[0] === "string" ? JSON.parse(args[0]) : args[0];
40955
+ } catch {
40956
+ }
40957
+ if (maybeArgObj && typeof maybeArgObj === "object" && maybeArgObj.type === "worker_stats") {
40958
+ output2.write((0, import_fast_safe_stringify3.default)(maybeArgObj) + LOG_DELIMITER);
40959
+ return;
40960
+ }
40945
40961
  const logEntry = {
40946
40962
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
40947
40963
  type,
@@ -40953,8 +40969,7 @@ function writeStructuredLog(type, ...args) {
40953
40969
  if (traceId) {
40954
40970
  logEntry.traceId = traceId;
40955
40971
  }
40956
- const output2 = process.stdout;
40957
- output2.write(JSON.stringify(logEntry) + "\n");
40972
+ output2.write((0, import_fast_safe_stringify3.default)(logEntry) + LOG_DELIMITER);
40958
40973
  }
40959
40974
  function installStructuredLogging() {
40960
40975
  console.log = (...args) => {
@@ -45475,6 +45490,7 @@ var BaseKnowledge = class {
45475
45490
  constructor(props) {
45476
45491
  this.name = props.name;
45477
45492
  this.sources = props.sources;
45493
+ this.description = props.description;
45478
45494
  }
45479
45495
  /** @internal */
45480
45496
  getDefinition() {