@voltagent/core 2.4.1 → 2.4.3
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 +21 -5
- package/dist/index.d.ts +21 -5
- package/dist/index.js +82 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +82 -34
- package/dist/index.mjs.map +1 -1
- package/docs/observability-platform/mental-model.md +35 -0
- package/docs/observability-platform/overview.md +13 -6
- package/docs/observability-platform/setup.md +56 -44
- package/docs/ui/copilotkit.md +157 -0
- package/docs/workflows/steps/and-loop.md +18 -8
- package/package.json +1 -1
- package/docs/observability-platform/concept.md +0 -56
- package/docs/observability-platform/why.md +0 -75
package/dist/index.d.mts
CHANGED
|
@@ -10755,14 +10755,28 @@ interface WorkflowStepForEach<INPUT, DATA, ITEM, RESULT, MAP_DATA = ITEM> extend
|
|
|
10755
10755
|
items?: WorkflowStepForEachItemsFunc<INPUT, DATA, ITEM>;
|
|
10756
10756
|
map?: WorkflowStepForEachMapFunc<INPUT, DATA, ITEM, MAP_DATA>;
|
|
10757
10757
|
}
|
|
10758
|
-
type
|
|
10759
|
-
|
|
10758
|
+
type WorkflowStepLoopSteps<INPUT, DATA, RESULT> = readonly [InternalAnyWorkflowStep<INPUT, DATA, RESULT>] | readonly [
|
|
10759
|
+
InternalAnyWorkflowStep<INPUT, DATA, DangerouslyAllowAny>,
|
|
10760
|
+
...InternalAnyWorkflowStep<INPUT, DangerouslyAllowAny, DangerouslyAllowAny>[],
|
|
10761
|
+
InternalAnyWorkflowStep<INPUT, DangerouslyAllowAny, RESULT>
|
|
10762
|
+
];
|
|
10763
|
+
type WorkflowStepLoopBaseConfig<INPUT, RESULT> = InternalWorkflowStepConfig<{
|
|
10760
10764
|
condition: InternalWorkflowFunc<INPUT, RESULT, boolean, any, any>;
|
|
10761
10765
|
}>;
|
|
10766
|
+
type WorkflowStepLoopSingleStepConfig<INPUT, DATA, RESULT> = WorkflowStepLoopBaseConfig<INPUT, RESULT> & {
|
|
10767
|
+
step: InternalAnyWorkflowStep<INPUT, DATA, RESULT>;
|
|
10768
|
+
steps?: never;
|
|
10769
|
+
};
|
|
10770
|
+
type WorkflowStepLoopMultiStepConfig<INPUT, DATA, RESULT> = WorkflowStepLoopBaseConfig<INPUT, RESULT> & {
|
|
10771
|
+
steps: WorkflowStepLoopSteps<INPUT, DATA, RESULT>;
|
|
10772
|
+
step?: never;
|
|
10773
|
+
};
|
|
10774
|
+
type WorkflowStepLoopConfig<INPUT, DATA, RESULT> = WorkflowStepLoopSingleStepConfig<INPUT, DATA, RESULT> | WorkflowStepLoopMultiStepConfig<INPUT, DATA, RESULT>;
|
|
10762
10775
|
interface WorkflowStepLoop<INPUT, DATA, RESULT> extends InternalBaseWorkflowStep<INPUT, DATA, RESULT, any, any> {
|
|
10763
10776
|
type: "loop";
|
|
10764
10777
|
loopType: "dowhile" | "dountil";
|
|
10765
|
-
step: InternalAnyWorkflowStep<INPUT, DATA,
|
|
10778
|
+
step: InternalAnyWorkflowStep<INPUT, DATA, DangerouslyAllowAny>;
|
|
10779
|
+
steps: WorkflowStepLoopSteps<INPUT, DATA, RESULT>;
|
|
10766
10780
|
condition: InternalWorkflowFunc<INPUT, RESULT, boolean, any, any>;
|
|
10767
10781
|
}
|
|
10768
10782
|
type WorkflowStepBranchConfig<INPUT, DATA, RESULT> = InternalWorkflowStepConfig<{
|
|
@@ -11137,7 +11151,8 @@ type LoopType = "dowhile" | "dountil";
|
|
|
11137
11151
|
declare function andDoWhile<INPUT, DATA, RESULT>(config: WorkflowStepLoopConfig<INPUT, DATA, RESULT>): {
|
|
11138
11152
|
type: "loop";
|
|
11139
11153
|
loopType: LoopType;
|
|
11140
|
-
step: InternalAnyWorkflowStep<INPUT, DATA, RESULT>;
|
|
11154
|
+
step: InternalAnyWorkflowStep<INPUT, DATA, RESULT> | InternalAnyWorkflowStep<INPUT, DATA, any>;
|
|
11155
|
+
steps: WorkflowStepLoopSteps<INPUT, DATA, RESULT>;
|
|
11141
11156
|
condition: InternalWorkflowFunc<INPUT, RESULT, boolean, any, any>;
|
|
11142
11157
|
execute: (context: WorkflowExecuteContext<INPUT, DATA, any, any>) => Promise<RESULT>;
|
|
11143
11158
|
id: string;
|
|
@@ -11151,7 +11166,8 @@ declare function andDoWhile<INPUT, DATA, RESULT>(config: WorkflowStepLoopConfig<
|
|
|
11151
11166
|
declare function andDoUntil<INPUT, DATA, RESULT>(config: WorkflowStepLoopConfig<INPUT, DATA, RESULT>): {
|
|
11152
11167
|
type: "loop";
|
|
11153
11168
|
loopType: LoopType;
|
|
11154
|
-
step: InternalAnyWorkflowStep<INPUT, DATA, RESULT>;
|
|
11169
|
+
step: InternalAnyWorkflowStep<INPUT, DATA, RESULT> | InternalAnyWorkflowStep<INPUT, DATA, any>;
|
|
11170
|
+
steps: WorkflowStepLoopSteps<INPUT, DATA, RESULT>;
|
|
11155
11171
|
condition: InternalWorkflowFunc<INPUT, RESULT, boolean, any, any>;
|
|
11156
11172
|
execute: (context: WorkflowExecuteContext<INPUT, DATA, any, any>) => Promise<RESULT>;
|
|
11157
11173
|
id: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -10755,14 +10755,28 @@ interface WorkflowStepForEach<INPUT, DATA, ITEM, RESULT, MAP_DATA = ITEM> extend
|
|
|
10755
10755
|
items?: WorkflowStepForEachItemsFunc<INPUT, DATA, ITEM>;
|
|
10756
10756
|
map?: WorkflowStepForEachMapFunc<INPUT, DATA, ITEM, MAP_DATA>;
|
|
10757
10757
|
}
|
|
10758
|
-
type
|
|
10759
|
-
|
|
10758
|
+
type WorkflowStepLoopSteps<INPUT, DATA, RESULT> = readonly [InternalAnyWorkflowStep<INPUT, DATA, RESULT>] | readonly [
|
|
10759
|
+
InternalAnyWorkflowStep<INPUT, DATA, DangerouslyAllowAny>,
|
|
10760
|
+
...InternalAnyWorkflowStep<INPUT, DangerouslyAllowAny, DangerouslyAllowAny>[],
|
|
10761
|
+
InternalAnyWorkflowStep<INPUT, DangerouslyAllowAny, RESULT>
|
|
10762
|
+
];
|
|
10763
|
+
type WorkflowStepLoopBaseConfig<INPUT, RESULT> = InternalWorkflowStepConfig<{
|
|
10760
10764
|
condition: InternalWorkflowFunc<INPUT, RESULT, boolean, any, any>;
|
|
10761
10765
|
}>;
|
|
10766
|
+
type WorkflowStepLoopSingleStepConfig<INPUT, DATA, RESULT> = WorkflowStepLoopBaseConfig<INPUT, RESULT> & {
|
|
10767
|
+
step: InternalAnyWorkflowStep<INPUT, DATA, RESULT>;
|
|
10768
|
+
steps?: never;
|
|
10769
|
+
};
|
|
10770
|
+
type WorkflowStepLoopMultiStepConfig<INPUT, DATA, RESULT> = WorkflowStepLoopBaseConfig<INPUT, RESULT> & {
|
|
10771
|
+
steps: WorkflowStepLoopSteps<INPUT, DATA, RESULT>;
|
|
10772
|
+
step?: never;
|
|
10773
|
+
};
|
|
10774
|
+
type WorkflowStepLoopConfig<INPUT, DATA, RESULT> = WorkflowStepLoopSingleStepConfig<INPUT, DATA, RESULT> | WorkflowStepLoopMultiStepConfig<INPUT, DATA, RESULT>;
|
|
10762
10775
|
interface WorkflowStepLoop<INPUT, DATA, RESULT> extends InternalBaseWorkflowStep<INPUT, DATA, RESULT, any, any> {
|
|
10763
10776
|
type: "loop";
|
|
10764
10777
|
loopType: "dowhile" | "dountil";
|
|
10765
|
-
step: InternalAnyWorkflowStep<INPUT, DATA,
|
|
10778
|
+
step: InternalAnyWorkflowStep<INPUT, DATA, DangerouslyAllowAny>;
|
|
10779
|
+
steps: WorkflowStepLoopSteps<INPUT, DATA, RESULT>;
|
|
10766
10780
|
condition: InternalWorkflowFunc<INPUT, RESULT, boolean, any, any>;
|
|
10767
10781
|
}
|
|
10768
10782
|
type WorkflowStepBranchConfig<INPUT, DATA, RESULT> = InternalWorkflowStepConfig<{
|
|
@@ -11137,7 +11151,8 @@ type LoopType = "dowhile" | "dountil";
|
|
|
11137
11151
|
declare function andDoWhile<INPUT, DATA, RESULT>(config: WorkflowStepLoopConfig<INPUT, DATA, RESULT>): {
|
|
11138
11152
|
type: "loop";
|
|
11139
11153
|
loopType: LoopType;
|
|
11140
|
-
step: InternalAnyWorkflowStep<INPUT, DATA, RESULT>;
|
|
11154
|
+
step: InternalAnyWorkflowStep<INPUT, DATA, RESULT> | InternalAnyWorkflowStep<INPUT, DATA, any>;
|
|
11155
|
+
steps: WorkflowStepLoopSteps<INPUT, DATA, RESULT>;
|
|
11141
11156
|
condition: InternalWorkflowFunc<INPUT, RESULT, boolean, any, any>;
|
|
11142
11157
|
execute: (context: WorkflowExecuteContext<INPUT, DATA, any, any>) => Promise<RESULT>;
|
|
11143
11158
|
id: string;
|
|
@@ -11151,7 +11166,8 @@ declare function andDoWhile<INPUT, DATA, RESULT>(config: WorkflowStepLoopConfig<
|
|
|
11151
11166
|
declare function andDoUntil<INPUT, DATA, RESULT>(config: WorkflowStepLoopConfig<INPUT, DATA, RESULT>): {
|
|
11152
11167
|
type: "loop";
|
|
11153
11168
|
loopType: LoopType;
|
|
11154
|
-
step: InternalAnyWorkflowStep<INPUT, DATA, RESULT>;
|
|
11169
|
+
step: InternalAnyWorkflowStep<INPUT, DATA, RESULT> | InternalAnyWorkflowStep<INPUT, DATA, any>;
|
|
11170
|
+
steps: WorkflowStepLoopSteps<INPUT, DATA, RESULT>;
|
|
11155
11171
|
condition: InternalWorkflowFunc<INPUT, RESULT, boolean, any, any>;
|
|
11156
11172
|
execute: (context: WorkflowExecuteContext<INPUT, DATA, any, any>) => Promise<RESULT>;
|
|
11157
11173
|
id: string;
|
package/dist/index.js
CHANGED
|
@@ -505,7 +505,7 @@ function convertWorkflowStateToParam(state, executionContext, signal) {
|
|
|
505
505
|
executionId: state.executionId,
|
|
506
506
|
conversationId: state.conversationId,
|
|
507
507
|
userId: state.userId,
|
|
508
|
-
context: state.context,
|
|
508
|
+
context: executionContext?.context ?? state.context,
|
|
509
509
|
workflowState: state.workflowState,
|
|
510
510
|
active: state.active,
|
|
511
511
|
startAt: state.startAt,
|
|
@@ -3166,47 +3166,78 @@ function andBranch({
|
|
|
3166
3166
|
__name(andBranch, "andBranch");
|
|
3167
3167
|
|
|
3168
3168
|
// src/workflow/steps/and-loop.ts
|
|
3169
|
-
|
|
3170
|
-
|
|
3169
|
+
function splitLoopConfig(config) {
|
|
3170
|
+
if ("step" in config) {
|
|
3171
|
+
const { step: _step, condition: condition2, ...stepConfig2 } = config;
|
|
3172
|
+
return { condition: condition2, stepConfig: stepConfig2 };
|
|
3173
|
+
}
|
|
3174
|
+
const { steps: _steps, condition, ...stepConfig } = config;
|
|
3175
|
+
return { condition, stepConfig };
|
|
3176
|
+
}
|
|
3177
|
+
__name(splitLoopConfig, "splitLoopConfig");
|
|
3178
|
+
function getLoopSteps(config) {
|
|
3179
|
+
if ("steps" in config && config.steps) {
|
|
3180
|
+
if (config.steps.length === 0) {
|
|
3181
|
+
throw new Error("andDoWhile/andDoUntil requires at least one step");
|
|
3182
|
+
}
|
|
3183
|
+
return config.steps;
|
|
3184
|
+
}
|
|
3185
|
+
return [config.step];
|
|
3186
|
+
}
|
|
3187
|
+
__name(getLoopSteps, "getLoopSteps");
|
|
3188
|
+
var createLoopStep = /* @__PURE__ */ __name((loopType, config) => {
|
|
3189
|
+
const { condition, stepConfig } = splitLoopConfig(config);
|
|
3190
|
+
const loopSteps = getLoopSteps(config);
|
|
3191
|
+
const resolvedSteps = loopSteps.map((loopStep) => matchStep(loopStep));
|
|
3192
|
+
const firstStep = loopSteps[0];
|
|
3193
|
+
if (!firstStep) {
|
|
3194
|
+
throw new Error("andDoWhile/andDoUntil requires at least one step");
|
|
3195
|
+
}
|
|
3171
3196
|
return {
|
|
3172
|
-
...defaultStepConfig(
|
|
3197
|
+
...defaultStepConfig(stepConfig),
|
|
3173
3198
|
type: "loop",
|
|
3174
3199
|
loopType,
|
|
3175
|
-
step,
|
|
3200
|
+
step: firstStep,
|
|
3201
|
+
steps: loopSteps,
|
|
3176
3202
|
condition,
|
|
3177
3203
|
execute: /* @__PURE__ */ __name(async (context8) => {
|
|
3178
3204
|
const { state } = context8;
|
|
3179
3205
|
const traceContext = state.workflowContext?.traceContext;
|
|
3180
3206
|
let currentData = context8.data;
|
|
3181
3207
|
let iteration = 0;
|
|
3182
|
-
|
|
3183
|
-
|
|
3208
|
+
const runResolvedStep = /* @__PURE__ */ __name(async (stepIndex) => {
|
|
3209
|
+
const resolvedStep = resolvedSteps[stepIndex];
|
|
3210
|
+
if (!resolvedStep) {
|
|
3211
|
+
return;
|
|
3212
|
+
}
|
|
3184
3213
|
let childSpan;
|
|
3185
3214
|
if (traceContext) {
|
|
3215
|
+
const isSingleLoopStep = resolvedSteps.length === 1;
|
|
3186
3216
|
childSpan = traceContext.createStepSpan(
|
|
3187
|
-
iteration,
|
|
3188
|
-
|
|
3189
|
-
|
|
3217
|
+
iteration * resolvedSteps.length + stepIndex,
|
|
3218
|
+
resolvedStep.type,
|
|
3219
|
+
resolvedStep.name || resolvedStep.id || (isSingleLoopStep ? `Loop ${iteration + 1}` : `Loop ${iteration + 1}.${stepIndex + 1}`),
|
|
3190
3220
|
{
|
|
3191
|
-
parentStepId:
|
|
3192
|
-
parallelIndex: iteration,
|
|
3221
|
+
parentStepId: stepConfig.id,
|
|
3222
|
+
parallelIndex: isSingleLoopStep ? iteration : stepIndex,
|
|
3193
3223
|
input: currentData,
|
|
3194
3224
|
attributes: {
|
|
3195
3225
|
"workflow.step.loop": true,
|
|
3196
3226
|
"workflow.step.parent_type": "loop",
|
|
3197
|
-
"workflow.step.loop_type": loopType
|
|
3227
|
+
"workflow.step.loop_type": loopType,
|
|
3228
|
+
"workflow.step.loop_iteration": iteration,
|
|
3229
|
+
"workflow.step.loop_step_index": stepIndex
|
|
3198
3230
|
}
|
|
3199
3231
|
}
|
|
3200
3232
|
);
|
|
3201
3233
|
}
|
|
3202
|
-
const
|
|
3203
|
-
...state,
|
|
3204
|
-
workflowContext: void 0
|
|
3205
|
-
};
|
|
3206
|
-
const executeStep = /* @__PURE__ */ __name(() => finalStep.execute({
|
|
3234
|
+
const executeStep = /* @__PURE__ */ __name(() => resolvedStep.execute({
|
|
3207
3235
|
...context8,
|
|
3208
3236
|
data: currentData,
|
|
3209
|
-
state:
|
|
3237
|
+
state: {
|
|
3238
|
+
...state,
|
|
3239
|
+
workflowContext: void 0
|
|
3240
|
+
}
|
|
3210
3241
|
}), "executeStep");
|
|
3211
3242
|
try {
|
|
3212
3243
|
currentData = childSpan && traceContext ? await traceContext.withSpan(childSpan, executeStep) : await executeStep();
|
|
@@ -3219,6 +3250,13 @@ var createLoopStep = /* @__PURE__ */ __name((loopType, { step, condition, ...con
|
|
|
3219
3250
|
}
|
|
3220
3251
|
throw error;
|
|
3221
3252
|
}
|
|
3253
|
+
}, "runResolvedStep");
|
|
3254
|
+
while (true) {
|
|
3255
|
+
throwIfAborted(state.signal);
|
|
3256
|
+
for (let stepIndex = 0; stepIndex < resolvedSteps.length; stepIndex += 1) {
|
|
3257
|
+
throwIfAborted(state.signal);
|
|
3258
|
+
await runResolvedStep(stepIndex);
|
|
3259
|
+
}
|
|
3222
3260
|
iteration += 1;
|
|
3223
3261
|
throwIfAborted(state.signal);
|
|
3224
3262
|
const shouldContinue = await condition({
|
|
@@ -9775,7 +9813,7 @@ function createWorkflow({
|
|
|
9775
9813
|
workflowName: name,
|
|
9776
9814
|
status: "running",
|
|
9777
9815
|
input: input2,
|
|
9778
|
-
context: options?.context ? Array.from(
|
|
9816
|
+
context: options?.context ? Array.from(contextMap.entries()) : void 0,
|
|
9779
9817
|
workflowState: workflowStateStore,
|
|
9780
9818
|
userId: options?.userId,
|
|
9781
9819
|
conversationId: options?.conversationId,
|
|
@@ -9796,7 +9834,7 @@ function createWorkflow({
|
|
|
9796
9834
|
);
|
|
9797
9835
|
}
|
|
9798
9836
|
}
|
|
9799
|
-
const streamWriter = streamController ? new WorkflowStreamWriterImpl(streamController, executionId, id, name, 0,
|
|
9837
|
+
const streamWriter = streamController ? new WorkflowStreamWriterImpl(streamController, executionId, id, name, 0, contextMap) : new NoOpWorkflowStreamWriter();
|
|
9800
9838
|
const executionContext = {
|
|
9801
9839
|
workflowId: id,
|
|
9802
9840
|
executionId,
|
|
@@ -9850,7 +9888,7 @@ function createWorkflow({
|
|
|
9850
9888
|
from: name,
|
|
9851
9889
|
input: input2,
|
|
9852
9890
|
status: "running",
|
|
9853
|
-
context:
|
|
9891
|
+
context: contextMap,
|
|
9854
9892
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
9855
9893
|
});
|
|
9856
9894
|
runLogger.debug(
|
|
@@ -9863,6 +9901,7 @@ function createWorkflow({
|
|
|
9863
9901
|
if (options?.resumeFrom?.executionId) {
|
|
9864
9902
|
stateManager.start(input2, {
|
|
9865
9903
|
...options,
|
|
9904
|
+
context: contextMap,
|
|
9866
9905
|
executionId,
|
|
9867
9906
|
// Use the resumed execution ID
|
|
9868
9907
|
active: options.resumeFrom.resumeStepIndex,
|
|
@@ -9871,6 +9910,7 @@ function createWorkflow({
|
|
|
9871
9910
|
} else {
|
|
9872
9911
|
stateManager.start(input2, {
|
|
9873
9912
|
...options,
|
|
9913
|
+
context: contextMap,
|
|
9874
9914
|
executionId,
|
|
9875
9915
|
// Use the created execution ID
|
|
9876
9916
|
workflowState: workflowStateStore
|
|
@@ -9984,7 +10024,7 @@ function createWorkflow({
|
|
|
9984
10024
|
input: stateManager.state.data,
|
|
9985
10025
|
output: void 0,
|
|
9986
10026
|
status: "cancelled",
|
|
9987
|
-
context:
|
|
10027
|
+
context: contextMap,
|
|
9988
10028
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9989
10029
|
stepIndex: index,
|
|
9990
10030
|
stepType: step.type,
|
|
@@ -10020,7 +10060,7 @@ function createWorkflow({
|
|
|
10020
10060
|
executionId,
|
|
10021
10061
|
from: name,
|
|
10022
10062
|
status: "cancelled",
|
|
10023
|
-
context:
|
|
10063
|
+
context: contextMap,
|
|
10024
10064
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10025
10065
|
metadata: { reason }
|
|
10026
10066
|
});
|
|
@@ -10152,7 +10192,7 @@ function createWorkflow({
|
|
|
10152
10192
|
step.id,
|
|
10153
10193
|
step.name || step.id,
|
|
10154
10194
|
index,
|
|
10155
|
-
|
|
10195
|
+
contextMap
|
|
10156
10196
|
) : new NoOpWorkflowStreamWriter();
|
|
10157
10197
|
executionContext.streamWriter = stepWriter;
|
|
10158
10198
|
emitAndCollectEvent({
|
|
@@ -10161,7 +10201,7 @@ function createWorkflow({
|
|
|
10161
10201
|
from: step.name || step.id,
|
|
10162
10202
|
input: stateManager.state.data,
|
|
10163
10203
|
status: "running",
|
|
10164
|
-
context:
|
|
10204
|
+
context: contextMap,
|
|
10165
10205
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10166
10206
|
stepIndex: index,
|
|
10167
10207
|
stepType: step.type,
|
|
@@ -10231,7 +10271,7 @@ function createWorkflow({
|
|
|
10231
10271
|
input: stateManager.state.data,
|
|
10232
10272
|
output: void 0,
|
|
10233
10273
|
status: "suspended",
|
|
10234
|
-
context:
|
|
10274
|
+
context: contextMap,
|
|
10235
10275
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10236
10276
|
stepIndex: index,
|
|
10237
10277
|
metadata: {
|
|
@@ -10299,7 +10339,7 @@ function createWorkflow({
|
|
|
10299
10339
|
step.id,
|
|
10300
10340
|
step.name || step.id,
|
|
10301
10341
|
index,
|
|
10302
|
-
|
|
10342
|
+
contextMap
|
|
10303
10343
|
) : new NoOpWorkflowStreamWriter();
|
|
10304
10344
|
const stepExecutionContext = {
|
|
10305
10345
|
...executionContext,
|
|
@@ -10376,7 +10416,7 @@ function createWorkflow({
|
|
|
10376
10416
|
input: stateManager.state.data,
|
|
10377
10417
|
output: result2,
|
|
10378
10418
|
status: isSkipped ? "skipped" : "success",
|
|
10379
|
-
context:
|
|
10419
|
+
context: contextMap,
|
|
10380
10420
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10381
10421
|
stepIndex: index,
|
|
10382
10422
|
stepType: step.type,
|
|
@@ -10501,7 +10541,7 @@ function createWorkflow({
|
|
|
10501
10541
|
from: name,
|
|
10502
10542
|
output: finalState.result,
|
|
10503
10543
|
status: "success",
|
|
10504
|
-
context:
|
|
10544
|
+
context: contextMap,
|
|
10505
10545
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
10506
10546
|
});
|
|
10507
10547
|
streamController?.close();
|
|
@@ -10531,7 +10571,7 @@ function createWorkflow({
|
|
|
10531
10571
|
executionId,
|
|
10532
10572
|
from: name,
|
|
10533
10573
|
status: "cancelled",
|
|
10534
|
-
context:
|
|
10574
|
+
context: contextMap,
|
|
10535
10575
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
10536
10576
|
metadata: cancellationReason ? { reason: cancellationReason } : void 0
|
|
10537
10577
|
});
|
|
@@ -10607,7 +10647,7 @@ function createWorkflow({
|
|
|
10607
10647
|
from: name,
|
|
10608
10648
|
status: "error",
|
|
10609
10649
|
error,
|
|
10610
|
-
context:
|
|
10650
|
+
context: contextMap,
|
|
10611
10651
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
10612
10652
|
});
|
|
10613
10653
|
if (stateManager.state.status !== "completed" && stateManager.state.status !== "failed") {
|
|
@@ -11043,6 +11083,7 @@ function serializeWorkflowStep(step, index) {
|
|
|
11043
11083
|
}
|
|
11044
11084
|
case "loop": {
|
|
11045
11085
|
const loopStep = step;
|
|
11086
|
+
const serializedSteps = loopStep.steps && Array.isArray(loopStep.steps) ? loopStep.steps.map((subStep, subIndex) => serializeWorkflowStep(subStep, subIndex)) : loopStep.step ? [serializeWorkflowStep(loopStep.step, 0)] : [];
|
|
11046
11087
|
return {
|
|
11047
11088
|
...baseStep,
|
|
11048
11089
|
...loopStep.condition && {
|
|
@@ -11051,8 +11092,12 @@ function serializeWorkflowStep(step, index) {
|
|
|
11051
11092
|
...loopStep.loopType && {
|
|
11052
11093
|
loopType: loopStep.loopType
|
|
11053
11094
|
},
|
|
11054
|
-
...
|
|
11055
|
-
nestedStep:
|
|
11095
|
+
...serializedSteps.length === 1 && {
|
|
11096
|
+
nestedStep: serializedSteps[0]
|
|
11097
|
+
},
|
|
11098
|
+
...serializedSteps.length > 1 && {
|
|
11099
|
+
subSteps: serializedSteps,
|
|
11100
|
+
subStepsCount: serializedSteps.length
|
|
11056
11101
|
}
|
|
11057
11102
|
};
|
|
11058
11103
|
}
|
|
@@ -29057,6 +29102,9 @@ var Agent = class {
|
|
|
29057
29102
|
},
|
|
29058
29103
|
options.logger
|
|
29059
29104
|
);
|
|
29105
|
+
if (this.voltOpsClient && !AgentRegistry.getInstance().getGlobalVoltOpsClient()) {
|
|
29106
|
+
AgentRegistry.getInstance().setGlobalVoltOpsClient(this.voltOpsClient);
|
|
29107
|
+
}
|
|
29060
29108
|
this.logger.debug(`Agent created: ${this.name}`, {
|
|
29061
29109
|
event: LogEvents.AGENT_CREATED,
|
|
29062
29110
|
agentId: this.id,
|