@memberjunction/ai-agents 2.111.0 → 2.112.0

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.
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.LoadFlowAgentType = exports.FlowAgentType = exports.FlowExecutionState = void 0;
10
10
  const global_1 = require("@memberjunction/global");
11
11
  const base_agent_type_1 = require("./base-agent-type");
12
- const core_1 = require("@memberjunction/core");
12
+ const global_2 = require("@memberjunction/global");
13
13
  const aiengine_1 = require("@memberjunction/aiengine");
14
14
  const actions_1 = require("@memberjunction/actions");
15
15
  const PayloadManager_1 = require("../PayloadManager");
@@ -39,7 +39,7 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
39
39
  const startingSteps = await this.getStartingSteps(params.agent.ID);
40
40
  if (startingSteps.length === 0) {
41
41
  return this.createNextStep('Failed', {
42
- errorMessage: 'No starting steps defined for flow agent'
42
+ errorMessage: 'No starting steps defined for flow agent',
43
43
  });
44
44
  }
45
45
  return await this.createStepForFlowNode(params, startingSteps[0], payload, flowState);
@@ -48,15 +48,14 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
48
48
  if (currentStep?.StepType === 'Prompt' && promptResult) {
49
49
  const promptResponse = this.parseJSONResponse(promptResult);
50
50
  if (promptResponse) {
51
- if (promptResponse.nextStep?.type === 'Chat' ||
52
- (promptResponse.taskComplete && promptResponse.message)) {
51
+ if (promptResponse.nextStep?.type === 'Chat' || (promptResponse.taskComplete && promptResponse.message)) {
53
52
  return this.createNextStep('Chat', {
54
53
  message: promptResponse.message || 'Response from flow prompt step',
55
54
  reasoning: promptResponse.reasoning,
56
55
  confidence: promptResponse.confidence,
57
56
  terminate: true,
58
57
  newPayload: payload,
59
- previousPayload: payload
58
+ previousPayload: payload,
60
59
  });
61
60
  }
62
61
  const mergedPayload = this._payloadManager.deepMerge(payload, promptResponse);
@@ -66,13 +65,13 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
66
65
  const paths = await this.getValidPaths(flowState.currentStepId, payload, flowState);
67
66
  if (paths.length === 0) {
68
67
  return this.createSuccessStep({
69
- message: 'Flow completed - no more paths to follow'
68
+ message: 'Flow completed - no more paths to follow',
70
69
  });
71
70
  }
72
71
  const nextStep = await this.getStepById(paths[0].DestinationStepID);
73
72
  if (!nextStep) {
74
73
  return this.createNextStep('Failed', {
75
- errorMessage: `Destination step not found: ${paths[0].DestinationStepID}`
74
+ errorMessage: `Destination step not found: ${paths[0].DestinationStepID}`,
76
75
  });
77
76
  }
78
77
  if (nextStep.Status !== 'Active') {
@@ -83,15 +82,15 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
83
82
  }
84
83
  }
85
84
  return this.createNextStep('Failed', {
86
- errorMessage: `No active steps found. Step '${nextStep.Name}' has status: ${nextStep.Status}`
85
+ errorMessage: `No active steps found. Step '${nextStep.Name}' has status: ${nextStep.Status}`,
87
86
  });
88
87
  }
89
88
  return await this.createStepForFlowNode(params, nextStep, payload, flowState);
90
89
  }
91
90
  catch (error) {
92
- (0, core_1.LogError)(`Error in FlowAgentType.DetermineNextStep: ${error.message}`);
91
+ (0, global_2.LogError)(`Error in FlowAgentType.DetermineNextStep: ${error.message}`);
93
92
  return this.createNextStep('Failed', {
94
- errorMessage: `Flow execution error: ${error.message}`
93
+ errorMessage: `Flow execution error: ${error.message}`,
95
94
  });
96
95
  }
97
96
  }
@@ -110,25 +109,24 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
110
109
  currentStepId: flowState.currentStepId,
