@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.
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.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
 
@@ -41495,7 +41495,7 @@ var adk = {
41495
41495
  get zai() {
41496
41496
  return new Zai({
41497
41497
  client: context.get("cognitive"),
41498
- modelId: Array.isArray(adk.project.config.defaultModels.autonomous) ? adk.project.config.defaultModels.autonomous[0] : adk.project.config.defaultModels.autonomous
41498
+ modelId: Array.isArray(adk.project.config.defaultModels.autonomous) ? adk.project.config.defaultModels.autonomous[0] ?? "auto" : adk.project.config.defaultModels.autonomous
41499
41499
  });
41500
41500
  },
41501
41501
  get project() {
@@ -42742,6 +42742,9 @@ async function _step(name, run, { maxAttempts = DEFAULT_MAX_ATTEMPTS } = {}, {
42742
42742
  startedAt: (/* @__PURE__ */ new Date()).toISOString()
42743
42743
  };
42744
42744
  if (steps[name].finishedAt) {
42745
+ if (steps[name].error) {
42746
+ throw new Error(steps[name].error.message);
42747
+ }
42745
42748
  return steps[name].output;
42746
42749
  }
42747
42750
  while (true) {
@@ -42770,17 +42773,24 @@ async function _step(name, run, { maxAttempts = DEFAULT_MAX_ATTEMPTS } = {}, {
42770
42773
  return;
42771
42774
  }
42772
42775
  if (steps[name].attempts >= maxAttempts - 1) {
42776
+ const errorMessage = e instanceof Error ? e.message : String(e);
42777
+ steps[name].error = {
42778
+ message: errorMessage,
42779
+ failedAt: (/* @__PURE__ */ new Date()).toISOString(),
42780
+ maxAttemptsReached: true
42781
+ };
42782
+ steps[name].finishedAt = (/* @__PURE__ */ new Date()).toISOString();
42773
42783
  stepSpan.setAttributes({
42774
- "workflow.step.error": e instanceof Error ? e.message : String(e)
42784
+ "workflow.step.error": errorMessage,
42785
+ "workflow.step.max_attempts": maxAttempts
42775
42786
  });
42776
42787
  stepSpan.setStatus({
42777
42788
  code: 2,
42778
42789
  message: `Step "${name}" failed after max attempts (${maxAttempts})`
42779
42790
  });
42780
- workflowControlContext.fail(
42781
- `Step "${name}" failed after max attempts (${maxAttempts})`
42782
- );
42783
- return;
42791
+ state.value.revision++;
42792
+ await workflowControlContext.ack();
42793
+ throw e;
42784
42794
  } else {
42785
42795
  steps[name].attempts++;
42786
42796
  stepSpan.setAttributes({
@@ -43113,7 +43123,12 @@ var workflowStepContextSchema = z17.lazy(
43113
43123
  i: z17.number().optional(),
43114
43124
  startedAt: z17.string(),
43115
43125
  finishedAt: z17.string().optional(),
43116
- steps: z17.record(z17.string(), workflowStepContextSchema).optional()
43126
+ steps: z17.record(z17.string(), workflowStepContextSchema).optional(),
43127
+ error: z17.object({
43128
+ message: z17.string(),
43129
+ failedAt: z17.string(),
43130
+ maxAttemptsReached: z17.boolean()
43131
+ }).optional()
43117
43132
  })
43118
43133
  );
43119
43134
  var workflowExecutionContextSchema = z17.object({