@memberjunction/ng-core-entity-forms 6.1.0-edge.4 → 6.1.0-edge.5
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/ai-agent-run/agent-run-step-order.d.ts +27 -0
- package/dist/lib/custom/ai-agent-run/agent-run-step-order.d.ts.map +1 -0
- package/dist/lib/custom/ai-agent-run/agent-run-step-order.js +41 -0
- package/dist/lib/custom/ai-agent-run/agent-run-step-order.js.map +1 -0
- package/dist/lib/custom/ai-agent-run/ai-agent-run-analytics.component.d.ts +7 -2
- package/dist/lib/custom/ai-agent-run/ai-agent-run-analytics.component.d.ts.map +1 -1
- package/dist/lib/custom/ai-agent-run/ai-agent-run-analytics.component.js +39 -12
- package/dist/lib/custom/ai-agent-run/ai-agent-run-analytics.component.js.map +1 -1
- package/dist/lib/custom/ai-agent-run/ai-agent-run-data.service.d.ts.map +1 -1
- package/dist/lib/custom/ai-agent-run/ai-agent-run-data.service.js +9 -4
- package/dist/lib/custom/ai-agent-run/ai-agent-run-data.service.js.map +1 -1
- package/dist/lib/custom/ai-agent-run/ai-agent-run-timeline.component.d.ts.map +1 -1
- package/dist/lib/custom/ai-agent-run/ai-agent-run-timeline.component.js +9 -4
- package/dist/lib/custom/ai-agent-run/ai-agent-run-timeline.component.js.map +1 -1
- package/dist/lib/generated/Entities/MJAIModelCost/mjaimodelcost.form.component.js +6 -8
- package/dist/lib/generated/Entities/MJAIModelCost/mjaimodelcost.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/MJAIModelPriceUnitType/mjaimodelpriceunittype.form.component.d.ts.map +1 -1
- package/dist/lib/generated/Entities/MJAIModelPriceUnitType/mjaimodelpriceunittype.form.component.js +20 -10
- package/dist/lib/generated/Entities/MJAIModelPriceUnitType/mjaimodelpriceunittype.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/MJAIPromptRun/mjaipromptrun.form.component.d.ts.map +1 -1
- package/dist/lib/generated/Entities/MJAIPromptRun/mjaipromptrun.form.component.js +80 -68
- package/dist/lib/generated/Entities/MJAIPromptRun/mjaipromptrun.form.component.js.map +1 -1
- package/dist/lib/generated/Entities/MJAIUsageType/mjaiusagetype.form.component.d.ts +10 -0
- package/dist/lib/generated/Entities/MJAIUsageType/mjaiusagetype.form.component.d.ts.map +1 -0
- package/dist/lib/generated/Entities/MJAIUsageType/mjaiusagetype.form.component.js +95 -0
- package/dist/lib/generated/Entities/MJAIUsageType/mjaiusagetype.form.component.js.map +1 -0
- package/dist/lib/generated/generated-forms.module.d.ts +322 -321
- package/dist/lib/generated/generated-forms.module.d.ts.map +1 -1
- package/dist/lib/generated/generated-forms.module.js +83 -80
- package/dist/lib/generated/generated-forms.module.js.map +1 -1
- package/package.json +41 -41
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-agent-run-data.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/custom/ai-agent-run/ai-agent-run-data.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,UAAU,EAAE,MAAM,MAAM,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAqB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"ai-agent-run-data.service.d.ts","sourceRoot":"","sources":["../../../../src/lib/custom/ai-agent-run/ai-agent-run-data.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,UAAU,EAAE,MAAM,MAAM,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAqB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAG5I,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAChC,OAAO,EAAE,kBAAkB,EAAE,CAA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AgB;IAQxB;;OAEG;IACH,aAAa;;;;;;IASb;;OAEG;IACH,cAAc,IAAI,YAAY;CAQ/B"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BehaviorSubject } from 'rxjs';
|
|
2
2
|
import { Metadata, RunView } from '@memberjunction/core';
|
|
3
|
+
import { SortAgentRunStepsByExecutionOrder } from './agent-run-step-order';
|
|
3
4
|
/**
|
|
4
5
|
* Helper class for managing AI Agent Run data per component instance
|
|
5
6
|
* No longer a singleton Angular service - instantiated per component
|
|
@@ -71,15 +72,19 @@ export class AIAgentRunDataHelper {
|
|
|
71
72
|
async loadStepsAndSubRuns(agentRunId) {
|
|
72
73
|
const rv = RunView.FromMetadataProvider(this.Provider);
|
|
73
74
|
// First, get all steps to determine what additional data we need
|
|
75
|
+
// StartedAt is execution time (what the timeline paints). __mj_CreatedAt is persist time
|
|
76
|
+
// and inverts for fast sibling steps whose fire-and-forget INSERTs race. StepNumber is
|
|
77
|
+
// the same-millisecond tie-break. Client-sort after the query as well — T-SQL NULLs
|
|
78
|
+
// sort first, and SQL datetime rounding can still disagree with JS Date.getTime().
|
|
74
79
|
const stepsResult = await rv.RunView({
|
|
75
80
|
EntityName: 'MJ: AI Agent Run Steps',
|
|
76
81
|
ExtraFilter: `AgentRunID='${agentRunId}'`,
|
|
77
|
-
OrderBy: '
|
|
82
|
+
OrderBy: 'StartedAt, StepNumber'
|
|
78
83
|
});
|
|
79
84
|
if (!stepsResult.Success) {
|
|
80
85
|
throw new Error('Failed to load agent run steps');
|
|
81
86
|
}
|
|
82
|
-
const steps = stepsResult.Results || [];
|
|
87
|
+
const steps = SortAgentRunStepsByExecutionOrder(stepsResult.Results || []);
|
|
83
88
|
// Build filters for batch loading
|
|
84
89
|
const actionLogIds = steps
|
|
85
90
|
.filter(s => s.StepType === 'Actions' && s.TargetLogID)
|
|
@@ -170,12 +175,12 @@ export class AIAgentRunDataHelper {
|
|
|
170
175
|
const stepsResult = await rv.RunView({
|
|
171
176
|
EntityName: 'MJ: AI Agent Run Steps',
|
|
172
177
|
ExtraFilter: `AgentRunID = '${subAgentRunId}'`,
|
|
173
|
-
OrderBy: '
|
|
178
|
+
OrderBy: 'StartedAt, StepNumber'
|
|
174
179
|
});
|
|
175
180
|
if (!stepsResult.Success || !stepsResult.Results) {
|
|
176
181
|
return { steps: [], promptRuns: [] };
|
|
177
182
|
}
|
|
178
|
-
const steps = stepsResult.Results;
|
|
183
|
+
const steps = SortAgentRunStepsByExecutionOrder(stepsResult.Results);
|
|
179
184
|
// Get prompt run IDs
|
|
180
185
|
const promptRunIds = steps
|
|
181
186
|
.filter(s => s.StepType === 'Prompt' && s.TargetLogID)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-agent-run-data.service.js","sourceRoot":"","sources":["../../../../src/lib/custom/ai-agent-run/ai-agent-run-data.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAc,MAAM,MAAM,CAAC;AACnD,OAAO,EAAqB,QAAQ,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAU5E;;;GAGG;AACH,MAAM,OAAO,oBAAoB;IAuC/B,IAAW,QAAQ,CAAC,KAA+B;QAC/C,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;IAC3B,CAAC;IAED,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,IAAI,QAAQ,CAAC,QAAQ,CAAC;IAC/C,CAAC;IAED;QA9CA,gBAAgB;QACR,kBAAa,GAAG,IAAI,eAAe,CAA2B,EAAE,CAAC,CAAC;QAClE,oBAAe,GAAG,IAAI,eAAe,CAAuB,EAAE,CAAC,CAAC;QAChE,uBAAkB,GAAG,IAAI,eAAe,CAA+B,EAAE,CAAC,CAAC;QAC3E,uBAAkB,GAAG,IAAI,eAAe,CAAwB,EAAE,CAAC,CAAC;QACpE,oBAAe,GAAG,IAAI,eAAe,CAAU,IAAI,CAAC,CAAC;QACrD,kBAAa,GAAG,IAAI,eAAe,CAAgB,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O;YACL,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,IAAI;YACjC,OAAO,EAAE,IAAI,CAAC,cAAc;YAC5B,KAAK,EAAE,IAAI,CAAC,YAAY;YACxB,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC,gBAAgB,CAAC;SACxC,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,KAAK;YAC/B,OAAO,EAAE,IAAI,CAAC,eAAe,CAAC,KAAK;YACnC,UAAU,EAAE,IAAI,CAAC,kBAAkB,CAAC,KAAK;YACzC,UAAU,EAAE,IAAI,CAAC,kBAAkB,CAAC,KAAK;SAC1C,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { BehaviorSubject, Observable } from 'rxjs';\nimport { IMetadataProvider, Metadata, RunView } from '@memberjunction/core';\nimport { MJAIAgentRunEntity, MJAIAgentRunStepEntity, MJActionExecutionLogEntity, MJAIPromptRunEntity } from '@memberjunction/core-entities';\n\nexport interface AgentRunData {\n steps: MJAIAgentRunStepEntity[];\n subRuns: MJAIAgentRunEntity[];\n actionLogs: MJActionExecutionLogEntity[];\n promptRuns: MJAIPromptRunEntity[];\n}\n\n/**\n * Helper class for managing AI Agent Run data per component instance\n * No longer a singleton Angular service - instantiated per component\n */\nexport class AIAgentRunDataHelper {\n // Data subjects\n private stepsSubject$ = new BehaviorSubject<MJAIAgentRunStepEntity[]>([]);\n private subRunsSubject$ = new BehaviorSubject<MJAIAgentRunEntity[]>([]);\n private actionLogsSubject$ = new BehaviorSubject<MJActionExecutionLogEntity[]>([]);\n private promptRunsSubject$ = new BehaviorSubject<MJAIPromptRunEntity[]>([]);\n private loadingSubject$ = new BehaviorSubject<boolean>(true);\n private errorSubject$ = new BehaviorSubject<string | null>(null);\n \n // Public observables\n steps$ = this.stepsSubject$.asObservable();\n subRuns$ = this.subRunsSubject$.asObservable();\n actionLogs$ = this.actionLogsSubject$.asObservable();\n promptRuns$ = this.promptRunsSubject$.asObservable();\n loading$ = this.loadingSubject$.asObservable();\n error$ = this.errorSubject$.asObservable();\n \n // Cache for sub-agent data with size limit\n private readonly MAX_CACHE_SIZE = 100; // Maximum 100 sub-agent entries\n private readonly CACHE_TTL_MS = 15 * 60 * 1000; // 15 minute TTL\n \n private subAgentDataCache = new Map<string, {\n steps: MJAIAgentRunStepEntity[];\n promptRuns: MJAIPromptRunEntity[];\n timestamp: number;\n }>();\n \n // Track cache access order for LRU eviction\n private cacheAccessOrder: string[] = [];\n \n private currentAgentRunId: string | null = null;\n\n /**\n * Optional explicit metadata provider. Set via `setProvider()` by the\n * owning component (which has provider context via BaseAngularComponent).\n * Falls back to `Metadata.Provider` when not set.\n */\n private _provider: IMetadataProvider | null = null;\n\n public set Provider(value: IMetadataProvider | null) {\n this._provider = value;\n }\n\n public get Provider(): IMetadataProvider {\n return this._provider ?? Metadata.Provider;\n }\n\n constructor() {}\n \n /**\n * Load all data for an agent run\n */\n async loadAgentRunData(agentRunId: string, forceReload = false): Promise<void> {\n if (!agentRunId) {\n this.errorSubject$.next('No agent run ID provided');\n return;\n }\n \n // Skip cache check when force reloading\n if (!forceReload && this.currentAgentRunId === agentRunId && this.stepsSubject$.value.length > 0) {\n return;\n }\n \n this.currentAgentRunId = agentRunId;\n this.loadingSubject$.next(true);\n this.errorSubject$.next(null);\n \n // Clear cache when loading new run\n this.subAgentDataCache.clear();\n \n try {\n await this.loadStepsAndSubRuns(agentRunId);\n } catch (error) {\n this.errorSubject$.next('Failed to load agent run data');\n console.error('Error loading agent run data:', error);\n } finally {\n this.loadingSubject$.next(false);\n }\n }\n \n private async loadStepsAndSubRuns(agentRunId: string) {\n const rv = RunView.FromMetadataProvider(this.Provider);\n \n // First, get all steps to determine what additional data we need\n const stepsResult = await rv.RunView<MJAIAgentRunStepEntity>({\n EntityName: 'MJ: AI Agent Run Steps',\n ExtraFilter: `AgentRunID='${agentRunId}'`,\n OrderBy: '__mj_CreatedAt, StepNumber'\n });\n \n if (!stepsResult.Success) {\n throw new Error('Failed to load agent run steps');\n }\n \n const steps = stepsResult.Results as MJAIAgentRunStepEntity[] || [];\n \n // Build filters for batch loading\n const actionLogIds = steps\n .filter(s => s.StepType === 'Actions' && s.TargetLogID)\n .map(s => s.TargetLogID)\n .filter(id => id != null);\n \n const promptRunIds = steps\n .filter(s => s.StepType === 'Prompt' && s.TargetLogID)\n .map(s => s.TargetLogID)\n .filter(id => id != null);\n \n // Build batch queries array\n const batchQueries: any[] = [\n // Sub-runs query\n {\n EntityName: 'MJ: AI Agent Runs',\n ExtraFilter: `ParentRunID='${agentRunId}'`,\n OrderBy: 'StartedAt'\n },\n // Current run query\n {\n EntityName: 'MJ: AI Agent Runs',\n ExtraFilter: `ID='${agentRunId}'`\n }\n ];\n \n // Add action logs query if needed\n if (actionLogIds.length > 0) {\n batchQueries.push({\n EntityName: 'MJ: Action Execution Logs',\n ExtraFilter: `ID IN ('${actionLogIds.join(\"','\")}')`,\n OrderBy: 'StartedAt'\n });\n }\n \n // Add prompt runs query if needed\n if (promptRunIds.length > 0) {\n batchQueries.push({\n EntityName: 'MJ: AI Prompt Runs',\n ExtraFilter: `ID IN ('${promptRunIds.join(\"','\")}')`,\n OrderBy: '__mj_CreatedAt'\n });\n }\n \n // Execute all queries in one batch\n const batchResults = await rv.RunViews(batchQueries);\n \n // Process results\n let resultIndex = 0;\n \n // Sub-runs\n const subRuns = batchResults[resultIndex].Success \n ? (batchResults[resultIndex].Results as MJAIAgentRunEntity[] || [])\n : [];\n resultIndex++;\n \n // Skip current run result\n resultIndex++;\n \n // Action logs\n const actionLogs = actionLogIds.length > 0 && batchResults[resultIndex]?.Success\n ? (batchResults[resultIndex].Results as MJActionExecutionLogEntity[] || [])\n : [];\n if (actionLogIds.length > 0) resultIndex++;\n \n // Prompt runs\n const promptRuns = promptRunIds.length > 0 && batchResults[resultIndex]?.Success\n ? (batchResults[resultIndex].Results as MJAIPromptRunEntity[] || [])\n : [];\n \n // Update all subjects\n this.stepsSubject$.next(steps);\n this.subRunsSubject$.next(subRuns);\n this.actionLogsSubject$.next(actionLogs);\n this.promptRunsSubject$.next(promptRuns);\n }\n \n /**\n * Load sub-agent data (for expanding sub-agent nodes)\n */\n async loadSubAgentData(subAgentRunId: string): Promise<{ steps: MJAIAgentRunStepEntity[], promptRuns: MJAIPromptRunEntity[] }> {\n // Check cache first\n const cachedData = this.subAgentDataCache.get(subAgentRunId);\n if (cachedData) {\n // Check if cache is still valid\n const now = Date.now();\n if (now - cachedData.timestamp < this.CACHE_TTL_MS) {\n // Update access order for LRU\n this.updateCacheAccessOrder(subAgentRunId);\n return { steps: cachedData.steps, promptRuns: cachedData.promptRuns };\n } else {\n // Cache expired, remove it\n this.removeCacheEntry(subAgentRunId);\n }\n }\n \n const rv = RunView.FromMetadataProvider(this.Provider);\n\n // Load steps first to determine what else we need\n const stepsResult = await rv.RunView<MJAIAgentRunStepEntity>({\n EntityName: 'MJ: AI Agent Run Steps',\n ExtraFilter: `AgentRunID = '${subAgentRunId}'`,\n OrderBy: '__mj_CreatedAt, StepNumber'\n });\n \n if (!stepsResult.Success || !stepsResult.Results) {\n return { steps: [], promptRuns: [] };\n }\n \n const steps = stepsResult.Results;\n \n // Get prompt run IDs\n const promptRunIds = steps\n .filter(s => s.StepType === 'Prompt' && s.TargetLogID)\n .map(s => s.TargetLogID)\n .filter(id => id != null);\n \n let promptRuns: MJAIPromptRunEntity[] = [];\n \n // Load prompt runs if needed\n if (promptRunIds.length > 0) {\n const promptResult = await rv.RunView<MJAIPromptRunEntity>({\n EntityName: 'MJ: AI Prompt Runs',\n ExtraFilter: `ID IN ('${promptRunIds.join(\"','\")}')`,\n OrderBy: '__mj_CreatedAt'\n });\n \n if (promptResult.Success) {\n promptRuns = promptResult.Results || [];\n }\n }\n \n // Cache the data with timestamp\n const data = { steps, promptRuns, timestamp: Date.now() };\n \n // Enforce cache size limit\n if (this.subAgentDataCache.size >= this.MAX_CACHE_SIZE) {\n // Remove least recently used entry\n const lruKey = this.cacheAccessOrder[0];\n if (lruKey && lruKey !== subAgentRunId) {\n this.removeCacheEntry(lruKey);\n }\n }\n \n this.subAgentDataCache.set(subAgentRunId, data);\n this.updateCacheAccessOrder(subAgentRunId);\n \n return data;\n }\n \n /**\n * Clear all data\n */\n clearData() {\n this.stepsSubject$.next([]);\n this.subRunsSubject$.next([]);\n this.actionLogsSubject$.next([]);\n this.promptRunsSubject$.next([]);\n this.clearCache();\n this.currentAgentRunId = null;\n }\n \n /**\n * Clear just the cache for the current agent run\n */\n clearCurrentRunCache() {\n // Clear all cache entries related to current run\n if (this.currentAgentRunId) {\n const keysToRemove: string[] = [];\n for (const [key, value] of this.subAgentDataCache.entries()) {\n // You might want to add logic here to identify related entries\n keysToRemove.push(key);\n }\n keysToRemove.forEach(key => this.removeCacheEntry(key));\n }\n }\n \n /**\n * Clear entire cache\n */\n private clearCache() {\n this.subAgentDataCache.clear();\n this.cacheAccessOrder = [];\n }\n \n /**\n * Update cache access order for LRU eviction\n */\n private updateCacheAccessOrder(key: string) {\n const index = this.cacheAccessOrder.indexOf(key);\n if (index > -1) {\n this.cacheAccessOrder.splice(index, 1);\n }\n this.cacheAccessOrder.push(key);\n }\n \n /**\n * Remove a cache entry\n */\n private removeCacheEntry(key: string) {\n this.subAgentDataCache.delete(key);\n const index = this.cacheAccessOrder.indexOf(key);\n if (index > -1) {\n this.cacheAccessOrder.splice(index, 1);\n }\n }\n \n /**\n * Get cache statistics for monitoring\n */\n getCacheStats() {\n return {\n size: this.subAgentDataCache.size,\n maxSize: this.MAX_CACHE_SIZE,\n ttlMs: this.CACHE_TTL_MS,\n accessOrder: [...this.cacheAccessOrder]\n };\n }\n \n /**\n * Get current data snapshot\n */\n getCurrentData(): AgentRunData {\n return {\n steps: this.stepsSubject$.value,\n subRuns: this.subRunsSubject$.value,\n actionLogs: this.actionLogsSubject$.value,\n promptRuns: this.promptRunsSubject$.value\n };\n }\n}"]}
|
|
1
|
+
{"version":3,"file":"ai-agent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AC,eAAe,CAAC,KAAK;YACnC,UAAU,EAAE,IAAI,CAAC,kBAAkB,CAAC,KAAK;YACzC,UAAU,EAAE,IAAI,CAAC,kBAAkB,CAAC,KAAK;SAC1C,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { BehaviorSubject, Observable } from 'rxjs';\nimport { IMetadataProvider, Metadata, RunView } from '@memberjunction/core';\nimport { MJAIAgentRunEntity, MJAIAgentRunStepEntity, MJActionExecutionLogEntity, MJAIPromptRunEntity } from '@memberjunction/core-entities';\nimport { SortAgentRunStepsByExecutionOrder } from './agent-run-step-order';\n\nexport interface AgentRunData {\n steps: MJAIAgentRunStepEntity[];\n subRuns: MJAIAgentRunEntity[];\n actionLogs: MJActionExecutionLogEntity[];\n promptRuns: MJAIPromptRunEntity[];\n}\n\n/**\n * Helper class for managing AI Agent Run data per component instance\n * No longer a singleton Angular service - instantiated per component\n */\nexport class AIAgentRunDataHelper {\n // Data subjects\n private stepsSubject$ = new BehaviorSubject<MJAIAgentRunStepEntity[]>([]);\n private subRunsSubject$ = new BehaviorSubject<MJAIAgentRunEntity[]>([]);\n private actionLogsSubject$ = new BehaviorSubject<MJActionExecutionLogEntity[]>([]);\n private promptRunsSubject$ = new BehaviorSubject<MJAIPromptRunEntity[]>([]);\n private loadingSubject$ = new BehaviorSubject<boolean>(true);\n private errorSubject$ = new BehaviorSubject<string | null>(null);\n \n // Public observables\n steps$ = this.stepsSubject$.asObservable();\n subRuns$ = this.subRunsSubject$.asObservable();\n actionLogs$ = this.actionLogsSubject$.asObservable();\n promptRuns$ = this.promptRunsSubject$.asObservable();\n loading$ = this.loadingSubject$.asObservable();\n error$ = this.errorSubject$.asObservable();\n \n // Cache for sub-agent data with size limit\n private readonly MAX_CACHE_SIZE = 100; // Maximum 100 sub-agent entries\n private readonly CACHE_TTL_MS = 15 * 60 * 1000; // 15 minute TTL\n \n private subAgentDataCache = new Map<string, {\n steps: MJAIAgentRunStepEntity[];\n promptRuns: MJAIPromptRunEntity[];\n timestamp: number;\n }>();\n \n // Track cache access order for LRU eviction\n private cacheAccessOrder: string[] = [];\n \n private currentAgentRunId: string | null = null;\n\n /**\n * Optional explicit metadata provider. Set via `setProvider()` by the\n * owning component (which has provider context via BaseAngularComponent).\n * Falls back to `Metadata.Provider` when not set.\n */\n private _provider: IMetadataProvider | null = null;\n\n public set Provider(value: IMetadataProvider | null) {\n this._provider = value;\n }\n\n public get Provider(): IMetadataProvider {\n return this._provider ?? Metadata.Provider;\n }\n\n constructor() {}\n \n /**\n * Load all data for an agent run\n */\n async loadAgentRunData(agentRunId: string, forceReload = false): Promise<void> {\n if (!agentRunId) {\n this.errorSubject$.next('No agent run ID provided');\n return;\n }\n \n // Skip cache check when force reloading\n if (!forceReload && this.currentAgentRunId === agentRunId && this.stepsSubject$.value.length > 0) {\n return;\n }\n \n this.currentAgentRunId = agentRunId;\n this.loadingSubject$.next(true);\n this.errorSubject$.next(null);\n \n // Clear cache when loading new run\n this.subAgentDataCache.clear();\n \n try {\n await this.loadStepsAndSubRuns(agentRunId);\n } catch (error) {\n this.errorSubject$.next('Failed to load agent run data');\n console.error('Error loading agent run data:', error);\n } finally {\n this.loadingSubject$.next(false);\n }\n }\n \n private async loadStepsAndSubRuns(agentRunId: string) {\n const rv = RunView.FromMetadataProvider(this.Provider);\n \n // First, get all steps to determine what additional data we need\n // StartedAt is execution time (what the timeline paints). __mj_CreatedAt is persist time\n // and inverts for fast sibling steps whose fire-and-forget INSERTs race. StepNumber is\n // the same-millisecond tie-break. Client-sort after the query as well — T-SQL NULLs\n // sort first, and SQL datetime rounding can still disagree with JS Date.getTime().\n const stepsResult = await rv.RunView<MJAIAgentRunStepEntity>({\n EntityName: 'MJ: AI Agent Run Steps',\n ExtraFilter: `AgentRunID='${agentRunId}'`,\n OrderBy: 'StartedAt, StepNumber'\n });\n \n if (!stepsResult.Success) {\n throw new Error('Failed to load agent run steps');\n }\n \n const steps = SortAgentRunStepsByExecutionOrder(stepsResult.Results as MJAIAgentRunStepEntity[] || []);\n \n // Build filters for batch loading\n const actionLogIds = steps\n .filter(s => s.StepType === 'Actions' && s.TargetLogID)\n .map(s => s.TargetLogID)\n .filter(id => id != null);\n \n const promptRunIds = steps\n .filter(s => s.StepType === 'Prompt' && s.TargetLogID)\n .map(s => s.TargetLogID)\n .filter(id => id != null);\n \n // Build batch queries array\n const batchQueries: any[] = [\n // Sub-runs query\n {\n EntityName: 'MJ: AI Agent Runs',\n ExtraFilter: `ParentRunID='${agentRunId}'`,\n OrderBy: 'StartedAt'\n },\n // Current run query\n {\n EntityName: 'MJ: AI Agent Runs',\n ExtraFilter: `ID='${agentRunId}'`\n }\n ];\n \n // Add action logs query if needed\n if (actionLogIds.length > 0) {\n batchQueries.push({\n EntityName: 'MJ: Action Execution Logs',\n ExtraFilter: `ID IN ('${actionLogIds.join(\"','\")}')`,\n OrderBy: 'StartedAt'\n });\n }\n \n // Add prompt runs query if needed\n if (promptRunIds.length > 0) {\n batchQueries.push({\n EntityName: 'MJ: AI Prompt Runs',\n ExtraFilter: `ID IN ('${promptRunIds.join(\"','\")}')`,\n OrderBy: '__mj_CreatedAt'\n });\n }\n \n // Execute all queries in one batch\n const batchResults = await rv.RunViews(batchQueries);\n \n // Process results\n let resultIndex = 0;\n \n // Sub-runs\n const subRuns = batchResults[resultIndex].Success \n ? (batchResults[resultIndex].Results as MJAIAgentRunEntity[] || [])\n : [];\n resultIndex++;\n \n // Skip current run result\n resultIndex++;\n \n // Action logs\n const actionLogs = actionLogIds.length > 0 && batchResults[resultIndex]?.Success\n ? (batchResults[resultIndex].Results as MJActionExecutionLogEntity[] || [])\n : [];\n if (actionLogIds.length > 0) resultIndex++;\n \n // Prompt runs\n const promptRuns = promptRunIds.length > 0 && batchResults[resultIndex]?.Success\n ? (batchResults[resultIndex].Results as MJAIPromptRunEntity[] || [])\n : [];\n \n // Update all subjects\n this.stepsSubject$.next(steps);\n this.subRunsSubject$.next(subRuns);\n this.actionLogsSubject$.next(actionLogs);\n this.promptRunsSubject$.next(promptRuns);\n }\n \n /**\n * Load sub-agent data (for expanding sub-agent nodes)\n */\n async loadSubAgentData(subAgentRunId: string): Promise<{ steps: MJAIAgentRunStepEntity[], promptRuns: MJAIPromptRunEntity[] }> {\n // Check cache first\n const cachedData = this.subAgentDataCache.get(subAgentRunId);\n if (cachedData) {\n // Check if cache is still valid\n const now = Date.now();\n if (now - cachedData.timestamp < this.CACHE_TTL_MS) {\n // Update access order for LRU\n this.updateCacheAccessOrder(subAgentRunId);\n return { steps: cachedData.steps, promptRuns: cachedData.promptRuns };\n } else {\n // Cache expired, remove it\n this.removeCacheEntry(subAgentRunId);\n }\n }\n \n const rv = RunView.FromMetadataProvider(this.Provider);\n\n // Load steps first to determine what else we need\n const stepsResult = await rv.RunView<MJAIAgentRunStepEntity>({\n EntityName: 'MJ: AI Agent Run Steps',\n ExtraFilter: `AgentRunID = '${subAgentRunId}'`,\n OrderBy: 'StartedAt, StepNumber'\n });\n \n if (!stepsResult.Success || !stepsResult.Results) {\n return { steps: [], promptRuns: [] };\n }\n \n const steps = SortAgentRunStepsByExecutionOrder(stepsResult.Results);\n \n // Get prompt run IDs\n const promptRunIds = steps\n .filter(s => s.StepType === 'Prompt' && s.TargetLogID)\n .map(s => s.TargetLogID)\n .filter(id => id != null);\n \n let promptRuns: MJAIPromptRunEntity[] = [];\n \n // Load prompt runs if needed\n if (promptRunIds.length > 0) {\n const promptResult = await rv.RunView<MJAIPromptRunEntity>({\n EntityName: 'MJ: AI Prompt Runs',\n ExtraFilter: `ID IN ('${promptRunIds.join(\"','\")}')`,\n OrderBy: '__mj_CreatedAt'\n });\n \n if (promptResult.Success) {\n promptRuns = promptResult.Results || [];\n }\n }\n \n // Cache the data with timestamp\n const data = { steps, promptRuns, timestamp: Date.now() };\n \n // Enforce cache size limit\n if (this.subAgentDataCache.size >= this.MAX_CACHE_SIZE) {\n // Remove least recently used entry\n const lruKey = this.cacheAccessOrder[0];\n if (lruKey && lruKey !== subAgentRunId) {\n this.removeCacheEntry(lruKey);\n }\n }\n \n this.subAgentDataCache.set(subAgentRunId, data);\n this.updateCacheAccessOrder(subAgentRunId);\n \n return data;\n }\n \n /**\n * Clear all data\n */\n clearData() {\n this.stepsSubject$.next([]);\n this.subRunsSubject$.next([]);\n this.actionLogsSubject$.next([]);\n this.promptRunsSubject$.next([]);\n this.clearCache();\n this.currentAgentRunId = null;\n }\n \n /**\n * Clear just the cache for the current agent run\n */\n clearCurrentRunCache() {\n // Clear all cache entries related to current run\n if (this.currentAgentRunId) {\n const keysToRemove: string[] = [];\n for (const [key, value] of this.subAgentDataCache.entries()) {\n // You might want to add logic here to identify related entries\n keysToRemove.push(key);\n }\n keysToRemove.forEach(key => this.removeCacheEntry(key));\n }\n }\n \n /**\n * Clear entire cache\n */\n private clearCache() {\n this.subAgentDataCache.clear();\n this.cacheAccessOrder = [];\n }\n \n /**\n * Update cache access order for LRU eviction\n */\n private updateCacheAccessOrder(key: string) {\n const index = this.cacheAccessOrder.indexOf(key);\n if (index > -1) {\n this.cacheAccessOrder.splice(index, 1);\n }\n this.cacheAccessOrder.push(key);\n }\n \n /**\n * Remove a cache entry\n */\n private removeCacheEntry(key: string) {\n this.subAgentDataCache.delete(key);\n const index = this.cacheAccessOrder.indexOf(key);\n if (index > -1) {\n this.cacheAccessOrder.splice(index, 1);\n }\n }\n \n /**\n * Get cache statistics for monitoring\n */\n getCacheStats() {\n return {\n size: this.subAgentDataCache.size,\n maxSize: this.MAX_CACHE_SIZE,\n ttlMs: this.CACHE_TTL_MS,\n accessOrder: [...this.cacheAccessOrder]\n };\n }\n \n /**\n * Get current data snapshot\n */\n getCurrentData(): AgentRunData {\n return {\n steps: this.stepsSubject$.value,\n subRuns: this.subRunsSubject$.value,\n actionLogs: this.actionLogsSubject$.value,\n promptRuns: this.promptRunsSubject$.value\n };\n }\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-agent-run-timeline.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/custom/ai-agent-run/ai-agent-run-timeline.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,YAAY,EAAE,MAAM,EAAE,SAAS,EAA2B,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACtI,OAAO,EAAW,UAAU,EAAkC,MAAM,MAAM,CAAC;AAE3E,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC1J,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAInE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;;
|
|
1
|
+
{"version":3,"file":"ai-agent-run-timeline.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/custom/ai-agent-run/ai-agent-run-timeline.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,YAAY,EAAE,MAAM,EAAE,SAAS,EAA2B,iBAAiB,EAAE,MAAM,eAAe,CAAC;AACtI,OAAO,EAAW,UAAU,EAAkC,MAAM,MAAM,CAAC;AAE3E,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC1J,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAInE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;;AAa5F,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX;;;;;;OAMG;IACH,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,GAAG,MAAM,CAAC;IACrE;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,KAAK,EA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AAC;QAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI;IAW/E;;;;;;;;;;;OAWG;IACG,eAAe,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BxD,2EAA2E;IAC3E,gBAAgB,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO;IAI7C,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM;IAIxD,sBAAsB,IAAI,oBAAoB;yCA5hBnC,2BAA2B;2CAA3B,2BAA2B;CAgiBvC"}
|
|
@@ -7,6 +7,7 @@ import { UUIDsEqual } from '@memberjunction/global';
|
|
|
7
7
|
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
8
8
|
import { FindAgentRunTreeNodes } from '@memberjunction/ai-core-plus';
|
|
9
9
|
import { NormalizeStatus, ProjectRunTreeToTimeline } from './run-tree-timeline-projection';
|
|
10
|
+
import { SortAgentRunStepsByExecutionOrder } from './agent-run-step-order';
|
|
10
11
|
import { ActionEngineBase } from '@memberjunction/actions-base';
|
|
11
12
|
import * as i0 from "@angular/core";
|
|
12
13
|
const _c0 = a0 => ({ $implicit: a0 });
|
|
@@ -291,15 +292,19 @@ export class AIAgentRunTimelineComponent extends BaseAngularComponent {
|
|
|
291
292
|
return this.buildHierarchicalItems(steps, 0, promptRuns);
|
|
292
293
|
}
|
|
293
294
|
buildHierarchicalItems(steps, baseLevel, promptRuns) {
|
|
295
|
+
// Walk in execution order, not persist order. Children are pushed in this walk, so a
|
|
296
|
+
// loop's iterations and root siblings both inherit the sort. Query OrderBy is the
|
|
297
|
+
// same pair; this is the belt for a caller that handed us an unsorted array.
|
|
298
|
+
const ordered = SortAgentRunStepsByExecutionOrder(steps);
|
|
294
299
|
// Create a map of all timeline items by step ID
|
|
295
300
|
const itemMap = new Map();
|
|
296
301
|
// First pass: create all timeline items
|
|
297
|
-
|
|
302
|
+
ordered.forEach(step => {
|
|
298
303
|
const item = this.createTimelineItemFromStep(step, baseLevel, promptRuns);
|
|
299
304
|
itemMap.set(step.ID, item);
|
|
300
305
|
});
|
|
301
306
|
// Second pass: build parent-child relationships based on ParentID
|
|
302
|
-
|
|
307
|
+
ordered.forEach(step => {
|
|
303
308
|
if (step.ParentID) {
|
|
304
309
|
const parentItem = itemMap.get(step.ParentID);
|
|
305
310
|
const childItem = itemMap.get(step.ID);
|
|
@@ -317,7 +322,7 @@ export class AIAgentRunTimelineComponent extends BaseAngularComponent {
|
|
|
317
322
|
});
|
|
318
323
|
// Return only root-level items (those without a ParentID)
|
|
319
324
|
const rootItems = [];
|
|
320
|
-
|
|
325
|
+
ordered.forEach(step => {
|
|
321
326
|
if (!step.ParentID) {
|
|
322
327
|
const item = itemMap.get(step.ID);
|
|
323
328
|
if (item) {
|
|
@@ -671,5 +676,5 @@ export class AIAgentRunTimelineComponent extends BaseAngularComponent {
|
|
|
671
676
|
}], navigateToEntity: [{
|
|
672
677
|
type: Output
|
|
673
678
|
}] }); })();
|
|
674
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(AIAgentRunTimelineComponent, { className: "AIAgentRunTimelineComponent", filePath: "src/lib/custom/ai-agent-run/ai-agent-run-timeline.component.ts", lineNumber:
|
|
679
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(AIAgentRunTimelineComponent, { className: "AIAgentRunTimelineComponent", filePath: "src/lib/custom/ai-agent-run/ai-agent-run-timeline.component.ts", lineNumber: 74 }); })();
|
|
675
680
|
//# sourceMappingURL=ai-agent-run-timeline.component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-agent-run-timeline.component.js","sourceRoot":"","sources":["../../../../src/lib/custom/ai-agent-run/ai-agent-run-timeline.component.ts","../../../../src/lib/custom/ai-agent-run/ai-agent-run-timeline.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KA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C,IAAI,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC;QAC1B,CAAC;IACH,CAAC;IAED,2EAA2E;IAC3E,gBAAgB,CAAC,IAAkB;QACjC,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,aAAa,CAAC,KAAa,EAAE,IAAkB;QAC7C,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;IAED,sBAAsB;QACpB,8EAA8E;QAC9E,OAAO,IAAI,oBAAoB,EAAE,CAAC;IACpC,CAAC;4HA1hBU,2BAA2B;oEAA3B,2BAA2B;YCxExC,6FAAe;;YA4Eb,AAxEA,mGAA6C,uEAwEtC;YAOT,wGAAa;YAOb,6HAAuC;;;YA1FvC,yGAiFC;YAED,eAIC;YAJD,oCAIC;;;iFDfY,2BAA2B;cAPvC,SAAS;6BACI,KAAK,YACP,0BAA0B,mBAGnB,uBAAuB,CAAC,MAAM;;kBAG9C,KAAK;;kBAeL,KAAK;;kBAUL,KAAK;;kBACL,MAAM;;kBACN,MAAM;;kFA5BI,2BAA2B","sourcesContent":["import { Component, Input, Output, EventEmitter, OnInit, OnDestroy, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';\nimport { Subject, Observable, combineLatest, BehaviorSubject } from 'rxjs';\nimport { takeUntil, map, shareReplay, filter } from 'rxjs/operators';\nimport { MJAIAgentRunEntity, MJAIAgentRunStepEntity, MJActionExecutionLogEntity, MJAIPromptRunEntity, MJTaskEntity } from '@memberjunction/core-entities';\nimport { AIAgentRunDataHelper } from './ai-agent-run-data.service';\nimport { AIEngineBase } from '@memberjunction/ai-engine-base';\nimport { UUIDsEqual } from '@memberjunction/global';\n\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport { FindAgentRunTreeNodes, type AgentRunTreeNode } from '@memberjunction/ai-core-plus';\nimport { NormalizeStatus, ProjectRunTreeToTimeline } from './run-tree-timeline-projection';\nimport { ActionEngineBase } from '@memberjunction/actions-base';\n\n/**\n * Node kinds whose row is a LOOP, not the work inside it.\n *\n * A ForEach carries the ActionID of the action it repeats, so resolving an icon from it would draw\n * \"a Google search\" on a row that is a loop over five of them — losing the one distinction the row\n * exists to make.\n */\nconst LOOP_KINDS: ReadonlySet<string> = new Set(['ForEach', 'While']);\nexport interface TimelineItem {\n id: string;\n /**\n * What the row represents.\n *\n * `taskgraph` and `task` are dispatcher work — a graph that outlives the run that submitted it,\n * and the steps inside it. They are rendered as ordinary rows rather than as an embedded diagram,\n * and colour-coded so their provenance is visible without opening anything.\n */\n type: 'step' | 'subrun' | 'action' | 'prompt' | 'taskgraph' | 'task';\n /**\n * Where this row's work ran, when that is not obvious from its type.\n *\n * `'workflow'` means it ran on the task-graph dispatcher and outlives the agent run that\n * submitted it. Kept separate from `type` on purpose: a workflow step that runs an action IS an\n * action and should render as one — provenance styles it, it does not redefine it.\n */\n provenance?: 'workflow';\n title: string;\n subtitle: string;\n status: string;\n /**\n * When this row started, or NULL when it has not.\n *\n * Nullable on purpose. A projection that needed \"sorts last\" once filled this with the maximum\n * Date, and every unstarted row then displayed that sentinel as a real clock time — identical on\n * every row and indistinguishable from data. Ordering belongs to whatever produced the rows; a row\n * that has not run has no start time, and says so by having none.\n */\n startTime: Date | null;\n endTime?: Date;\n duration?: string;\n icon: string;\n logoUrl?: string;\n color: string;\n data: any;\n children?: TimelineItem[];\n level: number;\n parentId?: string;\n isExpanded?: boolean;\n childrenLoaded?: boolean;\n hasNoChildren?: boolean;\n}\n\n@Component({\n standalone: false,\n selector: 'mj-ai-agent-run-timeline',\n templateUrl: './ai-agent-run-timeline.component.html',\n styleUrls: ['./ai-agent-run-timeline.component.css'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class AIAgentRunTimelineComponent extends BaseAngularComponent implements OnInit, OnDestroy {\n @Input() aiAgentRunId!: string;\n\n /**\n * The run's execution tree, loaded ONCE by the form and shared with every tab.\n *\n * Received rather than fetched: three tabs need the same structure, and letting each load its own\n * issues the same recursive query three times AND lets the tabs disagree — a tab that loaded a\n * second earlier shows a different run than the one beside it.\n */\n /**\n * Setter, not a plain field: a TaskGraph step's row takes its STATUS from the graph (see\n * `graphNodeForStep`), and the tree usually arrives after the step rows have already been built.\n * Republishing rebuilds them, so a dispatched workflow stops reading Completed the moment the\n * tree says it is still running.\n */\n @Input()\n public set RunTree(value: AgentRunTreeNode | null) {\n this.runTree = value;\n this.runTree$.next(value);\n }\n public get RunTree(): AgentRunTreeNode | null {\n return this.runTree;\n }\n private runTree: AgentRunTreeNode | null = null;\n private runTree$ = new BehaviorSubject<AgentRunTreeNode | null>(null);\n @Input() dataHelper!: AIAgentRunDataHelper; // Data helper passed from parent\n @Output() itemSelected = new EventEmitter<TimelineItem>();\n @Output() navigateToEntity = new EventEmitter<{ entityName: string; recordId: string }>();\n\n private destroy$ = new Subject<void>();\n /** Resolved once the action cache is warm, so a first paint without icons can be re-rendered with them. */\n private actionsReady = false;\n /**\n * Execution-log id → action id, for the RUN-STEP path only.\n *\n * The tree path needs none of this — it carries `ActionID` outright. A run step of type `Actions`\n * still names only its log, so this map stays for that case, built from logs the data service has\n * already fetched by id.\n */\n private actionIDByLogID = new Map<string, string>();\n \n // Public observables from data helper\n steps$!: Observable<MJAIAgentRunStepEntity[]>;\n subRuns$!: Observable<MJAIAgentRunEntity[]>;\n actionLogs$!: Observable<MJActionExecutionLogEntity[]>;\n promptRuns$!: Observable<MJAIPromptRunEntity[]>;\n \n timelineItems$!: Observable<TimelineItem[]>;\n \n loading = true;\n error: string | null = null;\n selectedItem: TimelineItem | null = null;\n\n /** Graph steps currently being expanded, so a second click cannot start a second load. */\n private expandingGraphIDs = new Set<string>();\n\n constructor(\n private cdr: ChangeDetectorRef\n ) {\n super();}\n \n async ngOnInit() {\n // AIEngineBase is deferred at startup; ensure it's loaded before timeline\n // items render — getStepIconInfo / sub-agent lookups read .Agents synchronously.\n await AIEngineBase.Instance.EnsureLoaded();\n // Same reason, for the same kind of read: `resolveActionIcon` looks up `.Actions` synchronously\n // inside the projection. Cheap when another surface already warmed it, and a no-op on reload.\n try {\n await ActionEngineBase.Instance.EnsureLoaded();\n this.actionsReady = true;\n } catch {\n // An action cache that will not load costs icons, not rows — every action keeps the generic\n // glyph it had before. Never worth failing a run view over.\n this.actionsReady = false;\n }\n\n // Initialize observables from the data helper\n this.steps$ = this.dataHelper.steps$;\n this.subRuns$ = this.dataHelper.subRuns$;\n this.actionLogs$ = this.dataHelper.actionLogs$;\n this.promptRuns$ = this.dataHelper.promptRuns$;\n \n // Combine all data sources to build timeline.\n // Skip emissions where steps are empty but data is still loading —\n // the BehaviorSubjects initialise with [] so combineLatest fires\n // immediately with an empty array before the real data arrives.\n this.timelineItems$ = combineLatest([\n this.steps$,\n this.subRuns$,\n this.actionLogs$,\n this.promptRuns$,\n this.dataHelper.loading$,\n this.runTree$\n ]).pipe(\n filter(([steps, _subRuns, _actionLogs, _promptRuns, isLoading]) => {\n // While loading, suppress the empty-array emission so the\n // template keeps showing the mj-loading indicator.\n return !(isLoading && steps.length === 0);\n }),\n map(([steps, subRuns, actionLogs, promptRuns]) => {\n // Built here rather than on demand: this is where the logs arrive, and the resolver runs\n // synchronously inside the projection, which cannot await anything.\n this.actionIDByLogID = new Map(\n (actionLogs ?? [])\n .filter((log) => log.ID && log.ActionID)\n .map((log) => [log.ID.toLowerCase(), log.ActionID]),\n );\n return this.buildTimelineItems(steps, subRuns, actionLogs, promptRuns);\n }),\n shareReplay(1)\n );\n \n // Data loading is now handled by the parent component through the helper\n // Subscribe to loading state from helper\n this.dataHelper.loading$.pipe(takeUntil(this.destroy$)).subscribe(loading => {\n this.loading = loading;\n this.cdr.markForCheck();\n });\n\n this.dataHelper.error$.pipe(takeUntil(this.destroy$)).subscribe(error => {\n this.error = error;\n this.cdr.markForCheck();\n });\n }\n\n ngOnDestroy() {\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n // This method is now just for compatibility - actual loading is done by parent\n async loadData() {\n if (!this.aiAgentRunId) return;\n // The parent component should handle data loading through the helper\n return this.dataHelper.loadAgentRunData(this.aiAgentRunId);\n }\n \n private buildTimelineItems(\n steps: MJAIAgentRunStepEntity[],\n subRuns: MJAIAgentRunEntity[],\n actionLogs: MJActionExecutionLogEntity[],\n promptRuns: MJAIPromptRunEntity[]\n ): TimelineItem[] {\n return this.buildHierarchicalItems(steps, 0, promptRuns);\n }\n\n private buildHierarchicalItems(\n steps: MJAIAgentRunStepEntity[],\n baseLevel: number,\n promptRuns?: MJAIPromptRunEntity[]\n ): TimelineItem[] {\n // Create a map of all timeline items by step ID\n const itemMap = new Map<string, TimelineItem>();\n\n // First pass: create all timeline items\n steps.forEach(step => {\n const item = this.createTimelineItemFromStep(step, baseLevel, promptRuns);\n itemMap.set(step.ID, item);\n });\n\n // Second pass: build parent-child relationships based on ParentID\n steps.forEach(step => {\n if (step.ParentID) {\n const parentItem = itemMap.get(step.ParentID);\n const childItem = itemMap.get(step.ID);\n\n if (parentItem && childItem) {\n // Initialize children array if needed\n if (!parentItem.children) {\n parentItem.children = [];\n }\n\n // Set child's level based on parent's level\n childItem.level = parentItem.level + 1;\n\n // Add child to parent's children array\n parentItem.children.push(childItem);\n }\n }\n });\n\n // Return only root-level items (those without a ParentID)\n const rootItems: TimelineItem[] = [];\n steps.forEach(step => {\n if (!step.ParentID) {\n const item = itemMap.get(step.ID);\n if (item) {\n rootItems.push(item);\n }\n }\n });\n\n return rootItems;\n }\n \n /**\n * Font Awesome class for a node that runs a known action or agent, or null to keep the default.\n *\n * **Why the row kind is the wrong answer.** The same action reaches this timeline through two\n * arms of the run-tree query — as a graph Task and as a loop pass — and each arm had its own\n * generic glyph, so one Google Custom Search drew a lightning bolt and the next a paper plane.\n * What the step IS does not change with where it ran.\n *\n * **No hop.** The tree carries `ActionID` and `AgentID` directly (a task holds them as columns;\n * a pass takes them from the log it expanded from), so this is one cache read. The first version\n * of this went through the execution log and silently resolved NOTHING for graph steps, because\n * the logs it consulted are only loaded for run steps of type `Actions` — of which a dispatched\n * workflow has none.\n *\n * **Loops keep their own icon.** A ForEach carries the ActionID of the action it repeats, and\n * drawing that action's mark on the loop row would say \"this is a Google search\" about a row that\n * is a loop over five of them. The distinction the loop icon carries is worth more.\n */\n private resolveActionIcon(node: AgentRunTreeNode): string | null {\n if (LOOP_KINDS.has(node.SourceKind ?? '')) return null;\n\n if (node.ActionID) {\n const action = ActionEngineBase.Instance.Actions?.find((a) => UUIDsEqual(a.ID, node.ActionID!));\n if (action?.IconClass) return action.IconClass;\n }\n if (node.AgentID) {\n const agent = AIEngineBase.Instance.Agents?.find((a) => UUIDsEqual(a.ID, node.AgentID!));\n if (agent?.IconClass) return agent.IconClass;\n }\n return null;\n }\n\n\n\n /**\n * The graph a TaskGraph step dispatched, from the run tree.\n *\n * Null until the tree arrives (the setter above republishes then) and null for a submission that\n * produced no graph — a failed submit, where the step's own status IS the story.\n */\n private graphNodeForStep(stepID: string): AgentRunTreeNode | null {\n if (!this.runTree) return null;\n const stepNode = FindAgentRunTreeNodes(this.runTree, (n) => UUIDsEqual(n.NodeID, stepID))[0] ?? null;\n return stepNode?.Children.find((c) => c.NodeType === 'TaskGraph') ?? null;\n }\n\n private createTimelineItemFromStep(step: MJAIAgentRunStepEntity, level: number, promptRuns?: MJAIPromptRunEntity[]): TimelineItem {\n let subtitle = `Type: ${step.StepType}`;\n\n // For prompt steps, try to find the associated prompt run to get model/vendor info\n if (step.StepType === 'Prompt' && step.TargetLogID && promptRuns) {\n const promptRun = promptRuns.find(pr => UUIDsEqual(pr.ID, step.TargetLogID));\n if (promptRun) {\n subtitle = `Model: ${promptRun.Model || 'Unknown'} | Vendor: ${promptRun.Vendor || 'Unknown'}`;\n }\n }\n\n // Get icon and logoUrl based on step type\n const iconInfo = this.getStepIconInfo(step);\n\n // A dispatched workflow's row describes the WORKFLOW, not the handoff that started it. The\n // step's own status is about submission — Completed in ~300ms, correctly — and showing that\n // under a title naming the workflow is how the timeline came to report a running graph as\n // finished while the page header said \"Workflow still running\".\n const graph = step.StepType === 'TaskGraph' ? this.graphNodeForStep(step.ID) : null;\n if (graph) {\n subtitle = `${subtitle} · dispatched in ${this.calculateDuration(step.StartedAt, step.CompletedAt)}`;\n }\n\n return {\n id: step.ID,\n type: 'step',\n title: step.StepName || `Step ${step.StepNumber}`,\n subtitle: subtitle,\n status: graph ? NormalizeStatus(graph.Status) : step.Status,\n startTime: step.StartedAt,\n endTime: (graph ? graph.CompletedAt : step.CompletedAt) || undefined,\n // A graph that has not started yet has no duration of its own — the submission's stands in,\n // and the subtitle says which it is either way.\n duration: graph?.StartedAt\n ? this.calculateDuration(graph.StartedAt, graph.CompletedAt)\n : this.calculateDuration(step.StartedAt, step.CompletedAt),\n icon: iconInfo.icon,\n logoUrl: iconInfo.logoUrl,\n color: this.getStatusColor(graph ? NormalizeStatus(graph.Status) : step.Status),\n data: step,\n children: [],\n level,\n isExpanded: false\n };\n }\n \n\n private getStepIconInfo(step: MJAIAgentRunStepEntity): { icon: string; logoUrl?: string } {\n // For sub-agents, try to get agent-specific icon/logo\n if (step.StepType === 'Sub-Agent' && step.TargetID) {\n const agent = AIEngineBase.Instance.Agents.find(a => UUIDsEqual(a.ID, step.TargetID));\n if (agent) {\n // Prefer LogoURL - if present, use it with robot as fallback icon (icon won't be shown when logoUrl exists)\n if (agent.LogoURL) {\n return { icon: 'fa-robot', logoUrl: agent.LogoURL };\n }\n // Next preference: IconClass from agent metadata\n else if (agent.IconClass) {\n return { icon: agent.IconClass };\n }\n // Agent exists but has no custom icon or logo - use default robot icon\n else {\n return { icon: 'fa-robot' };\n }\n }\n }\n\n // An action step draws its OWN action's icon, exactly as a sub-agent step draws its agent's —\n // the two cases are the same idea, and only one of them was implemented. `TargetLogID` names\n // the execution log this run already loaded; that log names the action, whose IconClass is in\n // ActionEngineBase's cache. A step whose action cannot be resolved (an action with no icon, a\n // cache that did not load) falls through to the step-type default below, which is the same\n // lightning bolt it drew before.\n if (step.StepType === 'Actions' && step.TargetLogID) {\n const actionID = this.actionIDByLogID.get(step.TargetLogID.toLowerCase());\n const action = actionID\n ? ActionEngineBase.Instance.Actions?.find((a) => UUIDsEqual(a.ID, actionID))\n : undefined;\n if (action?.IconClass) return { icon: action.IconClass };\n }\n\n // Default icons for each step type (includes fa-robot for sub-agents without agent metadata)\n const icon = this.getStepIcon(step.StepType);\n return { icon };\n }\n\n private getStepIcon(stepType: string): string {\n const iconMap: Record<string, string> = {\n 'Prompt': 'fa-brain',\n 'Tool': 'fa-tools',\n 'Sub-Agent': 'fa-robot',\n 'Decision': 'fa-code-branch',\n 'Actions': 'fa-wrench',\n 'Validation': 'fa-square-check',\n 'ForEach': 'fa-repeat',\n 'While': 'fa-rotate',\n 'Skill': 'fa-wand-magic-sparkles',\n 'Plan': 'fa-clipboard-check'\n };\n return iconMap[stepType] || 'fa-circle';\n }\n \n private getStatusColor(status: string): string {\n const colorMap: Record<string, string> = {\n 'Running': 'info',\n 'Completed': 'success',\n 'Failed': 'error',\n 'Cancelled': 'warning',\n 'Paused': 'secondary'\n };\n return colorMap[status] || 'secondary';\n }\n \n calculateDuration(start: Date, end?: Date | null): string {\n if (!end) return 'Running...';\n \n const startTime = new Date(start).getTime();\n const endTime = new Date(end).getTime();\n const duration = endTime - startTime;\n \n if (duration < 1000) return `${duration}ms`;\n if (duration < 60000) return `${(duration / 1000).toFixed(1)}s`;\n if (duration < 3600000) return `${Math.floor(duration / 60000)}m ${Math.floor((duration % 60000) / 1000)}s`;\n return `${Math.floor(duration / 3600000)}h ${Math.floor((duration % 3600000) / 60000)}m`;\n }\n \n selectItem(item: TimelineItem) {\n this.selectedItem = item;\n this.itemSelected.emit(item);\n }\n \n async toggleItemExpansion(item: TimelineItem, event: Event) {\n event.stopPropagation();\n\n // Toggle expansion state\n item.isExpanded = !item.isExpanded;\n\n // For Sub-Agent steps, load their run data on demand (requires DB query)\n if (item.isExpanded && !item.childrenLoaded && item.type === 'step' && item.data?.StepType === 'Sub-Agent') {\n await this.loadSubAgentChildren(item);\n }\n\n // A TaskGraph step expands into the graph's own steps — one query for the whole subtree, so it\n // never shows a per-level loading state the way the sub-agent path has to.\n if (item.isExpanded && item.type === 'step' && item.data?.StepType === 'TaskGraph') {\n await this.ExpandTaskGraph(item);\n }\n\n // For parent steps (loop containers like ForEach/While), children are already loaded via ParentID\n // Just toggle - no additional loading needed since we already have all steps from the run\n // The children were already attached in buildTimelineItems()\n }\n \n private async loadSubAgentChildren(item: TimelineItem) {\n try {\n const subAgentRunId = item.data?.TargetLogID;\n\n if (!subAgentRunId) {\n item.hasNoChildren = true;\n item.children = [];\n item.childrenLoaded = true;\n return;\n }\n\n // Load sub-agent data through service\n const data = await this.dataHelper.loadSubAgentData(subAgentRunId);\n\n if (!data.steps || data.steps.length === 0) {\n item.hasNoChildren = true;\n item.children = [];\n item.childrenLoaded = true;\n return;\n }\n\n // Build hierarchical timeline items with ParentID relationships\n // This ensures that loop steps (ForEach/While) within sub-agents also show their children\n item.children = this.buildHierarchicalItems(data.steps, item.level + 1, data.promptRuns);\n\n item.childrenLoaded = true;\n // Trigger change detection after updating the data\n this.cdr.markForCheck();\n } catch (error) {\n console.error('🔄 Timeline: Error loading sub-agent children:', error);\n item.hasNoChildren = true;\n item.childrenLoaded = true;\n // Trigger change detection for error state\n this.cdr.markForCheck();\n }\n }\n \n navigateToSubRun(runId: string, event: Event) {\n event.stopPropagation();\n this.navigateToEntity.emit({ entityName: 'MJ: AI Agent Runs', recordId: runId });\n }\n \n navigateToActionLog(logId: string, event: Event) {\n event.stopPropagation();\n this.navigateToEntity.emit({ entityName: 'MJ: Action Execution Logs', recordId: logId });\n }\n \n navigateToPromptRun(runId: string, event: Event) {\n event.stopPropagation();\n this.navigateToEntity.emit({ entityName: 'MJ: AI Prompt Runs', recordId: runId });\n }\n \n /**\n * TrackBy function for timeline items\n */\n /**\n * The graph a TaskGraph step submitted, read from the step's own output.\n *\n * `executeTasksStep` records `parentTaskID` there whether or not submission succeeded, because a\n * rejected graph is the case where forensics matter most. A step with no id therefore means the\n * graph never reached the dispatcher — a real state the caller renders differently, which is why\n * this returns null rather than an empty string.\n */\n GetGraphParentTaskID(item: TimelineItem): string | null {\n const raw = item?.data?.OutputData;\n if (!raw) return null;\n try {\n const parsed = typeof raw === 'string' ? JSON.parse(raw) : raw;\n const id = parsed?.parentTaskID;\n return typeof id === 'string' && id.length > 0 ? id : null;\n } catch {\n return null;\n }\n }\n\n /**\n * A step inside the graph was selected.\n *\n * An Agent node carries the run it started, so selecting one offers the same navigation a\n * Sub-Agent step already does — that link is the seam between the two views, and without it a\n * dispatched sub-agent run is unreachable from the run that caused it.\n */\n OnGraphNodeSelected(event: { TaskID: string; Task: MJTaskEntity | null }): void {\n const agentRunID = event.Task?.AgentRunID;\n if (agentRunID) {\n this.navigateToEntity.emit({ entityName: 'MJ: AI Agent Runs', recordId: agentRunID });\n return;\n }\n if (event.Task?.ActionID) {\n this.navigateToEntity.emit({ entityName: 'MJ: Tasks', recordId: event.TaskID });\n }\n }\n\n /**\n * Expands a task-graph step into the graph's own steps, as ordinary timeline rows.\n *\n * **The graph's steps are steps.** They used to appear as an embedded canvas inside the list — a\n * diagram wedged into a vertical column, in a different visual language from everything around it,\n * and the only work in a run that could not be read, selected or navigated the same way as the\n * rest. They are rows now, colour-coded so their provenance is obvious, with the canvas moved to\n * the detail panel where edges have room to be seen.\n *\n * One query rather than a walk: the whole subtree arrives at once, so there is no\n * \"Loading sub-agent steps…\" and no per-level round trip.\n */\n async ExpandTaskGraph(item: TimelineItem): Promise<void> {\n if (item.childrenLoaded || this.expandingGraphIDs.has(item.id)) return;\n\n this.expandingGraphIDs.add(item.id);\n this.cdr.markForCheck();\n try {\n if (!this.RunTree) {\n this.error = 'The run tree is not loaded yet, so this workflow cannot be expanded.';\n return;\n }\n\n // The graph hangs off THIS step in the tree, so the subtree to splice in is the node whose id\n // matches the step — not the whole run, which is already on screen above it.\n const stepNode = FindAgentRunTreeNodes(this.RunTree, (n) => n.NodeID === item.id)[0] ?? null;\n\n item.children = ProjectRunTreeToTimeline(stepNode, item.level + 1, true, (n) => this.resolveActionIcon(n));\n item.childrenLoaded = true;\n item.hasNoChildren = item.children.length === 0;\n } catch (e) {\n this.error = e instanceof Error ? e.message : String(e);\n } finally {\n this.expandingGraphIDs.delete(item.id);\n this.cdr.markForCheck();\n }\n }\n\n /** True while a graph's steps are being fetched, so the row can say so. */\n IsExpandingGraph(item: TimelineItem): boolean {\n return this.expandingGraphIDs.has(item.id);\n }\n\n trackByItemId(index: number, item: TimelineItem): string {\n return item.id;\n }\n \n createSubRunDataHelper(): AIAgentRunDataHelper {\n // Create a new data helper instance for sub-runs to prevent caching conflicts\n return new AIAgentRunDataHelper();\n }\n}","@if (loading) {\n <div class=\"loading-state\">\n <mj-loading text=\"Loading run steps...\" size=\"medium\"></mj-loading>\n </div>\n} @else if (timelineItems$ | async; as items) {\n <div class=\"timeline-container\">\n @if (items.length > 0) {\n <div class=\"timeline\">\n @for (item of items; track trackByItemId($index, item)) {\n <!-- Main Timeline Item -->\n <mj-ai-agent-run-step-node\n [item]=\"item\"\n [isSelected]=\"selectedItem?.id === item.id\"\n (itemClick)=\"selectItem(item)\"\n (expandToggle)=\"toggleItemExpansion(item, $event)\"\n (navigateToEntity)=\"navigateToEntity.emit($event)\">\n </mj-ai-agent-run-step-node>\n <!-- Children Container (for both Sub-Agent and ParentID relationships) -->\n @if (item.isExpanded) {\n <!-- Show loading indicator while loading Sub-Agent children -->\n @if (item.type === 'step' && item.data?.StepType === 'Sub-Agent' && !item.childrenLoaded) {\n <div class=\"loading-children\">\n <i class=\"fas fa-spinner fa-spin\"></i> Loading sub-agent steps...\n </div>\n }\n <!-- Show no children message for Sub-Agents -->\n @if (item.type === 'step' && item.data?.StepType === 'Sub-Agent' && item.childrenLoaded && item.hasNoChildren) {\n <div class=\"no-children\">\n <i class=\"fas fa-info-circle\"></i> No sub-agent steps found\n </div>\n }\n <!-- Render children recursively (works for both Sub-Agent and ParentID children) -->\n @if (item.children && item.children.length > 0) {\n <ng-container *ngTemplateOutlet=\"recursiveSteps; context: { $implicit: item.children }\"></ng-container>\n }\n <!-- A TaskGraph step stands in for a whole graph of Task rows. Its steps render as\n ORDINARY ROWS, colour-coded for provenance — they are steps, and squeezing a diagram\n into the column made them the only work in a run that could not be read, selected or\n navigated like everything else. The canvas lives in the detail panel, where edges\n (which branch was taken, and why) have the room they need. -->\n @if (item.type === 'step' && item.data?.StepType === 'TaskGraph') {\n @if (IsExpandingGraph(item)) {\n <div class=\"loading-children\">\n <i class=\"fas fa-spinner fa-spin\"></i> Loading workflow steps...\n </div>\n } @else if (!GetGraphParentTaskID(item)) {\n <div class=\"no-children\">\n <i class=\"fas fa-info-circle\"></i>\n This workflow was recorded but never reached the dispatcher.\n </div>\n } @else if (item.childrenLoaded && item.hasNoChildren) {\n <div class=\"no-children\">\n <i class=\"fas fa-info-circle\"></i> This workflow has no steps yet.\n </div>\n }\n }\n <!-- For actual sub-run items (from the initial load) - legacy support -->\n @if (item.type === 'subrun' && item.data?.ID) {\n <mj-ai-agent-run-timeline\n [aiAgentRunId]=\"item.data.ID\"\n [dataHelper]=\"createSubRunDataHelper()\"\n [autoRefresh]=\"false\"\n (itemSelected)=\"selectItem($event)\"\n (navigateToEntity)=\"navigateToEntity.emit($event)\">\n </mj-ai-agent-run-timeline>\n }\n }\n }\n </div>\n }\n @if (items.length === 0) {\n <mj-empty-state\n Icon=\"fa-solid fa-stream\"\n Title=\"No execution steps found\" />\n }\n </div>\n} @else {\n <!-- timelineItems$ hasn't emitted yet -->\n <div class=\"loading-state\">\n <mj-loading text=\"Loading run steps...\" size=\"medium\"></mj-loading>\n </div>\n}\n\n@if (error) {\n <mj-empty-state\n Variant=\"error\"\n [Message]=\"error\" />\n}\n\n<!-- Recursive template for rendering nested children (ParentID relationships) -->\n<ng-template #recursiveSteps let-steps>\n @for (step of steps; track trackByItemId($index, step)) {\n <mj-ai-agent-run-step-node\n [item]=\"step\"\n [isSelected]=\"selectedItem?.id === step.id\"\n (itemClick)=\"selectItem(step)\"\n (expandToggle)=\"toggleItemExpansion(step, $event)\"\n (navigateToEntity)=\"navigateToEntity.emit($event)\">\n </mj-ai-agent-run-step-node>\n <!-- Recursively render this step's children if expanded -->\n @if (step.isExpanded && step.children && step.children.length > 0) {\n <ng-container *ngTemplateOutlet=\"recursiveSteps; context: { $implicit: step.children }\"></ng-container>\n }\n }\n</ng-template>"]}
|
|
1
|
+
{"version":3,"file":"ai-agent-run-timeline.component.js","sourceRoot":"","sources":["../../../../src/lib/custom/ai-agent-run/ai-agent-run-timeline.component.ts","../../../../src/lib/custom/ai-agent-run/ai-agent-run-timeline.component.html"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAqB,uBAAuB,EAAqB,MAAM,eAAe,CAAC;AACtI,OAAO,EAAE,OAAO,EAAc,aAAa,EAAE,eAAe,EAAE,MAAM,MAAM,CAAC;AAC3E,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAErE,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAyB,MAAM,8BAA8B,CAAC;AAC5F,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC3F,OAAO,EAAE,iCAAiC,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;;;;ICX9D,8BAA2B;IACzB,gCAAmE;IACrE,iBAAM;;;IAkBM,8BAA8B;IAC5B,wBAAsC;IAAC,4CACzC;IAAA,iBAAM;;;IAIN,8BAAy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L,KAAK;;kBAUL,KAAK;;kBACL,MAAM;;kBACN,MAAM;;kFA5BI,2BAA2B","sourcesContent":["import { Component, Input, Output, EventEmitter, OnInit, OnDestroy, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core';\nimport { Subject, Observable, combineLatest, BehaviorSubject } from 'rxjs';\nimport { takeUntil, map, shareReplay, filter } from 'rxjs/operators';\nimport { MJAIAgentRunEntity, MJAIAgentRunStepEntity, MJActionExecutionLogEntity, MJAIPromptRunEntity, MJTaskEntity } from '@memberjunction/core-entities';\nimport { AIAgentRunDataHelper } from './ai-agent-run-data.service';\nimport { AIEngineBase } from '@memberjunction/ai-engine-base';\nimport { UUIDsEqual } from '@memberjunction/global';\n\nimport { BaseAngularComponent } from '@memberjunction/ng-base-types';\nimport { FindAgentRunTreeNodes, type AgentRunTreeNode } from '@memberjunction/ai-core-plus';\nimport { NormalizeStatus, ProjectRunTreeToTimeline } from './run-tree-timeline-projection';\nimport { SortAgentRunStepsByExecutionOrder } from './agent-run-step-order';\nimport { ActionEngineBase } from '@memberjunction/actions-base';\n\n/**\n * Node kinds whose row is a LOOP, not the work inside it.\n *\n * A ForEach carries the ActionID of the action it repeats, so resolving an icon from it would draw\n * \"a Google search\" on a row that is a loop over five of them — losing the one distinction the row\n * exists to make.\n */\nconst LOOP_KINDS: ReadonlySet<string> = new Set(['ForEach', 'While']);\nexport interface TimelineItem {\n id: string;\n /**\n * What the row represents.\n *\n * `taskgraph` and `task` are dispatcher work — a graph that outlives the run that submitted it,\n * and the steps inside it. They are rendered as ordinary rows rather than as an embedded diagram,\n * and colour-coded so their provenance is visible without opening anything.\n */\n type: 'step' | 'subrun' | 'action' | 'prompt' | 'taskgraph' | 'task';\n /**\n * Where this row's work ran, when that is not obvious from its type.\n *\n * `'workflow'` means it ran on the task-graph dispatcher and outlives the agent run that\n * submitted it. Kept separate from `type` on purpose: a workflow step that runs an action IS an\n * action and should render as one — provenance styles it, it does not redefine it.\n */\n provenance?: 'workflow';\n title: string;\n subtitle: string;\n status: string;\n /**\n * When this row started, or NULL when it has not.\n *\n * Nullable on purpose. A projection that needed \"sorts last\" once filled this with the maximum\n * Date, and every unstarted row then displayed that sentinel as a real clock time — identical on\n * every row and indistinguishable from data. Ordering belongs to whatever produced the rows; a row\n * that has not run has no start time, and says so by having none.\n */\n startTime: Date | null;\n endTime?: Date;\n duration?: string;\n icon: string;\n logoUrl?: string;\n color: string;\n data: any;\n children?: TimelineItem[];\n level: number;\n parentId?: string;\n isExpanded?: boolean;\n childrenLoaded?: boolean;\n hasNoChildren?: boolean;\n}\n\n@Component({\n standalone: false,\n selector: 'mj-ai-agent-run-timeline',\n templateUrl: './ai-agent-run-timeline.component.html',\n styleUrls: ['./ai-agent-run-timeline.component.css'],\n changeDetection: ChangeDetectionStrategy.OnPush\n})\nexport class AIAgentRunTimelineComponent extends BaseAngularComponent implements OnInit, OnDestroy {\n @Input() aiAgentRunId!: string;\n\n /**\n * The run's execution tree, loaded ONCE by the form and shared with every tab.\n *\n * Received rather than fetched: three tabs need the same structure, and letting each load its own\n * issues the same recursive query three times AND lets the tabs disagree — a tab that loaded a\n * second earlier shows a different run than the one beside it.\n */\n /**\n * Setter, not a plain field: a TaskGraph step's row takes its STATUS from the graph (see\n * `graphNodeForStep`), and the tree usually arrives after the step rows have already been built.\n * Republishing rebuilds them, so a dispatched workflow stops reading Completed the moment the\n * tree says it is still running.\n */\n @Input()\n public set RunTree(value: AgentRunTreeNode | null) {\n this.runTree = value;\n this.runTree$.next(value);\n }\n public get RunTree(): AgentRunTreeNode | null {\n return this.runTree;\n }\n private runTree: AgentRunTreeNode | null = null;\n private runTree$ = new BehaviorSubject<AgentRunTreeNode | null>(null);\n @Input() dataHelper!: AIAgentRunDataHelper; // Data helper passed from parent\n @Output() itemSelected = new EventEmitter<TimelineItem>();\n @Output() navigateToEntity = new EventEmitter<{ entityName: string; recordId: string }>();\n\n private destroy$ = new Subject<void>();\n /** Resolved once the action cache is warm, so a first paint without icons can be re-rendered with them. */\n private actionsReady = false;\n /**\n * Execution-log id → action id, for the RUN-STEP path only.\n *\n * The tree path needs none of this — it carries `ActionID` outright. A run step of type `Actions`\n * still names only its log, so this map stays for that case, built from logs the data service has\n * already fetched by id.\n */\n private actionIDByLogID = new Map<string, string>();\n \n // Public observables from data helper\n steps$!: Observable<MJAIAgentRunStepEntity[]>;\n subRuns$!: Observable<MJAIAgentRunEntity[]>;\n actionLogs$!: Observable<MJActionExecutionLogEntity[]>;\n promptRuns$!: Observable<MJAIPromptRunEntity[]>;\n \n timelineItems$!: Observable<TimelineItem[]>;\n \n loading = true;\n error: string | null = null;\n selectedItem: TimelineItem | null = null;\n\n /** Graph steps currently being expanded, so a second click cannot start a second load. */\n private expandingGraphIDs = new Set<string>();\n\n constructor(\n private cdr: ChangeDetectorRef\n ) {\n super();}\n \n async ngOnInit() {\n // AIEngineBase is deferred at startup; ensure it's loaded before timeline\n // items render — getStepIconInfo / sub-agent lookups read .Agents synchronously.\n await AIEngineBase.Instance.EnsureLoaded();\n // Same reason, for the same kind of read: `resolveActionIcon` looks up `.Actions` synchronously\n // inside the projection. Cheap when another surface already warmed it, and a no-op on reload.\n try {\n await ActionEngineBase.Instance.EnsureLoaded();\n this.actionsReady = true;\n } catch {\n // An action cache that will not load costs icons, not rows — every action keeps the generic\n // glyph it had before. Never worth failing a run view over.\n this.actionsReady = false;\n }\n\n // Initialize observables from the data helper\n this.steps$ = this.dataHelper.steps$;\n this.subRuns$ = this.dataHelper.subRuns$;\n this.actionLogs$ = this.dataHelper.actionLogs$;\n this.promptRuns$ = this.dataHelper.promptRuns$;\n \n // Combine all data sources to build timeline.\n // Skip emissions where steps are empty but data is still loading —\n // the BehaviorSubjects initialise with [] so combineLatest fires\n // immediately with an empty array before the real data arrives.\n this.timelineItems$ = combineLatest([\n this.steps$,\n this.subRuns$,\n this.actionLogs$,\n this.promptRuns$,\n this.dataHelper.loading$,\n this.runTree$\n ]).pipe(\n filter(([steps, _subRuns, _actionLogs, _promptRuns, isLoading]) => {\n // While loading, suppress the empty-array emission so the\n // template keeps showing the mj-loading indicator.\n return !(isLoading && steps.length === 0);\n }),\n map(([steps, subRuns, actionLogs, promptRuns]) => {\n // Built here rather than on demand: this is where the logs arrive, and the resolver runs\n // synchronously inside the projection, which cannot await anything.\n this.actionIDByLogID = new Map(\n (actionLogs ?? [])\n .filter((log) => log.ID && log.ActionID)\n .map((log) => [log.ID.toLowerCase(), log.ActionID]),\n );\n return this.buildTimelineItems(steps, subRuns, actionLogs, promptRuns);\n }),\n shareReplay(1)\n );\n \n // Data loading is now handled by the parent component through the helper\n // Subscribe to loading state from helper\n this.dataHelper.loading$.pipe(takeUntil(this.destroy$)).subscribe(loading => {\n this.loading = loading;\n this.cdr.markForCheck();\n });\n\n this.dataHelper.error$.pipe(takeUntil(this.destroy$)).subscribe(error => {\n this.error = error;\n this.cdr.markForCheck();\n });\n }\n\n ngOnDestroy() {\n this.destroy$.next();\n this.destroy$.complete();\n }\n\n // This method is now just for compatibility - actual loading is done by parent\n async loadData() {\n if (!this.aiAgentRunId) return;\n // The parent component should handle data loading through the helper\n return this.dataHelper.loadAgentRunData(this.aiAgentRunId);\n }\n \n private buildTimelineItems(\n steps: MJAIAgentRunStepEntity[],\n subRuns: MJAIAgentRunEntity[],\n actionLogs: MJActionExecutionLogEntity[],\n promptRuns: MJAIPromptRunEntity[]\n ): TimelineItem[] {\n return this.buildHierarchicalItems(steps, 0, promptRuns);\n }\n\n private buildHierarchicalItems(\n steps: MJAIAgentRunStepEntity[],\n baseLevel: number,\n promptRuns?: MJAIPromptRunEntity[]\n ): TimelineItem[] {\n // Walk in execution order, not persist order. Children are pushed in this walk, so a\n // loop's iterations and root siblings both inherit the sort. Query OrderBy is the\n // same pair; this is the belt for a caller that handed us an unsorted array.\n const ordered = SortAgentRunStepsByExecutionOrder(steps);\n\n // Create a map of all timeline items by step ID\n const itemMap = new Map<string, TimelineItem>();\n\n // First pass: create all timeline items\n ordered.forEach(step => {\n const item = this.createTimelineItemFromStep(step, baseLevel, promptRuns);\n itemMap.set(step.ID, item);\n });\n\n // Second pass: build parent-child relationships based on ParentID\n ordered.forEach(step => {\n if (step.ParentID) {\n const parentItem = itemMap.get(step.ParentID);\n const childItem = itemMap.get(step.ID);\n\n if (parentItem && childItem) {\n // Initialize children array if needed\n if (!parentItem.children) {\n parentItem.children = [];\n }\n\n // Set child's level based on parent's level\n childItem.level = parentItem.level + 1;\n\n // Add child to parent's children array\n parentItem.children.push(childItem);\n }\n }\n });\n\n // Return only root-level items (those without a ParentID)\n const rootItems: TimelineItem[] = [];\n ordered.forEach(step => {\n if (!step.ParentID) {\n const item = itemMap.get(step.ID);\n if (item) {\n rootItems.push(item);\n }\n }\n });\n\n return rootItems;\n }\n \n /**\n * Font Awesome class for a node that runs a known action or agent, or null to keep the default.\n *\n * **Why the row kind is the wrong answer.** The same action reaches this timeline through two\n * arms of the run-tree query — as a graph Task and as a loop pass — and each arm had its own\n * generic glyph, so one Google Custom Search drew a lightning bolt and the next a paper plane.\n * What the step IS does not change with where it ran.\n *\n * **No hop.** The tree carries `ActionID` and `AgentID` directly (a task holds them as columns;\n * a pass takes them from the log it expanded from), so this is one cache read. The first version\n * of this went through the execution log and silently resolved NOTHING for graph steps, because\n * the logs it consulted are only loaded for run steps of type `Actions` — of which a dispatched\n * workflow has none.\n *\n * **Loops keep their own icon.** A ForEach carries the ActionID of the action it repeats, and\n * drawing that action's mark on the loop row would say \"this is a Google search\" about a row that\n * is a loop over five of them. The distinction the loop icon carries is worth more.\n */\n private resolveActionIcon(node: AgentRunTreeNode): string | null {\n if (LOOP_KINDS.has(node.SourceKind ?? '')) return null;\n\n if (node.ActionID) {\n const action = ActionEngineBase.Instance.Actions?.find((a) => UUIDsEqual(a.ID, node.ActionID!));\n if (action?.IconClass) return action.IconClass;\n }\n if (node.AgentID) {\n const agent = AIEngineBase.Instance.Agents?.find((a) => UUIDsEqual(a.ID, node.AgentID!));\n if (agent?.IconClass) return agent.IconClass;\n }\n return null;\n }\n\n\n\n /**\n * The graph a TaskGraph step dispatched, from the run tree.\n *\n * Null until the tree arrives (the setter above republishes then) and null for a submission that\n * produced no graph — a failed submit, where the step's own status IS the story.\n */\n private graphNodeForStep(stepID: string): AgentRunTreeNode | null {\n if (!this.runTree) return null;\n const stepNode = FindAgentRunTreeNodes(this.runTree, (n) => UUIDsEqual(n.NodeID, stepID))[0] ?? null;\n return stepNode?.Children.find((c) => c.NodeType === 'TaskGraph') ?? null;\n }\n\n private createTimelineItemFromStep(step: MJAIAgentRunStepEntity, level: number, promptRuns?: MJAIPromptRunEntity[]): TimelineItem {\n let subtitle = `Type: ${step.StepType}`;\n\n // For prompt steps, try to find the associated prompt run to get model/vendor info\n if (step.StepType === 'Prompt' && step.TargetLogID && promptRuns) {\n const promptRun = promptRuns.find(pr => UUIDsEqual(pr.ID, step.TargetLogID));\n if (promptRun) {\n subtitle = `Model: ${promptRun.Model || 'Unknown'} | Vendor: ${promptRun.Vendor || 'Unknown'}`;\n }\n }\n\n // Get icon and logoUrl based on step type\n const iconInfo = this.getStepIconInfo(step);\n\n // A dispatched workflow's row describes the WORKFLOW, not the handoff that started it. The\n // step's own status is about submission — Completed in ~300ms, correctly — and showing that\n // under a title naming the workflow is how the timeline came to report a running graph as\n // finished while the page header said \"Workflow still running\".\n const graph = step.StepType === 'TaskGraph' ? this.graphNodeForStep(step.ID) : null;\n if (graph) {\n subtitle = `${subtitle} · dispatched in ${this.calculateDuration(step.StartedAt, step.CompletedAt)}`;\n }\n\n return {\n id: step.ID,\n type: 'step',\n title: step.StepName || `Step ${step.StepNumber}`,\n subtitle: subtitle,\n status: graph ? NormalizeStatus(graph.Status) : step.Status,\n startTime: step.StartedAt,\n endTime: (graph ? graph.CompletedAt : step.CompletedAt) || undefined,\n // A graph that has not started yet has no duration of its own — the submission's stands in,\n // and the subtitle says which it is either way.\n duration: graph?.StartedAt\n ? this.calculateDuration(graph.StartedAt, graph.CompletedAt)\n : this.calculateDuration(step.StartedAt, step.CompletedAt),\n icon: iconInfo.icon,\n logoUrl: iconInfo.logoUrl,\n color: this.getStatusColor(graph ? NormalizeStatus(graph.Status) : step.Status),\n data: step,\n children: [],\n level,\n isExpanded: false\n };\n }\n \n\n private getStepIconInfo(step: MJAIAgentRunStepEntity): { icon: string; logoUrl?: string } {\n // For sub-agents, try to get agent-specific icon/logo\n if (step.StepType === 'Sub-Agent' && step.TargetID) {\n const agent = AIEngineBase.Instance.Agents.find(a => UUIDsEqual(a.ID, step.TargetID));\n if (agent) {\n // Prefer LogoURL - if present, use it with robot as fallback icon (icon won't be shown when logoUrl exists)\n if (agent.LogoURL) {\n return { icon: 'fa-robot', logoUrl: agent.LogoURL };\n }\n // Next preference: IconClass from agent metadata\n else if (agent.IconClass) {\n return { icon: agent.IconClass };\n }\n // Agent exists but has no custom icon or logo - use default robot icon\n else {\n return { icon: 'fa-robot' };\n }\n }\n }\n\n // An action step draws its OWN action's icon, exactly as a sub-agent step draws its agent's —\n // the two cases are the same idea, and only one of them was implemented. `TargetLogID` names\n // the execution log this run already loaded; that log names the action, whose IconClass is in\n // ActionEngineBase's cache. A step whose action cannot be resolved (an action with no icon, a\n // cache that did not load) falls through to the step-type default below, which is the same\n // lightning bolt it drew before.\n if (step.StepType === 'Actions' && step.TargetLogID) {\n const actionID = this.actionIDByLogID.get(step.TargetLogID.toLowerCase());\n const action = actionID\n ? ActionEngineBase.Instance.Actions?.find((a) => UUIDsEqual(a.ID, actionID))\n : undefined;\n if (action?.IconClass) return { icon: action.IconClass };\n }\n\n // Default icons for each step type (includes fa-robot for sub-agents without agent metadata)\n const icon = this.getStepIcon(step.StepType);\n return { icon };\n }\n\n private getStepIcon(stepType: string): string {\n const iconMap: Record<string, string> = {\n 'Prompt': 'fa-brain',\n 'Tool': 'fa-tools',\n 'Sub-Agent': 'fa-robot',\n 'Decision': 'fa-code-branch',\n 'Actions': 'fa-wrench',\n 'Validation': 'fa-square-check',\n 'ForEach': 'fa-repeat',\n 'While': 'fa-rotate',\n 'Skill': 'fa-wand-magic-sparkles',\n 'Plan': 'fa-clipboard-check'\n };\n return iconMap[stepType] || 'fa-circle';\n }\n \n private getStatusColor(status: string): string {\n const colorMap: Record<string, string> = {\n 'Running': 'info',\n 'Completed': 'success',\n 'Failed': 'error',\n 'Cancelled': 'warning',\n 'Paused': 'secondary'\n };\n return colorMap[status] || 'secondary';\n }\n \n calculateDuration(start: Date, end?: Date | null): string {\n if (!end) return 'Running...';\n \n const startTime = new Date(start).getTime();\n const endTime = new Date(end).getTime();\n const duration = endTime - startTime;\n \n if (duration < 1000) return `${duration}ms`;\n if (duration < 60000) return `${(duration / 1000).toFixed(1)}s`;\n if (duration < 3600000) return `${Math.floor(duration / 60000)}m ${Math.floor((duration % 60000) / 1000)}s`;\n return `${Math.floor(duration / 3600000)}h ${Math.floor((duration % 3600000) / 60000)}m`;\n }\n \n selectItem(item: TimelineItem) {\n this.selectedItem = item;\n this.itemSelected.emit(item);\n }\n \n async toggleItemExpansion(item: TimelineItem, event: Event) {\n event.stopPropagation();\n\n // Toggle expansion state\n item.isExpanded = !item.isExpanded;\n\n // For Sub-Agent steps, load their run data on demand (requires DB query)\n if (item.isExpanded && !item.childrenLoaded && item.type === 'step' && item.data?.StepType === 'Sub-Agent') {\n await this.loadSubAgentChildren(item);\n }\n\n // A TaskGraph step expands into the graph's own steps — one query for the whole subtree, so it\n // never shows a per-level loading state the way the sub-agent path has to.\n if (item.isExpanded && item.type === 'step' && item.data?.StepType === 'TaskGraph') {\n await this.ExpandTaskGraph(item);\n }\n\n // For parent steps (loop containers like ForEach/While), children are already loaded via ParentID\n // Just toggle - no additional loading needed since we already have all steps from the run\n // The children were already attached in buildTimelineItems()\n }\n \n private async loadSubAgentChildren(item: TimelineItem) {\n try {\n const subAgentRunId = item.data?.TargetLogID;\n\n if (!subAgentRunId) {\n item.hasNoChildren = true;\n item.children = [];\n item.childrenLoaded = true;\n return;\n }\n\n // Load sub-agent data through service\n const data = await this.dataHelper.loadSubAgentData(subAgentRunId);\n\n if (!data.steps || data.steps.length === 0) {\n item.hasNoChildren = true;\n item.children = [];\n item.childrenLoaded = true;\n return;\n }\n\n // Build hierarchical timeline items with ParentID relationships\n // This ensures that loop steps (ForEach/While) within sub-agents also show their children\n item.children = this.buildHierarchicalItems(data.steps, item.level + 1, data.promptRuns);\n\n item.childrenLoaded = true;\n // Trigger change detection after updating the data\n this.cdr.markForCheck();\n } catch (error) {\n console.error('🔄 Timeline: Error loading sub-agent children:', error);\n item.hasNoChildren = true;\n item.childrenLoaded = true;\n // Trigger change detection for error state\n this.cdr.markForCheck();\n }\n }\n \n navigateToSubRun(runId: string, event: Event) {\n event.stopPropagation();\n this.navigateToEntity.emit({ entityName: 'MJ: AI Agent Runs', recordId: runId });\n }\n \n navigateToActionLog(logId: string, event: Event) {\n event.stopPropagation();\n this.navigateToEntity.emit({ entityName: 'MJ: Action Execution Logs', recordId: logId });\n }\n \n navigateToPromptRun(runId: string, event: Event) {\n event.stopPropagation();\n this.navigateToEntity.emit({ entityName: 'MJ: AI Prompt Runs', recordId: runId });\n }\n \n /**\n * TrackBy function for timeline items\n */\n /**\n * The graph a TaskGraph step submitted, read from the step's own output.\n *\n * `executeTasksStep` records `parentTaskID` there whether or not submission succeeded, because a\n * rejected graph is the case where forensics matter most. A step with no id therefore means the\n * graph never reached the dispatcher — a real state the caller renders differently, which is why\n * this returns null rather than an empty string.\n */\n GetGraphParentTaskID(item: TimelineItem): string | null {\n const raw = item?.data?.OutputData;\n if (!raw) return null;\n try {\n const parsed = typeof raw === 'string' ? JSON.parse(raw) : raw;\n const id = parsed?.parentTaskID;\n return typeof id === 'string' && id.length > 0 ? id : null;\n } catch {\n return null;\n }\n }\n\n /**\n * A step inside the graph was selected.\n *\n * An Agent node carries the run it started, so selecting one offers the same navigation a\n * Sub-Agent step already does — that link is the seam between the two views, and without it a\n * dispatched sub-agent run is unreachable from the run that caused it.\n */\n OnGraphNodeSelected(event: { TaskID: string; Task: MJTaskEntity | null }): void {\n const agentRunID = event.Task?.AgentRunID;\n if (agentRunID) {\n this.navigateToEntity.emit({ entityName: 'MJ: AI Agent Runs', recordId: agentRunID });\n return;\n }\n if (event.Task?.ActionID) {\n this.navigateToEntity.emit({ entityName: 'MJ: Tasks', recordId: event.TaskID });\n }\n }\n\n /**\n * Expands a task-graph step into the graph's own steps, as ordinary timeline rows.\n *\n * **The graph's steps are steps.** They used to appear as an embedded canvas inside the list — a\n * diagram wedged into a vertical column, in a different visual language from everything around it,\n * and the only work in a run that could not be read, selected or navigated the same way as the\n * rest. They are rows now, colour-coded so their provenance is obvious, with the canvas moved to\n * the detail panel where edges have room to be seen.\n *\n * One query rather than a walk: the whole subtree arrives at once, so there is no\n * \"Loading sub-agent steps…\" and no per-level round trip.\n */\n async ExpandTaskGraph(item: TimelineItem): Promise<void> {\n if (item.childrenLoaded || this.expandingGraphIDs.has(item.id)) return;\n\n this.expandingGraphIDs.add(item.id);\n this.cdr.markForCheck();\n try {\n if (!this.RunTree) {\n this.error = 'The run tree is not loaded yet, so this workflow cannot be expanded.';\n return;\n }\n\n // The graph hangs off THIS step in the tree, so the subtree to splice in is the node whose id\n // matches the step — not the whole run, which is already on screen above it.\n const stepNode = FindAgentRunTreeNodes(this.RunTree, (n) => n.NodeID === item.id)[0] ?? null;\n\n item.children = ProjectRunTreeToTimeline(stepNode, item.level + 1, true, (n) => this.resolveActionIcon(n));\n item.childrenLoaded = true;\n item.hasNoChildren = item.children.length === 0;\n } catch (e) {\n this.error = e instanceof Error ? e.message : String(e);\n } finally {\n this.expandingGraphIDs.delete(item.id);\n this.cdr.markForCheck();\n }\n }\n\n /** True while a graph's steps are being fetched, so the row can say so. */\n IsExpandingGraph(item: TimelineItem): boolean {\n return this.expandingGraphIDs.has(item.id);\n }\n\n trackByItemId(index: number, item: TimelineItem): string {\n return item.id;\n }\n \n createSubRunDataHelper(): AIAgentRunDataHelper {\n // Create a new data helper instance for sub-runs to prevent caching conflicts\n return new AIAgentRunDataHelper();\n }\n}","@if (loading) {\n <div class=\"loading-state\">\n <mj-loading text=\"Loading run steps...\" size=\"medium\"></mj-loading>\n </div>\n} @else if (timelineItems$ | async; as items) {\n <div class=\"timeline-container\">\n @if (items.length > 0) {\n <div class=\"timeline\">\n @for (item of items; track trackByItemId($index, item)) {\n <!-- Main Timeline Item -->\n <mj-ai-agent-run-step-node\n [item]=\"item\"\n [isSelected]=\"selectedItem?.id === item.id\"\n (itemClick)=\"selectItem(item)\"\n (expandToggle)=\"toggleItemExpansion(item, $event)\"\n (navigateToEntity)=\"navigateToEntity.emit($event)\">\n </mj-ai-agent-run-step-node>\n <!-- Children Container (for both Sub-Agent and ParentID relationships) -->\n @if (item.isExpanded) {\n <!-- Show loading indicator while loading Sub-Agent children -->\n @if (item.type === 'step' && item.data?.StepType === 'Sub-Agent' && !item.childrenLoaded) {\n <div class=\"loading-children\">\n <i class=\"fas fa-spinner fa-spin\"></i> Loading sub-agent steps...\n </div>\n }\n <!-- Show no children message for Sub-Agents -->\n @if (item.type === 'step' && item.data?.StepType === 'Sub-Agent' && item.childrenLoaded && item.hasNoChildren) {\n <div class=\"no-children\">\n <i class=\"fas fa-info-circle\"></i> No sub-agent steps found\n </div>\n }\n <!-- Render children recursively (works for both Sub-Agent and ParentID children) -->\n @if (item.children && item.children.length > 0) {\n <ng-container *ngTemplateOutlet=\"recursiveSteps; context: { $implicit: item.children }\"></ng-container>\n }\n <!-- A TaskGraph step stands in for a whole graph of Task rows. Its steps render as\n ORDINARY ROWS, colour-coded for provenance — they are steps, and squeezing a diagram\n into the column made them the only work in a run that could not be read, selected or\n navigated like everything else. The canvas lives in the detail panel, where edges\n (which branch was taken, and why) have the room they need. -->\n @if (item.type === 'step' && item.data?.StepType === 'TaskGraph') {\n @if (IsExpandingGraph(item)) {\n <div class=\"loading-children\">\n <i class=\"fas fa-spinner fa-spin\"></i> Loading workflow steps...\n </div>\n } @else if (!GetGraphParentTaskID(item)) {\n <div class=\"no-children\">\n <i class=\"fas fa-info-circle\"></i>\n This workflow was recorded but never reached the dispatcher.\n </div>\n } @else if (item.childrenLoaded && item.hasNoChildren) {\n <div class=\"no-children\">\n <i class=\"fas fa-info-circle\"></i> This workflow has no steps yet.\n </div>\n }\n }\n <!-- For actual sub-run items (from the initial load) - legacy support -->\n @if (item.type === 'subrun' && item.data?.ID) {\n <mj-ai-agent-run-timeline\n [aiAgentRunId]=\"item.data.ID\"\n [dataHelper]=\"createSubRunDataHelper()\"\n [autoRefresh]=\"false\"\n (itemSelected)=\"selectItem($event)\"\n (navigateToEntity)=\"navigateToEntity.emit($event)\">\n </mj-ai-agent-run-timeline>\n }\n }\n }\n </div>\n }\n @if (items.length === 0) {\n <mj-empty-state\n Icon=\"fa-solid fa-stream\"\n Title=\"No execution steps found\" />\n }\n </div>\n} @else {\n <!-- timelineItems$ hasn't emitted yet -->\n <div class=\"loading-state\">\n <mj-loading text=\"Loading run steps...\" size=\"medium\"></mj-loading>\n </div>\n}\n\n@if (error) {\n <mj-empty-state\n Variant=\"error\"\n [Message]=\"error\" />\n}\n\n<!-- Recursive template for rendering nested children (ParentID relationships) -->\n<ng-template #recursiveSteps let-steps>\n @for (step of steps; track trackByItemId($index, step)) {\n <mj-ai-agent-run-step-node\n [item]=\"step\"\n [isSelected]=\"selectedItem?.id === step.id\"\n (itemClick)=\"selectItem(step)\"\n (expandToggle)=\"toggleItemExpansion(step, $event)\"\n (navigateToEntity)=\"navigateToEntity.emit($event)\">\n </mj-ai-agent-run-step-node>\n <!-- Recursively render this step's children if expanded -->\n @if (step.isExpanded && step.children && step.children.length > 0) {\n <ng-container *ngTemplateOutlet=\"recursiveSteps; context: { $implicit: step.children }\"></ng-container>\n }\n }\n</ng-template>"]}
|
|
@@ -20,7 +20,7 @@ let MJAIModelCostFormComponent = class MJAIModelCostFormComponent extends BaseFo
|
|
|
20
20
|
]);
|
|
21
21
|
}
|
|
22
22
|
static { this.ɵfac = /*@__PURE__*/ (() => { let ɵMJAIModelCostFormComponent_BaseFactory; return function MJAIModelCostFormComponent_Factory(__ngFactoryType__) { return (ɵMJAIModelCostFormComponent_BaseFactory || (ɵMJAIModelCostFormComponent_BaseFactory = i0.ɵɵgetInheritedFactory(MJAIModelCostFormComponent)))(__ngFactoryType__ || MJAIModelCostFormComponent); }; })(); }
|
|
23
|
-
static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MJAIModelCostFormComponent, selectors: [["gen-mjaimodelcost-form"]], standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls:
|
|
23
|
+
static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: MJAIModelCostFormComponent, selectors: [["gen-mjaimodelcost-form"]], standalone: false, features: [i0.ɵɵInheritDefinitionFeature], decls: 23, vars: 85, consts: [[3, "Navigate", "DeleteRequested", "FavoriteToggled", "HistoryRequested", "ListManagementRequested", "Record", "FormComponent"], ["Slot", "before-fields", 3, "Entity", "Record", "FormComponent", "FormContext"], ["SectionKey", "modelProvider", "SectionName", "Model & Provider", "Icon", "fa fa-cubes", 3, "Form", "FormContext"], ["FieldName", "ModelID", "Type", "textbox", "LinkType", "Record", 3, "Record", "ShowLabel", "EditMode", "FormContext"], ["FieldName", "VendorID", "Type", "textbox", "LinkType", "Record", 3, "Record", "ShowLabel", "EditMode", "FormContext"], ["SectionKey", "validityProcessing", "SectionName", "Validity & Processing", "Icon", "fa fa-calendar", 3, "Form", "FormContext"], ["FieldName", "StartedAt", "Type", "datepicker", 3, "Record", "ShowLabel", "EditMode", "FormContext"], ["FieldName", "EndedAt", "Type", "datepicker", 3, "Record", "ShowLabel", "EditMode", "FormContext"], ["FieldName", "Status", "Type", "select", 3, "Record", "ShowLabel", "EditMode", "FormContext"], ["FieldName", "ProcessingType", "Type", "select", 3, "Record", "ShowLabel", "EditMode", "FormContext"], ["FieldName", "Comments", "Type", "textarea", 3, "Record", "ShowLabel", "EditMode", "FormContext"], ["SectionKey", "pricingDetails", "SectionName", "Pricing Details", "Icon", "fa fa-dollar-sign", 3, "Form", "FormContext"], ["FieldName", "Currency", "Type", "textbox", 3, "Record", "ShowLabel", "EditMode", "FormContext"], ["FieldName", "InputPricePerUnit", "Type", "number", 3, "Record", "ShowLabel", "EditMode", "FormContext"], ["FieldName", "OutputPricePerUnit", "Type", "number", 3, "Record", "ShowLabel", "EditMode", "FormContext"], ["FieldName", "UnitTypeID", "Type", "textbox", "LinkType", "Record", 3, "Record", "ShowLabel", "EditMode", "FormContext"], ["FieldName", "CacheReadPricePerUnit", "Type", "number", 3, "Record", "ShowLabel", "EditMode", "FormContext"], ["FieldName", "CacheWritePricePerUnit", "Type", "number", 3, "Record", "ShowLabel", "EditMode", "FormContext"], ["SectionKey", "systemMetadata", "SectionName", "System Metadata", "Icon", "fa fa-cog", 3, "Form", "FormContext"], ["FieldName", "__mj_CreatedAt", "Type", "textbox", 3, "Record", "ShowLabel", "EditMode", "FormContext"], ["FieldName", "__mj_UpdatedAt", "Type", "textbox", 3, "Record", "ShowLabel", "EditMode", "FormContext"], ["Slot", "after-fields", 3, "Entity", "Record", "FormComponent", "FormContext"], ["Slot", "after-related", 3, "Entity", "Record", "FormComponent", "FormContext"]], template: function MJAIModelCostFormComponent_Template(rf, ctx) { if (rf & 1) {
|
|
24
24
|
i0.ɵɵelementStart(0, "mj-record-form-container", 0);
|
|
25
25
|
i0.ɵɵlistener("Navigate", function MJAIModelCostFormComponent_Template_mj_record_form_container_Navigate_0_listener($event) { return ctx.OnFormNavigate($event); })("DeleteRequested", function MJAIModelCostFormComponent_Template_mj_record_form_container_DeleteRequested_0_listener() { return ctx.OnDeleteRequested(); })("FavoriteToggled", function MJAIModelCostFormComponent_Template_mj_record_form_container_FavoriteToggled_0_listener() { return ctx.OnFavoriteToggled(); })("HistoryRequested", function MJAIModelCostFormComponent_Template_mj_record_form_container_HistoryRequested_0_listener() { return ctx.OnHistoryRequested(); })("ListManagementRequested", function MJAIModelCostFormComponent_Template_mj_record_form_container_ListManagementRequested_0_listener() { return ctx.OnListManagementRequested(); });
|
|
26
26
|
i0.ɵɵelement(1, "mj-form-panel-slot", 1);
|
|
@@ -31,12 +31,12 @@ let MJAIModelCostFormComponent = class MJAIModelCostFormComponent extends BaseFo
|
|
|
31
31
|
i0.ɵɵelement(6, "mj-form-field", 6)(7, "mj-form-field", 7)(8, "mj-form-field", 8)(9, "mj-form-field", 9)(10, "mj-form-field", 10);
|
|
32
32
|
i0.ɵɵelementEnd();
|
|
33
33
|
i0.ɵɵelementStart(11, "mj-collapsible-panel", 11);
|
|
34
|
-
i0.ɵɵelement(12, "mj-form-field", 12)(13, "mj-form-field", 13)(14, "mj-form-field", 14)(15, "mj-form-field", 15)(16, "mj-form-field", 16)(17, "mj-form-field", 17)
|
|
34
|
+
i0.ɵɵelement(12, "mj-form-field", 12)(13, "mj-form-field", 13)(14, "mj-form-field", 14)(15, "mj-form-field", 15)(16, "mj-form-field", 16)(17, "mj-form-field", 17);
|
|
35
35
|
i0.ɵɵelementEnd();
|
|
36
|
-
i0.ɵɵelementStart(
|
|
37
|
-
i0.ɵɵelement(
|
|
36
|
+
i0.ɵɵelementStart(18, "mj-collapsible-panel", 18);
|
|
37
|
+
i0.ɵɵelement(19, "mj-form-field", 19)(20, "mj-form-field", 20);
|
|
38
38
|
i0.ɵɵelementEnd();
|
|
39
|
-
i0.ɵɵelement(
|
|
39
|
+
i0.ɵɵelement(21, "mj-form-panel-slot", 21)(22, "mj-form-panel-slot", 22);
|
|
40
40
|
i0.ɵɵelementEnd();
|
|
41
41
|
} if (rf & 2) {
|
|
42
42
|
i0.ɵɵproperty("Record", ctx.record)("FormComponent", ctx);
|
|
@@ -75,8 +75,6 @@ let MJAIModelCostFormComponent = class MJAIModelCostFormComponent extends BaseFo
|
|
|
75
75
|
i0.ɵɵadvance();
|
|
76
76
|
i0.ɵɵproperty("Record", ctx.record)("ShowLabel", true)("EditMode", ctx.EditMode)("FormContext", ctx.formContext);
|
|
77
77
|
i0.ɵɵadvance();
|
|
78
|
-
i0.ɵɵproperty("Record", ctx.record)("ShowLabel", true)("EditMode", ctx.EditMode)("FormContext", ctx.formContext);
|
|
79
|
-
i0.ɵɵadvance();
|
|
80
78
|
i0.ɵɵproperty("Form", ctx)("FormContext", ctx.formContext);
|
|
81
79
|
i0.ɵɵadvance();
|
|
82
80
|
i0.ɵɵproperty("Record", ctx.record)("ShowLabel", true)("EditMode", ctx.EditMode)("FormContext", ctx.formContext);
|
|
@@ -94,7 +92,7 @@ MJAIModelCostFormComponent = __decorate([
|
|
|
94
92
|
export { MJAIModelCostFormComponent };
|
|
95
93
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(MJAIModelCostFormComponent, [{
|
|
96
94
|
type: Component,
|
|
97
|
-
args: [{ standalone: false, selector: 'gen-mjaimodelcost-form', template: "<mj-record-form-container [Record]=\"record\" [FormComponent]=\"this\"\n (Navigate)=\"OnFormNavigate($event)\"\n (DeleteRequested)=\"OnDeleteRequested()\"\n (FavoriteToggled)=\"OnFavoriteToggled()\"\n (HistoryRequested)=\"OnHistoryRequested()\"\n (ListManagementRequested)=\"OnListManagementRequested()\">\n\n <mj-form-panel-slot Entity=\"{{record.EntityInfo.Name}}\" Slot=\"before-fields\" [Record]=\"record\" [FormComponent]=\"this\" [FormContext]=\"formContext\"></mj-form-panel-slot>\n\n <!-- ========================================\n FIELD PANELS\n ======================================== -->\n <!-- Model & Provider Section -->\n <mj-collapsible-panel\n SectionKey=\"modelProvider\"\n SectionName=\"Model & Provider\"\n Icon=\"fa fa-cubes\"\n [Form]=\"this\"\n [FormContext]=\"formContext\">\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"ModelID\"\n Type=\"textbox\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n LinkType=\"Record\"\n ></mj-form-field>\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"VendorID\"\n Type=\"textbox\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n LinkType=\"Record\"\n ></mj-form-field>\n\n </mj-collapsible-panel>\n\n <!-- Validity & Processing Section -->\n <mj-collapsible-panel\n SectionKey=\"validityProcessing\"\n SectionName=\"Validity & Processing\"\n Icon=\"fa fa-calendar\"\n [Form]=\"this\"\n [FormContext]=\"formContext\">\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"StartedAt\"\n Type=\"datepicker\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n ></mj-form-field>\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"EndedAt\"\n Type=\"datepicker\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n ></mj-form-field>\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"Status\"\n Type=\"select\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n ></mj-form-field>\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"ProcessingType\"\n Type=\"select\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n ></mj-form-field>\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"Comments\"\n Type=\"textarea\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n ></mj-form-field>\n\n </mj-collapsible-panel>\n\n <!-- Pricing Details Section -->\n <mj-collapsible-panel\n SectionKey=\"pricingDetails\"\n SectionName=\"Pricing Details\"\n Icon=\"fa fa-dollar-sign\"\n [Form]=\"this\"\n [FormContext]=\"formContext\">\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"Currency\"\n Type=\"textbox\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n ></mj-form-field>\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"
|
|
95
|
+
args: [{ standalone: false, selector: 'gen-mjaimodelcost-form', template: "<mj-record-form-container [Record]=\"record\" [FormComponent]=\"this\"\n (Navigate)=\"OnFormNavigate($event)\"\n (DeleteRequested)=\"OnDeleteRequested()\"\n (FavoriteToggled)=\"OnFavoriteToggled()\"\n (HistoryRequested)=\"OnHistoryRequested()\"\n (ListManagementRequested)=\"OnListManagementRequested()\">\n\n <mj-form-panel-slot Entity=\"{{record.EntityInfo.Name}}\" Slot=\"before-fields\" [Record]=\"record\" [FormComponent]=\"this\" [FormContext]=\"formContext\"></mj-form-panel-slot>\n\n <!-- ========================================\n FIELD PANELS\n ======================================== -->\n <!-- Model & Provider Section -->\n <mj-collapsible-panel\n SectionKey=\"modelProvider\"\n SectionName=\"Model & Provider\"\n Icon=\"fa fa-cubes\"\n [Form]=\"this\"\n [FormContext]=\"formContext\">\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"ModelID\"\n Type=\"textbox\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n LinkType=\"Record\"\n ></mj-form-field>\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"VendorID\"\n Type=\"textbox\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n LinkType=\"Record\"\n ></mj-form-field>\n\n </mj-collapsible-panel>\n\n <!-- Validity & Processing Section -->\n <mj-collapsible-panel\n SectionKey=\"validityProcessing\"\n SectionName=\"Validity & Processing\"\n Icon=\"fa fa-calendar\"\n [Form]=\"this\"\n [FormContext]=\"formContext\">\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"StartedAt\"\n Type=\"datepicker\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n ></mj-form-field>\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"EndedAt\"\n Type=\"datepicker\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n ></mj-form-field>\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"Status\"\n Type=\"select\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n ></mj-form-field>\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"ProcessingType\"\n Type=\"select\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n ></mj-form-field>\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"Comments\"\n Type=\"textarea\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n ></mj-form-field>\n\n </mj-collapsible-panel>\n\n <!-- Pricing Details Section -->\n <mj-collapsible-panel\n SectionKey=\"pricingDetails\"\n SectionName=\"Pricing Details\"\n Icon=\"fa fa-dollar-sign\"\n [Form]=\"this\"\n [FormContext]=\"formContext\">\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"Currency\"\n Type=\"textbox\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n ></mj-form-field>\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"InputPricePerUnit\"\n Type=\"number\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n ></mj-form-field>\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"OutputPricePerUnit\"\n Type=\"number\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n ></mj-form-field>\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"UnitTypeID\"\n Type=\"textbox\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n LinkType=\"Record\"\n ></mj-form-field>\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"CacheReadPricePerUnit\"\n Type=\"number\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n ></mj-form-field>\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"CacheWritePricePerUnit\"\n Type=\"number\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n ></mj-form-field>\n\n </mj-collapsible-panel>\n\n <!-- System Metadata Section -->\n <mj-collapsible-panel\n SectionKey=\"systemMetadata\"\n SectionName=\"System Metadata\"\n Icon=\"fa fa-cog\"\n [Form]=\"this\"\n [FormContext]=\"formContext\">\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"__mj_CreatedAt\"\n Type=\"textbox\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n ></mj-form-field>\n <mj-form-field \n [Record]=\"record\"\n [ShowLabel]=\"true\"\n FieldName=\"__mj_UpdatedAt\"\n Type=\"textbox\"\n [EditMode]=\"EditMode\"\n [FormContext]=\"formContext\"\n ></mj-form-field>\n\n </mj-collapsible-panel>\n\n <mj-form-panel-slot Entity=\"{{record.EntityInfo.Name}}\" Slot=\"after-fields\" [Record]=\"record\" [FormComponent]=\"this\" [FormContext]=\"formContext\"></mj-form-panel-slot>\n\n <mj-form-panel-slot Entity=\"{{record.EntityInfo.Name}}\" Slot=\"after-related\" [Record]=\"record\" [FormComponent]=\"this\" [FormContext]=\"formContext\"></mj-form-panel-slot>\n</mj-record-form-container>\n " }]
|
|
98
96
|
}], null, null); })();
|
|
99
97
|
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(MJAIModelCostFormComponent, { className: "MJAIModelCostFormComponent", filePath: "src/lib/generated/Entities/MJAIModelCost/mjaimodelcost.form.component.ts", lineNumber: 12 }); })();
|
|
100
98
|
//# sourceMappingURL=mjaimodelcost.form.component.js.map
|