@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/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.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
 
@@ -36951,16 +36951,13 @@ var init_conversation_instance = __esm({
36951
36951
  );
36952
36952
  }
36953
36953
  this.TrackedState = existingState;
36954
- const tags = context.get("tags", { optional: true });
36955
- const existingTags = tags?.find(
36956
- (t) => t.type === "conversation" && t.id === conversation.id
36957
- );
36958
- if (!existingTags) {
36959
- throw new Error(
36960
- `Conversation tags not found for conversation ${conversation.id}. Make sure TrackedTags.loadAll() is called before creating conversation instances.`
36961
- );
36962
- }
36963
- this.TrackedTags = existingTags;
36954
+ const tags = TrackedTags.create({
36955
+ type: "conversation",
36956
+ id: conversation.id,
36957
+ client: client._inner,
36958
+ initialTags: conversation.tags
36959
+ });
36960
+ this.TrackedTags = tags;
36964
36961
  }
36965
36962
  get tags() {
36966
36963
  return this.TrackedTags.tags;
@@ -37379,7 +37376,7 @@ var init_handlers2 = __esm({
37379
37376
  });
37380
37377
 
37381
37378
  // src/runtime/tracked-tags.ts
37382
- var TrackedTags2;
37379
+ var TrackedTags;
37383
37380
  var init_tracked_tags = __esm({
37384
37381
  "src/runtime/tracked-tags.ts"() {
37385
37382
  "use strict";
@@ -37387,7 +37384,7 @@ var init_tracked_tags = __esm({
37387
37384
  init_define_PACKAGE_VERSIONS();
37388
37385
  init_context();
37389
37386
  init_tracing();
37390
- TrackedTags2 = class _TrackedTags {
37387
+ TrackedTags = class _TrackedTags {
37391
37388
  type;
37392
37389
  id;
37393
37390
  client;
@@ -38213,7 +38210,7 @@ var init_workflow_instance = __esm({
38213
38210
  schema: definition?.stateSchema,
38214
38211
  name: BUILT_IN_STATES.workflowState
38215
38212
  });
38216
- this.TrackedTags = TrackedTags2.create({
38213
+ this.TrackedTags = TrackedTags.create({
38217
38214
  type: "workflow",
38218
38215
  client: client._inner,
38219
38216
  id: workflow.id,
@@ -38251,6 +38248,13 @@ var init_workflow_instance = __esm({
38251
38248
  if (!adk.project.workflows.find((w) => w.name === workflow.name)) {
38252
38249
  throw new Error(`No ADK Workflow definition found for "${workflow.name}"`);
38253
38250
  }
38251
+ TrackedTags.create({
38252
+ type: "workflow",
38253
+ client: client._inner,
38254
+ id: workflow.id,
38255
+ initialTags: workflow.tags
38256
+ });
38257
+ await TrackedTags.loadAll();
38254
38258
  return new _BaseWorkflowInstance(workflow, client);
38255
38259
  }
38256
38260
  /**
@@ -38264,11 +38268,16 @@ var init_workflow_instance = __esm({
38264
38268
  });
38265
38269
  return executeFunc(props);
38266
38270
  }
38271
+ /**
38272
+ * Cancel the workflow execution.
38273
+ * Note: This should be called from within a proper bot handler context.
38274
+ * If calling from a conversation handler, ensure TrackedTags.loadAll() has been called.
38275
+ */
38267
38276
  async cancel() {
38277
+ await TrackedTags.loadAll();
38268
38278
  const { workflow } = await updateWorkflow({
38269
38279
  id: this.id,
38270
- status: "cancelled",
38271
- failureReason: "Cancelled by user"
38280
+ status: "cancelled"
38272
38281
  });
38273
38282
  Object.assign(this.workflow, workflow);
38274
38283
  }