@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.
@@ -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
 
@@ -33380,7 +33380,7 @@ Always prefer information from the knowledge bases over general knowledge when a
33380
33380
  for (const obj of objs) {
33381
33381
  obj.tools = obj.tools?.map(
33382
33382
  (tool) => tool.clone({
33383
- handler: asyncResource.bind((args, ctx2) => {
33383
+ handler: bindContext((args, ctx2) => {
33384
33384
  let err = null;
33385
33385
  const result = span(
33386
33386
  "autonomous.tool",
@@ -33443,7 +33443,7 @@ Always prefer information from the knowledge bases over general knowledge when a
33443
33443
  iterationSpan?.setAttribute("autonomous.tools", allTools?.map((t) => t.name).join(", "));
33444
33444
  return allTools.map(
33445
33445
  (tool) => tool.clone({
33446
- handler: asyncResource.bind((args, ctx2) => {
33446
+ handler: bindContext((args, ctx2) => {
33447
33447
  let err = null;
33448
33448
  const result = span(
33449
33449
  "autonomous.tool",
@@ -45259,6 +45259,7 @@ var init_conversation = __esm({
45259
45259
  });
45260
45260
  let type;
45261
45261
  let requestObject = void 0;
45262
+ let completionObject = void 0;
45262
45263
  if (message) {
45263
45264
  type = "message";
45264
45265
  } else if (event && event.type === "workflowDataRequest") {
@@ -45277,6 +45278,24 @@ var init_conversation = __esm({
45277
45278
  console.error("Failed to load workflow instance for data request", err);
45278
45279
  type = "event";
45279
45280
  }
45281
+ } else if (event && event.type === "workflowCallback") {
45282
+ type = "workflow_callback";
45283
+ try {
45284
+ const workflowInstance = await BaseWorkflowInstance.load({
45285
+ id: event.payload.workflowId
45286
+ });
45287
+ const payload = event.payload;
45288
+ completionObject = {
45289
+ type: payload.workflow,
45290
+ workflow: workflowInstance,
45291
+ status: payload.status,
45292
+ output: payload.output,
45293
+ error: payload.error
45294
+ };
45295
+ } catch (err) {
45296
+ console.error("Failed to load workflow instance for completion", err);
45297
+ type = "event";
45298
+ }
45280
45299
  } else {
45281
45300
  type = "event";
45282
45301
  }
@@ -45366,6 +45385,7 @@ var init_conversation = __esm({
45366
45385
  channel: conversationInstance.channel,
45367
45386
  event,
45368
45387
  request: requestObject,
45388
+ completion: completionObject,
45369
45389
  conversation: conversationInstance,
45370
45390
  state: stateProxy,
45371
45391
  client: client2,
@@ -48190,9 +48210,7 @@ var init_span_helpers = __esm({
48190
48210
  attrsWithImportance.importance = spanDef.importance;
48191
48211
  }
48192
48212
  const cleanedAttributes = truncateAttributes(attrsWithImportance);
48193
- const s = tracer.startSpan(name, {
48194
- attributes: cleanedAttributes
48195
- });
48213
+ const s = parentContext ? tracer.startSpan(name, { attributes: cleanedAttributes }, parentContext) : tracer.startSpan(name, { attributes: cleanedAttributes });
48196
48214
  const ctx = trace.setSpan(parentContext || context.active(), s);
48197
48215
  s.ctx = ctx;
48198
48216
  s[Symbol.dispose] = () => s.end();