@botpress/runtime 1.16.2 → 1.16.5

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.16.2", 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.5", 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
 
@@ -15646,9 +15646,7 @@ var init_span_helpers = __esm({
15646
15646
  attrsWithImportance.importance = spanDef.importance;
15647
15647
  }
15648
15648
  const cleanedAttributes = truncateAttributes(attrsWithImportance);
15649
- const s = tracer.startSpan(name, {
15650
- attributes: cleanedAttributes
15651
- });
15649
+ const s = parentContext ? tracer.startSpan(name, { attributes: cleanedAttributes }, parentContext) : tracer.startSpan(name, { attributes: cleanedAttributes });
15652
15650
  const ctx = trace.setSpan(parentContext || context2.active(), s);
15653
15651
  s.ctx = ctx;
15654
15652
  s[Symbol.dispose] = () => s.end();
@@ -34494,7 +34492,7 @@ Always prefer information from the knowledge bases over general knowledge when a
34494
34492
  for (const obj of objs) {
34495
34493
  obj.tools = obj.tools?.map(
34496
34494
  (tool) => tool.clone({
34497
- handler: asyncResource.bind((args, ctx2) => {
34495
+ handler: bindContext((args, ctx2) => {
34498
34496
  let err = null;
34499
34497
  const result = span(
34500
34498
  "autonomous.tool",
@@ -34557,7 +34555,7 @@ Always prefer information from the knowledge bases over general knowledge when a
34557
34555
  iterationSpan?.setAttribute("autonomous.tools", allTools?.map((t) => t.name).join(", "));
34558
34556
  return allTools.map(
34559
34557
  (tool) => tool.clone({
34560
- handler: asyncResource.bind((args, ctx2) => {
34558
+ handler: bindContext((args, ctx2) => {
34561
34559
  let err = null;
34562
34560
  const result = span(
34563
34561
  "autonomous.tool",
@@ -39099,6 +39097,7 @@ var init_conversation = __esm({
39099
39097
  });
39100
39098
  let type;
39101
39099
  let requestObject = void 0;
39100
+ let completionObject = void 0;
39102
39101
  if (message) {
39103
39102
  type = "message";
39104
39103
  } else if (event && event.type === "workflowDataRequest") {
@@ -39117,6 +39116,24 @@ var init_conversation = __esm({
39117
39116
  console.error("Failed to load workflow instance for data request", err);
39118
39117
  type = "event";
39119
39118
  }
39119
+ } else if (event && event.type === "workflowCallback") {
39120
+ type = "workflow_callback";
39121
+ try {
39122
+ const workflowInstance = await BaseWorkflowInstance.load({
39123
+ id: event.payload.workflowId
39124
+ });
39125
+ const payload = event.payload;
39126
+ completionObject = {
39127
+ type: payload.workflow,
39128
+ workflow: workflowInstance,
39129
+ status: payload.status,
39130
+ output: payload.output,
39131
+ error: payload.error
39132
+ };
39133
+ } catch (err) {
39134
+ console.error("Failed to load workflow instance for completion", err);
39135
+ type = "event";
39136
+ }
39120
39137
  } else {
39121
39138
  type = "event";
39122
39139
  }
@@ -39206,6 +39223,7 @@ var init_conversation = __esm({
39206
39223
  channel: conversationInstance.channel,
39207
39224
  event,
39208
39225
  request: requestObject,
39226
+ completion: completionObject,
39209
39227
  conversation: conversationInstance,
39210
39228
  state: stateProxy,
39211
39229
  client: client2,