@botpress/runtime 1.16.3 → 1.16.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/internal.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.16.3", adk: "not-installed", sdk: "5.4.3", llmz: "0.0.54", zai: "2.6.0", cognitive: "0.3.14" };
51
+ define_PACKAGE_VERSIONS_default = { runtime: "1.16.6", adk: "not-installed", sdk: "5.4.3", llmz: "0.0.54", zai: "2.6.0", cognitive: "0.3.14" };
52
52
  }
53
53
  });
54
54
 
@@ -15950,9 +15950,7 @@ var init_span_helpers = __esm({
15950
15950
  attrsWithImportance.importance = spanDef.importance;
15951
15951
  }
15952
15952
  const cleanedAttributes = truncateAttributes(attrsWithImportance);
15953
- const s = tracer.startSpan(name, {
15954
- attributes: cleanedAttributes
15955
- });
15953
+ const s = parentContext ? tracer.startSpan(name, { attributes: cleanedAttributes }, parentContext) : tracer.startSpan(name, { attributes: cleanedAttributes });
15956
15954
  const ctx = trace.setSpan(parentContext || context2.active(), s);
15957
15955
  s.ctx = ctx;
15958
15956
  s[Symbol.dispose] = () => s.end();
@@ -34694,7 +34692,7 @@ Always prefer information from the knowledge bases over general knowledge when a
34694
34692
  for (const obj of objs) {
34695
34693
  obj.tools = obj.tools?.map(
34696
34694
  (tool) => tool.clone({
34697
- handler: asyncResource.bind((args, ctx2) => {
34695
+ handler: bindContext((args, ctx2) => {
34698
34696
  let err = null;
34699
34697
  const result = span(
34700
34698
  "autonomous.tool",
@@ -34757,7 +34755,7 @@ Always prefer information from the knowledge bases over general knowledge when a
34757
34755
  iterationSpan?.setAttribute("autonomous.tools", allTools?.map((t) => t.name).join(", "));
34758
34756
  return allTools.map(
34759
34757
  (tool) => tool.clone({
34760
- handler: asyncResource.bind((args, ctx2) => {
34758
+ handler: bindContext((args, ctx2) => {
34761
34759
  let err = null;
34762
34760
  const result = span(
34763
34761
  "autonomous.tool",
@@ -38422,6 +38420,7 @@ var init_conversation = __esm({
38422
38420
  });
38423
38421
  let type;
38424
38422
  let requestObject = void 0;
38423
+ let completionObject = void 0;
38425
38424
  if (message) {
38426
38425
  type = "message";
38427
38426
  } else if (event && event.type === "workflowDataRequest") {
@@ -38440,6 +38439,24 @@ var init_conversation = __esm({
38440
38439
  console.error("Failed to load workflow instance for data request", err);
38441
38440
  type = "event";
38442
38441
  }
38442
+ } else if (event && event.type === "workflowCallback") {
38443
+ type = "workflow_callback";
38444
+ try {
38445
+ const workflowInstance = await BaseWorkflowInstance.load({
38446
+ id: event.payload.workflowId
38447
+ });
38448
+ const payload = event.payload;
38449
+ completionObject = {
38450
+ type: payload.workflow,
38451
+ workflow: workflowInstance,
38452
+ status: payload.status,
38453
+ output: payload.output,
38454
+ error: payload.error
38455
+ };
38456
+ } catch (err) {
38457
+ console.error("Failed to load workflow instance for completion", err);
38458
+ type = "event";
38459
+ }
38443
38460
  } else {
38444
38461
  type = "event";
38445
38462
  }
@@ -38529,6 +38546,7 @@ var init_conversation = __esm({
38529
38546
  channel: conversationInstance.channel,
38530
38547
  event,
38531
38548
  request: requestObject,
38549
+ completion: completionObject,
38532
38550
  conversation: conversationInstance,
38533
38551
  state: stateProxy,
38534
38552
  client: client2,