111
110
  completedSteps: Array.from(flowState.completedStepIds),
112
111
  executionPath: flowState.executionPath,
113
- stepCount: flowState.completedStepIds.size
112
+ stepCount: flowState.completedStepIds.size,
114
113
  };
115
114
  }
116
115
  }
117
116
  }
118
117
  async getStartingSteps(agentId) {
119
118
  const steps = aiengine_1.AIEngine.Instance.GetAgentSteps(agentId, 'Active');
120
- return steps.filter(step => step.StartingStep).sort((a, b) => a.Name.localeCompare(b.Name));
119
+ return steps.filter((step) => step.StartingStep).sort((a, b) => a.Name.localeCompare(b.Name));
121
120
  }
122
121
  async getStepById(stepId) {
123
122
  return aiengine_1.AIEngine.Instance.GetAgentStepByID(stepId);
124
123
  }
125
124
  async getStepByName(agentId, stepName) {
126
125
  const steps = aiengine_1.AIEngine.Instance.GetAgentSteps(agentId);
127
- return steps.find(step => step.Name === stepName) || null;
126
+ return steps.find((step) => step.Name === stepName) || null;
128
127
  }
129
128
  async getValidPaths(stepId, payload, flowState) {
130
- const allPaths = aiengine_1.AIEngine.Instance.GetPathsFromStep(stepId)
131
- .sort((a, b) => b.Priority - a.Priority);
129
+ const allPaths = aiengine_1.AIEngine.Instance.GetPathsFromStep(stepId).sort((a, b) => b.Priority - a.Priority);
132
130
  const validPaths = [];
133
131
  for (const path of allPaths) {
134
132
  if (!path.Condition) {
@@ -143,23 +141,23 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
143
141
  currentStepId: flowState.currentStepId,
144
142
  completedSteps: Array.from(flowState.completedStepIds),
145
143
  executionPath: flowState.executionPath,
146
- stepCount: flowState.completedStepIds.size
147
- }
144
+ stepCount: flowState.completedStepIds.size,
145
+ },
148
146
  };
149
147
  const evalResult = this._evaluator.evaluate(path.Condition, context);
150
148
  if (evalResult.success && evalResult.value) {
151
149
  validPaths.push(path);
152
150
  }
153
151
  else if (!evalResult.success) {
154
- (0, core_1.LogError)(`Path condition failed: ${path.Condition}\n${evalResult.error}`);
152
+ (0, global_2.LogError)(`Path condition failed: ${path.Condition}\n${evalResult.error}`);
155
153
  }
156
154
  }
157
155
  catch (error) {
158
- (0, core_1.LogError)(`Failed to evaluate path condition: ${error.message}`);
156
+ (0, global_2.LogError)(`Failed to evaluate path condition: ${error.message}`);
159
157
  }
160
158
  }
161
159
  if (validPaths.length === 0) {
162
- return allPaths.filter(p => p.Priority <= 0 && !p.Condition);
160
+ return allPaths.filter((p) => p.Priority <= 0 && !p.Condition);
163
161
  }
164
162
  return validPaths.sort((a, b) => b.Priority - a.Priority);
165
163
  }
@@ -183,7 +181,7 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
183
181
  value = actionResult;
184
182
  for (const part of parts) {
185
183
  if (value && typeof value === 'object' && !Array.isArray(value)) {
186
- const actualKey = Object.keys(value).find(key => key.toLowerCase() === part.toLowerCase());
184
+ const actualKey = Object.keys(value).find((key) => key.toLowerCase() === part.toLowerCase());
187
185
  value = actualKey ? value[actualKey] : undefined;
188
186
  }
189
187
  else {
@@ -193,7 +191,7 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
193
191
  }
194
192
  }
