@voltagent/core 1.2.14 → 1.2.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/index.d.mts CHANGED
@@ -5697,6 +5697,10 @@ type Workflow<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema, RESULT_SCHEM
5697
5697
  * Input schema for the workflow (for API access)
5698
5698
  */
5699
5699
  inputSchema?: INPUT_SCHEMA;
5700
+ /**
5701
+ * Result schema for the workflow (for API access)
5702
+ */
5703
+ resultSchema?: RESULT_SCHEMA;
5700
5704
  /**
5701
5705
  * Suspend schema for the workflow (for API access)
5702
5706
  */
@@ -5724,6 +5728,7 @@ type Workflow<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema, RESULT_SCHEM
5724
5728
  stepsCount: number;
5725
5729
  steps: DangerouslyAllowAny[];
5726
5730
  inputSchema?: DangerouslyAllowAny;
5731
+ resultSchema?: DangerouslyAllowAny;
5727
5732
  suspendSchema?: DangerouslyAllowAny;
5728
5733
  resumeSchema?: DangerouslyAllowAny;
5729
5734
  };
package/dist/index.d.ts CHANGED
@@ -5697,6 +5697,10 @@ type Workflow<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema, RESULT_SCHEM
5697
5697
  * Input schema for the workflow (for API access)
5698
5698
  */
5699
5699
  inputSchema?: INPUT_SCHEMA;
5700
+ /**
5701
+ * Result schema for the workflow (for API access)
5702
+ */
5703
+ resultSchema?: RESULT_SCHEMA;
5700
5704
  /**
5701
5705
  * Suspend schema for the workflow (for API access)
5702
5706
  */
@@ -5724,6 +5728,7 @@ type Workflow<INPUT_SCHEMA extends InternalBaseWorkflowInputSchema, RESULT_SCHEM
5724
5728
  stepsCount: number;
5725
5729
  steps: DangerouslyAllowAny[];
5726
5730
  inputSchema?: DangerouslyAllowAny;
5731
+ resultSchema?: DangerouslyAllowAny;
5727
5732
  suspendSchema?: DangerouslyAllowAny;
5728
5733
  resumeSchema?: DangerouslyAllowAny;
5729
5734
  };
