@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/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.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
 
@@ -41312,6 +41312,9 @@ async function _step(name, run, { maxAttempts = DEFAULT_MAX_ATTEMPTS } = {}, {
41312
41312
  startedAt: (/* @__PURE__ */ new Date()).toISOString()
41313
41313
  };
41314
41314
  if (steps[name].finishedAt) {
41315
+ if (steps[name].error) {
41316
+ throw new Error(steps[name].error.message);
41317
+ }
41315
41318
  return steps[name].output;
41316
41319
  }
41317
41320
  while (true) {
@@ -41340,17 +41343,24 @@ async function _step(name, run, { maxAttempts = DEFAULT_MAX_ATTEMPTS } = {}, {
41340
41343
  return;
41341
41344
  }
41342
41345
  if (steps[name].attempts >= maxAttempts - 1) {
41346
+ const errorMessage = e instanceof Error ? e.message : String(e);
41347
+ steps[name].error = {
41348
+ message: errorMessage,
41349
+ failedAt: (/* @__PURE__ */ new Date()).toISOString(),
41350
+ maxAttemptsReached: true
41351
+ };
41352
+ steps[name].finishedAt = (/* @__PURE__ */ new Date()).toISOString();
41343
41353
  stepSpan.setAttributes({
41344
- "workflow.step.error": e instanceof Error ? e.message : String(e)
41354
+ "workflow.step.error": errorMessage,
41355
+ "workflow.step.max_attempts": maxAttempts
41345
41356
  });
41346
41357
  stepSpan.setStatus({
41347
41358
  code: 2,
41348
41359
  message: `Step "${name}" failed after max attempts (${maxAttempts})`
41349
41360
  });
41350
- workflowControlContext.fail(
41351
- `Step "${name}" failed after max attempts (${maxAttempts})`
41352
- );
41353
- return;
41361
+ state.value.revision++;
41362
+ await workflowControlContext.ack();
41363
+ throw e;
41354
41364
  } else {
41355
41365
  steps[name].attempts++;
41356
41366
  stepSpan.setAttributes({
@@ -41683,7 +41693,12 @@ var workflowStepContextSchema = z7.lazy(
41683
41693
  i: z7.number().optional(),
41684
41694
  startedAt: z7.string(),
41685
41695
  finishedAt: z7.string().optional(),
41686
- steps: z7.record(z7.string(), workflowStepContextSchema).optional()
41696
+ steps: z7.record(z7.string(), workflowStepContextSchema).optional(),
41697
+ error: z7.object({
41698
+ message: z7.string(),
41699
+ failedAt: z7.string(),
41700
+ maxAttemptsReached: z7.boolean()
41701
+ }).optional()
41687
41702
  })
41688
41703
  );
41689
41704
  var workflowExecutionContextSchema = z7.object({
@@ -42253,7 +42268,7 @@ var adk = {
42253
42268
  get zai() {
42254
42269
  return new Zai({
42255
42270
  client: context.get("cognitive"),
42256
- modelId: Array.isArray(adk.project.config.defaultModels.autonomous) ? adk.project.config.defaultModels.autonomous[0] : adk.project.config.defaultModels.autonomous
42271
+ modelId: Array.isArray(adk.project.config.defaultModels.autonomous) ? adk.project.config.defaultModels.autonomous[0] ?? "auto" : adk.project.config.defaultModels.autonomous
42257
42272
  });
42258
42273
  },
42259
42274
  get project() {