195
193
  else {
196
- const actualKey = Object.keys(actionResult).find(key => key.toLowerCase() === outputParam.toLowerCase());
194
+ const actualKey = Object.keys(actionResult).find((key) => key.toLowerCase() === outputParam.toLowerCase());
197
195
  value = actualKey ? actionResult[actualKey] : undefined;
198
196
  }
199
197
  if (value !== undefined) {
@@ -213,18 +211,18 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
213
211
  return null;
214
212
  }
215
213
  return {
216
- updateElements: updateObj
214
+ updateElements: updateObj,
217
215
  };
218
216
  }
219
217
  catch (error) {
220
- (0, core_1.LogError)(`Failed to parse ActionOutputMapping: ${error.message}`);
218
+ (0, global_2.LogError)(`Failed to parse ActionOutputMapping: ${error.message}`);
221
219
  return null;
222
220
  }
223
221
  }
224
222
  async createStepForFlowNode(params, node, payload, flowState) {
225
223
  flowState.currentStepId = node.ID;
226
- const userMessages = params.conversationMessages.filter(m => m.role === 'user');
227
- const latestUserMessage = userMessages ? userMessages[userMessages.length - 1].content : "";
224
+ const userMessages = params.conversationMessages.filter((m) => m.role === 'user');
225
+ const latestUserMessage = userMessages ? userMessages[userMessages.length - 1].content : '';
228
226
  const latestUserMessageString = typeof latestUserMessage === 'string' ? latestUserMessage : latestUserMessage[0].content;
229
227
  switch (node.StepType) {
230
228
  case 'Action':
@@ -232,7 +230,7 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
232
230
  return this.createNextStep('Failed', {
233
231
  errorMessage: `Action step '${node.Name}' has no ActionID`,
234
232
  newPayload: payload,
235
- previousPayload: payload
233
+ previousPayload: payload,
236
234
  });
237
235
  }
238
236
  const actionName = await this.getActionName(node.ActionID);
@@ -240,17 +238,19 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
240
238
  return this.createNextStep('Failed', {
241
239
  errorMessage: `Action not found for step '${node.Name}'`,
242
240
  newPayload: payload,
243
- previousPayload: payload
241
+ previousPayload: payload,
244
242
  });
245
243
  }
246
244
  const baseStep = this.createNextStep('Actions', {
247
- actions: [{
245
+ actions: [
246
+ {
248
247
  name: actionName,
249
- params: {}
250
- }],
248
+ params: {},
249
+ },
250
+ ],
251
251
  terminate: false,
252
252
  newPayload: payload,
253
- previousPayload: payload
253
+ previousPayload: payload,
254
254
  });
255
255
  baseStep.stepId = node.ID;
256
256
  if (node.ActionOutputMapping) {
@@ -262,7 +262,7 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
262
262
  return this.createNextStep('Failed', {
263
263
  errorMessage: `Sub-Agent step '${node.Name}' has no SubAgentID`,
264
264
  newPayload: payload,
265
- previousPayload: payload
265
+ previousPayload: payload,
266
266
  });
267
267
  }
268
268
  const subAgentName = await this.getAgentName(node.SubAgentID);
@@ -270,25 +270,25 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
270
270
  return this.createNextStep('Failed', {
271
271
  errorMessage: `Sub-Agent not found for step '${node.Name}'`,
272
272
  newPayload: payload,
273
- previousPayload: payload
273
+ previousPayload: payload,
274
274
  });
275
275
  }
276
276
  return this.createNextStep('Sub-Agent', {
277
277
  subAgent: {
278
278
  name: subAgentName,
279
279
  message: latestUserMessageString || node.Description || `Execute sub-agent: ${subAgentName}`,
280
- terminateAfter: false
280
+ terminateAfter: false,
281
281
  },
282
282
  terminate: false,
283
283
  newPayload: payload,
284
- previousPayload: payload
284
+ previousPayload: payload,
285
285
  });
286
286
  case 'Prompt':
