@botpress/runtime 1.10.1 → 1.10.2

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.10.1", adk: "1.10.1", sdk: "4.20.2", llmz: "0.0.33", zai: "2.5.0", cognitive: "0.2.0" };
51
+ define_PACKAGE_VERSIONS_default = { runtime: "1.10.2", adk: "1.10.2", sdk: "4.20.2", llmz: "0.0.33", zai: "2.5.0", cognitive: "0.2.0" };
52
52
  }
53
53
  });
54
54
 
@@ -36329,6 +36329,13 @@ var init_workflow_instance = __esm({
36329
36329
  if (!adk.project.workflows.find((w) => w.name === workflow.name)) {
36330
36330
  throw new Error(`No ADK Workflow definition found for "${workflow.name}"`);
36331
36331
  }
36332
+ TrackedTags.create({
36333
+ type: "workflow",
36334
+ client: client._inner,
36335
+ id: workflow.id,
36336
+ initialTags: workflow.tags
36337
+ });
36338
+ await TrackedTags.loadAll();
36332
36339
  return new _BaseWorkflowInstance(workflow, client);
36333
36340
  }
36334
36341
  /**
@@ -36342,11 +36349,16 @@ var init_workflow_instance = __esm({
36342
36349
  });
36343
36350
  return executeFunc(props);
36344
36351
  }
36352
+ /**
36353
+ * Cancel the workflow execution.
36354
+ * Note: This should be called from within a proper bot handler context.
36355
+ * If calling from a conversation handler, ensure TrackedTags.loadAll() has been called.
36356
+ */
36345
36357
  async cancel() {
36358
+ await TrackedTags.loadAll();
36346
36359
  const { workflow } = await updateWorkflow({
36347
36360
  id: this.id,
36348
- status: "cancelled",
36349
- failureReason: "Cancelled by user"
36361
+ status: "cancelled"
36350
36362
  });
36351
36363
  Object.assign(this.workflow, workflow);
36352
36364
  }
@@ -37898,16 +37910,13 @@ var init_conversation_instance = __esm({
37898
37910
  );
37899
37911
  }
37900
37912
  this.TrackedState = existingState;
37901
- const tags = context.get("tags", { optional: true });
37902
- const existingTags = tags?.find(
37903
- (t) => t.type === "conversation" && t.id === conversation.id
37904
- );
37905
- if (!existingTags) {
37906
- throw new Error(
37907
- `Conversation tags not found for conversation ${conversation.id}. Make sure TrackedTags.loadAll() is called before creating conversation instances.`
37908
- );
37909
- }
37910
- this.TrackedTags = existingTags;
37913
+ const tags = TrackedTags.create({
37914
+ type: "conversation",
37915
+ id: conversation.id,
37916
+ client: client._inner,
37917
+ initialTags: conversation.tags
37918
+ });
37919
+ this.TrackedTags = tags;
37911
37920
  }
37912
37921
  get tags() {
37913
37922
  return this.TrackedTags.tags;