@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.
Files changed (97) hide show
  1. package/README.md +215 -1
  2. package/dist/lib/custom/AIAgents/agent-execution-monitor.component.d.ts +244 -0
  3. package/dist/lib/custom/AIAgents/agent-execution-monitor.component.d.ts.map +1 -0
  4. package/dist/lib/custom/AIAgents/agent-execution-monitor.component.js +1314 -0
  5. package/dist/lib/custom/AIAgents/agent-execution-monitor.component.js.map +1 -0
  6. package/dist/lib/custom/AIAgents/agent-execution-node.component.d.ts +19 -0
  7. package/dist/lib/custom/AIAgents/agent-execution-node.component.d.ts.map +1 -0
  8. package/dist/lib/custom/AIAgents/agent-execution-node.component.js +458 -0
  9. package/dist/lib/custom/AIAgents/agent-execution-node.component.js.map +1 -0
  10. package/dist/lib/custom/AIAgents/ai-agent-form.component.d.ts +171 -11
  11. package/dist/lib/custom/AIAgents/ai-agent-form.component.d.ts.map +1 -1
  12. package/dist/lib/custom/AIAgents/ai-agent-form.component.js +1411 -145
  13. package/dist/lib/custom/AIAgents/ai-agent-form.component.js.map +1 -1
  14. package/dist/lib/custom/AIAgents/ai-test-harness-dialog.component.d.ts +78 -0
  15. package/dist/lib/custom/AIAgents/ai-test-harness-dialog.component.d.ts.map +1 -0
  16. package/dist/lib/custom/AIAgents/ai-test-harness-dialog.component.js +157 -0
  17. package/dist/lib/custom/AIAgents/ai-test-harness-dialog.component.js.map +1 -0
  18. package/dist/lib/custom/AIAgents/ai-test-harness.component.d.ts +508 -0
  19. package/dist/lib/custom/AIAgents/ai-test-harness.component.d.ts.map +1 -0
  20. package/dist/lib/custom/AIAgents/ai-test-harness.component.js +2658 -0
  21. package/dist/lib/custom/AIAgents/ai-test-harness.component.js.map +1 -0
  22. package/dist/lib/custom/AIPromptRuns/ai-prompt-run-form.component.d.ts +40 -0
  23. package/dist/lib/custom/AIPromptRuns/ai-prompt-run-form.component.d.ts.map +1 -0
  24. package/dist/lib/custom/AIPromptRuns/ai-prompt-run-form.component.js +965 -0
  25. package/dist/lib/custom/AIPromptRuns/ai-prompt-run-form.component.js.map +1 -0
  26. package/dist/lib/custom/AIPrompts/ai-prompt-execution-dialog.component.d.ts +5 -0
  27. package/dist/lib/custom/AIPrompts/ai-prompt-execution-dialog.component.d.ts.map +1 -1
  28. package/dist/lib/custom/AIPrompts/ai-prompt-execution-dialog.component.js +137 -99
  29. package/dist/lib/custom/AIPrompts/ai-prompt-execution-dialog.component.js.map +1 -1
  30. package/dist/lib/custom/AIPrompts/ai-prompt-form.component.d.ts +80 -4
  31. package/dist/lib/custom/AIPrompts/ai-prompt-form.component.d.ts.map +1 -1
  32. package/dist/lib/custom/AIPrompts/ai-prompt-form.component.js +956 -470
  33. package/dist/lib/custom/AIPrompts/ai-prompt-form.component.js.map +1 -1
  34. package/dist/lib/custom/Actions/action-execution-log-form.component.d.ts +40 -0
  35. package/dist/lib/custom/Actions/action-execution-log-form.component.d.ts.map +1 -0
  36. package/dist/lib/custom/Actions/action-execution-log-form.component.js +530 -0
  37. package/dist/lib/custom/Actions/action-execution-log-form.component.js.map +1 -0
  38. package/dist/lib/custom/Actions/action-form.component.d.ts +90 -0
  39. package/dist/lib/custom/Actions/action-form.component.d.ts.map +1 -0
  40. package/dist/lib/custom/Actions/action-form.component.js +1579 -0
  41. package/dist/lib/custom/Actions/action-form.component.js.map +1 -0
  42. package/dist/lib/custom/Actions/action-param-dialog.component.d.ts +32 -0
  43. package/dist/lib/custom/Actions/action-param-dialog.component.d.ts.map +1 -0
  44. package/dist/lib/custom/Actions/action-param-dialog.component.js +320 -0
  45. package/dist/lib/custom/Actions/action-param-dialog.component.js.map +1 -0
  46. package/dist/lib/custom/Actions/action-test-harness-dialog.component.d.ts +15 -0
  47. package/dist/lib/custom/Actions/action-test-harness-dialog.component.d.ts.map +1 -0
  48. package/dist/lib/custom/Actions/action-test-harness-dialog.component.js +96 -0
  49. package/dist/lib/custom/Actions/action-test-harness-dialog.component.js.map +1 -0
  50. package/dist/lib/custom/Actions/action-test-harness.component.d.ts +50 -0
  51. package/dist/lib/custom/Actions/action-test-harness.component.d.ts.map +1 -0
  52. package/dist/lib/custom/Actions/action-test-harness.component.js +708 -0
  53. package/dist/lib/custom/Actions/action-test-harness.component.js.map +1 -0
  54. package/dist/lib/custom/custom-forms.module.d.ts +31 -19
  55. package/dist/lib/custom/custom-forms.module.d.ts.map +1 -1
  56. package/dist/lib/custom/custom-forms.module.js +94 -15
  57. package/dist/lib/custom/custom-forms.module.js.map +1 -1
  58. package/dist/lib/custom/shared/entity-selector-dialog.component.d.ts +35 -0
  59. package/dist/lib/custom/shared/entity-selector-dialog.component.d.ts.map +1 -0
  60. package/dist/lib/custom/shared/entity-selector-dialog.component.js +290 -0
  61. package/dist/lib/custom/shared/entity-selector-dialog.component.js.map +1 -0
  62. package/dist/lib/custom/test-harness-dialog.service.d.ts +111 -0
  63. package/dist/lib/custom/test-harness-dialog.service.d.ts.map +1 -0
  64. package/dist/lib/custom/test-harness-dialog.service.js +211 -0
  65. package/dist/lib/custom/test-harness-dialog.service.js.map +1 -0
  66. package/dist/lib/generated/Entities/AIAgent/aiagent.form.component.js +12 -11
  67. package/dist/lib/generated/Entities/AIAgent/aiagent.form.component.js.map +1 -1
  68. package/dist/lib/generated/Entities/AIAgent/sections/aiagent-form-overview.component.d.ts +54 -0
  69. package/dist/lib/generated/Entities/AIAgent/sections/aiagent-form-overview.component.d.ts.map +1 -0
  70. package/dist/lib/generated/Entities/AIAgent/sections/aiagent-form-overview.component.js +492 -0
  71. package/dist/lib/generated/Entities/AIAgent/sections/aiagent-form-overview.component.js.map +1 -0
  72. package/dist/lib/generated/Entities/AIAgentRun/aiagentrun.form.component.js +8 -7
  73. package/dist/lib/generated/Entities/AIAgentRun/aiagentrun.form.component.js.map +1 -1
  74. package/dist/lib/generated/Entities/AIConfiguration/aiconfiguration.form.component.js +8 -7
  75. package/dist/lib/generated/Entities/AIConfiguration/aiconfiguration.form.component.js.map +1 -1
  76. package/dist/lib/generated/Entities/AIModel/aimodel.form.component.js +8 -7
  77. package/dist/lib/generated/Entities/AIModel/aimodel.form.component.js.map +1 -1
  78. package/dist/lib/generated/Entities/AIModelType/aimodeltype.form.component.js +12 -11
  79. package/dist/lib/generated/Entities/AIModelType/aimodeltype.form.component.js.map +1 -1
  80. package/dist/lib/generated/Entities/AIPrompt/aiprompt.form.component.js +12 -11
  81. package/dist/lib/generated/Entities/AIPrompt/aiprompt.form.component.js.map +1 -1
  82. package/dist/lib/generated/Entities/AIPromptRun/aipromptrun.form.component.js +12 -11
  83. package/dist/lib/generated/Entities/AIPromptRun/aipromptrun.form.component.js.map +1 -1
  84. package/dist/lib/generated/Entities/AIVendor/aivendor.form.component.js +12 -11
  85. package/dist/lib/generated/Entities/AIVendor/aivendor.form.component.js.map +1 -1
  86. package/dist/lib/generated/Entities/ActionExecutionLog/sections/details.component.d.ts.map +1 -1
  87. package/dist/lib/generated/Entities/ActionExecutionLog/sections/details.component.js +13 -4
  88. package/dist/lib/generated/Entities/ActionExecutionLog/sections/details.component.js.map +1 -1
  89. package/dist/public-api.d.ts +3 -0
  90. package/dist/public-api.d.ts.map +1 -1
  91. package/dist/public-api.js +16 -0
  92. package/dist/public-api.js.map +1 -1
  93. package/package.json +12 -11
  94. package/dist/lib/custom/AIAgents/ai-agent-execution-dialog.component.d.ts +0 -52
  95. package/dist/lib/custom/AIAgents/ai-agent-execution-dialog.component.d.ts.map +0 -1
  96. package/dist/lib/custom/AIAgents/ai-agent-execution-dialog.component.js +0 -590
  97. package/dist/lib/custom/AIAgents/ai-agent-execution-dialog.component.js.map +0 -1