287
287
  if (!node.PromptID) {
288
288
  return this.createNextStep('Failed', {
289
289
  errorMessage: `Prompt step '${node.Name}' has no PromptID`,
290
290
  newPayload: payload,
291
- previousPayload: payload
291
+ previousPayload: payload,
292
292
  });
293
293
  }
294
294
  const retryStep = {
@@ -297,7 +297,7 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
297
297
  terminate: false,
298
298
  flowPromptStepId: node.PromptID,
299
299
  newPayload: payload,
300
- previousPayload: payload
300
+ previousPayload: payload,
301
301
  };
302
302
  return retryStep;
303
303
  case 'ForEach':
@@ -308,16 +308,16 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
308
308
  return this.createNextStep('Failed', {
309
309
  errorMessage: `Unknown step type: ${node.StepType}`,
310
310
  newPayload: payload,
311
- previousPayload: payload
311
+ previousPayload: payload,
312
312
  });
313
313
  }
314
314
  }
315
315
  async getActionName(actionId) {
316
- const action = actions_1.ActionEngineServer.Instance.Actions.find(a => a.ID === actionId);
316
+ const action = actions_1.ActionEngineServer.Instance.Actions.find((a) => a.ID === actionId);
317
317
  return action?.Name || null;
318
318
  }
319
319
  async getAgentName(agentId) {
320
- const agent = aiengine_1.AIEngine.Instance.Agents.find(a => a.ID === agentId);
320
+ const agent = aiengine_1.AIEngine.Instance.Agents.find((a) => a.ID === agentId);
321
321
  return agent?.Name || null;
322
322
  }
323
323
  processActionResult(actionResult, _stepId, outputMapping, currentPayload) {
@@ -334,14 +334,14 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
334
334
  }
335
335
  const stepEntity = aiengine_1.AIEngine.Instance.GetAgentStepByID(stepId);
336
336
  if (!stepEntity) {
337
- (0, core_1.LogError)(`Failed to find AIAgentStep for input mapping: ${stepId}`);
337
+ (0, global_2.LogError)(`Failed to find AIAgentStep for input mapping: ${stepId}`);
338
338
  return;
339
339
  }
340
340
  if (!stepEntity.ActionInputMapping) {
341
341
  return;
342
342
  }
343
343
  if (actions.length > 1) {
344
- (0, core_1.LogError)('Flow agent action input mapping currently only supports single action steps');
344
+ (0, global_2.LogError)('Flow agent action input mapping currently only supports single action steps');
345
345
  return;
346
346
  }
347
347
  try {
@@ -353,7 +353,7 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
353
353
  inputMapping = stepEntity.ActionInputMapping;
354
354
  }
355
355
  else {
356
- (0, core_1.LogError)(`Invalid ActionInputMapping format for step ${stepEntity.Name}: ${stepEntity.ActionInputMapping}`);
356
+ (0, global_2.LogError)(`Invalid ActionInputMapping format for step ${stepEntity.Name}: ${stepEntity.ActionInputMapping}`);
357
357
  return;
358
358
  }
359
359
  const action = actions[0];
@@ -364,12 +364,12 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
364
364
  const resolvedValue = this.resolveNestedValue(mappingValue, currentPayload);
365
365
  action.params[paramName] = resolvedValue;
366
366
  }
367
- if ((0, core_1.IsVerboseLoggingEnabled)()) {
367
+ if ((0, global_2.IsVerboseLoggingEnabled)()) {
368
368
  console.log(`Applied action input mapping for step ${stepEntity.Name}:`, action.params);
369
369
  }
370
370
  }
371
371
  catch (error) {
372
- (0, core_1.LogError)(`Failed to apply action input mapping: ${error.message}`);
372
+ (0, global_2.LogError)(`Failed to apply action input mapping: ${error.message}`);
373
373
  }
374
374
  }
375
375
  getValueFromPath(obj, path) {
@@ -420,7 +420,7 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
420
420
  }
421
421
  }
