@botpress/runtime 1.3.15 → 1.3.17

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.15", adk: "not-installed", sdk: "4.17.3", llmz: "0.0.27", zai: "2.1.20", cognitive: "0.1.50" };
51
+ define_PACKAGE_VERSIONS_default = { runtime: "1.3.17", 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
 
@@ -40650,7 +40650,7 @@ Always prefer information from the knowledge bases over general knowledge when a
40650
40650
  "autonomous.tool.input": args
40651
40651
  },
40652
40652
  async (s) => {
40653
- const value = tool.execute(args, ctx2).catch((e) => {
40653
+ const value = await tool.execute(args, ctx2).catch((e) => {
40654
40654
  err = e;
40655
40655
  if (err && err?.constructor && err?.constructor?.name && err?.constructor?.name === "ThinkSignal") {
40656
40656
  s.setAttributes({
@@ -40715,7 +40715,7 @@ Always prefer information from the knowledge bases over general knowledge when a
40715
40715
  "autonomous.tool.input": args
40716
40716
  },
40717
40717
  async (s) => {
40718
- const value = tool.execute(args, ctx2).catch((e) => {
40718
+ const value = await tool.execute(args, ctx2).catch((e) => {
40719
40719
  err = e;
40720
40720
  if (err && err?.constructor && err?.constructor?.name && err?.constructor?.name === "ThinkSignal") {
40721
40721
  s.setAttributes({
@@ -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({