@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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execution-order sort for agent-run steps.
|
|
3
|
+
*
|
|
4
|
+
* The timeline paints `StartedAt` on every row, but it used to *list* rows by `__mj_CreatedAt`
|
|
5
|
+
* (when the fire-and-forget INSERT committed). Those clocks disagree for fast sibling steps —
|
|
6
|
+
* an Artifact Tool that ran in 1ms, then the next Execute Agent Prompt 2ms later, routinely
|
|
7
|
+
* persisted in the opposite order because different step entities save concurrently. Sorting
|
|
8
|
+
* on persist time therefore showed the tool *after* the prompt that consumed it.
|
|
9
|
+
*
|
|
10
|
+
* `StartedAt` is stamped in memory at create time and is the clock the UI already shows.
|
|
11
|
+
* `StepNumber` is the in-memory sequence and the tie-break when two steps share a millisecond
|
|
12
|
+
* (parallel `Promise.all` tool calls). Unstarted rows (null/invalid `StartedAt`) sort last,
|
|
13
|
+
* matching `get-agent-run-tree.sql` — T-SQL otherwise puts NULLs first.
|
|
14
|
+
*/
|
|
15
|
+
/** The two fields the execution-order sort reads. Deliberately not the full entity. */
|
|
16
|
+
export type AgentRunStepOrderFields = {
|
|
17
|
+
StartedAt?: Date | string | null;
|
|
18
|
+
StepNumber?: number | null;
|
|
19
|
+
};
|
|
20
|
+
/** Compare two steps by execution order: `StartedAt` ascending, then `StepNumber`. */
|
|
21
|
+
export declare function CompareAgentRunStepsByExecutionOrder(a: AgentRunStepOrderFields, b: AgentRunStepOrderFields): number;
|
|
22
|
+
/**
|
|
23
|
+
* Returns a new array of steps in execution order. Does not mutate the input — RunView
|
|
24
|
+
* results are shared with other consumers, and a sort in place would reorder their view too.
|
|
25
|
+
*/
|
|
26
|
+
export declare function SortAgentRunStepsByExecutionOrder<T extends AgentRunStepOrderFields>(steps: T[]): T[];
|
|
27
|
+
//# sourceMappingURL=agent-run-step-order.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-run-step-order.d.ts","sourceRoot":"","sources":["../../../../src/lib/custom/ai-agent-run/agent-run-step-order.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,uFAAuF;AACvF,MAAM,MAAM,uBAAuB,GAAG;IAClC,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,CAAC;AAcF,sFAAsF;AACtF,wBAAgB,oCAAoC,CAChD,CAAC,EAAE,uBAAuB,EAC1B,CAAC,EAAE,uBAAuB,GAC3B,MAAM,CAIR;AAED;;;GAGG;AACH,wBAAgB,iCAAiC,CAAC,CAAC,SAAS,uBAAuB,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAEpG"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Execution-order sort for agent-run steps.
|
|
3
|
+
*
|
|
4
|
+
* The timeline paints `StartedAt` on every row, but it used to *list* rows by `__mj_CreatedAt`
|
|
5
|
+
* (when the fire-and-forget INSERT committed). Those clocks disagree for fast sibling steps —
|
|
6
|
+
* an Artifact Tool that ran in 1ms, then the next Execute Agent Prompt 2ms later, routinely
|
|
7
|
+
* persisted in the opposite order because different step entities save concurrently. Sorting
|
|
8
|
+
* on persist time therefore showed the tool *after* the prompt that consumed it.
|
|
9
|
+
*
|
|
10
|
+
* `StartedAt` is stamped in memory at create time and is the clock the UI already shows.
|
|
11
|
+
* `StepNumber` is the in-memory sequence and the tie-break when two steps share a millisecond
|
|
12
|
+
* (parallel `Promise.all` tool calls). Unstarted rows (null/invalid `StartedAt`) sort last,
|
|
13
|
+
* matching `get-agent-run-tree.sql` — T-SQL otherwise puts NULLs first.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Milliseconds of `StartedAt`, or +∞ when the step has not started / cannot be parsed.
|
|
17
|
+
*
|
|
18
|
+
* +∞, not 0: an unstarted row has no place among work that did run, and 0 would pin it at
|
|
19
|
+
* the epoch — the same class of lie the timeline used to render with a max-Date sentinel.
|
|
20
|
+
*/
|
|
21
|
+
function startedAtMs(value) {
|
|
22
|
+
if (value == null || value === '')
|
|
23
|
+
return Number.POSITIVE_INFINITY;
|
|
24
|
+
const ms = value instanceof Date ? value.getTime() : new Date(value).getTime();
|
|
25
|
+
return Number.isNaN(ms) ? Number.POSITIVE_INFINITY : ms;
|
|
26
|
+
}
|
|
27
|
+
/** Compare two steps by execution order: `StartedAt` ascending, then `StepNumber`. */
|
|
28
|
+
export function CompareAgentRunStepsByExecutionOrder(a, b) {
|
|
29
|
+
const byStart = startedAtMs(a.StartedAt) - startedAtMs(b.StartedAt);
|
|
30
|
+
if (byStart !== 0)
|
|
31
|
+
return byStart;
|
|
32
|
+
return (a.StepNumber ?? 0) - (b.StepNumber ?? 0);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Returns a new array of steps in execution order. Does not mutate the input — RunView
|
|
36
|
+
* results are shared with other consumers, and a sort in place would reorder their view too.
|
|
37
|
+
*/
|
|
38
|
+
export function SortAgentRunStepsByExecutionOrder(steps) {
|
|
39
|
+
return [...steps].sort(CompareAgentRunStepsByExecutionOrder);
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=agent-run-step-order.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-run-step-order.js","sourceRoot":"","sources":["../../../../src/lib/custom/ai-agent-run/agent-run-step-order.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAQH;;;;;GAKG;AACH,SAAS,WAAW,CAAC,KAAuC;IACxD,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,MAAM,CAAC,iBAAiB,CAAC;IACnE,MAAM,EAAE,GAAG,KAAK,YAAY,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;IAC/E,OAAO,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAAC;AAC5D,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,oCAAoC,CAChD,CAA0B,EAC1B,CAA0B;IAE1B,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACpE,IAAI,OAAO,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC;IAClC,OAAO,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,CAAC;AACrD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iCAAiC,CAAoC,KAAU;IAC3F,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;AACjE,CAAC","sourcesContent":["/**\n * Execution-order sort for agent-run steps.\n *\n * The timeline paints `StartedAt` on every row, but it used to *list* rows by `__mj_CreatedAt`\n * (when the fire-and-forget INSERT committed). Those clocks disagree for fast sibling steps —\n * an Artifact Tool that ran in 1ms, then the next Execute Agent Prompt 2ms later, routinely\n * persisted in the opposite order because different step entities save concurrently. Sorting\n * on persist time therefore showed the tool *after* the prompt that consumed it.\n *\n * `StartedAt` is stamped in memory at create time and is the clock the UI already shows.\n * `StepNumber` is the in-memory sequence and the tie-break when two steps share a millisecond\n * (parallel `Promise.all` tool calls). Unstarted rows (null/invalid `StartedAt`) sort last,\n * matching `get-agent-run-tree.sql` — T-SQL otherwise puts NULLs first.\n */\n\n/** The two fields the execution-order sort reads. Deliberately not the full entity. */\nexport type AgentRunStepOrderFields = {\n StartedAt?: Date | string | null;\n StepNumber?: number | null;\n};\n\n/**\n * Milliseconds of `StartedAt`, or +∞ when the step has not started / cannot be parsed.\n *\n * +∞, not 0: an unstarted row has no place among work that did run, and 0 would pin it at\n * the epoch — the same class of lie the timeline used to render with a max-Date sentinel.\n */\nfunction startedAtMs(value: Date | string | null | undefined): number {\n if (value == null || value === '') return Number.POSITIVE_INFINITY;\n const ms = value instanceof Date ? value.getTime() : new Date(value).getTime();\n return Number.isNaN(ms) ? Number.POSITIVE_INFINITY : ms;\n}\n\n/** Compare two steps by execution order: `StartedAt` ascending, then `StepNumber`. */\nexport function CompareAgentRunStepsByExecutionOrder(\n a: AgentRunStepOrderFields,\n b: AgentRunStepOrderFields,\n): number {\n const byStart = startedAtMs(a.StartedAt) - startedAtMs(b.StartedAt);\n if (byStart !== 0) return byStart;\n return (a.StepNumber ?? 0) - (b.StepNumber ?? 0);\n}\n\n/**\n * Returns a new array of steps in execution order. Does not mutate the input — RunView\n * results are shared with other consumers, and a sort in place would reorder their view too.\n */\nexport function SortAgentRunStepsByExecutionOrder<T extends AgentRunStepOrderFields>(steps: T[]): T[] {\n return [...steps].sort(CompareAgentRunStepsByExecutionOrder);\n}\n"]}
|
|
@@ -141,7 +141,6 @@ export declare class AIAgentRunAnalyticsComponent extends BaseAngularComponent i
|
|
|
141
141
|
agentRun: SimpleAgentRun | null;
|
|
142
142
|
allPromptRuns: MJAIPromptRunEntity[];
|
|
143
143
|
private cacheRates;
|
|
144
|
-
private static readonly UNIT_DIVISORS;
|
|
145
144
|
allActionLogs: SimpleActionLog[];
|
|
146
145
|
allSteps: SimpleAgentRunStep[];
|
|
147
146
|
subAgentRuns: SimpleAgentRun[];
|
|
@@ -185,7 +184,13 @@ export declare class AIAgentRunAnalyticsComponent extends BaseAngularComponent i
|
|
|
185
184
|
private initializeTimelineMetrics;
|
|
186
185
|
/** Stable rate-map key for a model+vendor pair. */
|
|
187
186
|
private rateKey;
|
|
188
|
-
/**
|
|
187
|
+
/**
|
|
188
|
+
* Load active realtime AIModelCost rates and normalize each to currency-per-token.
|
|
189
|
+
*
|
|
190
|
+
* The scale comes from the unit type's DriverClass, not its display name — the name is editable
|
|
191
|
+
* metadata (`Per 1M Tokens`) while the driver class is the contract the pricing drivers register
|
|
192
|
+
* under, so this cannot drift the way a hardcoded name table does.
|
|
193
|
+
*/
|
|
189
194
|
private loadCacheRates;
|
|
190
195
|
private calculatePromptMetrics;
|
|
191
196
|
private calculateActionMetrics;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-agent-run-analytics.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/custom/ai-agent-run/ai-agent-run-analytics.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,MAAM,EAAE,SAAS,EAAa,UAAU,EAAE,iBAAiB,EAAE,aAAa,EAA2B,MAAM,eAAe,CAAC;AAKtJ,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAoB,KAAK,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"ai-agent-run-analytics.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/custom/ai-agent-run/ai-agent-run-analytics.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,MAAM,EAAE,SAAS,EAAa,UAAU,EAAE,iBAAiB,EAAE,aAAa,EAA2B,MAAM,eAAe,CAAC;A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M,GAAG,MAAM;IAuBpC,OAAO,CAAC,iCAAiC;IAqEzC,OAAO,CAAC,kCAAkC;IA+H1C,OAAO,CAAC,iCAAiC;IAkFzC,OAAO,CAAC,4BAA4B;IAoGpC;;OAEG;YACW,iBAAiB;IAyB/B;;;OAGG;YACW,iBAAiB;IAqC/B;;OAEG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,GAAG,CAAA;KAAE,GAAG,MAAM;IAIpE;;OAEG;IACH,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM;IAIrF;;OAEG;IACH,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM;yCA3vDxC,4BAA4B;2CAA5B,4BAA4B;CA8vDxC"}
|
|
@@ -3,6 +3,7 @@ import { Subject } from 'rxjs';
|
|
|
3
3
|
import { RunView } from '@memberjunction/core';
|
|
4
4
|
import { UUIDsEqual, NormalizeUUID } from '@memberjunction/global';
|
|
5
5
|
import { WalkAgentRunTree } from '@memberjunction/ai-core-plus';
|
|
6
|
+
import { TOKEN_PRICE_UNIT_TYPE_DIVISORS } from '@memberjunction/ai-engine-base';
|
|
6
7
|
import * as d3 from 'd3';
|
|
7
8
|
import { BaseAngularComponent } from '@memberjunction/ng-base-types';
|
|
8
9
|
import * as i0 from "@angular/core";
|
|
@@ -891,9 +892,6 @@ export class AIAgentRunAnalyticsComponent extends BaseAngularComponent {
|
|
|
891
892
|
this.activeTimeouts.splice(index, 1);
|
|
892
893
|
}
|
|
893
894
|
}
|
|
894
|
-
static { this.UNIT_DIVISORS = {
|
|
895
|
-
'Per Million Tokens': 1_000_000, 'Per Hundred Thousand Tokens': 100_000, 'Per Thousand Tokens': 1_000
|
|
896
|
-
}; }
|
|
897
895
|
constructor(cdr, costService) {
|
|
898
896
|
super();
|
|
899
897
|
this.cdr = cdr;
|
|
@@ -1148,20 +1146,49 @@ export class AIAgentRunAnalyticsComponent extends BaseAngularComponent {
|
|
|
1148
1146
|
rateKey(modelID, vendorID) {
|
|
1149
1147
|
return `${NormalizeUUID(modelID ?? '')}|${NormalizeUUID(vendorID ?? '')}`;
|
|
1150
1148
|
}
|
|
1151
|
-
/**
|
|
1149
|
+
/**
|
|
1150
|
+
* Load active realtime AIModelCost rates and normalize each to currency-per-token.
|
|
1151
|
+
*
|
|
1152
|
+
* The scale comes from the unit type's DriverClass, not its display name — the name is editable
|
|
1153
|
+
* metadata (`Per 1M Tokens`) while the driver class is the contract the pricing drivers register
|
|
1154
|
+
* under, so this cannot drift the way a hardcoded name table does.
|
|
1155
|
+
*/
|
|
1152
1156
|
async loadCacheRates() {
|
|
1153
1157
|
this.cacheRates.clear();
|
|
1154
1158
|
const rv = RunView.FromMetadataProvider(this.ProviderToUse);
|
|
1155
|
-
const res = await rv.
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1159
|
+
const [res, unitTypeRes] = await rv.RunViews([
|
|
1160
|
+
{
|
|
1161
|
+
EntityName: 'MJ: AI Model Costs',
|
|
1162
|
+
ExtraFilter: `Status='Active' AND ProcessingType='Realtime'`,
|
|
1163
|
+
Fields: ['ModelID', 'VendorID', 'InputPricePerUnit', 'OutputPricePerUnit', 'CacheReadPricePerUnit', 'CacheWritePricePerUnit', 'UnitTypeID'],
|
|
1164
|
+
ResultType: 'simple'
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
EntityName: 'MJ: AI Model Price Unit Types',
|
|
1168
|
+
Fields: ['ID', 'DriverClass'],
|
|
1169
|
+
ResultType: 'simple'
|
|
1170
|
+
}
|
|
1171
|
+
]);
|
|
1161
1172
|
if (!res.Success)
|
|
1162
1173
|
return;
|
|
1174
|
+
// The sibling view gets the same treatment for the same reason. Without the driver classes
|
|
1175
|
+
// every rate row hits the `continue` below and the panel shows a confident zero rather than an
|
|
1176
|
+
// error — the failure mode most likely to be believed.
|
|
1177
|
+
if (unitTypeRes && !unitTypeRes.Success) {
|
|
1178
|
+
console.error('AI Agent Run analytics: price unit types failed to load; token rates will be empty. ' +
|
|
1179
|
+
unitTypeRes.ErrorMessage);
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
const driverClassByUnitType = new Map((unitTypeRes?.Results || []).filter(u => u.DriverClass).map(u => [NormalizeUUID(u.ID), u.DriverClass]));
|
|
1163
1183
|
for (const row of res.Results || []) {
|
|
1164
|
-
const
|
|
1184
|
+
const driverClass = driverClassByUnitType.get(NormalizeUUID(row.UnitTypeID ?? ''));
|
|
1185
|
+
const divisor = TOKEN_PRICE_UNIT_TYPE_DIVISORS[driverClass ?? ''];
|
|
1186
|
+
if (divisor === undefined) {
|
|
1187
|
+
// A non-token unit type (per minute/hour/image), or one this build has no driver for.
|
|
1188
|
+
// Defaulting to the per-1M-token divisor would divide an hourly audio rate by a million
|
|
1189
|
+
// and report token rates that are noise.
|
|
1190
|
+
continue;
|
|
1191
|
+
}
|
|
1165
1192
|
const input = (row.InputPricePerUnit ?? 0) / divisor;
|
|
1166
1193
|
this.cacheRates.set(this.rateKey(row.ModelID, row.VendorID), {
|
|
1167
1194
|
inputRate: input,
|
|
@@ -2398,5 +2425,5 @@ export class AIAgentRunAnalyticsComponent extends BaseAngularComponent {
|
|
|
2398
2425
|
type: ViewChild,
|
|
2399
2426
|
args: ['promptCountByNameChart', { static: false }]
|
|
2400
2427
|
}] }); })();
|
|
2401
|
-
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(AIAgentRunAnalyticsComponent, { className: "AIAgentRunAnalyticsComponent", filePath: "src/lib/custom/ai-agent-run/ai-agent-run-analytics.component.ts", lineNumber:
|
|
2428
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(AIAgentRunAnalyticsComponent, { className: "AIAgentRunAnalyticsComponent", filePath: "src/lib/custom/ai-agent-run/ai-agent-run-analytics.component.ts", lineNumber: 84 }); })();
|
|
2402
2429
|
//# sourceMappingURL=ai-agent-run-analytics.component.js.map
|