422
422
  else if (Array.isArray(value)) {
423
- return value.map(item => this.resolveNestedValue(item, currentPayload));
423
+ return value.map((item) => this.resolveNestedValue(item, currentPayload));
424
424
  }
425
425
  else if (value && typeof value === 'object') {
426
426
  const resolvedObj = {};
@@ -441,7 +441,7 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
441
441
  return null;
442
442
  }
443
443
  if (actionResults.length > 1) {
444
- (0, core_1.LogError)('Flow agent action output mapping currently only supports single action steps');
444
+ (0, global_2.LogError)('Flow agent action output mapping currently only supports single action steps');
445
445
  return null;
446
446
  }
447
447
  const actionResult = actionResults[0];
@@ -458,10 +458,10 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
458
458
  const existingPayload = currentPayload || {};
459
459
  const mergeResult = this._payloadManager.applyAgentChangeRequest(existingPayload, payloadChange, {
460
460
  logChanges: false,
461
- verbose: (0, core_1.IsVerboseLoggingEnabled)()
461
+ verbose: (0, global_2.IsVerboseLoggingEnabled)(),
462
462
  });
463
463
  if (mergeResult.warnings && mergeResult.warnings.length > 0) {
464
- (0, core_1.LogError)(`Warnings during payload merge in flow state: ${mergeResult.warnings.join(', ')}`);
464
+ (0, global_2.LogError)(`Warnings during payload merge in flow state: ${mergeResult.warnings.join(', ')}`);
465
465
  }
466
466
  }
467
467
  return payloadChange;
@@ -472,7 +472,7 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
472
472
  const startingSteps = await this.getStartingSteps(flowState.agentId);
473
473
  if (startingSteps.length === 0) {
474
474
  return this.createNextStep('Failed', {
475
- errorMessage: 'No starting steps defined for flow agent'
475
+ errorMessage: 'No starting steps defined for flow agent',
476
476
  });
477
477
  }
478
478
  return await this.createStepForFlowNode(params, startingSteps[0], payloadToUse, flowState);
@@ -492,7 +492,7 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
492
492
  return this.createNextStep('Failed', {
493
493
  errorMessage: 'No current step in flow state after action execution',
494
494
  newPayload: currentPayload,
495
- previousPayload: currentPayload
495
+ previousPayload: currentPayload,
496
496
  });
497
497
  }
498
498
  const paths = await this.getValidPaths(flowState.currentStepId, currentPayload, flowState);
@@ -500,13 +500,13 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
500
500
  return this.createSuccessStep({
501
501
  message: 'Flow completed - no more paths to follow',
502
502
  newPayload: currentPayload,
503
- previousPayload: currentPayload
503
+ previousPayload: currentPayload,
504
504
  });
505
505
  }
506
506
  const nextStep = await this.getStepById(paths[0].DestinationStepID);
507
507
  if (!nextStep) {
508
508
  return this.createNextStep('Failed', {
509
- errorMessage: `Destination step not found: ${paths[0].DestinationStepID}`
509
+ errorMessage: `Destination step not found: ${paths[0].DestinationStepID}`,
510
510
  });
511
511
  }
512
512
  if (nextStep.Status !== 'Active') {
@@ -519,7 +519,7 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
519
519
  return this.createNextStep('Failed', {
520
520
  errorMessage: `No active steps found. Step '${nextStep.Name}' has status: ${nextStep.Status}`,
521
521
  newPayload: currentPayload,
522
- previousPayload: currentPayload
522
+ previousPayload: currentPayload,
523
523
  });
524
524
  }
525
525
  return await this.createStepForFlowNode(params, nextStep, currentPayload, flowState);
@@ -528,12 +528,12 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
528
528
  const flowDecision = previousDecision;
