@memberjunction/ai-agents 2.112.0 → 2.113.1

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