@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.
@@ -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
 
@@ -39947,7 +39947,7 @@ Always prefer information from the knowledge bases over general knowledge when a
39947
39947
  "autonomous.tool.input": args
39948
39948
  },
39949
39949
  async (s) => {
39950
- const value = tool.execute(args, ctx2).catch((e) => {
39950
+ const value = await tool.execute(args, ctx2).catch((e) => {
39951
39951
  err = e;
39952
39952
  if (err && err?.constructor && err?.constructor?.name && err?.constructor?.name === "ThinkSignal") {
39953
39953
  s.setAttributes({
@@ -40012,7 +40012,7 @@ Always prefer information from the knowledge bases over general knowledge when a
40012
40012
  "autonomous.tool.input": args
40013
40013
  },
40014
40014
  async (s) => {
40015
- const value = tool.execute(args, ctx2).catch((e) => {
40015
+ const value = await tool.execute(args, ctx2).catch((e) => {
40016
40016
  err = e;
40017
40017
  if (err && err?.constructor && err?.constructor?.name && err?.constructor?.name === "ThinkSignal") {
40018
40018
  s.setAttributes({
@@ -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({