@@ -0,0 +1,508 @@
1
+ import { EventEmitter, OnInit, OnDestroy, OnChanges, SimpleChanges, AfterViewChecked } from '@angular/core';
2
+ import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
3
+ import { AIAgentEntity, AIPromptEntity } from '@memberjunction/core-entities';
4
+ import { ChatMessage } from '@memberjunction/ai';
5
+ import * as i0 from "@angular/core";
6
+ /**
7
+ * Supported modes for the test harness
8
+ */
9
+ export type TestHarnessMode = 'agent' | 'prompt';
10
+ /**
11
+ * Represents a variable in the data context or template data for agent execution.
12
+ * Used to pass dynamic data to agents during testing and execution.
13
+ */
14
+ export interface DataContextVariable {
15
+ /** Variable name used in agent prompts and templates */
16
+ name: string;
17
+ /** String representation of the variable value */
18
+ value: string;
19
+ /** Data type for proper conversion during execution */
20
+ type: 'string' | 'number' | 'boolean' | 'object';
21
+ }
22
+ /**
23
+ * Enhanced chat message interface extending the base ChatMessage from @memberjunction/ai.
24
+ * Includes additional properties for streaming, timing, error handling, and content management.
25
+ */
26
+ export interface ConversationMessage extends ChatMessage {
27
+ /** Unique identifier for this message */
28
+ id: string;
29
+ /** Timestamp when the message was created */
30
+ timestamp: Date;
31
+ /** Whether this message is currently being streamed */
32
+ isStreaming?: boolean;
33
+ /** Accumulated content during streaming (temporary) */
34
+ streamingContent?: string;
35
+ /** Total execution time for AI-generated messages */
36
+ executionTime?: number;
37
+ /** Associated agent run ID for tracking */
38
+ agentRunId?: string;
39
+ /** Error message if processing failed */
40
+ error?: string;
41
+ /** Original unprocessed content from the AI model */
42
+ rawContent?: string;
43
+ /** Whether to display raw content instead of processed content */
44
+ showRaw?: boolean;
45
+ /** Timestamp when streaming started (for elapsed time calculation) */
46
+ streamingStartTime?: number;
47
+ /** Current elapsed time during streaming */
48
+ elapsedTime?: number;
49
+ /** Whether JSON raw section is expanded in collapsible view */
50
+ showJsonRaw?: boolean;
51
+ /** Execution history data for this message (agent mode) */
52
+ executionData?: any;
53
+ }
54
+ /**
55
+ * Represents a saved conversation session with complete state information.
56
+ * Includes all messages, context data, and metadata for restoration.
57
+ */
58
+ export interface SavedConversation {
59
+ /** Unique identifier for the saved conversation */
60
+ id: string;
61
+ /** User-provided name for the conversation */
62
+ name: string;
63
+ /** ID of the agent used in this conversation */
64
+ agentId: string;
65
+ /** Name of the agent for display purposes */
66
+ agentName: string;
67
+ /** Complete message history */
68
+ messages: ConversationMessage[];
69
+ /** Data context variables used during the conversation */
70
+ dataContext: Record<string, any>;
71
+ /** Template data variables used during the conversation (agent mode) */
72
+ templateData: Record<string, any>;
73
+ /** Template variables used during the conversation (prompt mode) */
74
+ templateVariables?: Record<string, any>;
75
+ /** When the conversation was first created */
76
+ createdAt: Date;
77
+ /** When the conversation was last modified */
78
+ updatedAt: Date;
79
+ }
80
+ /**
81
+ * Comprehensive test harness component for AI Agent development and testing.
82
+ * Provides a full-featured chat interface with conversation management, data context configuration,
83
+ * template data management, streaming responses, conversation persistence, and import/export capabilities.
84
+ *
85
+ * ## Key Features:
86
+ * - **Interactive Chat**: Real-time conversation with AI agents
87
+ * - **Streaming Support**: Live streaming of agent responses with elapsed time tracking
88
+ * - **Data Context Management**: Configure variables passed to agent during execution
89
+ * - **Template Data Management**: Manage template variables for agent prompts
90
+ * - **Conversation Persistence**: Save/load conversations with full state restoration
91
+ * - **Import/Export**: JSON-based conversation backup and sharing
92
+ * - **Content Formatting**: Automatic detection and rendering of Markdown, JSON, and plain text
93
+ * - **Raw Content Toggle**: View both processed and raw AI responses
94
+ * - **Error Handling**: Comprehensive error display and user feedback
95
+ *
96
+ * ## Usage:
97
+ * ```html
98
+ * <mj-ai-agent-test-harness
99
+ * [aiAgent]="myAgent"
100
+ * [isVisible]="true"
101
+ * (visibilityChange)="onVisibilityChanged($event)">
102
+ * </mj-ai-agent-test-harness>
103
+ * ```
104
+ *
105
+ * @example
106
+ * ```typescript
107
+ * // Using with agent entity
108
+ * const agent = await metadata.GetEntityObject<AIAgentEntity>('AI Agents');
109
+ * await agent.Load('agent-id');
110
+ * this.testHarness.aiAgent = agent;
111
+ * this.testHarness.isVisible = true;
112
+ * ```
113
+ */
114
+ export declare class AITestHarnessComponent implements OnInit, OnDestroy, OnChanges, AfterViewChecked {
115
+ private sanitizer;
116
+ /**
117
+ * Creates a new AI Test Harness component instance.
118
+ * @param sanitizer - Angular DomSanitizer for safe HTML rendering of formatted content
119
+ */
120
+ constructor(sanitizer: DomSanitizer);
121
+ /** The mode of operation - either 'agent' or 'prompt' */
122
+ mode: TestHarnessMode;
123
+ /** The entity to test - either an AI Agent or AI Prompt */
124
+ entity: AIAgentEntity | AIPromptEntity | null;
125
+ /** @deprecated Use 'entity' instead. Kept for backward compatibility. */
126
+ get aiAgent(): AIAgentEntity | null;
127
+ set aiAgent(value: AIAgentEntity | null);
128
+ private _isVisible;
129
+ /**
130
+ * Controls the visibility of the test harness. When set to true, automatically resets the harness state.
131
+ * This property is typically controlled by parent components or dialog wrappers.
132
+ */
133
+ get isVisible(): boolean;
134
+ set isVisible(value: boolean);
135
+ /** Event emitted when the visibility state changes, allowing parent components to react */
136
+ visibilityChange: EventEmitter<boolean>;
137
+ /** Reference to the scrollable messages container for auto-scrolling functionality */
138
+ private messagesContainer;
139
+ /** Reference to the hidden file input element for conversation import functionality */
140
+ private fileInput;
141
+ /** Reference to the message input textarea */
142
+ private messageInput;
143
+ /** Reference to the save dialog input */
144
+ private saveDialogInput?;
145
+ /** Complete array of all messages in the current conversation session */
146
+ conversationMessages: ConversationMessage[];
147
+ /** Current text input by the user (bound to textarea) */
148
+ currentUserMessage: string;
149
+ /** Whether an agent execution is currently in progress */
150
+ isExecuting: boolean;
151
+ /** Unified variables for agent execution (combines data context and template data) */
152
+ agentVariables: DataContextVariable[];
153
+ /** Variables for prompt template rendering */
154
+ templateVariables: DataContextVariable[];
155
+ /** Selected AI model for prompt execution */
156
+ selectedModelId: string;
157
+ /** Temperature setting for prompt execution */
158
+ temperature: number;
159
+ /** Maximum tokens for prompt execution */
160
+ maxTokens: number | null;
161
+ /** Available AI models for prompt execution */
162
+ availableModels: any[];
163
+ /** Selected response format for prompt execution */
164
+ selectedResponseFormat: 'Any' | 'Text' | 'Markdown' | 'JSON' | 'ModelSpecific';
165
+ /** Available response format options */
166
+ responseFormatOptions: {
167
+ text: string;
168
+ value: string;
169
+ }[];
170
+ /** Whether the configuration sidebar is currently visible */
171
+ showSidebar: boolean;
172
+ /** Currently active tab in the sidebar */
173
+ activeTab: 'agentVariables' | 'executionMonitor' | 'templateVariables' | 'modelSettings' | 'savedConversations';
174
+ /** Array of saved conversation sessions loaded from localStorage */
175
+ savedConversations: SavedConversation[];
176
+ /** ID of the currently active/loaded conversation, if any */
177
+ currentConversationId: string | null;
178
+ /** Flag to control JSON dialog visibility */
179
+ showJsonDialog: boolean;
180
+ /** Current JSON content to display in the dialog */
181
+ currentJsonContent: string;
182
+ /** Mode for the execution monitor component */
183
+ executionMonitorMode: 'live' | 'historical';
184
+ /** Current execution data for the monitor */
185
+ currentExecutionData: any;
186
+ /** Agent conversation state tracking */
187
+ private agentConversationState;
188
+ private lastAgentReturnValue;
189
+ private subAgentHistory;
190
+ /** Whether to show the save conversation dialog */
191
+ showSaveDialog: boolean;
192
+ /** Name for the new conversation being saved */
193
+ newConversationName: string;
194
+ /** Temporary name for the dialog input to avoid binding conflicts */
195
+ tempConversationName: string;
196
+ /** Whether to show the load confirmation dialog */
197
+ showLoadConfirmDialog: boolean;
198
+ /** Conversation pending to be loaded */
199
+ private pendingLoadConversation;
200
+ /** Reference to the current message for JSON display */
201
+ private currentJsonMessage;
202
+ /** Subject for component destruction cleanup */
203
+ private destroy$;
204
+ /** Flag indicating that auto-scroll is needed on next view check */
205
+ private scrollNeeded;
206
+ /** Interval handle for elapsed time counter during streaming */
207
+ private elapsedTimeInterval;
208
+ /** MemberJunction metadata instance for entity operations */
209
+ private _metadata;
210
+ /** Track if input has been focused to prevent repeated focusing */
211
+ private _hasFocused;
212
+ /** Subscription to MJGlobal events for streaming updates */
213
+ private _mjGlobalEventSub;
214
+ /** Direct GraphQL subscription for agent execution streaming */
215
+ private _agentStreamSub;
216
+ /**
217
+ * Component initialization. Loads saved conversations, sets up event subscriptions,
218
+ * and initializes the harness to a clean state.
219
+ */
220
+ ngOnInit(): void;
221
+ /**
222
+ * Responds to input property changes, particularly when entity is set/changed
223
+ */
224
+ ngOnChanges(changes: SimpleChanges): void;
225
+ /**
226
+ * Component cleanup. Destroys subscriptions and clears any active intervals
227
+ * to prevent memory leaks.
228
+ */
229
+ ngOnDestroy(): void;
230
+ /**
231
+ * Post-view check hook that handles auto-scrolling to the bottom of the message container
232
+ * when new content is added.
233
+ */
234
+ ngAfterViewChecked(): void;
235
+ private subscribeToEvents;
236
+ /**
237
+ * Loads available AI models for prompt execution.
238
+ * Only called when the harness is in prompt mode.
239
+ */
240
+ private loadAvailableModels;
241
+ /**
242
+ * Resets the test harness to its initial state, clearing all conversations,
243
+ * variables, and UI state. Called automatically when the harness becomes visible.
244
+ */
245
+ resetHarness(): void;
246
+ /**
247
+ * Starts a new conversation
248
+ */
249
+ newConversation(): void;
250
+ /**
251
+ * Closes the test harness by setting visibility to false and emitting the change event.
252
+ * Used by dialog implementations and close buttons.
253
+ */
254
+ close(): void;
255
+ /**
256
+ * Toggles the visibility of the configuration sidebar.
257
+ * Allows users to show/hide the data context and conversation management panels.
258
+ */
259
+ toggleSidebar(): void;
260
+ /**
261
+ * Switches to the specified tab in the configuration sidebar.
262
+ * @param tab - The tab to activate
263
+ */
264
+ selectTab(tab: 'agentVariables' | 'executionMonitor' | 'templateVariables' | 'modelSettings' | 'savedConversations'): void;
265
+ /**
266
+ * Shows the execution history for a specific message
267
+ * @param message - The message to show execution history for
268
+ */
269
+ showMessageExecutionHistory(message: ConversationMessage): void;
270
+ /**
271
+ * Extract sub-agent nodes from execution tree
272
+ */
273
+ private extractSubAgentNodes;
274
+ /**
275
+ * Sends the current user message to the AI agent and initiates execution.
276
+ * Handles message validation, conversation updates, UI state management, and agent execution.
277
+ * Automatically clears the input field and triggers auto-scroll after sending.
278
+ *
279
+ * @example
280
+ * ```typescript
281
+ * // Called when user presses Enter or clicks Send button
282
+ * await this.sendMessage();
283
+ * ```
284
+ */
285
+ sendMessage(): Promise<void>;
286
+ private executeAgent;
287
+ private executePrompt;
288
+ private startTypingAnimation;
289
+ private buildDataContext;
290
+ private buildTemplateData;
291
+ private buildTemplateVariables;
292
+ private convertVariableValue;
293
+ /**
294
+ * Adds a new empty agent variable to the collection.
295
+ * Agent variables are passed to the agent during execution for dynamic content and template rendering.
296
+ */
297
+ addAgentVariable(): void;
298
+ /**
299
+ * Removes an agent variable at the specified index.
300
+ * @param index - Zero-based index of the variable to remove
301
+ */
302
+ removeAgentVariable(index: number): void;
303
+ /**
304
+ * Adds a new empty template variable to the collection (prompt mode only).
305
+ * Template variables are used for prompt template rendering.
306
+ */
307
+ addTemplateVariable(): void;
308
+ /**
309
+ * Removes a template variable at the specified index (prompt mode only).
310
+ * @param index - Zero-based index of the variable to remove
311
+ */
312
+ removeTemplateVariable(index: number): void;
313
+ /**
314
+ * Clears the current conversation after user confirmation.
315
+ * Resets both the message history and the current conversation ID.
316
+ */
317
+ clearConversation(): void;
318
+ private scrollToBottom;
319
+ private generateMessageId;
320
+ private loadSavedConversations;
321
+ /**
322
+ * Gets the storage key for saved conversations based on entity type and ID
323
+ */
324
+ private getStorageKey;
325
+ /**
326
+ * Saves the current conversation to localStorage with user-provided name.
327
+ * Handles both creating new conversations and updating existing ones.
328
+ * Automatically limits storage to 50 conversations to prevent excessive memory usage.
329
+ *
330
+ * @example
331
+ * ```typescript
332
+ * // User clicks save button
333
+ * this.saveConversation(); // Prompts for name and saves
334
+ * ```
335
+ */
336
+ saveConversation(): void;
337
+ updateTempConversation(): void;
338
+ /**
339
+ * Handles the save dialog confirmation
340
+ */
341
+ confirmSaveConversation(): void;
342
+ /**
343
+ * Cancels the save dialog
344
+ */
345
+ cancelSaveDialog(): void;
346
+ /**
347
+ * Saves conversations to localStorage
348
+ */
349
+ private saveConversationsToStorage;
350
+ private autoSaveConversation;
351
+ loadConversation(conversation: SavedConversation): void;
352
+ /**
353
+ * Confirms loading a conversation after dialog confirmation
354
+ */
355
+ confirmLoadConversation(): void;
356
+ /**
357
+ * Cancels loading a conversation
358
+ */
359
+ cancelLoadConversation(): void;
360
+ /**
361
+ * Actually loads the conversation
362
+ */
363
+ private doLoadConversation;
364
+ deleteConversation(conversation: SavedConversation, event: Event): Promise<void>;
365
+ exportConversation(): void;
366
+ importConversation(): void;
367
+ onFileSelected(event: Event): void;
368
+ /**
369
+ * Handles keyboard input in the message textarea.
370
+ * Sends message on Enter (without Shift) and allows multi-line input with Shift+Enter.
371
+ * @param event - Keyboard event from the textarea
372
+ */
373
+ handleKeyPress(event: KeyboardEvent): void;
374
+ /**
375
+ * Generates CSS class names for message display based on message properties.
376
+ * @param message - The conversation message to generate classes for
377
+ * @returns Space-separated CSS class string for styling
378
+ */
379
+ getMessageClass(message: ConversationMessage): string;
380
+ /**
381
+ * Formats a Date object into a user-friendly time string.
382
+ * @param date - Date object to format
383
+ * @returns Formatted time string in HH:MM format
384
+ */
385
+ formatTimestamp(date: Date): string;
386
+ /**
387
+ * Formats execution time from milliseconds into a human-readable string.
388
+ * Automatically selects appropriate units (minutes, seconds, or milliseconds).
389
+ * @param milliseconds - Execution time in milliseconds
390
+ * @returns Formatted time string (e.g., "2m 30.5s", "1.23s", "500ms")
391
+ */
392
+ formatExecutionTime(milliseconds: number): string;
393
+ formatElapsedTime(milliseconds: number): string;
394
+ private startElapsedTimeCounter;
395
+ /**
396
+ * Shows the raw JSON dialog for a specific message
397
+ * @param message - The message to show raw JSON for
398
+ */
399
+ showRawJsonDialog(message: ConversationMessage): void;
400
+ /**
401
+ * Creates a summary of the execution tree for easier viewing
402
+ * @param executionTree - The execution tree to summarize
403
+ * @returns A human-readable summary of the execution
404
+ */
405
+ private summarizeExecutionTree;
406
+ /**
407
+ * Copies the message content to clipboard.
408
+ * @param message - The message to copy
409
+ */
410
+ copyMessage(message: ConversationMessage): Promise<void>;
411
+ /**
412
+ * Focuses the message input textarea.
413
+ */
414
+ private focusMessageInput;
415
+ /**
416
+ * Determines if the provided content is valid JSON.
417
+ * @param content - String content to test
418
+ * @returns True if content can be parsed as JSON, false otherwise
419
+ */
420
+ isJsonContent(content: string): boolean;
421
+ /**
422
+ * Formats JSON content with proper indentation for display.
423
+ * @param content - JSON string to format
424
+ * @returns Formatted JSON string or original content if parsing fails
425
+ */
426
+ formatJson(content: string): string;
427
+ /**
428
+ * Automatically detects the content type of a message for appropriate rendering.
429
+ * Uses pattern matching to identify JSON, Markdown, or plain text content.
430
+ * @param content - Content string to analyze
431
+ * @returns Detected content type ('markdown', 'json', or 'text')
432
+ */
433
+ detectContentType(content: string): 'markdown' | 'json' | 'text';
434
+ renderMarkdown(content: string): SafeHtml;
435
+ getFormattedContent(message: ConversationMessage): SafeHtml;
436
+ /**
437
+ * Renders JSON content using an inline code editor component
438
+ */
439
+ private renderJsonWithCodeEditor;
440
+ /**
441
+ * Escapes HTML content for use in attributes
442
+ */
443
+ private escapeHtmlAttribute;
444
+ /**
445
+ * Renders JSON content with human-readable content prominently displayed
446
+ * and raw JSON in a collapsible section below with proper text wrapping.
447
+ */
448
+ /**
449
+ * Gets a summary of the execution for tooltip display
450
+ * @param message - The message to get execution summary for
451
+ * @returns A brief summary of the execution steps
452
+ */
453
+ getExecutionSummary(message: ConversationMessage): string;
454
+ /**
455
+ * Closes the JSON dialog
456
+ */
457
+ closeJsonDialog(): void;
458
+ /**
459
+ * Copies the JSON content to clipboard
460
+ */
461
+ copyJsonContent(): void;
462
+ /**
463
+ * Extracts human-readable content from JSON responses.
464
+ * Prioritizes userMessage field first, then checks other common fields.
465
+ * @param jsonStr - JSON string to extract content from
466
+ * @returns Extracted human-readable content or null if none found
467
+ */
468
+ private extractHumanReadableContent;
469
+ /**
470
+ * Checks if a message contains JSON content that has extractable human-readable content.
471
+ * Used to determine if the raw toggle should be shown.
472
+ * @param message - The conversation message to check
473
+ * @returns True if the message has extractable content different from raw JSON
474
+ */
475
+ hasExtractableContent(message: ConversationMessage): boolean;
476
+ /**
477
+ * Determines whether to show the raw toggle button for a message.
478
+ * Combines the logic for raw content availability and extractable content.
479
+ * @param message - The conversation message to check
480
+ * @returns True if the raw toggle should be displayed
481
+ */
482
+ showRawToggle(message: ConversationMessage): boolean;
483
+ private escapeHtml;
484
+ /**
485
+ * Formats JSON for proper display with text wrapping instead of wide code blocks.
486
+ * Creates a structured, readable format that respects container width.
487
+ */
488
+ private formatJsonForDisplay;
489
+ /**
490
+ * Creates formatted HTML for JSON display with proper indentation and wrapping.
491
+ */
492
+ private createJsonDisplayHtml;
493
+ /**
494
+ * Type guard to check if entity is an AI Agent
495
+ */
496
+ private isAgentEntity;
497
+ /**
498
+ * Type guard to check if entity is an AI Prompt
499
+ */
500
+ private isPromptEntity;
501
+ /**
502
+ * Gets the display name of the current entity
503
+ */
504
+ getEntityName(): string;
505
+ static ɵfac: i0.ɵɵFactoryDeclaration<AITestHarnessComponent, never>;
506
+ static ɵcmp: i0.ɵɵComponentDeclaration<AITestHarnessComponent, "mj-ai-test-harness", never, { "mode": { "alias": "mode"; "required": false; }; "entity": { "alias": "entity"; "required": false; }; "aiAgent": { "alias": "aiAgent"; "required": false; }; "isVisible": { "alias": "isVisible"; "required": false; }; }, { "visibilityChange": "visibilityChange"; }, never, never, false, never>;
507
+ }
508
+ //# sourceMappingURL=ai-test-harness.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai-test-harness.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/custom/AIAgents/ai-test-harness.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAyB,gBAAgB,EAAmB,MAAM,eAAe,CAAC;AAC9K,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAEnE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAI9E,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;;AAIjD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,QAAQ,CAAC;AAQjD;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAChC,wDAAwD;I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