package/dist/index.js CHANGED
@@ -5984,6 +5984,7 @@ function createWorkflow({
5984
5984
  purpose,
5985
5985
  hooks,
5986
5986
  input,
5987
+ result,
5987
5988
  suspendSchema,
5988
5989
  resumeSchema,
5989
5990
  memory: workflowMemory,
@@ -6493,7 +6494,7 @@ function createWorkflow({
6493
6494
  typedSuspendFn,
6494
6495
  isResumingThisStep ? resumeInputData : void 0
6495
6496
  );
6496
- const result = await traceContext.withSpan(stepSpan, async () => {
6497
+ const result2 = await traceContext.withSpan(stepSpan, async () => {
6497
6498
  return await executeWithSignalCheck(
6498
6499
  () => step.execute(stepContext),
6499
6500
  options?.suspendController?.signal,
@@ -6503,21 +6504,21 @@ function createWorkflow({
6503
6504
  });
6504
6505
  const stepData = executionContext.stepData.get(step.id);
6505
6506
  if (stepData) {
6506
- stepData.output = result;
6507
+ stepData.output = result2;
6507
6508
  }
6508
- const isSkipped = step.type === "conditional-when" && result === stateManager.state.data;
6509
+ const isSkipped = step.type === "conditional-when" && result2 === stateManager.state.data;
6509
6510
  stateManager.update({
6510
- data: result,
6511
- result
6511
+ data: result2,
6512
+ result: result2
6512
6513
  });
6513
6514
  if (isSkipped) {
6514
6515
  traceContext.endStepSpan(stepSpan, "skipped", {
6515
- output: result,
6516
+ output: result2,
6516
6517
  skippedReason: "Condition not met"
6517
6518
  });
6518
6519
  } else {
6519
6520
  traceContext.endStepSpan(stepSpan, "completed", {
6520
- output: result
6521
+ output: result2
6521
6522
  });
6522
6523
  }
6523
6524
  runLogger.debug(
@@ -6526,7 +6527,7 @@ function createWorkflow({
6526
6527
  stepIndex: index,
6527
6528
  stepType: step.type,
6528
6529
  stepName,
6529
- output: result !== void 0 ? result : null,
6530
+ output: result2 !== void 0 ? result2 : null,
6530
6531
  skipped: isSkipped
6531
6532
  }
6532
6533
  );
@@ -6535,7 +6536,7 @@ function createWorkflow({
6535
6536
  executionId,
6536
6537
  from: stepName,
6537
6538
  input: stateManager.state.data,
6538
- output: result,
6539
+ output: result2,
6539
6540
  status: "success",
6540
6541
  context: options?.context,
6541
6542
  timestamp: (/* @__PURE__ */ new Date()).toISOString(),
@@ -6808,6 +6809,7 @@ function createWorkflow({
6808
6809
  purpose: purpose ?? "No purpose provided",
6809
6810
  steps,
6810
6811
  inputSchema: input,
6812
+ resultSchema: result,
6811
6813
  suspendSchema: effectiveSuspendSchema,
6812
6814
  resumeSchema: effectiveResumeSchema,
6813
6815
  // ✅ Always expose memory for registry access
@@ -6821,6 +6823,7 @@ function createWorkflow({
6821
6823
  stepsCount: steps.length,
6822
6824
  steps: steps.map((step, index) => serializeWorkflowStep(step, index)),
6823
6825
  inputSchema: input,
6826
+ resultSchema: result,
6824
6827
  suspendSchema: effectiveSuspendSchema,
6825
6828
  resumeSchema: effectiveResumeSchema
6826
6829
  };
@@ -6848,15 +6851,15 @@ function createWorkflow({
6848
6851
  }
6849
6852
  );
6850
6853
  const executeWithStream = /* @__PURE__ */ __name(async () => {
6851
- const result = await executeInternal(input2, executionOptions, streamController);
6852
- return result;
6854
+ const result2 = await executeInternal(input2, executionOptions, streamController);
6855
+ return result2;
6853
6856
  }, "executeWithStream");
6854
6857
  executeWithStream().then(
6855
- (result) => {
6856
- if (result.status !== "suspended") {
6858
+ (result2) => {
6859
+ if (result2.status !== "suspended") {
6857
6860
  streamController?.close();
6858
6861
  }
6859
- resultResolve(result);
6862
+ resultResolve(result2);
6860
6863
  },
6861
6864
  (error) => {
6862
6865
  streamController?.close();
@@ -6922,11 +6925,11 @@ function createWorkflow({
6922
6925
  return resumed;
6923
6926
  }, "executeResume");
6924
6927
  executeResume().then(
6925
- (result) => {
6926
- if (result.status !== "suspended") {
6928
+ (result2) => {
6929
+ if (result2.status !== "suspended") {
6927
6930
  streamController?.close();
6928
6931
  }
6929
- resumedResolve(result);
6932
+ resumedResolve(result2);
6930
6933
  },
6931
6934
  (error) => {
6932
6935
  streamController?.close();
@@ -15660,10 +15663,13 @@ var SubAgentManager = class {
15660
15663
  */
15661
15664
  extractAgentPurpose(agentConfig) {
15662
15665
  const agent = this.extractAgent(agentConfig);
15666
+ if (agent.purpose) {
15667
+ return agent.purpose;
15668
+ }
15663
15669
  if (typeof agent.instructions === "string") {
15664
- return agent.purpose ?? agent.instructions;
15670
+ return agent.instructions;
15665
15671
  }
15666
- return agent.purpose ?? "Dynamic instructions";
15672
+ return "Dynamic instructions";
15667
15673
  }
15668
15674
  /**
15669
15675
  * Type guard to check if a SubAgentConfig is a direct AgentV2 instance