@memberjunction/ng-core-entity-forms 2.86.0 → 2.88.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.
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-agent-form-section.component.d.ts.map +1 -1
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-agent-form-section.component.js +7 -7
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-agent-form-section.component.js.map +1 -1
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/condition-editor/condition-editor.component.d.ts +29 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/condition-editor/condition-editor.component.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/condition-editor/condition-editor.component.js +198 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/condition-editor/condition-editor.component.js.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/confirmation-dialog/confirmation-dialog.component.d.ts +14 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/confirmation-dialog/confirmation-dialog.component.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/confirmation-dialog/confirmation-dialog.component.js +98 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/confirmation-dialog/confirmation-dialog.component.js.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/custom-node/custom-node.component.d.ts +44 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/custom-node/custom-node.component.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/custom-node/custom-node.component.js +282 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/custom-node/custom-node.component.js.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/execution-panel/execution-panel.component.d.ts +35 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/execution-panel/execution-panel.component.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/execution-panel/execution-panel.component.js +287 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/execution-panel/execution-panel.component.js.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/flow-editor/flow-editor.component.d.ts +106 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/flow-editor/flow-editor.component.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/flow-editor/flow-editor.component.js +951 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/flow-editor/flow-editor.component.js.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/prompt-editor/prompt-editor.component.d.ts +30 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/prompt-editor/prompt-editor.component.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/prompt-editor/prompt-editor.component.js +450 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/prompt-editor/prompt-editor.component.js.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/properties-panel/properties-panel.component.d.ts +25 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/properties-panel/properties-panel.component.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/properties-panel/properties-panel.component.js +423 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/properties-panel/properties-panel.component.js.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/simple-condition-editor/simple-condition-editor.component.d.ts +21 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/simple-condition-editor/simple-condition-editor.component.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/simple-condition-editor/simple-condition-editor.component.js +182 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/simple-condition-editor/simple-condition-editor.component.js.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/step/step.component.d.ts +34 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/step/step.component.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/step/step.component.js +171 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/step/step.component.js.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/toolbar/toolbar.component.d.ts +17 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/toolbar/toolbar.component.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/toolbar/toolbar.component.js +78 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/components/toolbar/toolbar.component.js.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/models/connection.model.d.ts +17 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/models/connection.model.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/models/connection.model.js +11 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/models/connection.model.js.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/models/mj-extended.model.d.ts +21 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/models/mj-extended.model.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/models/mj-extended.model.js +2 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/models/mj-extended.model.js.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/models/module.model.d.ts +33 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/models/module.model.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/models/module.model.js +2 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/models/module.model.js.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/models/step.model.d.ts +44 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/models/step.model.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/models/step.model.js +166 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/models/step.model.js.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/flow-editor.service.d.ts +14 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/flow-editor.service.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/flow-editor.service.js +31 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/flow-editor.service.js.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/flow-executor.service.d.ts +63 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/flow-executor.service.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/flow-executor.service.js +294 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/flow-executor.service.js.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/mj-flow-transformer.service.d.ts +77 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/mj-flow-transformer.service.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/mj-flow-transformer.service.js +408 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/mj-flow-transformer.service.js.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/module-manager.service.d.ts +19 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/module-manager.service.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/module-manager.service.js +116 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/module-manager.service.js.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/prompt-manager.service.d.ts +25 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/prompt-manager.service.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/prompt-manager.service.js +90 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/prompt-manager.service.js.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/mj-integrated-flow-editor.component.d.ts +52 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/mj-integrated-flow-editor.component.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/mj-integrated-flow-editor.component.js +500 -0
- package/dist/lib/custom/AIAgents/FlowAgentType/mj-integrated-flow-editor.component.js.map +1 -0
- package/dist/lib/custom/custom-forms.module.d.ts +2 -1
- package/dist/lib/custom/custom-forms.module.d.ts.map +1 -1
- package/dist/lib/custom/custom-forms.module.js +10 -4
- package/dist/lib/custom/custom-forms.module.js.map +1 -1
- package/dist/lib/generated/Entities/Component/sections/details.component.d.ts.map +1 -1
- package/dist/lib/generated/Entities/Component/sections/details.component.js +40 -4
- package/dist/lib/generated/Entities/Component/sections/details.component.js.map +1 -1
- package/package.json +16 -16
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { Injectable } from '@angular/core';
|
|
2
|
+
import { BehaviorSubject, Subject, Observable, interval } from 'rxjs';
|
|
3
|
+
import { takeUntil } from 'rxjs/operators';
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export class FlowExecutorService {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.executionStatus$ = new BehaviorSubject('idle');
|
|
8
|
+
this.currentStepId$ = new BehaviorSubject(null);
|
|
9
|
+
this.executionLogs$ = new BehaviorSubject([]);
|
|
10
|
+
this.executionContext$ = new BehaviorSubject({
|
|
11
|
+
variables: {},
|
|
12
|
+
results: {}
|
|
13
|
+
});
|
|
14
|
+
this.stopExecution$ = new Subject();
|
|
15
|
+
this.pauseExecution$ = new BehaviorSubject(false);
|
|
16
|
+
this.executionStatus = this.executionStatus$.asObservable();
|
|
17
|
+
this.currentStepId = this.currentStepId$.asObservable();
|
|
18
|
+
this.executionLogs = this.executionLogs$.asObservable();
|
|
19
|
+
this.executionContext = this.executionContext$.asObservable();
|
|
20
|
+
}
|
|
21
|
+
async executeFlow(steps, connections) {
|
|
22
|
+
if (this.executionStatus$.value === 'running') {
|
|
23
|
+
console.warn('Execution already in progress');
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
this.resetExecution();
|
|
27
|
+
this.executionStatus$.next('running');
|
|
28
|
+
try {
|
|
29
|
+
const executionOrder = this.buildExecutionOrder(steps, connections);
|
|
30
|
+
this.addLog(null, 'Flow', 'start', `Starting flow execution with ${executionOrder.length} steps`);
|
|
31
|
+
for (const step of executionOrder) {
|
|
32
|
+
if (this.executionStatus$.value === 'paused' || this.executionStatus$.value === 'idle' || this.executionStatus$.value === 'completed' || this.executionStatus$.value === 'error') {
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
await this.waitForUnpause();
|
|
36
|
+
if (this.executionStatus$.value === 'paused' || this.executionStatus$.value === 'idle' || this.executionStatus$.value === 'completed' || this.executionStatus$.value === 'error') {
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
await this.executeStep(step, connections);
|
|
40
|
+
}
|
|
41
|
+
if (this.executionStatus$.value !== 'idle' && this.executionStatus$.value !== 'error' && this.executionStatus$.value !== 'completed' && this.executionStatus$.value !== 'paused') {
|
|
42
|
+
this.executionStatus$.next('completed');
|
|
43
|
+
this.addLog(null, 'Flow', 'complete', 'Flow execution completed successfully');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
this.executionStatus$.next('error');
|
|
48
|
+
this.addLog(null, 'Flow', 'error', `Flow execution failed: ${error}`);
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
this.currentStepId$.next(null);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async executeStep(step, connections) {
|
|
55
|
+
this.currentStepId$.next(step.id);
|
|
56
|
+
this.addLog(step.id, step.name, 'start', `Executing ${step.type} step`);
|
|
57
|
+
try {
|
|
58
|
+
// Simulate execution delay
|
|
59
|
+
await this.delay(1000);
|
|
60
|
+
// Execute based on step type
|
|
61
|
+
const result = await this.executeStepByType(step);
|
|
62
|
+
// Store result in context
|
|
63
|
+
const context = this.executionContext$.value;
|
|
64
|
+
context.results[step.id] = result;
|
|
65
|
+
this.executionContext$.next(context);
|
|
66
|
+
this.addLog(step.id, step.name, 'complete', 'Step completed successfully', result.output);
|
|
67
|
+
// Check conditions for next steps
|
|
68
|
+
if (!result.success) {
|
|
69
|
+
const errorConnections = connections.filter(c => c.source === step.id && c.condition?.expression === 'error');
|
|
70
|
+
if (errorConnections.length > 0) {
|
|
71
|
+
this.addLog(step.id, step.name, 'log', 'Taking error path');
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
this.addLog(step.id, step.name, 'error', `Step execution failed: ${error}`);
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async executeStepByType(step) {
|
|
81
|
+
const baseResult = {
|
|
82
|
+
stepId: step.id,
|
|
83
|
+
success: true,
|
|
84
|
+
output: {}
|
|
85
|
+
};
|
|
86
|
+
switch (step.type) {
|
|
87
|
+
case 'prompt':
|
|
88
|
+
return this.executePromptStep(step, baseResult);
|
|
89
|
+
case 'agent':
|
|
90
|
+
return this.executeAgentStep(step, baseResult);
|
|
91
|
+
case 'action':
|
|
92
|
+
return this.executeActionStep(step, baseResult);
|
|
93
|
+
default:
|
|
94
|
+
throw new Error(`Unknown step type: ${step.type}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async executePromptStep(step, baseResult) {
|
|
98
|
+
const promptType = step.selectedOption || 'system';
|
|
99
|
+
const properties = step.propertyValues || {};
|
|
100
|
+
await this.delay(500); // Simulate API call
|
|
101
|
+
const mockResponses = {
|
|
102
|
+
'system': 'System initialized with instructions',
|
|
103
|
+
'user': 'User query processed successfully',
|
|
104
|
+
'assistant': 'Assistant response generated'
|
|
105
|
+
};
|
|
106
|
+
return {
|
|
107
|
+
...baseResult,
|
|
108
|
+
output: {
|
|
109
|
+
type: promptType,
|
|
110
|
+
message: properties['systemMessage'] || properties['userMessage'] || properties['assistantMessage'] || mockResponses[promptType],
|
|
111
|
+
response: `Mock response for ${promptType} prompt`,
|
|
112
|
+
tokens: Math.floor(Math.random() * 500) + 100
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
async executeAgentStep(step, baseResult) {
|
|
117
|
+
const agentType = step.selectedOption || 'research';
|
|
118
|
+
const properties = step.propertyValues || {};
|
|
119
|
+
await this.delay(2000); // Simulate longer processing
|
|
120
|
+
const mockResults = {
|
|
121
|
+
'research': {
|
|
122
|
+
sources: ['Wikipedia', 'ArXiv', 'Google Scholar'],
|
|
123
|
+
findings: ['Finding 1', 'Finding 2', 'Finding 3'],
|
|
124
|
+
summary: 'Research completed with 3 relevant sources'
|
|
125
|
+
},
|
|
126
|
+
'code': {
|
|
127
|
+
language: properties['language'] || 'python',
|
|
128
|
+
code: `# Generated code\ndef example():\n return "Hello from ${agentType} agent"`,
|
|
129
|
+
explanation: 'Code generated successfully'
|
|
130
|
+
},
|
|
131
|
+
'analysis': {
|
|
132
|
+
type: properties['analysisType'] || 'statistical',
|
|
133
|
+
results: { score: 0.85, confidence: 0.92 },
|
|
134
|
+
summary: 'Analysis completed with high confidence'
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
return {
|
|
138
|
+
...baseResult,
|
|
139
|
+
output: mockResults[agentType] || { message: `${agentType} agent completed` }
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
async executeActionStep(step, baseResult) {
|
|
143
|
+
const actionType = step.selectedOption || 'api';
|
|
144
|
+
const properties = step.propertyValues || {};
|
|
145
|
+
await this.delay(1500); // Simulate action execution
|
|
146
|
+
const mockResults = {
|
|
147
|
+
'api': {
|
|
148
|
+
endpoint: properties['endpoint'] || 'https://api.example.com',
|
|
149
|
+
method: properties['method'] || 'GET',
|
|
150
|
+
status: 200,
|
|
151
|
+
response: { data: 'API call successful' }
|
|
152
|
+
},
|
|
153
|
+
'database': {
|
|
154
|
+
query: properties['query'] || 'SELECT * FROM users',
|
|
155
|
+
rows: 42,
|
|
156
|
+
executionTime: '125ms'
|
|
157
|
+
},
|
|
158
|
+
'file': {
|
|
159
|
+
operation: properties['operation'] || 'read',
|
|
160
|
+
path: properties['filePath'] || '/tmp/example.txt',
|
|
161
|
+
success: true,
|
|
162
|
+
size: '2.5KB'
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
return {
|
|
166
|
+
...baseResult,
|
|
167
|
+
output: mockResults[actionType] || { message: `${actionType} action completed` }
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
buildExecutionOrder(steps, connections) {
|
|
171
|
+
// Simple topological sort for execution order
|
|
172
|
+
const visited = new Set();
|
|
173
|
+
const order = [];
|
|
174
|
+
// Find starting nodes (no incoming connections)
|
|
175
|
+
const incomingCount = new Map();
|
|
176
|
+
steps.forEach(step => incomingCount.set(step.id, 0));
|
|
177
|
+
connections.forEach(conn => {
|
|
178
|
+
incomingCount.set(conn.target, (incomingCount.get(conn.target) || 0) + 1);
|
|
179
|
+
});
|
|
180
|
+
const startNodes = steps.filter(step => incomingCount.get(step.id) === 0);
|
|
181
|
+
// DFS from each start node
|
|
182
|
+
const visit = (step) => {
|
|
183
|
+
if (visited.has(step.id))
|
|
184
|
+
return;
|
|
185
|
+
visited.add(step.id);
|
|
186
|
+
order.push(step);
|
|
187
|
+
// Find connected steps
|
|
188
|
+
const nextConnections = connections.filter(c => c.source === step.id);
|
|
189
|
+
nextConnections.forEach(conn => {
|
|
190
|
+
const nextStep = steps.find(s => s.id === conn.target);
|
|
191
|
+
if (nextStep)
|
|
192
|
+
visit(nextStep);
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
startNodes.forEach(visit);
|
|
196
|
+
// Add any unvisited steps (disconnected nodes)
|
|
197
|
+
steps.forEach(step => {
|
|
198
|
+
if (!visited.has(step.id)) {
|
|
199
|
+
order.push(step);
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
return order;
|
|
203
|
+
}
|
|
204
|
+
pause() {
|
|
205
|
+
if (this.executionStatus$.value === 'running') {
|
|
206
|
+
this.executionStatus$.next('paused');
|
|
207
|
+
this.pauseExecution$.next(true);
|
|
208
|
+
this.addLog(null, 'Flow', 'log', 'Execution paused');
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
resume() {
|
|
212
|
+
if (this.executionStatus$.value === 'paused') {
|
|
213
|
+
this.executionStatus$.next('running');
|
|
214
|
+
this.pauseExecution$.next(false);
|
|
215
|
+
this.addLog(null, 'Flow', 'log', 'Execution resumed');
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
stop() {
|
|
219
|
+
const currentStatus = this.executionStatus$.value;
|
|
220
|
+
if (currentStatus === 'running' || currentStatus === 'paused') {
|
|
221
|
+
this.executionStatus$.next('idle');
|
|
222
|
+
this.stopExecution$.next();
|
|
223
|
+
this.currentStepId$.next(null);
|
|
224
|
+
this.addLog(null, 'Flow', 'log', 'Execution stopped by user');
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
async waitForUnpause() {
|
|
228
|
+
return new Promise((resolve) => {
|
|
229
|
+
if (!this.pauseExecution$.value) {
|
|
230
|
+
resolve();
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
const sub = this.pauseExecution$.subscribe(isPaused => {
|
|
234
|
+
if (!isPaused) {
|
|
235
|
+
sub.unsubscribe();
|
|
236
|
+
resolve();
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
resetExecution() {
|
|
242
|
+
this.executionLogs$.next([]);
|
|
243
|
+
this.executionContext$.next({
|
|
244
|
+
variables: {},
|
|
245
|
+
results: {}
|
|
246
|
+
});
|
|
247
|
+
this.currentStepId$.next(null);
|
|
248
|
+
this.pauseExecution$.next(false);
|
|
249
|
+
}
|
|
250
|
+
addLog(stepId, stepName, type, message, data) {
|
|
251
|
+
const logs = this.executionLogs$.value;
|
|
252
|
+
logs.push({
|
|
253
|
+
timestamp: new Date(),
|
|
254
|
+
stepId: stepId || 0,
|
|
255
|
+
stepName,
|
|
256
|
+
type,
|
|
257
|
+
message,
|
|
258
|
+
data
|
|
259
|
+
});
|
|
260
|
+
this.executionLogs$.next(logs);
|
|
261
|
+
}
|
|
262
|
+
delay(ms) {
|
|
263
|
+
return new Promise((resolve) => {
|
|
264
|
+
const timer = interval(ms).pipe(takeUntil(this.stopExecution$)).subscribe(() => {
|
|
265
|
+
timer.unsubscribe();
|
|
266
|
+
resolve();
|
|
267
|
+
});
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
getExecutionSummary() {
|
|
271
|
+
return new Observable(observer => {
|
|
272
|
+
const logs = this.executionLogs$.value;
|
|
273
|
+
const startLog = logs.find(l => l.type === 'start' && l.stepName === 'Flow');
|
|
274
|
+
const endLog = logs.find(l => (l.type === 'complete' || l.type === 'error') && l.stepName === 'Flow');
|
|
275
|
+
const summary = {
|
|
276
|
+
totalSteps: logs.filter(l => l.type === 'start' && l.stepName !== 'Flow').length,
|
|
277
|
+
completedSteps: logs.filter(l => l.type === 'complete' && l.stepName !== 'Flow').length,
|
|
278
|
+
errors: logs.filter(l => l.type === 'error').length,
|
|
279
|
+
duration: startLog && endLog ? endLog.timestamp.getTime() - startLog.timestamp.getTime() : 0
|
|
280
|
+
};
|
|
281
|
+
observer.next(summary);
|
|
282
|
+
observer.complete();
|
|
283
|
+
});
|
|
284
|
+
}
|
|
285
|
+
static { this.ɵfac = function FlowExecutorService_Factory(t) { return new (t || FlowExecutorService)(); }; }
|
|
286
|
+
static { this.ɵprov = /*@__PURE__*/ i0.ɵɵdefineInjectable({ token: FlowExecutorService, factory: FlowExecutorService.ɵfac, providedIn: 'root' }); }
|
|
287
|
+
}
|
|
288
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(FlowExecutorService, [{
|
|
289
|
+
type: Injectable,
|
|
290
|
+
args: [{
|
|
291
|
+
providedIn: 'root'
|
|
292
|
+
}]
|
|
293
|
+
}], () => [], null); })();
|
|
294
|
+
//# sourceMappingURL=flow-executor.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-executor.service.js","sourceRoot":"","sources":["../../../../../../../src/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/flow-executor.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;;AA8B3C,MAAM,OAAO,mBAAmB;IAiB9B;QAhBQ,qBAAgB,GAAG,IAAI,eAAe,CAAkB,MAAM,CAAC,CAAC;QAChE,mBAAc,GAAG,IAAI,eAAe,CAAgB,IAAI,CAAC,CAAC;QAC1D,mBAAc,GAAG,IAAI,eA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C;YACvB,QAAQ,CAAC,QAAQ,EAAE,CAAC;QACtB,CAAC,CAAC,CAAC;IACL,CAAC;oFA5UU,mBAAmB;uEAAnB,mBAAmB,WAAnB,mBAAmB,mBAFlB,MAAM;;iFAEP,mBAAmB;cAH/B,UAAU;eAAC;gBACV,UAAU,EAAE,MAAM;aACnB"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { AIAgentStepEntity, AIAgentStepPathEntity } from '@memberjunction/core-entities';
|
|
2
|
+
import { MJStep, MJConnection } from '../models/mj-extended.model';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
export declare class MJFlowTransformerService {
|
|
5
|
+
/**
|
|
6
|
+
* Transform MJ entities to standalone flow editor models
|
|
7
|
+
*/
|
|
8
|
+
transformToStandaloneModels(mjSteps: AIAgentStepEntity[], mjPaths: AIAgentStepPathEntity[]): {
|
|
9
|
+
steps: MJStep[];
|
|
10
|
+
connections: MJConnection[];
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Transform a single MJ step entity to standalone Step model
|
|
14
|
+
*/
|
|
15
|
+
private transformStep;
|
|
16
|
+
/**
|
|
17
|
+
* Transform a single MJ path entity to standalone Connection model
|
|
18
|
+
*/
|
|
19
|
+
private transformPath;
|
|
20
|
+
/**
|
|
21
|
+
* Map MJ step type to standalone step type
|
|
22
|
+
*/
|
|
23
|
+
private mapStepType;
|
|
24
|
+
/**
|
|
25
|
+
* Map MJ step to selected option for the standalone model
|
|
26
|
+
*/
|
|
27
|
+
private mapSelectedOption;
|
|
28
|
+
/**
|
|
29
|
+
* Extract property values from MJ step
|
|
30
|
+
*/
|
|
31
|
+
private extractPropertyValues;
|
|
32
|
+
/**
|
|
33
|
+
* Transform standalone models back to MJ entities for saving
|
|
34
|
+
*/
|
|
35
|
+
transformToMJEntities(steps: MJStep[], connections: MJConnection[], existingMJSteps: AIAgentStepEntity[], existingMJPaths: AIAgentStepPathEntity[]): {
|
|
36
|
+
stepsToUpdate: AIAgentStepEntity[];
|
|
37
|
+
pathsToUpdate: AIAgentStepPathEntity[];
|
|
38
|
+
stepsToCreate: Partial<AIAgentStepEntity>[];
|
|
39
|
+
pathsToCreate: Partial<AIAgentStepPathEntity>[];
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Update existing MJ step with data from standalone model
|
|
43
|
+
*/
|
|
44
|
+
private updateMJStep;
|
|
45
|
+
/**
|
|
46
|
+
* Create new MJ step from standalone model
|
|
47
|
+
*/
|
|
48
|
+
private createMJStep;
|
|
49
|
+
/**
|
|
50
|
+
* Update existing MJ path with data from standalone model
|
|
51
|
+
*/
|
|
52
|
+
private updateMJPath;
|
|
53
|
+
/**
|
|
54
|
+
* Create new MJ path from standalone model
|
|
55
|
+
*/
|
|
56
|
+
private createMJPath;
|
|
57
|
+
/**
|
|
58
|
+
* Reverse map standalone step type to MJ step type
|
|
59
|
+
*/
|
|
60
|
+
private reverseMapStepType;
|
|
61
|
+
/**
|
|
62
|
+
* Generate numeric ID from string UUID
|
|
63
|
+
* This is needed because the standalone editor uses numeric IDs
|
|
64
|
+
*/
|
|
65
|
+
private generateNumericId;
|
|
66
|
+
/**
|
|
67
|
+
* Extract a readable label from a condition expression
|
|
68
|
+
*/
|
|
69
|
+
private extractConditionLabel;
|
|
70
|
+
/**
|
|
71
|
+
* Calculate smart positions for steps that don't have valid positions
|
|
72
|
+
*/
|
|
73
|
+
private calculateSmartPositions;
|
|
74
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MJFlowTransformerService, never>;
|
|
75
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MJFlowTransformerService>;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=mj-flow-transformer.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mj-flow-transformer.service.d.ts","sourceRoot":"","sources":["../../../../../../../src/lib/custom/AIAgents/FlowAgentType/flow-editor-integration/services/mj-flow-transformer.service.ts"],"names":[],"mappings":"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