529
529
  if (flowDecision?.flowPromptStepId) {
530
530
  const promptId = flowDecision.flowPromptStepId;
531
- const promptEntity = aiengine_1.AIEngine.Instance.Prompts.find(p => p.ID === promptId);
531
+ const promptEntity = aiengine_1.AIEngine.Instance.Prompts.find((p) => p.ID === promptId);
532
532
  if (promptEntity) {
533
533
  return promptEntity;
534
534
  }
535
535
  else {
536
- (0, core_1.LogError)(`Failed to find flow prompt with ID: ${promptId} in AIEngine`);
536
+ (0, global_2.LogError)(`Failed to find flow prompt with ID: ${promptId} in AIEngine`);
537
537
  return config.childPrompt || null;
538
538
  }
539
539
  }
@@ -544,7 +544,7 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
544
544
  return this.createNextStep('Failed', {
545
545
  errorMessage: `ForEach step '${node.Name}' has no Configuration`,
546
546
  newPayload: payload,
547
- previousPayload: payload
547
+ previousPayload: payload,
548
548
  });
549
549
  }
550
550
  const baseConfig = JSON.parse(node.Configuration);
@@ -556,43 +556,43 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
556
556
  continueOnError: baseConfig.continueOnError,
557
557
  delayBetweenIterationsMs: baseConfig.delayBetweenIterationsMs,
558
558
  executionMode: baseConfig.executionMode,
559
- maxConcurrency: baseConfig.maxConcurrency
559
+ maxConcurrency: baseConfig.maxConcurrency,
560
560
  };
561
561
  if (node.LoopBodyType === 'Action') {
562
- const action = aiengine_1.AIEngine.Instance.Actions.find(a => a.ID === node.ActionID);
562
+ const action = aiengine_1.AIEngine.Instance.Actions.find((a) => a.ID === node.ActionID);
563
563
  if (!action) {
564
564
  return this.createNextStep('Failed', {
565
565
  errorMessage: `Action not found for loop body: ${node.ActionID}`,
566
566
  newPayload: payload,
567
- previousPayload: payload
567
+ previousPayload: payload,
568
568
  });
569
569
  }
570
570
  forEach.action = {
571
571
  name: action.Name,
572
572
  params: JSON.parse(node.ActionInputMapping || '{}'),
573
- outputMapping: node.ActionOutputMapping || undefined
573
+ outputMapping: node.ActionOutputMapping || undefined,
574
574
  };
575
575
  }
576
576
  else if (node.LoopBodyType === 'Sub-Agent') {
577
- const subAgent = aiengine_1.AIEngine.Instance.Agents.find(a => a.ID === node.SubAgentID);
577
+ const subAgent = aiengine_1.AIEngine.Instance.Agents.find((a) => a.ID === node.SubAgentID);
578
578
  if (!subAgent) {
579
579
  return this.createNextStep('Failed', {
580
580
  errorMessage: `Sub-Agent not found for loop body: ${node.SubAgentID}`,
581
581
  newPayload: payload,
582
- previousPayload: payload
582
+ previousPayload: payload,
583
583
  });
584
584
  }
585
585
  forEach.subAgent = {
586
586
  name: subAgent.Name,
587
587
  message: node.Description || `Execute sub-agent: ${subAgent.Name}`,
588
- templateParameters: {}
588
+ templateParameters: {},
589
589
  };
590
590
  }
591
591
  else if (node.LoopBodyType === 'Prompt') {
592
592
  return this.createNextStep('Failed', {
593
593
  errorMessage: 'Prompt loop bodies not yet fully supported',
594
594
  newPayload: payload,
595
- previousPayload: payload
595
+ previousPayload: payload,
596
596
  });
597
597
  }
598
598
  flowState.currentStepId = node.ID;
@@ -602,7 +602,7 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
602
602
  terminate: false,
603
603
  newPayload: payload,
604
604
  previousPayload: payload,
605
- agentTypeData: { stepId: node.ID }
605
+ agentTypeData: { stepId: node.ID },
606
606
  };
607
607
  }
