@botpress/runtime 1.3.14 → 1.3.16

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.3.14", adk: "not-installed", sdk: "4.17.3", llmz: "0.0.27", zai: "2.1.19", cognitive: "0.1.50" };
51
+ define_PACKAGE_VERSIONS_default = { runtime: "1.3.16", adk: "not-installed", sdk: "4.17.3", llmz: "0.0.27", zai: "2.1.20", cognitive: "0.1.50" };
52
52
  }
53
53
  });
54
54
 
@@ -43751,6 +43751,9 @@ async function _step(name, run, { maxAttempts = DEFAULT_MAX_ATTEMPTS } = {}, {
43751
43751
  startedAt: (/* @__PURE__ */ new Date()).toISOString()
43752
43752
  };
43753
43753
  if (steps[name].finishedAt) {
43754
+ if (steps[name].error) {
43755
+ throw new Error(steps[name].error.message);
43756
+ }
43754
43757
  return steps[name].output;
43755
43758
  }
43756
43759
  while (true) {
@@ -43779,17 +43782,24 @@ async function _step(name, run, { maxAttempts = DEFAULT_MAX_ATTEMPTS } = {}, {
43779
43782
  return;
43780
43783
  }
43781
43784
  if (steps[name].attempts >= maxAttempts - 1) {
43785
+ const errorMessage = e instanceof Error ? e.message : String(e);
43786
+ steps[name].error = {
43787
+ message: errorMessage,
43788
+ failedAt: (/* @__PURE__ */ new Date()).toISOString(),
43789
+ maxAttemptsReached: true
43790
+ };
43791
+ steps[name].finishedAt = (/* @__PURE__ */ new Date()).toISOString();
43782
43792
  stepSpan.setAttributes({
43783
- "workflow.step.error": e instanceof Error ? e.message : String(e)
43793
+ "workflow.step.error": errorMessage,
43794
+ "workflow.step.max_attempts": maxAttempts
43784
43795
  });
43785
43796
  stepSpan.setStatus({
43786
43797
  code: 2,
43787
43798
  message: `Step "${name}" failed after max attempts (${maxAttempts})`
43788
43799
  });
43789
- workflowControlContext.fail(
43790
- `Step "${name}" failed after max attempts (${maxAttempts})`
43791
- );
43792
- return;
43800
+ state.value.revision++;
43801
+ await workflowControlContext.ack();
43802
+ throw e;
43793
43803
  } else {
43794
43804
  steps[name].attempts++;
43795
43805
  stepSpan.setAttributes({
@@ -44122,7 +44132,12 @@ var workflowStepContextSchema = z21.lazy(
44122
44132
  i: z21.number().optional(),
44123
44133
  startedAt: z21.string(),
44124
44134
  finishedAt: z21.string().optional(),
44125
- steps: z21.record(z21.string(), workflowStepContextSchema).optional()
44135
+ steps: z21.record(z21.string(), workflowStepContextSchema).optional(),
44136
+ error: z21.object({
44137
+ message: z21.string(),
44138
+ failedAt: z21.string(),
44139
+ maxAttemptsReached: z21.boolean()
44140
+ }).optional()
44126
44141
  })
44127
44142
  );
44128
44143
  var workflowExecutionContextSchema = z21.object({
@@ -44635,7 +44650,7 @@ var adk = {
44635
44650
  get zai() {
44636
44651
  return new Zai({
44637
44652
  client: context2.get("cognitive"),
44638
- modelId: Array.isArray(adk.project.config.defaultModels.autonomous) ? adk.project.config.defaultModels.autonomous[0] : adk.project.config.defaultModels.autonomous
44653
+ modelId: Array.isArray(adk.project.config.defaultModels.autonomous) ? adk.project.config.defaultModels.autonomous[0] ?? "auto" : adk.project.config.defaultModels.autonomous
44639
44654
  });
44640
44655
  },
44641
44656
  get project() {