@memberjunction/ng-core-entity-forms 2.49.0 → 2.51.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/README.md +215 -1
- package/dist/lib/custom/AIAgents/agent-execution-monitor.component.d.ts +244 -0
- package/dist/lib/custom/AIAgents/agent-execution-monitor.component.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/agent-execution-monitor.component.js +1314 -0
- package/dist/lib/custom/AIAgents/agent-execution-monitor.component.js.map +1 -0
- package/dist/lib/custom/AIAgents/agent-execution-node.component.d.ts +19 -0
- package/dist/lib/custom/AIAgents/agent-execution-node.component.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/agent-execution-node.component.js +458 -0
- package/dist/lib/custom/AIAgents/agent-execution-node.component.js.map +1 -0
- package/dist/lib/custom/AIAgents/ai-agent-form.component.d.ts +171 -11
- package/dist/lib/custom/AIAgents/ai-agent-form.component.d.ts.map +1 -1
- package/dist/lib/custom/AIAgents/ai-agent-form.component.js +1411 -145
- package/dist/lib/custom/AIAgents/ai-agent-form.component.js.map +1 -1
- package/dist/lib/custom/AIAgents/ai-test-harness-dialog.component.d.ts +78 -0
- package/dist/lib/custom/AIAgents/ai-test-harness-dialog.component.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/ai-test-harness-dialog.component.js +157 -0
- package/dist/lib/custom/AIAgents/ai-test-harness-dialog.component.js.map +1 -0
- package/dist/lib/custom/AIAgents/ai-test-harness.component.d.ts +508 -0
- package/dist/lib/custom/AIAgents/ai-test-harness.component.d.ts.map +1 -0
- package/dist/lib/custom/AIAgents/ai-test-harness.component.js +2658 -0
- package/dist/lib/custom/AIAgents/ai-test-harness.component.js.map +1 -0
- package/dist/lib/custom/AIPromptRuns/ai-prompt-run-form.component.d.ts +40 -0
- package/dist/lib/custom/AIPromptRuns/ai-prompt-run-form.component.d.ts.map +1 -0
- package/dist/lib/custom/AIPromptRuns/ai-prompt-run-form.component.js +965 -0
- package/dist/lib/custom/AIPromptRuns/ai-prompt-run-form.component.js.map +1 -0
- package/dist/lib/custom/AIPrompts/ai-prompt-execution-dialog.component.d.ts +5 -0
- package/dist/lib/custom/AIPrompts/ai-prompt-execution-dialog.component.d.ts.map +1 -1
- package/dist/lib/custom/AIPrompts/ai-prompt-execution-dialog.component.js +137 -99
- package/dist/lib/custom/AIPrompts/ai-prompt-execution-dialog.component.js.map +1 -1
- package/dist/lib/custom/AIPrompts/ai-prompt-form.component.d.ts +80 -4
- package/dist/lib/custom/AIPrompts/ai-prompt-form.component.d.ts.map +1 -1
- package/dist/lib/custom/AIPrompts/ai-prompt-form.component.js +956 -470
- package/dist/lib/custom/AIPrompts/ai-prompt-form.component.js.map +1 -1
- package/dist/lib/custom/Actions/action-execution-log-form.component.d.ts +40 -0
- package/dist/lib/custom/Actions/action-execution-log-form.component.d.ts.map +1 -0
- package/dist/lib/custom/Actions/action-execution-log-form.component.js +530 -0
- package/dist/lib/custom/Actions/action-execution-log-form.component.js.map +1 -0
- package/dist/lib/custom/Actions/action-form.component.d.ts +90 -0
- package/dist/lib/custom/Actions/action-form.component.d.ts.map +1 -0
- package/dist/lib/custom/Actions/action-form.component.js +1579 -0
- package/dist/lib/custom/Actions/action-form.component.js.map +1 -0
- package/dist/lib/custom/Actions/action-param-dialog.component.d.ts +32 -0
- package/dist/lib/custom/Actions/action-param-dialog.component.d.ts.map +1 -0
- package/dist/lib/custom/Actions/action-param-dialog.component.js +320 -0
- package/dist/lib/custom/Actions/action-param-dialog.component.js.map +1 -0
- package/dist/lib/custom/Actions/action-test-harness-dialog.component.d.ts +15 -0
- package/dist/lib/custom/Actions/action-test-harness-dialog.component.d.ts.map +1 -0
- package/dist/lib/custom/Actions/action-test-harness-dialog.component.js +96 -0
- package/dist/lib/custom/Actions/action-test-harness-dialog.component.js.map +1 -0
- package/dist/lib/custom/Actions/action-test-harness.component.d.ts +50 -0
- package/dist/lib/custom/Actions/action-test-harness.component.d.ts.map +1 -0
- package/dist/lib/custom/Actions/action-test-harness.component.js +708 -0
- package/dist/lib/custom/Actions/action-test-harness.component.js.map +1 -0
- package/dist/lib/custom/custom-forms.module.d.ts +31 -19
- package/dist/lib/custom/custom-forms.module.d.ts.map +1 -1
- package/dist/lib/custom/custom-forms.module.js +94 -15
- package/dist/lib/custom/custom-forms.module.js.map +1 -1
- package/dist/lib/custom/shared/entity-selector-dialog.component.d.ts +35 -0
- package/dist/lib/custom/shared/entity-selector-dialog.component.d.ts.map +1 -0
- package/dist/lib/custom/shared/entity-selector-dialog.component.js +290 -0
- package/dist/lib/custom/shared/entity-selector-dialog.component.js.map +1 -0
- package/dist/lib/custom/test-harness-dialog.service.d.ts +111 -0
- package/dist/lib/custom/test-harness-dialog.service.d.ts.map +1 -0
- package/dist/lib/custom/test-harness-dialog.service.js +211 -0
- package/dist/lib/custom/test-harness-dialog.service.js.map +1 -0
- package/dist/lib/generated/Entities/AIAgent/aiagent.form.component.js +12 -11
- package/dist/lib/generated/Entities/AIAgent/aiagent.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/AIAgent/sections/aiagent-form-overview.component.d.ts +54 -0
- package/dist/lib/generated/Entities/AIAgent/sections/aiagent-form-overview.component.d.ts.map +1 -0
- package/dist/lib/generated/Entities/AIAgent/sections/aiagent-form-overview.component.js +492 -0
- package/dist/lib/generated/Entities/AIAgent/sections/aiagent-form-overview.component.js.map +1 -0
- package/dist/lib/generated/Entities/AIAgentRun/aiagentrun.form.component.js +8 -7
- package/dist/lib/generated/Entities/AIAgentRun/aiagentrun.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/AIConfiguration/aiconfiguration.form.component.js +8 -7
- package/dist/lib/generated/Entities/AIConfiguration/aiconfiguration.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/AIModel/aimodel.form.component.js +8 -7
- package/dist/lib/generated/Entities/AIModel/aimodel.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/AIModelType/aimodeltype.form.component.js +12 -11
- package/dist/lib/generated/Entities/AIModelType/aimodeltype.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/AIPrompt/aiprompt.form.component.js +12 -11
- package/dist/lib/generated/Entities/AIPrompt/aiprompt.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/AIPromptRun/aipromptrun.form.component.js +12 -11
- package/dist/lib/generated/Entities/AIPromptRun/aipromptrun.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/AIVendor/aivendor.form.component.js +12 -11
- package/dist/lib/generated/Entities/AIVendor/aivendor.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/ActionExecutionLog/sections/details.component.d.ts.map +1 -1
- package/dist/lib/generated/Entities/ActionExecutionLog/sections/details.component.js +13 -4
- package/dist/lib/generated/Entities/ActionExecutionLog/sections/details.component.js.map +1 -1
- package/dist/public-api.d.ts +3 -0
- package/dist/public-api.d.ts.map +1 -1
- package/dist/public-api.js +16 -0
- package/dist/public-api.js.map +1 -1
- package/package.json +12 -11
- package/dist/lib/custom/AIAgents/ai-agent-execution-dialog.component.d.ts +0 -52
- package/dist/lib/custom/AIAgents/ai-agent-execution-dialog.component.d.ts.map +0 -1
- package/dist/lib/custom/AIAgents/ai-agent-execution-dialog.component.js +0 -590
- package/dist/lib/custom/AIAgents/ai-agent-execution-dialog.component.js.map +0 -1
package/README.md
CHANGED
|
@@ -218,6 +218,192 @@ Each entity form typically follows this structure:
|
|
|
218
218
|
| AI-related forms | Forms for AI models, prompts, and agents |
|
|
219
219
|
| Content forms | Forms for content management |
|
|
220
220
|
| Communication forms | Forms for messaging and notifications |
|
|
221
|
+
| **Test Harness Components** | **Interactive testing interfaces for AI agents and prompts** |
|
|
222
|
+
|
|
223
|
+
## AI Test Harness System
|
|
224
|
+
|
|
225
|
+
This package includes a comprehensive test harness system for AI Agents and AI Prompts, providing developers with powerful tools for testing, debugging, and validating AI components.
|
|
226
|
+
|
|
227
|
+
### Test Harness Components
|
|
228
|
+
|
|
229
|
+
#### 1. AI Agent Test Harness (`AIAgentTestHarnessComponent`)
|
|
230
|
+
|
|
231
|
+
A full-featured testing interface for AI agents with the following capabilities:
|
|
232
|
+
|
|
233
|
+
**Core Features:**
|
|
234
|
+
- **Interactive Chat Interface**: Real-time conversation with AI agents
|
|
235
|
+
- **Streaming Support**: Live streaming of agent responses with elapsed time tracking
|
|
236
|
+
- **Data Context Management**: Configure variables passed to agents during execution
|
|
237
|
+
- **Template Data Management**: Manage template variables for agent prompts
|
|
238
|
+
- **Conversation Persistence**: Save/load conversations with full state restoration
|
|
239
|
+
- **Import/Export**: JSON-based conversation backup and sharing
|
|
240
|
+
- **Content Formatting**: Automatic detection and rendering of Markdown, JSON, and plain text
|
|
241
|
+
- **Raw Content Toggle**: View both processed and raw AI responses
|
|
242
|
+
- **Error Handling**: Comprehensive error display and user feedback
|
|
243
|
+
|
|
244
|
+
**Usage Example:**
|
|
245
|
+
```html
|
|
246
|
+
<mj-ai-agent-test-harness
|
|
247
|
+
[aiAgent]="myAgent"
|
|
248
|
+
[isVisible]="true"
|
|
249
|
+
(visibilityChange)="onVisibilityChanged($event)">
|
|
250
|
+
</mj-ai-agent-test-harness>
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**Data Context Configuration:**
|
|
254
|
+
```typescript
|
|
255
|
+
// Configure variables passed to the agent
|
|
256
|
+
this.testHarness.dataContextVariables = [
|
|
257
|
+
{ name: 'userId', value: 'user-123', type: 'string' },
|
|
258
|
+
{ name: 'department', value: 'Engineering', type: 'string' },
|
|
259
|
+
{ name: 'priority', value: '1', type: 'number' }
|
|
260
|
+
];
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
#### 2. AI Prompt Test Harness (`AIPromptTestHarnessComponent`)
|
|
264
|
+
|
|
265
|
+
A specialized testing interface for AI prompts with template variable management:
|
|
266
|
+
|
|
267
|
+
**Core Features:**
|
|
268
|
+
- **Prompt Testing**: Execute prompts with different AI models
|
|
269
|
+
- **Template Variable Management**: Configure and test prompt variables
|
|
270
|
+
- **Model Selection**: Choose from available AI models for testing
|
|
271
|
+
- **Rendered Prompt Preview**: View how templates render with current variables
|
|
272
|
+
- **Conversation Management**: Similar conversation features as agent harness
|
|
273
|
+
- **Variable Auto-Detection**: Automatically detect variables in prompt templates
|
|
274
|
+
|
|
275
|
+
**Usage Example:**
|
|
276
|
+
```html
|
|
277
|
+
<mj-ai-prompt-test-harness
|
|
278
|
+
[aiPrompt]="myPrompt"
|
|
279
|
+
[template]="promptTemplate"
|
|
280
|
+
[templateContent]="templateContent"
|
|
281
|
+
[isVisible]="true">
|
|
282
|
+
</mj-ai-prompt-test-harness>
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
#### 3. Test Harness Dialog Service (`TestHarnessDialogService`)
|
|
286
|
+
|
|
287
|
+
A centralized service for opening test harnesses in modal dialogs:
|
|
288
|
+
|
|
289
|
+
**Features:**
|
|
290
|
+
- **Configurable Dialogs**: Custom sizing, titles, and initial data
|
|
291
|
+
- **Agent Loading**: Load agents by ID or use existing entities
|
|
292
|
+
- **Dimension Support**: Viewport units (vw, vh) and pixel dimensions
|
|
293
|
+
- **Initial Data Setup**: Pre-populate context and template variables
|
|
294
|
+
|
|
295
|
+
**Usage Examples:**
|
|
296
|
+
```typescript
|
|
297
|
+
// Open AI Agent test harness
|
|
298
|
+
const dialogRef = this.testHarnessService.openAgentTestHarness({
|
|
299
|
+
agentId: 'agent-123',
|
|
300
|
+
title: 'Test My Agent',
|
|
301
|
+
width: '90vw',
|
|
302
|
+
height: '80vh',
|
|
303
|
+
initialDataContext: {
|
|
304
|
+
userId: 'user-456',
|
|
305
|
+
department: 'Engineering'
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
// Open AI Prompt test harness
|
|
310
|
+
const dialogRef = this.testHarnessService.openPromptTestHarness({
|
|
311
|
+
promptId: 'prompt-789',
|
|
312
|
+
selectedModelId: 'gpt-4',
|
|
313
|
+
initialTemplateVariables: {
|
|
314
|
+
name: 'Alice',
|
|
315
|
+
context: 'Customer support inquiry'
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
// Convenience methods
|
|
320
|
+
await this.testHarnessService.openAgentById('agent-123');
|
|
321
|
+
await this.testHarnessService.openPromptById('prompt-456');
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Enhanced AI Agent Form
|
|
325
|
+
|
|
326
|
+
The AI Agent form (`AIAgentFormComponentExtended`) includes integrated test harness access:
|
|
327
|
+
|
|
328
|
+
**Features:**
|
|
329
|
+
- **Built-in Test Button**: Direct access to test harness from agent form
|
|
330
|
+
- **Related Entity Management**: View sub-agents, prompts, actions, and execution history
|
|
331
|
+
- **Status Indicators**: Visual status badges and execution mode icons
|
|
332
|
+
- **Navigation Support**: Links to related entities
|
|
333
|
+
- **Execution History**: Recent runs with timing and status information
|
|
334
|
+
|
|
335
|
+
**Enhanced Capabilities:**
|
|
336
|
+
```typescript
|
|
337
|
+
// Open test harness from form
|
|
338
|
+
this.openTestHarness(); // Validates agent is saved first
|
|
339
|
+
|
|
340
|
+
// View execution status
|
|
341
|
+
this.getExecutionStatusIcon(status); // Returns appropriate FontAwesome icon
|
|
342
|
+
this.getExecutionStatusColor(status); // Returns status color
|
|
343
|
+
|
|
344
|
+
// Format timing information
|
|
345
|
+
this.formatExecutionTime(milliseconds); // Human-readable time format
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
### Conversation Management
|
|
349
|
+
|
|
350
|
+
Both test harnesses include comprehensive conversation management:
|
|
351
|
+
|
|
352
|
+
**Features:**
|
|
353
|
+
- **Auto-Save**: Conversations automatically save during active sessions
|
|
354
|
+
- **Manual Save**: Save conversations with custom names
|
|
355
|
+
- **Load/Restore**: Restore complete conversation state including variables
|
|
356
|
+
- **Export/Import**: JSON-based conversation portability
|
|
357
|
+
- **Storage Limits**: Automatic cleanup (50 conversation limit)
|
|
358
|
+
|
|
359
|
+
**Export Format:**
|
|
360
|
+
```json
|
|
361
|
+
{
|
|
362
|
+
"agent": {
|
|
363
|
+
"id": "agent-123",
|
|
364
|
+
"name": "Customer Service Agent",
|
|
365
|
+
"description": "Handles customer inquiries"
|
|
366
|
+
},
|
|
367
|
+
"messages": [...],
|
|
368
|
+
"dataContext": {
|
|
369
|
+
"userId": "user-456",
|
|
370
|
+
"department": "Support"
|
|
371
|
+
},
|
|
372
|
+
"templateData": {
|
|
373
|
+
"customerName": "John Doe"
|
|
374
|
+
},
|
|
375
|
+
"exportedAt": "2024-01-15T10:30:00.000Z"
|
|
376
|
+
}
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### Content Rendering System
|
|
380
|
+
|
|
381
|
+
Advanced content formatting with automatic type detection:
|
|
382
|
+
|
|
383
|
+
**Supported Formats:**
|
|
384
|
+
- **Markdown**: Headers, lists, code blocks, links, emphasis
|
|
385
|
+
- **JSON**: Syntax highlighting and pretty formatting
|
|
386
|
+
- **Plain Text**: Clean text rendering with line breaks
|
|
387
|
+
|
|
388
|
+
**Content Type Detection:**
|
|
389
|
+
```typescript
|
|
390
|
+
// Automatically detects content type
|
|
391
|
+
const contentType = this.detectContentType(content);
|
|
392
|
+
// Returns: 'markdown' | 'json' | 'text'
|
|
393
|
+
|
|
394
|
+
// Renders content appropriately
|
|
395
|
+
const safeHtml = this.getFormattedContent(message);
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
### Integration Points
|
|
399
|
+
|
|
400
|
+
The test harness system integrates seamlessly with:
|
|
401
|
+
|
|
402
|
+
- **MemberJunction Entity System**: Uses proper entity loading patterns
|
|
403
|
+
- **GraphQL Data Provider**: Executes agents and prompts via GraphQL mutations
|
|
404
|
+
- **Notification Service**: User feedback for actions and errors
|
|
405
|
+
- **LocalStorage**: Conversation persistence across sessions
|
|
406
|
+
- **Kendo UI Dialogs**: Professional modal interfaces
|
|
221
407
|
|
|
222
408
|
## Notes
|
|
223
409
|
|
|
@@ -228,6 +414,7 @@ Each entity form typically follows this structure:
|
|
|
228
414
|
|
|
229
415
|
## Dependencies
|
|
230
416
|
|
|
417
|
+
### Core Dependencies
|
|
231
418
|
- @angular/common
|
|
232
419
|
- @angular/core
|
|
233
420
|
- @angular/forms
|
|
@@ -235,6 +422,8 @@ Each entity form typically follows this structure:
|
|
|
235
422
|
- @memberjunction/core-entities
|
|
236
423
|
- @memberjunction/ng-explorer-core
|
|
237
424
|
- @memberjunction/ng-base-forms
|
|
425
|
+
|
|
426
|
+
### UI Component Dependencies
|
|
238
427
|
- @memberjunction/ng-form-toolbar
|
|
239
428
|
- @memberjunction/ng-tabstrip
|
|
240
429
|
- @memberjunction/ng-container-directives
|
|
@@ -242,4 +431,29 @@ Each entity form typically follows this structure:
|
|
|
242
431
|
- @memberjunction/ng-timeline
|
|
243
432
|
- @memberjunction/ng-join-grid
|
|
244
433
|
- @progress/kendo-angular-grid
|
|
245
|
-
- @progress/kendo-angular-dropdowns
|
|
434
|
+
- @progress/kendo-angular-dropdowns
|
|
435
|
+
- @progress/kendo-angular-dialog
|
|
436
|
+
|
|
437
|
+
### AI & Notification Dependencies
|
|
438
|
+
- @memberjunction/ai
|
|
439
|
+
- @memberjunction/ng-notifications
|
|
440
|
+
- @memberjunction/graphql-dataprovider
|
|
441
|
+
|
|
442
|
+
### Test Harness Components
|
|
443
|
+
|
|
444
|
+
The test harness system introduces several new components and services:
|
|
445
|
+
|
|
446
|
+
| Component/Service | Purpose |
|
|
447
|
+
|------------------|---------|
|
|
448
|
+
| `AIAgentTestHarnessComponent` | Interactive chat interface for testing AI agents |
|
|
449
|
+
| `AIPromptTestHarnessComponent` | Template variable testing for AI prompts |
|
|
450
|
+
| `AIAgentTestHarnessDialogComponent` | Modal dialog wrapper for agent testing |
|
|
451
|
+
| `AIPromptTestHarnessDialogComponent` | Modal dialog wrapper for prompt testing |
|
|
452
|
+
| `TestHarnessDialogService` | Centralized service for opening test harness dialogs |
|
|
453
|
+
| `AIAgentFormComponentExtended` | Enhanced AI agent form with integrated test harness |
|
|
454
|
+
|
|
455
|
+
### New Dependencies Added for Test Harness:
|
|
456
|
+
- **Angular DomSanitizer**: Safe HTML rendering for formatted content
|
|
457
|
+
- **RxJS Subjects**: Component lifecycle and event management
|
|
458
|
+
- **LocalStorage**: Conversation persistence across sessions
|
|
459
|
+
- **File API**: Import/export functionality for conversations
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import { OnChanges, SimpleChanges, OnDestroy, ElementRef, AfterViewInit, ChangeDetectorRef, ViewContainerRef } from '@angular/core';
|
|
2
|
+
import * as i0 from "@angular/core";
|
|
3
|
+
/**
|
|
4
|
+
* Represents a node in the execution tree with all necessary display information
|
|
5
|
+
*/
|
|
6
|
+
export interface ExecutionTreeNode {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
type: 'validation' | 'prompt' | 'action' | 'sub-agent' | 'decision' | 'chat';
|
|
10
|
+
status: 'pending' | 'running' | 'completed' | 'failed';
|
|
11
|
+
startTime?: Date;
|
|
12
|
+
endTime?: Date;
|
|
13
|
+
duration?: number;
|
|
14
|
+
agentPath: string[];
|
|
15
|
+
inputPreview?: string;
|
|
16
|
+
outputPreview?: string;
|
|
17
|
+
error?: string;
|
|
18
|
+
children?: ExecutionTreeNode[];
|
|
19
|
+
expanded?: boolean;
|
|
20
|
+
depth: number;
|
|
21
|
+
tokensUsed?: number;
|
|
22
|
+
cost?: number;
|
|
23
|
+
detailsMarkdown?: string;
|
|
24
|
+
detailsExpanded?: boolean;
|
|
25
|
+
promptCount?: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Mode for the execution monitor component
|
|
29
|
+
*/
|
|
30
|
+
export type ExecutionMonitorMode = 'live' | 'historical';
|
|
31
|
+
/**
|
|
32
|
+
* Execution statistics for display
|
|
33
|
+
*/
|
|
34
|
+
export interface ExecutionStats {
|
|
35
|
+
totalSteps: number;
|
|
36
|
+
completedSteps: number;
|
|
37
|
+
failedSteps: number;
|
|
38
|
+
totalTokens: number;
|
|
39
|
+
totalCost: number;
|
|
40
|
+
stepsByType: Record<string, number>;
|
|
41
|
+
totalDuration?: number;
|
|
42
|
+
totalPrompts: number;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* AgentExecutionMonitor Component
|
|
46
|
+
*
|
|
47
|
+
* A reusable component for visualizing AI agent execution flow in real-time or historically.
|
|
48
|
+
* Displays a hierarchical tree of execution steps with status, timing, and preview information.
|
|
49
|
+
*
|
|
50
|
+
* Features:
|
|
51
|
+
* - Real-time updates for live executions
|
|
52
|
+
* - Historical playback for completed executions
|
|
53
|
+
* - Collapsible tree structure
|
|
54
|
+
* - Step status indicators with animations
|
|
55
|
+
* - Execution statistics
|
|
56
|
+
* - Token usage and cost tracking
|
|
57
|
+
* - Error display
|
|
58
|
+
* - Input/output preview
|
|
59
|
+
*/
|
|
60
|
+
export declare class AgentExecutionMonitorComponent implements OnChanges, OnDestroy, AfterViewInit {
|
|
61
|
+
private cdr;
|
|
62
|
+
mode: ExecutionMonitorMode;
|
|
63
|
+
executionData: any;
|
|
64
|
+
autoExpand: boolean;
|
|
65
|
+
executionTreeContainer: ElementRef<HTMLDivElement>;
|
|
66
|
+
executionNodesContainer: ViewContainerRef;
|
|
67
|
+
executionTree: ExecutionTreeNode[];
|
|
68
|
+
currentStep: ExecutionTreeNode | null;
|
|
69
|
+
private nodeComponentMap;
|
|
70
|
+
stats: ExecutionStats;
|
|
71
|
+
private userHasInteracted;
|
|
72
|
+
private userHasScrolled;
|
|
73
|
+
private isAutoScrolling;
|
|
74
|
+
private lastScrollPosition;
|
|
75
|
+
private scrollThreshold;
|
|
76
|
+
private viewInitialized;
|
|
77
|
+
private processedStepIds;
|
|
78
|
+
private newlyAddedNodeIds;
|
|
79
|
+
private destroy$;
|
|
80
|
+
private updateSubscription?;
|
|
81
|
+
constructor(cdr: ChangeDetectorRef);
|
|
82
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
83
|
+
ngAfterViewInit(): void;
|
|
84
|
+
ngOnDestroy(): void;
|
|
85
|
+
/**
|
|
86
|
+
* Clear all dynamically created components
|
|
87
|
+
*/
|
|
88
|
+
private clearNodeComponents;
|
|
89
|
+
/**
|
|
90
|
+
* Process execution data based on mode
|
|
91
|
+
*/
|
|
92
|
+
private processExecutionData;
|
|
93
|
+
/**
|
|
94
|
+
* Build tree from historical execution data
|
|
95
|
+
*/
|
|
96
|
+
private buildTreeFromHistoricalData;
|
|
97
|
+
/**
|
|
98
|
+
* Render the execution tree using dynamic components
|
|
99
|
+
*/
|
|
100
|
+
private renderTree;
|
|
101
|
+
/**
|
|
102
|
+
* Create a component for a node and its children
|
|
103
|
+
*/
|
|
104
|
+
private createNodeComponent;
|
|
105
|
+
/**
|
|
106
|
+
* Convert new execution tree format to display nodes
|
|
107
|
+
*/
|
|
108
|
+
private convertExecutionTree;
|
|
109
|
+
/**
|
|
110
|
+
* Convert legacy step format to tree nodes
|
|
111
|
+
*/
|
|
112
|
+
private convertLegacySteps;
|
|
113
|
+
/**
|
|
114
|
+
* Map step type strings to our type enum
|
|
115
|
+
*/
|
|
116
|
+
private mapStepType;
|
|
117
|
+
/**
|
|
118
|
+
* Map status strings to our status enum
|
|
119
|
+
*/
|
|
120
|
+
private mapStepStatus;
|
|
121
|
+
/**
|
|
122
|
+
* Create a preview string from data
|
|
123
|
+
*/
|
|
124
|
+
private createPreview;
|
|
125
|
+
/**
|
|
126
|
+
* Extract token count from output data
|
|
127
|
+
*/
|
|
128
|
+
private extractTokens;
|
|
129
|
+
/**
|
|
130
|
+
* Extract cost from output data
|
|
131
|
+
*/
|
|
132
|
+
private extractCost;
|
|
133
|
+
/**
|
|
134
|
+
* Calculate duration from timestamps
|
|
135
|
+
*/
|
|
136
|
+
private calculateDuration;
|
|
137
|
+
/**
|
|
138
|
+
* Set up live updates for real-time execution
|
|
139
|
+
*/
|
|
140
|
+
private setupLiveUpdates;
|
|
141
|
+
/**
|
|
142
|
+
* Convert live steps format to execution tree format
|
|
143
|
+
*/
|
|
144
|
+
private convertLiveStepsToTree;
|
|
145
|
+
/**
|
|
146
|
+
* Update current step indicator
|
|
147
|
+
*/
|
|
148
|
+
private updateCurrentStep;
|
|
149
|
+
/**
|
|
150
|
+
* Mark previously new nodes as completed
|
|
151
|
+
*/
|
|
152
|
+
private markPreviouslyNewNodesAsComplete;
|
|
153
|
+
/**
|
|
154
|
+
* Find a node by ID in the tree
|
|
155
|
+
*/
|
|
156
|
+
private findNodeById;
|
|
157
|
+
/**
|
|
158
|
+
* Calculate execution statistics
|
|
159
|
+
*/
|
|
160
|
+
private calculateStats;
|
|
161
|
+
/**
|
|
162
|
+
* Toggle node expansion
|
|
163
|
+
*/
|
|
164
|
+
toggleNode(node: ExecutionTreeNode): void;
|
|
165
|
+
/**
|
|
166
|
+
* Check if node has expandable content
|
|
167
|
+
*/
|
|
168
|
+
private hasExpandableContent;
|
|
169
|
+
/**
|
|
170
|
+
* Handle scroll events
|
|
171
|
+
*/
|
|
172
|
+
onScroll(event: Event): void;
|
|
173
|
+
/**
|
|
174
|
+
* Handle user clicks (interaction detection)
|
|
175
|
+
*/
|
|
176
|
+
onUserInteraction(): void;
|
|
177
|
+
/**
|
|
178
|
+
* Check if scroll is at bottom
|
|
179
|
+
*/
|
|
180
|
+
private isScrolledToBottom;
|
|
181
|
+
/**
|
|
182
|
+
* Check if user is at bottom (for initial setup)
|
|
183
|
+
*/
|
|
184
|
+
private checkIfUserAtBottom;
|
|
185
|
+
/**
|
|
186
|
+
* Auto-scroll to bottom if user hasn't interacted
|
|
187
|
+
*/
|
|
188
|
+
private autoScrollToBottom;
|
|
189
|
+
/**
|
|
190
|
+
* Format agent path for display
|
|
191
|
+
*/
|
|
192
|
+
formatAgentPath(path: string[]): string;
|
|
193
|
+
/**
|
|
194
|
+
* Format duration for display
|
|
195
|
+
*/
|
|
196
|
+
formatDuration(ms: number): string;
|
|
197
|
+
/**
|
|
198
|
+
* Get step types for display
|
|
199
|
+
*/
|
|
200
|
+
getStepTypes(): string[];
|
|
201
|
+
/**
|
|
202
|
+
* Format markdown content for display
|
|
203
|
+
*/
|
|
204
|
+
formatMarkdown(markdown: string): string;
|
|
205
|
+
/**
|
|
206
|
+
* Append new live steps without re-rendering entire tree
|
|
207
|
+
*/
|
|
208
|
+
private appendNewLiveSteps;
|
|
209
|
+
/**
|
|
210
|
+
* Generate a stable ID for a step based on its content
|
|
211
|
+
*/
|
|
212
|
+
private generateStepId;
|
|
213
|
+
/**
|
|
214
|
+
* Find parent node based on depth
|
|
215
|
+
*/
|
|
216
|
+
private findParentNode;
|
|
217
|
+
/**
|
|
218
|
+
* Build a map of nodes by ID for quick lookup
|
|
219
|
+
*/
|
|
220
|
+
private buildNodeMap;
|
|
221
|
+
/**
|
|
222
|
+
* Create a single node from a live step
|
|
223
|
+
*/
|
|
224
|
+
private createNodeFromLiveStep;
|
|
225
|
+
/**
|
|
226
|
+
* Collect all node IDs in the tree
|
|
227
|
+
*/
|
|
228
|
+
private collectNodeIds;
|
|
229
|
+
/**
|
|
230
|
+
* Preserve expanded state of all nodes
|
|
231
|
+
*/
|
|
232
|
+
private preserveExpandedState;
|
|
233
|
+
/**
|
|
234
|
+
* Restore expanded state of all nodes
|
|
235
|
+
*/
|
|
236
|
+
private restoreExpandedState;
|
|
237
|
+
/**
|
|
238
|
+
* Append a node to its parent based on depth
|
|
239
|
+
*/
|
|
240
|
+
private appendToParent;
|
|
241
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AgentExecutionMonitorComponent, never>;
|
|
242
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AgentExecutionMonitorComponent, "mj-agent-execution-monitor", never, { "mode": { "alias": "mode"; "required": false; }; "executionData": { "alias": "executionData"; "required": false; }; "autoExpand": { "alias": "autoExpand"; "required": false; }; }, {}, never, never, true, never>;
|
|
243
|
+
}
|
|
244
|
+
//# sourceMappingURL=agent-execution-monitor.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-execution-monitor.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/custom/AIAgents/agent-execution-monitor.component.ts"],"names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