608
608
  async convertWhileStepToOperation(node, payload, flowState, params) {
@@ -610,7 +610,7 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
610
610
  return this.createNextStep('Failed', {
611
611
  errorMessage: `While step '${node.Name}' has no Configuration`,
612
612
  newPayload: payload,
613
- previousPayload: payload
613
+ previousPayload: payload,
614
614
  });
615
615
  }
616
616
  const baseConfig = JSON.parse(node.Configuration);
@@ -619,43 +619,43 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
619
619
  itemVariable: baseConfig.itemVariable,
620
620
  maxIterations: baseConfig.maxIterations,
621
621
  continueOnError: baseConfig.continueOnError,
622
- delayBetweenIterationsMs: baseConfig.delayBetweenIterationsMs
622
+ delayBetweenIterationsMs: baseConfig.delayBetweenIterationsMs,
623
623
  };
624
624
  if (node.LoopBodyType === 'Action') {
625
- const action = aiengine_1.AIEngine.Instance.Actions.find(a => a.ID === node.ActionID);
625
+ const action = aiengine_1.AIEngine.Instance.Actions.find((a) => a.ID === node.ActionID);
626
626
  if (!action) {
627
627
  return this.createNextStep('Failed', {
628
628
  errorMessage: `Action not found for loop body: ${node.ActionID}`,
629
629
  newPayload: payload,
630
- previousPayload: payload
630
+ previousPayload: payload,
631
631
  });
632
632
  }
633
633
  whileOp.action = {
634
634
  name: action.Name,
635
635
  params: JSON.parse(node.ActionInputMapping || '{}'),
636
- outputMapping: node.ActionOutputMapping || undefined
636
+ outputMapping: node.ActionOutputMapping || undefined,
637
637
  };
638
638
  }
639
639
  else if (node.LoopBodyType === 'Sub-Agent') {
640
- const subAgent = aiengine_1.AIEngine.Instance.Agents.find(a => a.ID === node.SubAgentID);
640
+ const subAgent = aiengine_1.AIEngine.Instance.Agents.find((a) => a.ID === node.SubAgentID);
641
641
  if (!subAgent) {
642
642
  return this.createNextStep('Failed', {
643
643
  errorMessage: `Sub-Agent not found for loop body: ${node.SubAgentID}`,
644
644
  newPayload: payload,
645
- previousPayload: payload
645
+ previousPayload: payload,
646
646
  });
647
647
  }
648
648
  whileOp.subAgent = {
649
649
  name: subAgent.Name,
650
650
  message: node.Description || `Execute sub-agent: ${subAgent.Name}`,
651
- templateParameters: {}
651
+ templateParameters: {},
652
652
  };
653
653
  }
654
654
  else if (node.LoopBodyType === 'Prompt') {
655
655
  return this.createNextStep('Failed', {
656
656
  errorMessage: 'Prompt loop bodies not yet fully supported',
657
657
  newPayload: payload,
658
- previousPayload: payload
658
+ previousPayload: payload,
659
659
  });
660
660
  }
661
661
  flowState.currentStepId = node.ID;
@@ -665,7 +665,7 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
665
665
  terminate: false,
666
666
  newPayload: payload,
667
667
  previousPayload: payload,
668
- agentTypeData: { stepId: node.ID }
668
+ agentTypeData: { stepId: node.ID },
669
669
  };
670
670
  }
671
671
  get InjectLoopResultsAsMessage() {
@@ -697,7 +697,7 @@ let FlowAgentType = class FlowAgentType extends base_agent_type_1.BaseAgentType
697
697
  };
698
698
  exports.FlowAgentType = FlowAgentType;
699
699
  exports.FlowAgentType = FlowAgentType = __decorate([
700
- (0, global_1.RegisterClass)(base_agent_type_1.BaseAgentType, "FlowAgentType")
700
+ (0, global_1.RegisterClass)(base_agent_type_1.BaseAgentType, 'FlowAgentType')
701
701
  ], FlowAgentType);
702
702
  function LoadFlowAgentType() {
703
703
  }