ngx-core-components 0.3.25 → 0.3.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +85 -0
- package/charts/agentic-cognitive-topology/agentic-cognitive-topology.component.d.ts +71 -4
- package/charts/shared/chart-export-menu.component.d.ts +6 -0
- package/fesm2022/ngx-core-components-charts.mjs +709 -130
- package/fesm2022/ngx-core-components-charts.mjs.map +1 -1
- package/fesm2022/ngx-core-components-grid.mjs +282 -54
- package/fesm2022/ngx-core-components-grid.mjs.map +1 -1
- package/fesm2022/ngx-core-components-views.mjs +8 -1
- package/fesm2022/ngx-core-components-views.mjs.map +1 -1
- package/grid/data-grid/data-grid.component.d.ts +14 -1
- package/grid/data-grid/grid-export.service.d.ts +4 -7
- package/package.json +1 -1
- package/views/virtual-list/virtual-list.component.d.ts +2 -3
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, PLATFORM_ID, Injectable, input, output, signal, HostListener, ChangeDetectionStrategy, Component, viewChild, computed, ElementRef, DestroyRef, effect } from '@angular/core';
|
|
2
|
+
import { inject, PLATFORM_ID, Injectable, input, output, signal, viewChildren, HostListener, ChangeDetectionStrategy, Component, viewChild, computed, ElementRef, DestroyRef, effect } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { DOCUMENT, isPlatformBrowser, NgTemplateOutlet, CommonModule, DecimalPipe, UpperCasePipe } from '@angular/common';
|
|
5
5
|
import { NGX_CORE_I18N } from 'ngx-core-components/i18n';
|
|
6
|
+
import * as i2 from '@angular/forms';
|
|
7
|
+
import { FormsModule } from '@angular/forms';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* ChartExportService — SSR-safe chart data and image export.
|
|
@@ -147,12 +149,17 @@ class ChartExportMenuComponent {
|
|
|
147
149
|
formats = input(['json', 'csv', 'svg', 'pdf']);
|
|
148
150
|
exportClicked = output();
|
|
149
151
|
isOpen = signal(false);
|
|
152
|
+
focusedIndex = signal(-1);
|
|
153
|
+
menuBtns = viewChildren('menuBtn');
|
|
150
154
|
toggle(event) {
|
|
151
155
|
event.stopPropagation();
|
|
152
|
-
this.isOpen
|
|
156
|
+
const nextVal = !this.isOpen();
|
|
157
|
+
this.isOpen.set(nextVal);
|
|
158
|
+
this.focusedIndex.set(-1);
|
|
153
159
|
}
|
|
154
160
|
select(fmt) {
|
|
155
161
|
this.isOpen.set(false);
|
|
162
|
+
this.focusedIndex.set(-1);
|
|
156
163
|
this.exportClicked.emit(fmt);
|
|
157
164
|
}
|
|
158
165
|
formatIcon(fmt) {
|
|
@@ -164,15 +171,40 @@ class ChartExportMenuComponent {
|
|
|
164
171
|
};
|
|
165
172
|
return icons[fmt] ?? '📁';
|
|
166
173
|
}
|
|
174
|
+
onArrowDown(event) {
|
|
175
|
+
if (!this.isOpen())
|
|
176
|
+
return;
|
|
177
|
+
event.preventDefault();
|
|
178
|
+
this.navigate(1);
|
|
179
|
+
}
|
|
180
|
+
onArrowUp(event) {
|
|
181
|
+
if (!this.isOpen())
|
|
182
|
+
return;
|
|
183
|
+
event.preventDefault();
|
|
184
|
+
this.navigate(-1);
|
|
185
|
+
}
|
|
186
|
+
navigate(direction) {
|
|
187
|
+
const list = this.formats();
|
|
188
|
+
if (list.length === 0)
|
|
189
|
+
return;
|
|
190
|
+
const nextIdx = (this.focusedIndex() + direction + list.length) % list.length;
|
|
191
|
+
this.focusedIndex.set(nextIdx);
|
|
192
|
+
const buttons = this.menuBtns();
|
|
193
|
+
if (buttons && buttons[nextIdx]) {
|
|
194
|
+
buttons[nextIdx].nativeElement.focus();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
167
197
|
closeOnOutsideClick() {
|
|
168
198
|
this.isOpen.set(false);
|
|
199
|
+
this.focusedIndex.set(-1);
|
|
169
200
|
}
|
|
170
201
|
closeOnEscape() {
|
|
171
202
|
this.isOpen.set(false);
|
|
203
|
+
this.focusedIndex.set(-1);
|
|
172
204
|
}
|
|
173
205
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: ChartExportMenuComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
174
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: ChartExportMenuComponent, isStandalone: true, selector: "ngx-chart-export-menu", inputs: { formats: { classPropertyName: "formats", publicName: "formats", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { exportClicked: "exportClicked" }, host: { listeners: { "document:click": "closeOnOutsideClick()", "document:keydown.escape": "closeOnEscape()" } }, ngImport: i0, template: `
|
|
175
|
-
<div class="chart-export-menu">
|
|
206
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: ChartExportMenuComponent, isStandalone: true, selector: "ngx-chart-export-menu", inputs: { formats: { classPropertyName: "formats", publicName: "formats", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { exportClicked: "exportClicked" }, host: { listeners: { "document:click": "closeOnOutsideClick()", "document:keydown.escape": "closeOnEscape()" } }, viewQueries: [{ propertyName: "menuBtns", predicate: ["menuBtn"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
207
|
+
<div class="chart-export-menu" (keydown.arrowdown)="onArrowDown($event)" (keydown.arrowup)="onArrowUp($event)">
|
|
176
208
|
<button
|
|
177
209
|
class="export-trigger"
|
|
178
210
|
(click)="toggle($event)"
|
|
@@ -186,8 +218,9 @@ class ChartExportMenuComponent {
|
|
|
186
218
|
|
|
187
219
|
@if (isOpen()) {
|
|
188
220
|
<div class="export-dropdown" role="menu">
|
|
189
|
-
@for (fmt of formats(); track fmt) {
|
|
221
|
+
@for (fmt of formats(); track fmt; let i = $index) {
|
|
190
222
|
<button
|
|
223
|
+
#menuBtn
|
|
191
224
|
type="button"
|
|
192
225
|
role="menuitem"
|
|
193
226
|
(click)="select(fmt)"
|
|
@@ -203,7 +236,7 @@ class ChartExportMenuComponent {
|
|
|
203
236
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: ChartExportMenuComponent, decorators: [{
|
|
204
237
|
type: Component,
|
|
205
238
|
args: [{ selector: 'ngx-chart-export-menu', standalone: true, imports: [], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
206
|
-
<div class="chart-export-menu">
|
|
239
|
+
<div class="chart-export-menu" (keydown.arrowdown)="onArrowDown($event)" (keydown.arrowup)="onArrowUp($event)">
|
|
207
240
|
<button
|
|
208
241
|
class="export-trigger"
|
|
209
242
|
(click)="toggle($event)"
|
|
@@ -217,8 +250,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
217
250
|
|
|
218
251
|
@if (isOpen()) {
|
|
219
252
|
<div class="export-dropdown" role="menu">
|
|
220
|
-
@for (fmt of formats(); track fmt) {
|
|
253
|
+
@for (fmt of formats(); track fmt; let i = $index) {
|
|
221
254
|
<button
|
|
255
|
+
#menuBtn
|
|
222
256
|
type="button"
|
|
223
257
|
role="menuitem"
|
|
224
258
|
(click)="select(fmt)"
|
|
@@ -35041,14 +35075,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
35041
35075
|
}] } });
|
|
35042
35076
|
|
|
35043
35077
|
class AgenticCognitiveTopologyComponent {
|
|
35078
|
+
exportSvc = inject(ChartExportService);
|
|
35044
35079
|
nodes = input.required();
|
|
35045
35080
|
links = input.required();
|
|
35046
35081
|
width = input(650);
|
|
35047
35082
|
height = input(450);
|
|
35048
35083
|
colors = input(CHART_COLORS);
|
|
35049
35084
|
showExport = input(true);
|
|
35085
|
+
// Interactive Editor Inputs
|
|
35086
|
+
editable = input(false);
|
|
35087
|
+
gridSize = input(20);
|
|
35050
35088
|
nodeActionClick = output();
|
|
35051
35089
|
nodePositionChange = output();
|
|
35090
|
+
// Interactive Editor Outputs
|
|
35091
|
+
nodesChange = output();
|
|
35092
|
+
linksChange = output();
|
|
35093
|
+
validationError = output();
|
|
35052
35094
|
// State
|
|
35053
35095
|
exportMenuOpen = signal(false);
|
|
35054
35096
|
tooltipData = signal(null);
|
|
@@ -35065,16 +35107,50 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35065
35107
|
translateY = signal(0);
|
|
35066
35108
|
isPanning = signal(false);
|
|
35067
35109
|
zoomPercent = computed(() => Math.round(this.scale() * 100));
|
|
35068
|
-
transformString = computed(() => `translate(${this.translateX()}
|
|
35110
|
+
transformString = computed(() => `translate(${this.translateX()}, ${this.translateY()}) scale(${this.scale()})`);
|
|
35069
35111
|
startX = 0;
|
|
35070
35112
|
startY = 0;
|
|
35071
35113
|
svgEl = viewChild('svgEl');
|
|
35072
35114
|
// Node Dimensions
|
|
35073
35115
|
nodeWidth = 135;
|
|
35074
35116
|
nodeHeight = 55;
|
|
35117
|
+
// Interactive Editor State Signals
|
|
35118
|
+
activeEditingNode = signal(null);
|
|
35119
|
+
activePortDrag = signal(null);
|
|
35120
|
+
portDragCurrentMouse = signal(null);
|
|
35121
|
+
snapToGridActive = signal(true);
|
|
35122
|
+
undoStack = signal([]);
|
|
35123
|
+
redoStack = signal([]);
|
|
35124
|
+
// Functional Overrides to avoid syncing state anomalies
|
|
35125
|
+
addedNodes = signal([]);
|
|
35126
|
+
deletedNodeIds = signal(new Set());
|
|
35127
|
+
editedNodesMap = signal(new Map());
|
|
35128
|
+
addedLinks = signal([]);
|
|
35129
|
+
deletedLinks = signal(new Set());
|
|
35130
|
+
// Merge functional state signals reactively
|
|
35131
|
+
effectiveNodes = computed(() => {
|
|
35132
|
+
const base = this.nodes();
|
|
35133
|
+
const added = this.addedNodes();
|
|
35134
|
+
const deleted = this.deletedNodeIds();
|
|
35135
|
+
const edited = this.editedNodesMap();
|
|
35136
|
+
let combined = [...base, ...added];
|
|
35137
|
+
combined = combined.filter(n => !deleted.has(n.id));
|
|
35138
|
+
combined = combined.map(n => edited.has(n.id) ? edited.get(n.id) : n);
|
|
35139
|
+
return combined;
|
|
35140
|
+
});
|
|
35141
|
+
effectiveLinks = computed(() => {
|
|
35142
|
+
const base = this.links();
|
|
35143
|
+
const added = this.addedLinks();
|
|
35144
|
+
const deleted = this.deletedLinks();
|
|
35145
|
+
const deletedNodes = this.deletedNodeIds();
|
|
35146
|
+
let combined = [...base, ...added];
|
|
35147
|
+
combined = combined.filter(l => !deleted.has(`${l.source}-${l.target}`));
|
|
35148
|
+
combined = combined.filter(l => !deletedNodes.has(l.source) && !deletedNodes.has(l.target));
|
|
35149
|
+
return combined;
|
|
35150
|
+
});
|
|
35075
35151
|
/** Color map: maps lowercase node type string to a color from the colors input */
|
|
35076
35152
|
typeColorMap = computed(() => {
|
|
35077
|
-
const rawNodes = this.
|
|
35153
|
+
const rawNodes = this.effectiveNodes();
|
|
35078
35154
|
const c = this.colors();
|
|
35079
35155
|
const map = new Map();
|
|
35080
35156
|
let idx = 0;
|
|
@@ -35111,12 +35187,12 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35111
35187
|
});
|
|
35112
35188
|
}
|
|
35113
35189
|
activeAgentsCount = computed(() => {
|
|
35114
|
-
return this.
|
|
35190
|
+
return this.effectiveNodes().filter(n => n.status !== 'idle').length;
|
|
35115
35191
|
});
|
|
35116
35192
|
// Balanced Layered DAG layout algorithm calculated in-component
|
|
35117
35193
|
computedNodes = computed(() => {
|
|
35118
|
-
const rawNodes = this.
|
|
35119
|
-
const rawLinks = this.
|
|
35194
|
+
const rawNodes = this.effectiveNodes();
|
|
35195
|
+
const rawLinks = this.effectiveLinks();
|
|
35120
35196
|
const overrides = this.nodePositionOverrides();
|
|
35121
35197
|
if (!rawNodes.length)
|
|
35122
35198
|
return [];
|
|
@@ -35191,7 +35267,6 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35191
35267
|
const w = this.width();
|
|
35192
35268
|
const h = this.height();
|
|
35193
35269
|
// Map each group horizontally/vertically
|
|
35194
|
-
// Let's do a top-to-bottom layout
|
|
35195
35270
|
const levelsCount = maxDepth + 1;
|
|
35196
35271
|
const paddingY = 40;
|
|
35197
35272
|
const availableH = h - paddingY * 2;
|
|
@@ -35241,7 +35316,7 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35241
35316
|
});
|
|
35242
35317
|
computedLinks = computed(() => {
|
|
35243
35318
|
const nodes = this.computedNodes();
|
|
35244
|
-
const rawLinks = this.
|
|
35319
|
+
const rawLinks = this.effectiveLinks();
|
|
35245
35320
|
const nodeMap = new Map();
|
|
35246
35321
|
nodes.forEach(n => nodeMap.set(n.id, n));
|
|
35247
35322
|
return rawLinks.map(link => {
|
|
@@ -35325,9 +35400,48 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35325
35400
|
};
|
|
35326
35401
|
});
|
|
35327
35402
|
});
|
|
35403
|
+
// SVG port connection path trace (Cubic bezier curved connector from port center to mouse)
|
|
35404
|
+
temporaryDragLinkPath = computed(() => {
|
|
35405
|
+
const drag = this.activePortDrag();
|
|
35406
|
+
const mouse = this.portDragCurrentMouse();
|
|
35407
|
+
if (!drag || !mouse)
|
|
35408
|
+
return '';
|
|
35409
|
+
const x1 = drag.portX;
|
|
35410
|
+
const y1 = drag.portY;
|
|
35411
|
+
const x2 = mouse.x;
|
|
35412
|
+
const y2 = mouse.y;
|
|
35413
|
+
const cp1x = x1 + drag.dir[0] * 60;
|
|
35414
|
+
const cp1y = y1 + drag.dir[1] * 60;
|
|
35415
|
+
return `M ${x1} ${y1} C ${cp1x} ${cp1y}, ${cp1x} ${cp1y}, ${x2} ${y2}`;
|
|
35416
|
+
});
|
|
35417
|
+
// Validation report generator
|
|
35418
|
+
validationReport = computed(() => {
|
|
35419
|
+
const nodes = this.effectiveNodes();
|
|
35420
|
+
const links = this.effectiveLinks();
|
|
35421
|
+
const incoming = {};
|
|
35422
|
+
const outgoing = {};
|
|
35423
|
+
nodes.forEach(n => {
|
|
35424
|
+
incoming[n.id] = 0;
|
|
35425
|
+
outgoing[n.id] = 0;
|
|
35426
|
+
});
|
|
35427
|
+
links.forEach(l => {
|
|
35428
|
+
if (incoming[l.target] !== undefined)
|
|
35429
|
+
incoming[l.target]++;
|
|
35430
|
+
if (outgoing[l.source] !== undefined)
|
|
35431
|
+
outgoing[l.source]++;
|
|
35432
|
+
});
|
|
35433
|
+
const orphans = nodes.filter(n => incoming[n.id] === 0 && outgoing[n.id] === 0).map(n => n.id);
|
|
35434
|
+
const hasCycles = this.detectCyclesGlobal();
|
|
35435
|
+
return {
|
|
35436
|
+
orphans,
|
|
35437
|
+
hasCycles,
|
|
35438
|
+
isValid: orphans.length === 0 && !hasCycles
|
|
35439
|
+
};
|
|
35440
|
+
});
|
|
35328
35441
|
onNodeClick(node, event) {
|
|
35442
|
+
if (this.editable())
|
|
35443
|
+
return; // Don't trigger action tooltip menu in edit mode
|
|
35329
35444
|
event.stopPropagation();
|
|
35330
|
-
// Position tooltip right above or below node card, transformed by current scale and translation
|
|
35331
35445
|
const svg = this.svgEl()?.nativeElement;
|
|
35332
35446
|
if (!svg)
|
|
35333
35447
|
return;
|
|
@@ -35350,15 +35464,7 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35350
35464
|
this.nodeActionClick.emit({ nodeId, action });
|
|
35351
35465
|
this.closeTooltip();
|
|
35352
35466
|
}
|
|
35353
|
-
toggleExportMenu(event) {
|
|
35354
|
-
event.stopPropagation();
|
|
35355
|
-
this.exportMenuOpen.set(!this.exportMenuOpen());
|
|
35356
|
-
}
|
|
35357
|
-
closeExportMenu() {
|
|
35358
|
-
this.exportMenuOpen.set(false);
|
|
35359
|
-
}
|
|
35360
35467
|
onExport(type) {
|
|
35361
|
-
this.exportMenuOpen.set(false);
|
|
35362
35468
|
if (type === 'json')
|
|
35363
35469
|
this.exportToJson();
|
|
35364
35470
|
else if (type === 'csv')
|
|
@@ -35369,72 +35475,22 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35369
35475
|
this.exportToPdf();
|
|
35370
35476
|
}
|
|
35371
35477
|
exportToJson() {
|
|
35372
|
-
const payload = { nodes: this.
|
|
35373
|
-
|
|
35374
|
-
const link = document.createElement('a');
|
|
35375
|
-
link.href = URL.createObjectURL(blob);
|
|
35376
|
-
link.setAttribute('download', 'topology-flow-data.json');
|
|
35377
|
-
document.body.appendChild(link);
|
|
35378
|
-
link.click();
|
|
35379
|
-
document.body.removeChild(link);
|
|
35478
|
+
const payload = { nodes: this.effectiveNodes(), links: this.effectiveLinks() };
|
|
35479
|
+
this.exportSvc.downloadJson(payload, 'topology-flow-data.json');
|
|
35380
35480
|
}
|
|
35381
35481
|
exportToCsv() {
|
|
35382
|
-
|
|
35383
|
-
|
|
35384
|
-
|
|
35385
|
-
|
|
35386
|
-
const
|
|
35387
|
-
|
|
35388
|
-
link.href = URL.createObjectURL(blob);
|
|
35389
|
-
link.setAttribute('download', 'topology-flow-data.csv');
|
|
35390
|
-
document.body.appendChild(link);
|
|
35391
|
-
link.click();
|
|
35392
|
-
document.body.removeChild(link);
|
|
35482
|
+
const links = this.effectiveLinks();
|
|
35483
|
+
if (!links.length)
|
|
35484
|
+
return;
|
|
35485
|
+
const headers = ['Source', 'Target', 'Active'];
|
|
35486
|
+
const rows = links.map(l => [l.source, l.target, !!l.active ? 'true' : 'false']);
|
|
35487
|
+
this.exportSvc.downloadCsv(headers, rows, 'topology-flow-data.csv');
|
|
35393
35488
|
}
|
|
35394
35489
|
exportToSvg() {
|
|
35395
|
-
|
|
35396
|
-
if (!svg)
|
|
35397
|
-
return;
|
|
35398
|
-
const serializer = new XMLSerializer();
|
|
35399
|
-
let source = serializer.serializeToString(svg);
|
|
35400
|
-
if (!source.match(/^<svg[^>]+xmlns="http\:\/\/www\.w3\.org\/2000\/svg"/)) {
|
|
35401
|
-
source = source.replace(/^<svg/, '<svg xmlns="http://www.w3.org/2000/svg"');
|
|
35402
|
-
}
|
|
35403
|
-
source = '<?xml version="1.0" encoding="utf-8"?>\n' + source;
|
|
35404
|
-
const blob = new Blob([source], { type: 'image/svg+xml;charset=utf-8' });
|
|
35405
|
-
const link = document.createElement('a');
|
|
35406
|
-
link.href = URL.createObjectURL(blob);
|
|
35407
|
-
link.setAttribute('download', 'cognitive-topology.svg');
|
|
35408
|
-
document.body.appendChild(link);
|
|
35409
|
-
link.click();
|
|
35410
|
-
document.body.removeChild(link);
|
|
35490
|
+
this.exportSvc.downloadSvg(this.svgEl()?.nativeElement, 'cognitive-topology.svg');
|
|
35411
35491
|
}
|
|
35412
35492
|
exportToPdf() {
|
|
35413
|
-
|
|
35414
|
-
if (!svg)
|
|
35415
|
-
return;
|
|
35416
|
-
const printWindow = window.open('', '_blank');
|
|
35417
|
-
if (!printWindow)
|
|
35418
|
-
return;
|
|
35419
|
-
const svgString = new XMLSerializer().serializeToString(svg);
|
|
35420
|
-
printWindow.document.write(`
|
|
35421
|
-
<html>
|
|
35422
|
-
<head>
|
|
35423
|
-
<title>Export PDF</title>
|
|
35424
|
-
<style>
|
|
35425
|
-
body { margin: 0; display: flex; justify-content: center; align-items: center; height: 100vh; background: white; }
|
|
35426
|
-
svg { width: 100%; height: auto; }
|
|
35427
|
-
</style>
|
|
35428
|
-
</head>
|
|
35429
|
-
<body>
|
|
35430
|
-
${svgString}
|
|
35431
|
-
<script>
|
|
35432
|
-
window.onload = () => { window.print(); window.close(); };
|
|
35433
|
-
</script>
|
|
35434
|
-
</body>
|
|
35435
|
-
</html>
|
|
35436
|
-
`);
|
|
35437
|
-
printWindow.document.close();
|
|
35493
|
+
this.exportSvc.downloadPdf(this.svgEl()?.nativeElement, 'Chart Export', 'cognitive-topology.pdf');
|
|
35438
35494
|
}
|
|
35439
35495
|
// ── Color helpers ──
|
|
35440
35496
|
/** Returns the border color for a node, based on status (priority) or type (from colors input) */
|
|
@@ -35454,7 +35510,6 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35454
35510
|
const x1 = link.cp1X;
|
|
35455
35511
|
const x2 = link.cp2X;
|
|
35456
35512
|
const x3 = link.destX;
|
|
35457
|
-
// B(t) = (1-t)^3*P0 + 3*(1-t)^2*t*P1 + 3*(1-t)*t^2*P2 + t^3*P3
|
|
35458
35513
|
return Math.pow(1 - t, 3) * x0 + 3 * Math.pow(1 - t, 2) * t * x1 + 3 * (1 - t) * Math.pow(t, 2) * x2 + Math.pow(t, 3) * x3;
|
|
35459
35514
|
}
|
|
35460
35515
|
getMidpointY(link) {
|
|
@@ -35465,6 +35520,198 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35465
35520
|
const y3 = link.destY;
|
|
35466
35521
|
return Math.pow(1 - t, 3) * y0 + 3 * Math.pow(1 - t, 2) * t * y1 + 3 * (1 - t) * Math.pow(t, 2) * y2 + Math.pow(t, 3) * y3;
|
|
35467
35522
|
}
|
|
35523
|
+
// ── Undo/Redo & State History Snapshots ──
|
|
35524
|
+
saveHistory() {
|
|
35525
|
+
const snapshot = {
|
|
35526
|
+
addedNodes: [...this.addedNodes()],
|
|
35527
|
+
deletedNodeIds: new Set(this.deletedNodeIds()),
|
|
35528
|
+
editedNodesMap: new Map(this.editedNodesMap()),
|
|
35529
|
+
addedLinks: [...this.addedLinks()],
|
|
35530
|
+
deletedLinks: new Set(this.deletedLinks()),
|
|
35531
|
+
nodePositionOverrides: new Map(this.nodePositionOverrides())
|
|
35532
|
+
};
|
|
35533
|
+
this.undoStack.update(stack => [...stack, snapshot]);
|
|
35534
|
+
this.redoStack.set([]); // Clear redo stack on new action
|
|
35535
|
+
}
|
|
35536
|
+
applySnapshot(snap) {
|
|
35537
|
+
this.addedNodes.set(snap.addedNodes);
|
|
35538
|
+
this.deletedNodeIds.set(snap.deletedNodeIds);
|
|
35539
|
+
this.editedNodesMap.set(snap.editedNodesMap);
|
|
35540
|
+
this.addedLinks.set(snap.addedLinks);
|
|
35541
|
+
this.deletedLinks.set(snap.deletedLinks);
|
|
35542
|
+
this.nodePositionOverrides.set(snap.nodePositionOverrides);
|
|
35543
|
+
// Emit changes to parent
|
|
35544
|
+
this.nodesChange.emit(this.effectiveNodes());
|
|
35545
|
+
this.linksChange.emit(this.effectiveLinks());
|
|
35546
|
+
}
|
|
35547
|
+
undo() {
|
|
35548
|
+
const stack = this.undoStack();
|
|
35549
|
+
if (stack.length === 0)
|
|
35550
|
+
return;
|
|
35551
|
+
// Save current state to redo stack
|
|
35552
|
+
const current = {
|
|
35553
|
+
addedNodes: [...this.addedNodes()],
|
|
35554
|
+
deletedNodeIds: new Set(this.deletedNodeIds()),
|
|
35555
|
+
editedNodesMap: new Map(this.editedNodesMap()),
|
|
35556
|
+
addedLinks: [...this.addedLinks()],
|
|
35557
|
+
deletedLinks: new Set(this.deletedLinks()),
|
|
35558
|
+
nodePositionOverrides: new Map(this.nodePositionOverrides())
|
|
35559
|
+
};
|
|
35560
|
+
this.redoStack.update(rStack => [...rStack, current]);
|
|
35561
|
+
const previous = stack[stack.length - 1];
|
|
35562
|
+
this.undoStack.set(stack.slice(0, -1));
|
|
35563
|
+
this.applySnapshot(previous);
|
|
35564
|
+
}
|
|
35565
|
+
redo() {
|
|
35566
|
+
const rStack = this.redoStack();
|
|
35567
|
+
if (rStack.length === 0)
|
|
35568
|
+
return;
|
|
35569
|
+
// Save current state to undo stack
|
|
35570
|
+
const current = {
|
|
35571
|
+
addedNodes: [...this.addedNodes()],
|
|
35572
|
+
deletedNodeIds: new Set(this.deletedNodeIds()),
|
|
35573
|
+
editedNodesMap: new Map(this.editedNodesMap()),
|
|
35574
|
+
addedLinks: [...this.addedLinks()],
|
|
35575
|
+
deletedLinks: new Set(this.deletedLinks()),
|
|
35576
|
+
nodePositionOverrides: new Map(this.nodePositionOverrides())
|
|
35577
|
+
};
|
|
35578
|
+
this.undoStack.update(stack => [...stack, current]);
|
|
35579
|
+
const next = rStack[rStack.length - 1];
|
|
35580
|
+
this.redoStack.set(rStack.slice(0, -1));
|
|
35581
|
+
this.applySnapshot(next);
|
|
35582
|
+
}
|
|
35583
|
+
// Keyboard shortcut listener
|
|
35584
|
+
handleKeyDown(event) {
|
|
35585
|
+
if (!this.editable())
|
|
35586
|
+
return;
|
|
35587
|
+
const target = event.target;
|
|
35588
|
+
if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA') {
|
|
35589
|
+
return;
|
|
35590
|
+
}
|
|
35591
|
+
if (event.ctrlKey || event.metaKey) {
|
|
35592
|
+
if (event.key.toLowerCase() === 'z') {
|
|
35593
|
+
event.preventDefault();
|
|
35594
|
+
this.undo();
|
|
35595
|
+
}
|
|
35596
|
+
else if (event.key.toLowerCase() === 'y') {
|
|
35597
|
+
event.preventDefault();
|
|
35598
|
+
this.redo();
|
|
35599
|
+
}
|
|
35600
|
+
}
|
|
35601
|
+
}
|
|
35602
|
+
autoLayout() {
|
|
35603
|
+
this.saveHistory();
|
|
35604
|
+
this.nodePositionOverrides.set(new Map());
|
|
35605
|
+
// Clear manual x,y on any added nodes so they layout topological
|
|
35606
|
+
this.addedNodes.update(nodes => nodes.map(n => {
|
|
35607
|
+
const { x, y, ...rest } = n;
|
|
35608
|
+
return rest;
|
|
35609
|
+
}));
|
|
35610
|
+
this.nodesChange.emit(this.effectiveNodes());
|
|
35611
|
+
}
|
|
35612
|
+
addNode() {
|
|
35613
|
+
this.saveHistory();
|
|
35614
|
+
const nextId = 'node_' + Math.random().toString(36).substring(2, 8);
|
|
35615
|
+
const newNode = {
|
|
35616
|
+
id: nextId,
|
|
35617
|
+
label: 'New Agent',
|
|
35618
|
+
status: 'idle',
|
|
35619
|
+
type: 'agent',
|
|
35620
|
+
prompt: '',
|
|
35621
|
+
response: '',
|
|
35622
|
+
x: this.width() / 2 - this.translateX(),
|
|
35623
|
+
y: this.height() / 2 - this.translateY()
|
|
35624
|
+
};
|
|
35625
|
+
// Snapped default positioning
|
|
35626
|
+
const overrides = new Map(this.nodePositionOverrides());
|
|
35627
|
+
let x = newNode.x;
|
|
35628
|
+
let y = newNode.y;
|
|
35629
|
+
if (this.snapToGridActive()) {
|
|
35630
|
+
const grid = this.gridSize();
|
|
35631
|
+
x = Math.round(x / grid) * grid;
|
|
35632
|
+
y = Math.round(y / grid) * grid;
|
|
35633
|
+
}
|
|
35634
|
+
overrides.set(nextId, { x, y });
|
|
35635
|
+
this.nodePositionOverrides.set(overrides);
|
|
35636
|
+
this.addedNodes.update(nodes => [...nodes, newNode]);
|
|
35637
|
+
this.nodesChange.emit(this.effectiveNodes());
|
|
35638
|
+
}
|
|
35639
|
+
deleteNode(nodeId, event) {
|
|
35640
|
+
event.stopPropagation();
|
|
35641
|
+
this.saveHistory();
|
|
35642
|
+
const overrides = new Map(this.nodePositionOverrides());
|
|
35643
|
+
overrides.delete(nodeId);
|
|
35644
|
+
this.nodePositionOverrides.set(overrides);
|
|
35645
|
+
this.deletedNodeIds.update(set => {
|
|
35646
|
+
const copy = new Set(set);
|
|
35647
|
+
copy.add(nodeId);
|
|
35648
|
+
return copy;
|
|
35649
|
+
});
|
|
35650
|
+
this.nodesChange.emit(this.effectiveNodes());
|
|
35651
|
+
this.linksChange.emit(this.effectiveLinks());
|
|
35652
|
+
}
|
|
35653
|
+
deleteLink(source, target, event) {
|
|
35654
|
+
event.stopPropagation();
|
|
35655
|
+
this.saveHistory();
|
|
35656
|
+
const linkKey = `${source}-${target}`;
|
|
35657
|
+
this.deletedLinks.update(set => {
|
|
35658
|
+
const copy = new Set(set);
|
|
35659
|
+
copy.add(linkKey);
|
|
35660
|
+
return copy;
|
|
35661
|
+
});
|
|
35662
|
+
// Also remove from addedLinks if present
|
|
35663
|
+
this.addedLinks.update(links => links.filter(l => !(l.source === source && l.target === target)));
|
|
35664
|
+
this.linksChange.emit(this.effectiveLinks());
|
|
35665
|
+
}
|
|
35666
|
+
onNodeDblClick(node, event) {
|
|
35667
|
+
if (!this.editable())
|
|
35668
|
+
return;
|
|
35669
|
+
event.stopPropagation();
|
|
35670
|
+
this.activeEditingNode.set({ ...node });
|
|
35671
|
+
}
|
|
35672
|
+
saveNodeEdit() {
|
|
35673
|
+
const edited = this.activeEditingNode();
|
|
35674
|
+
if (!edited)
|
|
35675
|
+
return;
|
|
35676
|
+
this.saveHistory();
|
|
35677
|
+
this.editedNodesMap.update(map => {
|
|
35678
|
+
const copy = new Map(map);
|
|
35679
|
+
copy.set(edited.id, edited);
|
|
35680
|
+
return copy;
|
|
35681
|
+
});
|
|
35682
|
+
this.activeEditingNode.set(null);
|
|
35683
|
+
this.nodesChange.emit(this.effectiveNodes());
|
|
35684
|
+
}
|
|
35685
|
+
// ── Drag connection drawing logic ──
|
|
35686
|
+
onPortMouseDown(node, dir, event) {
|
|
35687
|
+
if (!this.editable())
|
|
35688
|
+
return;
|
|
35689
|
+
event.stopPropagation();
|
|
35690
|
+
event.preventDefault();
|
|
35691
|
+
const w = this.nodeWidth;
|
|
35692
|
+
const h = this.nodeHeight;
|
|
35693
|
+
let portX = node.x;
|
|
35694
|
+
let portY = node.y;
|
|
35695
|
+
if (dir[0] === 0 && dir[1] === -1) {
|
|
35696
|
+
portY -= h / 2;
|
|
35697
|
+
}
|
|
35698
|
+
else if (dir[0] === 0 && dir[1] === 1) {
|
|
35699
|
+
portY += h / 2;
|
|
35700
|
+
}
|
|
35701
|
+
else if (dir[0] === -1 && dir[1] === 0) {
|
|
35702
|
+
portX -= w / 2;
|
|
35703
|
+
}
|
|
35704
|
+
else if (dir[0] === 1 && dir[1] === 0) {
|
|
35705
|
+
portX += w / 2;
|
|
35706
|
+
}
|
|
35707
|
+
this.activePortDrag.set({
|
|
35708
|
+
nodeId: node.id,
|
|
35709
|
+
portX,
|
|
35710
|
+
portY,
|
|
35711
|
+
dir
|
|
35712
|
+
});
|
|
35713
|
+
this.portDragCurrentMouse.set({ x: portX, y: portY });
|
|
35714
|
+
}
|
|
35468
35715
|
// ── Node drag-to-reposition ──
|
|
35469
35716
|
onNodeMouseDown(node, event) {
|
|
35470
35717
|
if (event.button !== 0)
|
|
@@ -35476,24 +35723,24 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35476
35723
|
return;
|
|
35477
35724
|
const rect = svg.getBoundingClientRect();
|
|
35478
35725
|
const currentScale = this.scale();
|
|
35479
|
-
// Convert client coords to SVG-space coords
|
|
35480
35726
|
const svgX = (event.clientX - rect.left - this.translateX()) / currentScale;
|
|
35481
35727
|
const svgY = (event.clientY - rect.top - this.translateY()) / currentScale;
|
|
35482
35728
|
this.dragOffsetX = svgX - node.x;
|
|
35483
35729
|
this.dragOffsetY = svgY - node.y;
|
|
35484
35730
|
this.draggingNodeId.set(node.id);
|
|
35731
|
+
// Save history point before dragging start
|
|
35732
|
+
if (this.editable()) {
|
|
35733
|
+
this.saveHistory();
|
|
35734
|
+
}
|
|
35485
35735
|
}
|
|
35486
35736
|
// Zoom & Pan Mouse Interaction Event Handlers
|
|
35487
35737
|
onMouseDown(event) {
|
|
35488
|
-
// Only drag panning with left click
|
|
35489
35738
|
if (event.button !== 0)
|
|
35490
35739
|
return;
|
|
35491
|
-
|
|
35492
|
-
if (this.draggingNodeId())
|
|
35740
|
+
if (this.draggingNodeId() || this.activePortDrag())
|
|
35493
35741
|
return;
|
|
35494
|
-
// Ignore drags that originate on buttons, tooltips, or node cards
|
|
35495
35742
|
const target = event.target;
|
|
35496
|
-
if (target.closest('.node-group') || target.closest('.topology-tooltip') || target.closest('.zoom-controls') || target.closest('.chart-export-menu')) {
|
|
35743
|
+
if (target.closest('.node-group') || target.closest('.topology-tooltip') || target.closest('.zoom-controls') || target.closest('.chart-export-menu') || target.closest('.editor-toolbar') || target.closest('.modal-card')) {
|
|
35497
35744
|
return;
|
|
35498
35745
|
}
|
|
35499
35746
|
event.preventDefault();
|
|
@@ -35502,8 +35749,8 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35502
35749
|
this.startY = event.clientY - this.translateY();
|
|
35503
35750
|
}
|
|
35504
35751
|
onMouseMove(event) {
|
|
35505
|
-
// Node dragging takes priority over canvas panning
|
|
35506
35752
|
const dragId = this.draggingNodeId();
|
|
35753
|
+
const portDrag = this.activePortDrag();
|
|
35507
35754
|
if (dragId) {
|
|
35508
35755
|
const svg = this.svgEl()?.nativeElement;
|
|
35509
35756
|
if (!svg)
|
|
@@ -35514,11 +35761,29 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35514
35761
|
const svgY = (event.clientY - rect.top - this.translateY()) / currentScale;
|
|
35515
35762
|
const newX = svgX - this.dragOffsetX;
|
|
35516
35763
|
const newY = svgY - this.dragOffsetY;
|
|
35764
|
+
let x = newX;
|
|
35765
|
+
let y = newY;
|
|
35766
|
+
if (this.editable() && this.snapToGridActive()) {
|
|
35767
|
+
const grid = this.gridSize();
|
|
35768
|
+
x = Math.round(newX / grid) * grid;
|
|
35769
|
+
y = Math.round(newY / grid) * grid;
|
|
35770
|
+
}
|
|
35517
35771
|
const current = new Map(this.nodePositionOverrides());
|
|
35518
|
-
current.set(dragId, { x
|
|
35772
|
+
current.set(dragId, { x, y });
|
|
35519
35773
|
this.nodePositionOverrides.set(current);
|
|
35520
35774
|
return;
|
|
35521
35775
|
}
|
|
35776
|
+
if (portDrag) {
|
|
35777
|
+
const svg = this.svgEl()?.nativeElement;
|
|
35778
|
+
if (!svg)
|
|
35779
|
+
return;
|
|
35780
|
+
const rect = svg.getBoundingClientRect();
|
|
35781
|
+
const currentScale = this.scale();
|
|
35782
|
+
const svgX = (event.clientX - rect.left - this.translateX()) / currentScale;
|
|
35783
|
+
const svgY = (event.clientY - rect.top - this.translateY()) / currentScale;
|
|
35784
|
+
this.portDragCurrentMouse.set({ x: svgX, y: svgY });
|
|
35785
|
+
return;
|
|
35786
|
+
}
|
|
35522
35787
|
if (!this.isPanning())
|
|
35523
35788
|
return;
|
|
35524
35789
|
this.translateX.set(event.clientX - this.startX);
|
|
@@ -35526,6 +35791,7 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35526
35791
|
}
|
|
35527
35792
|
onMouseUp() {
|
|
35528
35793
|
const dragId = this.draggingNodeId();
|
|
35794
|
+
const portDrag = this.activePortDrag();
|
|
35529
35795
|
if (dragId) {
|
|
35530
35796
|
const pos = this.nodePositionOverrides().get(dragId);
|
|
35531
35797
|
if (pos) {
|
|
@@ -35534,6 +35800,33 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35534
35800
|
this.draggingNodeId.set(null);
|
|
35535
35801
|
return;
|
|
35536
35802
|
}
|
|
35803
|
+
if (portDrag) {
|
|
35804
|
+
const targetId = this.hoveredNodeId();
|
|
35805
|
+
const sourceId = portDrag.nodeId;
|
|
35806
|
+
if (targetId && targetId !== sourceId) {
|
|
35807
|
+
const introducesCycle = this.checkCycle(targetId, sourceId); // Cycles check
|
|
35808
|
+
const alreadyConnected = this.effectiveLinks().some(l => l.source === sourceId && l.target === targetId);
|
|
35809
|
+
if (alreadyConnected) {
|
|
35810
|
+
this.validationError.emit(`Connection already exists between ${sourceId} and ${targetId}.`);
|
|
35811
|
+
}
|
|
35812
|
+
else if (introducesCycle) {
|
|
35813
|
+
this.validationError.emit(`Cannot connect: introducing a cyclic dependency.`);
|
|
35814
|
+
}
|
|
35815
|
+
else {
|
|
35816
|
+
this.saveHistory();
|
|
35817
|
+
const newLink = {
|
|
35818
|
+
source: sourceId,
|
|
35819
|
+
target: targetId,
|
|
35820
|
+
active: false
|
|
35821
|
+
};
|
|
35822
|
+
this.addedLinks.update(links => [...links, newLink]);
|
|
35823
|
+
this.linksChange.emit(this.effectiveLinks());
|
|
35824
|
+
}
|
|
35825
|
+
}
|
|
35826
|
+
this.activePortDrag.set(null);
|
|
35827
|
+
this.portDragCurrentMouse.set(null);
|
|
35828
|
+
return;
|
|
35829
|
+
}
|
|
35537
35830
|
this.isPanning.set(false);
|
|
35538
35831
|
}
|
|
35539
35832
|
onMouseLeave() {
|
|
@@ -35545,6 +35838,8 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35545
35838
|
}
|
|
35546
35839
|
this.draggingNodeId.set(null);
|
|
35547
35840
|
}
|
|
35841
|
+
this.activePortDrag.set(null);
|
|
35842
|
+
this.portDragCurrentMouse.set(null);
|
|
35548
35843
|
this.isPanning.set(false);
|
|
35549
35844
|
this.hoveredNodeId.set(null);
|
|
35550
35845
|
}
|
|
@@ -35589,31 +35884,141 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35589
35884
|
this.translateX.set(0);
|
|
35590
35885
|
this.translateY.set(0);
|
|
35591
35886
|
}
|
|
35887
|
+
// ── DAG Helper validations ──
|
|
35888
|
+
checkCycle(start, target) {
|
|
35889
|
+
const links = this.effectiveLinks();
|
|
35890
|
+
const adj = {};
|
|
35891
|
+
this.effectiveNodes().forEach(n => adj[n.id] = []);
|
|
35892
|
+
links.forEach(l => {
|
|
35893
|
+
if (adj[l.source])
|
|
35894
|
+
adj[l.source].push(l.target);
|
|
35895
|
+
});
|
|
35896
|
+
const queue = [start];
|
|
35897
|
+
const visited = new Set();
|
|
35898
|
+
while (queue.length > 0) {
|
|
35899
|
+
const cur = queue.shift();
|
|
35900
|
+
if (cur === target)
|
|
35901
|
+
return true;
|
|
35902
|
+
if (visited.has(cur))
|
|
35903
|
+
continue;
|
|
35904
|
+
visited.add(cur);
|
|
35905
|
+
const neighbors = adj[cur] || [];
|
|
35906
|
+
for (const n of neighbors) {
|
|
35907
|
+
if (!visited.has(n)) {
|
|
35908
|
+
queue.push(n);
|
|
35909
|
+
}
|
|
35910
|
+
}
|
|
35911
|
+
}
|
|
35912
|
+
return false;
|
|
35913
|
+
}
|
|
35914
|
+
detectCyclesGlobal() {
|
|
35915
|
+
const nodes = this.effectiveNodes();
|
|
35916
|
+
const links = this.effectiveLinks();
|
|
35917
|
+
const adj = {};
|
|
35918
|
+
nodes.forEach(n => adj[n.id] = []);
|
|
35919
|
+
links.forEach(l => {
|
|
35920
|
+
if (adj[l.source])
|
|
35921
|
+
adj[l.source].push(l.target);
|
|
35922
|
+
});
|
|
35923
|
+
const visited = new Set();
|
|
35924
|
+
const recStack = new Set();
|
|
35925
|
+
const dfs = (nodeId) => {
|
|
35926
|
+
if (recStack.has(nodeId))
|
|
35927
|
+
return true;
|
|
35928
|
+
if (visited.has(nodeId))
|
|
35929
|
+
return false;
|
|
35930
|
+
visited.add(nodeId);
|
|
35931
|
+
recStack.add(nodeId);
|
|
35932
|
+
const neighbors = adj[nodeId] || [];
|
|
35933
|
+
for (const neighbor of neighbors) {
|
|
35934
|
+
if (dfs(neighbor))
|
|
35935
|
+
return true;
|
|
35936
|
+
}
|
|
35937
|
+
recStack.delete(nodeId);
|
|
35938
|
+
return false;
|
|
35939
|
+
};
|
|
35940
|
+
for (const node of nodes) {
|
|
35941
|
+
if (!visited.has(node.id)) {
|
|
35942
|
+
if (dfs(node.id))
|
|
35943
|
+
return true;
|
|
35944
|
+
}
|
|
35945
|
+
}
|
|
35946
|
+
return false;
|
|
35947
|
+
}
|
|
35948
|
+
exportWorkflowSchema() {
|
|
35949
|
+
const payload = {
|
|
35950
|
+
schemaVersion: "1.0.0",
|
|
35951
|
+
description: "Cognitive workflow schema exported from ngx-agentic-cognitive-topology",
|
|
35952
|
+
graph: {
|
|
35953
|
+
nodes: this.effectiveNodes().map(n => ({
|
|
35954
|
+
id: n.id,
|
|
35955
|
+
label: n.label,
|
|
35956
|
+
type: n.type || 'agent',
|
|
35957
|
+
metadata: {
|
|
35958
|
+
prompt: n.prompt || '',
|
|
35959
|
+
response: n.response || ''
|
|
35960
|
+
}
|
|
35961
|
+
})),
|
|
35962
|
+
edges: this.effectiveLinks().map(l => ({
|
|
35963
|
+
source: l.source,
|
|
35964
|
+
target: l.target,
|
|
35965
|
+
label: l.label || ''
|
|
35966
|
+
}))
|
|
35967
|
+
}
|
|
35968
|
+
};
|
|
35969
|
+
if (typeof navigator !== 'undefined' && navigator.clipboard) {
|
|
35970
|
+
navigator.clipboard.writeText(JSON.stringify(payload, null, 2))
|
|
35971
|
+
.then(() => this.validationError.emit("Workflow schema copied to clipboard!"))
|
|
35972
|
+
.catch(() => console.error("Clipboard copy failed"));
|
|
35973
|
+
}
|
|
35974
|
+
}
|
|
35592
35975
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AgenticCognitiveTopologyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
35593
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: AgenticCognitiveTopologyComponent, isStandalone: true, selector: "ngx-agentic-cognitive-topology", inputs: { nodes: { classPropertyName: "nodes", publicName: "nodes", isSignal: true, isRequired: true, transformFunction: null }, links: { classPropertyName: "links", publicName: "links", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, colors: { classPropertyName: "colors", publicName: "colors", isSignal: true, isRequired: false, transformFunction: null }, showExport: { classPropertyName: "showExport", publicName: "showExport", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { nodeActionClick: "nodeActionClick", nodePositionChange: "nodePositionChange" }, host: { listeners: { "document:
|
|
35976
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.20", type: AgenticCognitiveTopologyComponent, isStandalone: true, selector: "ngx-agentic-cognitive-topology", inputs: { nodes: { classPropertyName: "nodes", publicName: "nodes", isSignal: true, isRequired: true, transformFunction: null }, links: { classPropertyName: "links", publicName: "links", isSignal: true, isRequired: true, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, colors: { classPropertyName: "colors", publicName: "colors", isSignal: true, isRequired: false, transformFunction: null }, showExport: { classPropertyName: "showExport", publicName: "showExport", isSignal: true, isRequired: false, transformFunction: null }, editable: { classPropertyName: "editable", publicName: "editable", isSignal: true, isRequired: false, transformFunction: null }, gridSize: { classPropertyName: "gridSize", publicName: "gridSize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { nodeActionClick: "nodeActionClick", nodePositionChange: "nodePositionChange", nodesChange: "nodesChange", linksChange: "linksChange", validationError: "validationError" }, host: { listeners: { "document:keydown": "handleKeyDown($event)" } }, viewQueries: [{ propertyName: "svgEl", first: true, predicate: ["svgEl"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
35594
35977
|
<div class="ngx-topology-wrapper">
|
|
35595
35978
|
<div class="chart-header" (mousemove)="$event.stopPropagation()" (mouseleave)="closeTooltip()">
|
|
35596
35979
|
<div class="chart-title-space">
|
|
35597
35980
|
<div class="topology-title">Agentic Cognitive Topology (DAG)</div>
|
|
35598
35981
|
<div class="topology-subtitle">
|
|
35599
|
-
Active Agents: <span class="highlight-val">{{ activeAgentsCount() }}</span> / {{
|
|
35982
|
+
Active Agents: <span class="highlight-val">{{ activeAgentsCount() }}</span> / {{ effectiveNodes().length }}
|
|
35600
35983
|
</div>
|
|
35601
35984
|
</div>
|
|
35602
35985
|
@if (showExport()) {
|
|
35603
|
-
<
|
|
35604
|
-
<button class="export-trigger" (click)="toggleExportMenu($event)" aria-label="Export Menu">📤 Export</button>
|
|
35605
|
-
@if (exportMenuOpen()) {
|
|
35606
|
-
<div class="export-dropdown">
|
|
35607
|
-
<button (click)="onExport('json')">📊 Export JSON</button>
|
|
35608
|
-
<button (click)="onExport('csv')">📄 Export CSV</button>
|
|
35609
|
-
<button (click)="onExport('svg')">🖼️ Export SVG</button>
|
|
35610
|
-
<button (click)="onExport('pdf')">📕 Export PDF</button>
|
|
35611
|
-
</div>
|
|
35612
|
-
}
|
|
35613
|
-
</div>
|
|
35986
|
+
<ngx-chart-export-menu (exportClicked)="onExport($event)" />
|
|
35614
35987
|
}
|
|
35615
35988
|
</div>
|
|
35616
35989
|
|
|
35990
|
+
<!-- Editor Toolbar (Renders in Edit Mode) -->
|
|
35991
|
+
@if (editable()) {
|
|
35992
|
+
<div class="editor-toolbar">
|
|
35993
|
+
<div class="toolbar-section">
|
|
35994
|
+
<button class="tb-btn primary" (click)="addNode()" title="Add Node">➕ Add Agent</button>
|
|
35995
|
+
<span class="tb-divider"></span>
|
|
35996
|
+
<button class="tb-btn" [disabled]="undoStack().length === 0" (click)="undo()" title="Undo (Ctrl+Z)">↩️ Undo ({{ undoStack().length }})</button>
|
|
35997
|
+
<button class="tb-btn" [disabled]="redoStack().length === 0" (click)="redo()" title="Redo (Ctrl+Y)">↪️ Redo ({{ redoStack().length }})</button>
|
|
35998
|
+
<span class="tb-divider"></span>
|
|
35999
|
+
<button class="tb-btn" [class.active]="snapToGridActive()" (click)="snapToGridActive.set(!snapToGridActive())" title="Toggle Snap to Grid">
|
|
36000
|
+
🧲 Snap ({{ gridSize() }}px)
|
|
36001
|
+
</button>
|
|
36002
|
+
<button class="tb-btn" (click)="autoLayout()" title="Rearrange Nodes Automatically">
|
|
36003
|
+
🔀 Rearrange
|
|
36004
|
+
</button>
|
|
36005
|
+
</div>
|
|
36006
|
+
<div class="toolbar-section">
|
|
36007
|
+
<button class="tb-btn" (click)="exportWorkflowSchema()" title="Copy Workflow JSON Schema">📋 Copy JSON Flow</button>
|
|
36008
|
+
|
|
36009
|
+
<div class="validation-badge" [class.valid]="validationReport().isValid">
|
|
36010
|
+
@if (validationReport().isValid) {
|
|
36011
|
+
✅ DAG Solid
|
|
36012
|
+
} @else {
|
|
36013
|
+
⚠️ Warning:
|
|
36014
|
+
@if (validationReport().hasCycles) { Cycle detected! }
|
|
36015
|
+
@if (validationReport().orphans.length > 0) { Isolated nodes present! }
|
|
36016
|
+
}
|
|
36017
|
+
</div>
|
|
36018
|
+
</div>
|
|
36019
|
+
</div>
|
|
36020
|
+
}
|
|
36021
|
+
|
|
35617
36022
|
<div class="ngx-topology-container" [style.height.px]="height()">
|
|
35618
36023
|
<!-- SVG DAG Drawing Canvas -->
|
|
35619
36024
|
<svg
|
|
@@ -35626,7 +36031,7 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35626
36031
|
(mousemove)="onMouseMove($event)"
|
|
35627
36032
|
(mouseup)="onMouseUp()"
|
|
35628
36033
|
(mouseleave)="onMouseLeave()"
|
|
35629
|
-
[style.cursor]="draggingNodeId() ? 'grabbing' : isPanning() ? 'grabbing' : 'grab'"
|
|
36034
|
+
[style.cursor]="draggingNodeId() ? 'grabbing' : isPanning() ? 'grabbing' : activePortDrag() ? 'crosshair' : 'grab'"
|
|
35630
36035
|
>
|
|
35631
36036
|
<!-- Grid background dots -->
|
|
35632
36037
|
<defs>
|
|
@@ -35672,8 +36077,14 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35672
36077
|
class="topology-link-path"
|
|
35673
36078
|
/>
|
|
35674
36079
|
|
|
35675
|
-
<!--
|
|
35676
|
-
@if (
|
|
36080
|
+
<!-- Link Delete Button (Renders in Edit Mode) -->
|
|
36081
|
+
@if (editable()) {
|
|
36082
|
+
<g class="link-delete-btn" [attr.transform]="'translate(' + getMidpointX(link) + ',' + getMidpointY(link) + ')'" (click)="deleteLink(link.source, link.target, $event)">
|
|
36083
|
+
<circle r="7" fill="#ef4444" stroke="#ffffff" stroke-width="1.2" />
|
|
36084
|
+
<text text-anchor="middle" dominant-baseline="middle" fill="#ffffff" font-size="8" font-weight="900" y="-0.5">×</text>
|
|
36085
|
+
</g>
|
|
36086
|
+
} @else if (link.label) {
|
|
36087
|
+
<!-- Optional edge label -->
|
|
35677
36088
|
<text
|
|
35678
36089
|
class="edge-label"
|
|
35679
36090
|
[attr.x]="getMidpointX(link)"
|
|
@@ -35684,6 +36095,11 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35684
36095
|
}
|
|
35685
36096
|
}
|
|
35686
36097
|
|
|
36098
|
+
<!-- Temporary connector drawing edge (renders when dragging a port link) -->
|
|
36099
|
+
@if (temporaryDragLinkPath()) {
|
|
36100
|
+
<path [attr.d]="temporaryDragLinkPath()" class="temporary-drag-link" fill="none" />
|
|
36101
|
+
}
|
|
36102
|
+
|
|
35687
36103
|
<!-- Nodes rendering via foreignObject -->
|
|
35688
36104
|
@for (node of computedNodes(); track node.id) {
|
|
35689
36105
|
<g
|
|
@@ -35697,6 +36113,7 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35697
36113
|
[style.--node-translate]="'translate(' + (node.x - nodeWidth / 2) + 'px,' + (node.y - nodeHeight / 2) + 'px)'"
|
|
35698
36114
|
class="node-group"
|
|
35699
36115
|
(click)="onNodeClick(node, $event)"
|
|
36116
|
+
(dblclick)="onNodeDblClick(node, $event)"
|
|
35700
36117
|
(mousedown)="onNodeMouseDown(node, $event)"
|
|
35701
36118
|
(mouseenter)="hoveredNodeId.set(node.id)"
|
|
35702
36119
|
(mouseleave)="hoveredNodeId.set(null)"
|
|
@@ -35730,8 +36147,22 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35730
36147
|
</div>
|
|
35731
36148
|
</foreignObject>
|
|
35732
36149
|
|
|
36150
|
+
<!-- Connection Ports Handles (Renders in Edit Mode) -->
|
|
36151
|
+
@if (editable()) {
|
|
36152
|
+
<circle cx="67.5" cy="0" r="4" class="connection-port top" (mousedown)="onPortMouseDown(node, [0, -1], $event)" title="Drag connection" />
|
|
36153
|
+
<circle cx="67.5" cy="55" r="4" class="connection-port bottom" (mousedown)="onPortMouseDown(node, [0, 1], $event)" title="Drag connection" />
|
|
36154
|
+
<circle cx="0" cy="27.5" r="4" class="connection-port left" (mousedown)="onPortMouseDown(node, [-1, 0], $event)" title="Drag connection" />
|
|
36155
|
+
<circle cx="135" cy="27.5" r="4" class="connection-port right" (mousedown)="onPortMouseDown(node, [1, 0], $event)" title="Drag connection" />
|
|
36156
|
+
|
|
36157
|
+
<!-- Node Delete Badge -->
|
|
36158
|
+
<g class="node-delete-btn" transform="translate(132, 3)" (click)="deleteNode(node.id, $event)">
|
|
36159
|
+
<circle r="6" fill="#ef4444" stroke="#ffffff" stroke-width="1" />
|
|
36160
|
+
<text text-anchor="middle" dominant-baseline="middle" fill="#ffffff" font-size="8" font-weight="900" y="-0.5">×</text>
|
|
36161
|
+
</g>
|
|
36162
|
+
}
|
|
36163
|
+
|
|
35733
36164
|
<!-- Hover preview pill -->
|
|
35734
|
-
@if (hoveredNodeId() === node.id && !tooltipData()) {
|
|
36165
|
+
@if (!editable() && hoveredNodeId() === node.id && !tooltipData()) {
|
|
35735
36166
|
<foreignObject
|
|
35736
36167
|
[attr.x]="0"
|
|
35737
36168
|
[attr.y]="-28"
|
|
@@ -35789,36 +36220,108 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35789
36220
|
</div>
|
|
35790
36221
|
</div>
|
|
35791
36222
|
}
|
|
36223
|
+
|
|
36224
|
+
<!-- Glassmorphic Property Editor Modal -->
|
|
36225
|
+
@if (activeEditingNode(); as node) {
|
|
36226
|
+
<div class="modal-backdrop" (click)="activeEditingNode.set(null)">
|
|
36227
|
+
<div class="modal-card" (click)="$event.stopPropagation()">
|
|
36228
|
+
<div class="modal-header">
|
|
36229
|
+
<h3>Edit Agent Node</h3>
|
|
36230
|
+
<button class="modal-close" (click)="activeEditingNode.set(null)">×</button>
|
|
36231
|
+
</div>
|
|
36232
|
+
<div class="modal-body">
|
|
36233
|
+
<div class="form-group">
|
|
36234
|
+
<label>Agent Label</label>
|
|
36235
|
+
<input type="text" [(ngModel)]="node.label" placeholder="Enter label..." />
|
|
36236
|
+
</div>
|
|
36237
|
+
<div class="form-row">
|
|
36238
|
+
<div class="form-group half">
|
|
36239
|
+
<label>Type</label>
|
|
36240
|
+
<select [(ngModel)]="node.type">
|
|
36241
|
+
<option value="orchestrator">Orchestrator</option>
|
|
36242
|
+
<option value="agent">Agent</option>
|
|
36243
|
+
<option value="tool">Tool</option>
|
|
36244
|
+
<option value="critic">Critic</option>
|
|
36245
|
+
</select>
|
|
36246
|
+
</div>
|
|
36247
|
+
<div class="form-group half">
|
|
36248
|
+
<label>Status</label>
|
|
36249
|
+
<select [(ngModel)]="node.status">
|
|
36250
|
+
<option value="idle">Idle</option>
|
|
36251
|
+
<option value="thinking">Thinking</option>
|
|
36252
|
+
<option value="success">Success</option>
|
|
36253
|
+
<option value="error">Error</option>
|
|
36254
|
+
</select>
|
|
36255
|
+
</div>
|
|
36256
|
+
</div>
|
|
36257
|
+
<div class="form-group">
|
|
36258
|
+
<label>Prompt Template</label>
|
|
36259
|
+
<textarea [(ngModel)]="node.prompt" rows="3" placeholder="Define agent prompt rules..."></textarea>
|
|
36260
|
+
</div>
|
|
36261
|
+
<div class="form-group">
|
|
36262
|
+
<label>Latest Response</label>
|
|
36263
|
+
<textarea [(ngModel)]="node.response" rows="3" placeholder="Mock agent response..."></textarea>
|
|
36264
|
+
</div>
|
|
36265
|
+
</div>
|
|
36266
|
+
<div class="modal-footer">
|
|
36267
|
+
<button class="btn btn-secondary" (click)="activeEditingNode.set(null)">Cancel</button>
|
|
36268
|
+
<button class="btn btn-primary" (click)="saveNodeEdit()">Save Changes</button>
|
|
36269
|
+
</div>
|
|
36270
|
+
</div>
|
|
36271
|
+
</div>
|
|
36272
|
+
}
|
|
35792
36273
|
</div>
|
|
35793
36274
|
</div>
|
|
35794
|
-
`, isInline: true, styles: [":host{display:block;width:100%;height:100%}.ngx-topology-wrapper{width:100%;height:100%;padding:16px 20px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05));position:relative}.ngx-topology-container{position:relative;width:100%;overflow:hidden}.ngx-topology-svg{width:100%;height:100%;display:block;overflow:visible}.topology-link-path{transition:stroke .25s,stroke-width .25s}.link-active-flow{stroke-dasharray:6,4;animation:linkFlow .8s linear infinite}@keyframes linkFlow{0%{stroke-dashoffset:20}to{stroke-dashoffset:0}}.edge-label{font-size:9px;fill:var(--text-secondary, #64748b);font-family:system-ui,sans-serif;pointer-events:none}.node-group{cursor:pointer;transition:transform .2s ease-out}.node-backdrop{fill:#fff;stroke:#cbd5e1;stroke-width:1.5px;transition:all .2s}.node-group:hover .node-backdrop{stroke-width:2px;filter:drop-shadow(0 8px 12px rgba(99,102,241,.18))}.node-html-container{overflow:hidden;border-radius:10px;pointer-events:none}.hover-preview-container{overflow:visible;pointer-events:none}.hover-preview{display:inline-flex;align-items:center;gap:6px;padding:3px 8px;background:#0f172ae0;backdrop-filter:blur(6px);border-radius:10px;font-family:system-ui,sans-serif;pointer-events:none;white-space:nowrap;max-width:100%}.hover-preview-label{font-size:11px;font-weight:600;color:#f8fafc;overflow:hidden;text-overflow:ellipsis}.hover-preview-badge{font-size:8px;font-weight:700;text-transform:uppercase;padding:1px 5px;border-radius:6px;letter-spacing:.04em}.badge-idle{background:#334155;color:#94a3b8}.badge-thinking{background:#6366f140;color:#a5b4fc}.badge-success{background:#22c55e40;color:#86efac}.badge-error{background:#ef444440;color:#fca5a5}.node-card{width:100%;height:100%;padding:8px 10px;box-sizing:border-box;display:flex;flex-direction:column;font-family:system-ui,sans-serif}.node-card-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:4px}.node-type{font-size:8px;font-weight:700;color:#64748b;letter-spacing:.05em}.status-indicator{width:6px;height:6px;border-radius:50%;background:#94a3b8}.node-label{font-size:11px;font-weight:700;color:#0f172a;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.node-prompt-preview{font-size:8px;color:#64748b;margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.node-card.thinking .status-indicator{background:#6366f1;box-shadow:0 0 #6366f1b3;animation:statusIndicatorPulse 1.2s infinite}@keyframes statusIndicatorPulse{0%{box-shadow:0 0 #6366f180}70%{box-shadow:0 0 0 4px #6366f100}to{box-shadow:0 0 #6366f100}}.node-group.node-thinking .node-backdrop{stroke-width:2px;filter:drop-shadow(0 4px 10px rgba(99,102,241,.15))}.node-card.success .status-indicator{background:#22c55e}.node-card.error .status-indicator{background:#ef4444}.node-status-thinking{animation:thinkingPulse 2s ease-in-out infinite}@keyframes thinkingPulse{0%{transform:var(--node-translate) scale(1);filter:drop-shadow(0 0 0 rgba(99,102,241,0))}50%{transform:var(--node-translate) scale(1.03);filter:drop-shadow(0 0 8px rgba(99,102,241,.35))}to{transform:var(--node-translate) scale(1);filter:drop-shadow(0 0 0 rgba(99,102,241,0))}}.node-status-success{animation:successFlash .6s ease-out 1}@keyframes successFlash{0%{filter:drop-shadow(0 0 0 rgba(34,197,94,0))}30%{filter:drop-shadow(0 0 10px rgba(34,197,94,.5))}to{filter:drop-shadow(0 0 0 rgba(34,197,94,0))}}.node-status-error{animation:errorShake .4s ease-in-out 1}@keyframes errorShake{0%{transform:var(--node-translate) translate(0)}20%{transform:var(--node-translate) translate(-3px)}40%{transform:var(--node-translate) translate(3px)}60%{transform:var(--node-translate) translate(-2px)}80%{transform:var(--node-translate) translate(2px)}to{transform:var(--node-translate) translate(0)}}.chart-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.topology-title{font-size:14px;font-weight:700;color:var(--text-primary, #1e293b)}.topology-subtitle{font-size:11px;color:var(--text-secondary, #64748b);margin-top:2px}.highlight-val{font-weight:700;color:#6366f1;font-family:monospace}.topology-tooltip{position:absolute;z-index:100;background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .94));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:12px 14px;border-radius:12px;font-size:11px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);transform:translate(-50%,-105%);width:210px;pointer-events:auto;font-family:system-ui,sans-serif}.tt-section{margin-top:6px;display:flex;flex-direction:column;gap:2px}.section-title{font-weight:700;color:#38bdf8;font-size:9px;text-transform:uppercase;letter-spacing:.05em}.section-content{margin:0;color:#f8fafcd9;font-style:italic;font-family:monospace;font-size:10px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.action-buttons-row{margin-top:10px;display:flex;flex-direction:column;gap:6px;border-top:1px solid rgba(255,255,255,.15);padding-top:8px}.action-btn{color:#fff;border:none;border-radius:4px;padding:5px 8px;font-size:10px;cursor:pointer;font-weight:600;transition:all .12s;width:100%;text-align:left}.action-btn.explain{background:#4f46e5}.action-btn.explain:hover{background:#6366f1}.action-btn.rerun{background:#334155}.action-btn.rerun:hover{background:#475569}.chart-export-menu{position:relative;z-index:50}.export-trigger{padding:4px 10px;font-size:11px;font-weight:600;color:var(--ngx-chart-axis-text, #64748b);background:#f1f5f9cc;backdrop-filter:blur(8px);border:1px solid var(--ngx-chart-grid, #e2e8f0);border-radius:6px;cursor:pointer;transition:all .15s}.export-trigger:hover{background:#fff;color:#4f46e5;border-color:#4f46e5}.export-dropdown{position:absolute;right:0;top:calc(100% + 4px);background:#fff;border:1px solid var(--ngx-chart-grid, #e2e8f0);border-radius:8px;box-shadow:0 10px 15px -3px #0000001a;padding:4px;display:flex;flex-direction:column;gap:2px;min-width:120px}.export-dropdown button{background:none;border:none;padding:6px 10px;font-size:11px;text-align:left;cursor:pointer;color:#1e293b;border-radius:4px;width:100%;transition:all .12s}.export-dropdown button:hover{background:#4f46e50f;color:#4f46e5}.zoom-controls{position:absolute;bottom:12px;right:12px;display:flex;align-items:center;gap:6px;background:#0f172acc;backdrop-filter:blur(8px);border:1px solid rgba(255,255,255,.1);border-radius:8px;padding:4px 8px;box-shadow:0 4px 6px #0000001a;z-index:10}.zoom-controls button{background:#ffffff26;border:none;color:#fff;width:24px;height:24px;border-radius:4px;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:10px;transition:background .15s}.zoom-controls button:hover{background:#ffffff4d}.zoom-level{color:#ffffffd9;font-size:10px;font-weight:600;font-family:monospace;padding-left:4px;min-width:32px;text-align:right}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.UpperCasePipe, name: "uppercase" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
36275
|
+
`, isInline: true, styles: [":host{display:block;width:100%;height:100%}.ngx-topology-wrapper{width:100%;height:100%;padding:16px 20px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05));position:relative}.ngx-topology-container{position:relative;width:100%;overflow:hidden}.ngx-topology-svg{width:100%;height:100%;display:block;overflow:visible}.topology-link-path{transition:stroke .25s,stroke-width .25s}.link-active-flow{stroke-dasharray:6,4;animation:linkFlow .8s linear infinite}@keyframes linkFlow{0%{stroke-dashoffset:20}to{stroke-dashoffset:0}}.edge-label{font-size:9px;fill:var(--text-secondary, #64748b);font-family:system-ui,sans-serif;pointer-events:none}.link-delete-btn{cursor:pointer;opacity:.8;transition:opacity .15s}.link-delete-btn:hover{opacity:1}.link-delete-btn circle{transition:r .15s ease,fill .15s ease}.link-delete-btn:hover circle{r:9;fill:#dc2626}.temporary-drag-link{stroke:#f97316;stroke-width:2;stroke-dasharray:4,4;pointer-events:none}.connection-port{fill:#fff;stroke:#4f46e5;stroke-width:1.5;cursor:crosshair;transition:r .15s,fill .15s}.connection-port:hover{r:6.5;fill:#4f46e5}.node-delete-btn{cursor:pointer;opacity:.8;transition:opacity .15s}.node-delete-btn:hover{opacity:1}.node-delete-btn circle{transition:r .15s ease,fill .15s ease}.node-delete-btn:hover circle{r:8.5;fill:#dc2626}.node-group{cursor:pointer;transition:transform .2s ease-out}.node-backdrop{fill:#fff;stroke:#cbd5e1;stroke-width:1.5px;transition:all .2s}.node-group:hover .node-backdrop{stroke-width:2px;filter:drop-shadow(0 8px 12px rgba(99,102,241,.18))}.node-html-container{overflow:hidden;border-radius:10px;pointer-events:none}.hover-preview-container{overflow:visible;pointer-events:none}.hover-preview{display:inline-flex;align-items:center;gap:6px;padding:3px 8px;background:#0f172ae0;backdrop-filter:blur(6px);border-radius:10px;font-family:system-ui,sans-serif;pointer-events:none;white-space:nowrap;max-width:100%}.hover-preview-label{font-size:11px;font-weight:600;color:#f8fafc;overflow:hidden;text-overflow:ellipsis}.hover-preview-badge{font-size:8px;font-weight:700;text-transform:uppercase;padding:1px 5px;border-radius:6px;letter-spacing:.04em}.badge-idle{background:#334155;color:#94a3b8}.badge-thinking{background:#6366f140;color:#a5b4fc}.badge-success{background:#22c55e40;color:#86efac}.badge-error{background:#ef444440;color:#fca5a5}.node-card{width:100%;height:100%;padding:8px 10px;box-sizing:border-box;display:flex;flex-direction:column;font-family:system-ui,sans-serif}.node-card-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:4px}.node-type{font-size:8px;font-weight:700;color:#64748b;letter-spacing:.05em}.status-indicator{width:6px;height:6px;border-radius:50%;background:#94a3b8}.node-label{font-size:11px;font-weight:700;color:#0f172a;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.node-prompt-preview{font-size:8px;color:#64748b;margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.node-card.thinking .status-indicator{background:#6366f1;box-shadow:0 0 #6366f1b3;animation:statusIndicatorPulse 1.2s infinite}@keyframes statusIndicatorPulse{0%{box-shadow:0 0 #6366f180}70%{box-shadow:0 0 0 4px #6366f100}to{box-shadow:0 0 #6366f100}}.node-group.node-thinking .node-backdrop{stroke-width:2px;filter:drop-shadow(0 4px 10px rgba(99,102,241,.15))}.node-card.success .status-indicator{background:#22c55e}.node-card.error .status-indicator{background:#ef4444}.node-status-thinking{animation:thinkingPulse 2s ease-in-out infinite}@keyframes thinkingPulse{0%{transform:var(--node-translate) scale(1);filter:drop-shadow(0 0 0 rgba(99,102,241,0))}50%{transform:var(--node-translate) scale(1.03);filter:drop-shadow(0 0 8px rgba(99,102,241,.35))}to{transform:var(--node-translate) scale(1);filter:drop-shadow(0 0 0 rgba(99,102,241,0))}}.node-status-success{animation:successFlash .6s ease-out 1}@keyframes successFlash{0%{filter:drop-shadow(0 0 0 rgba(34,197,94,0))}30%{filter:drop-shadow(0 0 10px rgba(34,197,94,.5))}to{filter:drop-shadow(0 0 0 rgba(34,197,94,0))}}.node-status-error{animation:errorShake .4s ease-in-out 1}@keyframes errorShake{0%{transform:var(--node-translate) translate(0)}20%{transform:var(--node-translate) translate(-3px)}40%{transform:var(--node-translate) translate(3px)}60%{transform:var(--node-translate) translate(-2px)}80%{transform:var(--node-translate) translate(2px)}to{transform:var(--node-translate) translate(0)}}.chart-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.topology-title{font-size:14px;font-weight:700;color:var(--text-primary, #1e293b)}.topology-subtitle{font-size:11px;color:var(--text-secondary, #64748b);margin-top:2px}.highlight-val{font-weight:700;color:#6366f1;font-family:monospace}.editor-toolbar{display:flex;justify-content:space-between;align-items:center;background:#f1f5f9b3;backdrop-filter:blur(8px);border:1px solid var(--border-color, #e2e8f0);border-radius:10px;padding:8px 14px;margin-bottom:14px;gap:12px;flex-wrap:wrap}.toolbar-section{display:flex;align-items:center;gap:8px}.tb-btn{padding:6px 12px;font-size:11px;font-weight:600;background:#fff;border:1px solid #cbd5e1;border-radius:6px;color:#334155;cursor:pointer;transition:all .15s;display:flex;align-items:center;gap:4px}.tb-btn:hover:not(:disabled){background:#f8fafc;border-color:#94a3b8}.tb-btn:disabled{opacity:.5;cursor:not-allowed}.tb-btn.primary{background:#4f46e5;color:#fff;border-color:#4f46e5}.tb-btn.primary:hover:not(:disabled){background:#4338ca}.tb-btn.active{background:#e0e7ff;border-color:#6366f1;color:#4f46e5}.tb-divider{height:16px;width:1px;background:#cbd5e1}.validation-badge{font-size:11px;font-weight:600;padding:4px 10px;border-radius:6px;background:#fee2e2;color:#ef4444;display:flex;align-items:center;gap:4px}.validation-badge.valid{background:#dcfce7;color:#15803d}.topology-tooltip{position:absolute;z-index:100;background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .94));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:12px 14px;border-radius:12px;font-size:11px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);transform:translate(-50%,-105%);width:210px;pointer-events:auto;font-family:system-ui,sans-serif}.tt-cat{font-weight:700;margin-bottom:6px;font-size:12px;color:#38bdf8;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px}.tt-section{margin-top:6px;display:flex;flex-direction:column;gap:2px}.section-title{font-weight:700;color:#38bdf8;font-size:9px;text-transform:uppercase;letter-spacing:.05em}.section-content{margin:0;color:#f8fafcd9;font-style:italic;font-family:monospace;font-size:10px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.action-buttons-row{margin-top:10px;display:flex;flex-direction:column;gap:6px;border-top:1px solid rgba(255,255,255,.15);padding-top:8px}.action-btn{color:#fff;border:none;border-radius:4px;padding:5px 8px;font-size:10px;cursor:pointer;font-weight:600;transition:all .12s;width:100%;text-align:left}.action-btn.explain{background:#4f46e5}.action-btn.explain:hover{background:#6366f1}.action-btn.rerun{background:#334155}.action-btn.rerun:hover{background:#475569}.modal-backdrop{position:fixed;top:0;left:0;width:100vw;height:100vh;background:#0f172a73;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);z-index:1000;display:flex;justify-content:center;align-items:center}.modal-card{background:var(--ngx-chart-bg, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:16px;box-shadow:0 20px 25px -5px #0000001a,0 10px 10px -5px #0000000a;width:90%;max-width:440px;padding:24px;box-sizing:border-box;display:flex;flex-direction:column;gap:16px;animation:modalAppear .2s cubic-bezier(.16,1,.3,1) forwards}@keyframes modalAppear{0%{transform:scale(.95);opacity:0}to{transform:scale(1);opacity:1}}.modal-header{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid #e2e8f0;padding-bottom:12px}.modal-header h3{margin:0;font-size:15px;font-weight:700;color:#0f172a}.modal-close{background:none;border:none;font-size:22px;color:#64748b;cursor:pointer}.modal-body{display:flex;flex-direction:column;gap:14px}.form-group{display:flex;flex-direction:column;gap:5px}.form-group label{font-size:10px;font-weight:700;color:#475569;text-transform:uppercase;letter-spacing:.05em}.form-group input,.form-group select,.form-group textarea{padding:8px 12px;border:1px solid #cbd5e1;border-radius:6px;font-size:12px;font-family:inherit;color:#0f172a;outline:none;background:#fff;transition:border-color .15s}.form-group input:focus,.form-group select:focus,.form-group textarea:focus{border-color:#6366f1}.form-row{display:flex;gap:12px}.form-group.half{flex:1}.modal-footer{display:flex;justify-content:flex-end;gap:8px;border-top:1px solid #e2e8f0;padding-top:14px}.btn{padding:8px 16px;font-size:11px;font-weight:600;border-radius:6px;cursor:pointer;border:1px solid transparent;transition:all .15s}.btn-secondary{background:#fff;border-color:#cbd5e1;color:#334155}.btn-secondary:hover{background:#f1f5f9}.btn-primary{background:#4f46e5;color:#fff}.btn-primary:hover{background:#4338ca}.zoom-controls{position:absolute;bottom:12px;right:12px;display:flex;align-items:center;gap:6px;background:#0f172acc;backdrop-filter:blur(8px);border:1px solid rgba(255,255,255,.1);border-radius:8px;padding:4px 8px;box-shadow:0 4px 6px #0000001a;z-index:10}.zoom-controls button{background:#ffffff26;border:none;color:#fff;width:24px;height:24px;border-radius:4px;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:10px;transition:background .15s}.zoom-controls button:hover{background:#ffffff4d}.zoom-level{color:#ffffffd9;font-size:10px;font-weight:600;font-family:monospace;padding-left:4px;min-width:32px;text-align:right}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "pipe", type: i1.UpperCasePipe, name: "uppercase" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ChartExportMenuComponent, selector: "ngx-chart-export-menu", inputs: ["formats"], outputs: ["exportClicked"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
35795
36276
|
}
|
|
35796
36277
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AgenticCognitiveTopologyComponent, decorators: [{
|
|
35797
36278
|
type: Component,
|
|
35798
|
-
args: [{ selector: 'ngx-agentic-cognitive-topology', standalone: true, imports: [CommonModule, UpperCasePipe], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
36279
|
+
args: [{ selector: 'ngx-agentic-cognitive-topology', standalone: true, imports: [CommonModule, UpperCasePipe, FormsModule, ChartExportMenuComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
35799
36280
|
<div class="ngx-topology-wrapper">
|
|
35800
36281
|
<div class="chart-header" (mousemove)="$event.stopPropagation()" (mouseleave)="closeTooltip()">
|
|
35801
36282
|
<div class="chart-title-space">
|
|
35802
36283
|
<div class="topology-title">Agentic Cognitive Topology (DAG)</div>
|
|
35803
36284
|
<div class="topology-subtitle">
|
|
35804
|
-
Active Agents: <span class="highlight-val">{{ activeAgentsCount() }}</span> / {{
|
|
36285
|
+
Active Agents: <span class="highlight-val">{{ activeAgentsCount() }}</span> / {{ effectiveNodes().length }}
|
|
35805
36286
|
</div>
|
|
35806
36287
|
</div>
|
|
35807
36288
|
@if (showExport()) {
|
|
35808
|
-
<
|
|
35809
|
-
<button class="export-trigger" (click)="toggleExportMenu($event)" aria-label="Export Menu">📤 Export</button>
|
|
35810
|
-
@if (exportMenuOpen()) {
|
|
35811
|
-
<div class="export-dropdown">
|
|
35812
|
-
<button (click)="onExport('json')">📊 Export JSON</button>
|
|
35813
|
-
<button (click)="onExport('csv')">📄 Export CSV</button>
|
|
35814
|
-
<button (click)="onExport('svg')">🖼️ Export SVG</button>
|
|
35815
|
-
<button (click)="onExport('pdf')">📕 Export PDF</button>
|
|
35816
|
-
</div>
|
|
35817
|
-
}
|
|
35818
|
-
</div>
|
|
36289
|
+
<ngx-chart-export-menu (exportClicked)="onExport($event)" />
|
|
35819
36290
|
}
|
|
35820
36291
|
</div>
|
|
35821
36292
|
|
|
36293
|
+
<!-- Editor Toolbar (Renders in Edit Mode) -->
|
|
36294
|
+
@if (editable()) {
|
|
36295
|
+
<div class="editor-toolbar">
|
|
36296
|
+
<div class="toolbar-section">
|
|
36297
|
+
<button class="tb-btn primary" (click)="addNode()" title="Add Node">➕ Add Agent</button>
|
|
36298
|
+
<span class="tb-divider"></span>
|
|
36299
|
+
<button class="tb-btn" [disabled]="undoStack().length === 0" (click)="undo()" title="Undo (Ctrl+Z)">↩️ Undo ({{ undoStack().length }})</button>
|
|
36300
|
+
<button class="tb-btn" [disabled]="redoStack().length === 0" (click)="redo()" title="Redo (Ctrl+Y)">↪️ Redo ({{ redoStack().length }})</button>
|
|
36301
|
+
<span class="tb-divider"></span>
|
|
36302
|
+
<button class="tb-btn" [class.active]="snapToGridActive()" (click)="snapToGridActive.set(!snapToGridActive())" title="Toggle Snap to Grid">
|
|
36303
|
+
🧲 Snap ({{ gridSize() }}px)
|
|
36304
|
+
</button>
|
|
36305
|
+
<button class="tb-btn" (click)="autoLayout()" title="Rearrange Nodes Automatically">
|
|
36306
|
+
🔀 Rearrange
|
|
36307
|
+
</button>
|
|
36308
|
+
</div>
|
|
36309
|
+
<div class="toolbar-section">
|
|
36310
|
+
<button class="tb-btn" (click)="exportWorkflowSchema()" title="Copy Workflow JSON Schema">📋 Copy JSON Flow</button>
|
|
36311
|
+
|
|
36312
|
+
<div class="validation-badge" [class.valid]="validationReport().isValid">
|
|
36313
|
+
@if (validationReport().isValid) {
|
|
36314
|
+
✅ DAG Solid
|
|
36315
|
+
} @else {
|
|
36316
|
+
⚠️ Warning:
|
|
36317
|
+
@if (validationReport().hasCycles) { Cycle detected! }
|
|
36318
|
+
@if (validationReport().orphans.length > 0) { Isolated nodes present! }
|
|
36319
|
+
}
|
|
36320
|
+
</div>
|
|
36321
|
+
</div>
|
|
36322
|
+
</div>
|
|
36323
|
+
}
|
|
36324
|
+
|
|
35822
36325
|
<div class="ngx-topology-container" [style.height.px]="height()">
|
|
35823
36326
|
<!-- SVG DAG Drawing Canvas -->
|
|
35824
36327
|
<svg
|
|
@@ -35831,7 +36334,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
35831
36334
|
(mousemove)="onMouseMove($event)"
|
|
35832
36335
|
(mouseup)="onMouseUp()"
|
|
35833
36336
|
(mouseleave)="onMouseLeave()"
|
|
35834
|
-
[style.cursor]="draggingNodeId() ? 'grabbing' : isPanning() ? 'grabbing' : 'grab'"
|
|
36337
|
+
[style.cursor]="draggingNodeId() ? 'grabbing' : isPanning() ? 'grabbing' : activePortDrag() ? 'crosshair' : 'grab'"
|
|
35835
36338
|
>
|
|
35836
36339
|
<!-- Grid background dots -->
|
|
35837
36340
|
<defs>
|
|
@@ -35877,8 +36380,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
35877
36380
|
class="topology-link-path"
|
|
35878
36381
|
/>
|
|
35879
36382
|
|
|
35880
|
-
<!--
|
|
35881
|
-
@if (
|
|
36383
|
+
<!-- Link Delete Button (Renders in Edit Mode) -->
|
|
36384
|
+
@if (editable()) {
|
|
36385
|
+
<g class="link-delete-btn" [attr.transform]="'translate(' + getMidpointX(link) + ',' + getMidpointY(link) + ')'" (click)="deleteLink(link.source, link.target, $event)">
|
|
36386
|
+
<circle r="7" fill="#ef4444" stroke="#ffffff" stroke-width="1.2" />
|
|
36387
|
+
<text text-anchor="middle" dominant-baseline="middle" fill="#ffffff" font-size="8" font-weight="900" y="-0.5">×</text>
|
|
36388
|
+
</g>
|
|
36389
|
+
} @else if (link.label) {
|
|
36390
|
+
<!-- Optional edge label -->
|
|
35882
36391
|
<text
|
|
35883
36392
|
class="edge-label"
|
|
35884
36393
|
[attr.x]="getMidpointX(link)"
|
|
@@ -35889,6 +36398,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
35889
36398
|
}
|
|
35890
36399
|
}
|
|
35891
36400
|
|
|
36401
|
+
<!-- Temporary connector drawing edge (renders when dragging a port link) -->
|
|
36402
|
+
@if (temporaryDragLinkPath()) {
|
|
36403
|
+
<path [attr.d]="temporaryDragLinkPath()" class="temporary-drag-link" fill="none" />
|
|
36404
|
+
}
|
|
36405
|
+
|
|
35892
36406
|
<!-- Nodes rendering via foreignObject -->
|
|
35893
36407
|
@for (node of computedNodes(); track node.id) {
|
|
35894
36408
|
<g
|
|
@@ -35902,6 +36416,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
35902
36416
|
[style.--node-translate]="'translate(' + (node.x - nodeWidth / 2) + 'px,' + (node.y - nodeHeight / 2) + 'px)'"
|
|
35903
36417
|
class="node-group"
|
|
35904
36418
|
(click)="onNodeClick(node, $event)"
|
|
36419
|
+
(dblclick)="onNodeDblClick(node, $event)"
|
|
35905
36420
|
(mousedown)="onNodeMouseDown(node, $event)"
|
|
35906
36421
|
(mouseenter)="hoveredNodeId.set(node.id)"
|
|
35907
36422
|
(mouseleave)="hoveredNodeId.set(null)"
|
|
@@ -35935,8 +36450,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
35935
36450
|
</div>
|
|
35936
36451
|
</foreignObject>
|
|
35937
36452
|
|
|
36453
|
+
<!-- Connection Ports Handles (Renders in Edit Mode) -->
|
|
36454
|
+
@if (editable()) {
|
|
36455
|
+
<circle cx="67.5" cy="0" r="4" class="connection-port top" (mousedown)="onPortMouseDown(node, [0, -1], $event)" title="Drag connection" />
|
|
36456
|
+
<circle cx="67.5" cy="55" r="4" class="connection-port bottom" (mousedown)="onPortMouseDown(node, [0, 1], $event)" title="Drag connection" />
|
|
36457
|
+
<circle cx="0" cy="27.5" r="4" class="connection-port left" (mousedown)="onPortMouseDown(node, [-1, 0], $event)" title="Drag connection" />
|
|
36458
|
+
<circle cx="135" cy="27.5" r="4" class="connection-port right" (mousedown)="onPortMouseDown(node, [1, 0], $event)" title="Drag connection" />
|
|
36459
|
+
|
|
36460
|
+
<!-- Node Delete Badge -->
|
|
36461
|
+
<g class="node-delete-btn" transform="translate(132, 3)" (click)="deleteNode(node.id, $event)">
|
|
36462
|
+
<circle r="6" fill="#ef4444" stroke="#ffffff" stroke-width="1" />
|
|
36463
|
+
<text text-anchor="middle" dominant-baseline="middle" fill="#ffffff" font-size="8" font-weight="900" y="-0.5">×</text>
|
|
36464
|
+
</g>
|
|
36465
|
+
}
|
|
36466
|
+
|
|
35938
36467
|
<!-- Hover preview pill -->
|
|
35939
|
-
@if (hoveredNodeId() === node.id && !tooltipData()) {
|
|
36468
|
+
@if (!editable() && hoveredNodeId() === node.id && !tooltipData()) {
|
|
35940
36469
|
<foreignObject
|
|
35941
36470
|
[attr.x]="0"
|
|
35942
36471
|
[attr.y]="-28"
|
|
@@ -35994,12 +36523,62 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
35994
36523
|
</div>
|
|
35995
36524
|
</div>
|
|
35996
36525
|
}
|
|
36526
|
+
|
|
36527
|
+
<!-- Glassmorphic Property Editor Modal -->
|
|
36528
|
+
@if (activeEditingNode(); as node) {
|
|
36529
|
+
<div class="modal-backdrop" (click)="activeEditingNode.set(null)">
|
|
36530
|
+
<div class="modal-card" (click)="$event.stopPropagation()">
|
|
36531
|
+
<div class="modal-header">
|
|
36532
|
+
<h3>Edit Agent Node</h3>
|
|
36533
|
+
<button class="modal-close" (click)="activeEditingNode.set(null)">×</button>
|
|
36534
|
+
</div>
|
|
36535
|
+
<div class="modal-body">
|
|
36536
|
+
<div class="form-group">
|
|
36537
|
+
<label>Agent Label</label>
|
|
36538
|
+
<input type="text" [(ngModel)]="node.label" placeholder="Enter label..." />
|
|
36539
|
+
</div>
|
|
36540
|
+
<div class="form-row">
|
|
36541
|
+
<div class="form-group half">
|
|
36542
|
+
<label>Type</label>
|
|
36543
|
+
<select [(ngModel)]="node.type">
|
|
36544
|
+
<option value="orchestrator">Orchestrator</option>
|
|
36545
|
+
<option value="agent">Agent</option>
|
|
36546
|
+
<option value="tool">Tool</option>
|
|
36547
|
+
<option value="critic">Critic</option>
|
|
36548
|
+
</select>
|
|
36549
|
+
</div>
|
|
36550
|
+
<div class="form-group half">
|
|
36551
|
+
<label>Status</label>
|
|
36552
|
+
<select [(ngModel)]="node.status">
|
|
36553
|
+
<option value="idle">Idle</option>
|
|
36554
|
+
<option value="thinking">Thinking</option>
|
|
36555
|
+
<option value="success">Success</option>
|
|
36556
|
+
<option value="error">Error</option>
|
|
36557
|
+
</select>
|
|
36558
|
+
</div>
|
|
36559
|
+
</div>
|
|
36560
|
+
<div class="form-group">
|
|
36561
|
+
<label>Prompt Template</label>
|
|
36562
|
+
<textarea [(ngModel)]="node.prompt" rows="3" placeholder="Define agent prompt rules..."></textarea>
|
|
36563
|
+
</div>
|
|
36564
|
+
<div class="form-group">
|
|
36565
|
+
<label>Latest Response</label>
|
|
36566
|
+
<textarea [(ngModel)]="node.response" rows="3" placeholder="Mock agent response..."></textarea>
|
|
36567
|
+
</div>
|
|
36568
|
+
</div>
|
|
36569
|
+
<div class="modal-footer">
|
|
36570
|
+
<button class="btn btn-secondary" (click)="activeEditingNode.set(null)">Cancel</button>
|
|
36571
|
+
<button class="btn btn-primary" (click)="saveNodeEdit()">Save Changes</button>
|
|
36572
|
+
</div>
|
|
36573
|
+
</div>
|
|
36574
|
+
</div>
|
|
36575
|
+
}
|
|
35997
36576
|
</div>
|
|
35998
36577
|
</div>
|
|
35999
|
-
`, styles: [":host{display:block;width:100%;height:100%}.ngx-topology-wrapper{width:100%;height:100%;padding:16px 20px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05));position:relative}.ngx-topology-container{position:relative;width:100%;overflow:hidden}.ngx-topology-svg{width:100%;height:100%;display:block;overflow:visible}.topology-link-path{transition:stroke .25s,stroke-width .25s}.link-active-flow{stroke-dasharray:6,4;animation:linkFlow .8s linear infinite}@keyframes linkFlow{0%{stroke-dashoffset:20}to{stroke-dashoffset:0}}.edge-label{font-size:9px;fill:var(--text-secondary, #64748b);font-family:system-ui,sans-serif;pointer-events:none}.node-group{cursor:pointer;transition:transform .2s ease-out}.node-backdrop{fill:#fff;stroke:#cbd5e1;stroke-width:1.5px;transition:all .2s}.node-group:hover .node-backdrop{stroke-width:2px;filter:drop-shadow(0 8px 12px rgba(99,102,241,.18))}.node-html-container{overflow:hidden;border-radius:10px;pointer-events:none}.hover-preview-container{overflow:visible;pointer-events:none}.hover-preview{display:inline-flex;align-items:center;gap:6px;padding:3px 8px;background:#0f172ae0;backdrop-filter:blur(6px);border-radius:10px;font-family:system-ui,sans-serif;pointer-events:none;white-space:nowrap;max-width:100%}.hover-preview-label{font-size:11px;font-weight:600;color:#f8fafc;overflow:hidden;text-overflow:ellipsis}.hover-preview-badge{font-size:8px;font-weight:700;text-transform:uppercase;padding:1px 5px;border-radius:6px;letter-spacing:.04em}.badge-idle{background:#334155;color:#94a3b8}.badge-thinking{background:#6366f140;color:#a5b4fc}.badge-success{background:#22c55e40;color:#86efac}.badge-error{background:#ef444440;color:#fca5a5}.node-card{width:100%;height:100%;padding:8px 10px;box-sizing:border-box;display:flex;flex-direction:column;font-family:system-ui,sans-serif}.node-card-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:4px}.node-type{font-size:8px;font-weight:700;color:#64748b;letter-spacing:.05em}.status-indicator{width:6px;height:6px;border-radius:50%;background:#94a3b8}.node-label{font-size:11px;font-weight:700;color:#0f172a;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.node-prompt-preview{font-size:8px;color:#64748b;margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.node-card.thinking .status-indicator{background:#6366f1;box-shadow:0 0 #6366f1b3;animation:statusIndicatorPulse 1.2s infinite}@keyframes statusIndicatorPulse{0%{box-shadow:0 0 #6366f180}70%{box-shadow:0 0 0 4px #6366f100}to{box-shadow:0 0 #6366f100}}.node-group.node-thinking .node-backdrop{stroke-width:2px;filter:drop-shadow(0 4px 10px rgba(99,102,241,.15))}.node-card.success .status-indicator{background:#22c55e}.node-card.error .status-indicator{background:#ef4444}.node-status-thinking{animation:thinkingPulse 2s ease-in-out infinite}@keyframes thinkingPulse{0%{transform:var(--node-translate) scale(1);filter:drop-shadow(0 0 0 rgba(99,102,241,0))}50%{transform:var(--node-translate) scale(1.03);filter:drop-shadow(0 0 8px rgba(99,102,241,.35))}to{transform:var(--node-translate) scale(1);filter:drop-shadow(0 0 0 rgba(99,102,241,0))}}.node-status-success{animation:successFlash .6s ease-out 1}@keyframes successFlash{0%{filter:drop-shadow(0 0 0 rgba(34,197,94,0))}30%{filter:drop-shadow(0 0 10px rgba(34,197,94,.5))}to{filter:drop-shadow(0 0 0 rgba(34,197,94,0))}}.node-status-error{animation:errorShake .4s ease-in-out 1}@keyframes errorShake{0%{transform:var(--node-translate) translate(0)}20%{transform:var(--node-translate) translate(-3px)}40%{transform:var(--node-translate) translate(3px)}60%{transform:var(--node-translate) translate(-2px)}80%{transform:var(--node-translate) translate(2px)}to{transform:var(--node-translate) translate(0)}}.chart-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.topology-title{font-size:14px;font-weight:700;color:var(--text-primary, #1e293b)}.topology-subtitle{font-size:11px;color:var(--text-secondary, #64748b);margin-top:2px}.highlight-val{font-weight:700;color:#6366f1;font-family:monospace}.topology-tooltip{position:absolute;z-index:100;background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .94));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:12px 14px;border-radius:12px;font-size:11px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);transform:translate(-50%,-105%);width:210px;pointer-events:auto;font-family:system-ui,sans-serif}.tt-section{margin-top:6px;display:flex;flex-direction:column;gap:2px}.section-title{font-weight:700;color:#38bdf8;font-size:9px;text-transform:uppercase;letter-spacing:.05em}.section-content{margin:0;color:#f8fafcd9;font-style:italic;font-family:monospace;font-size:10px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.action-buttons-row{margin-top:10px;display:flex;flex-direction:column;gap:6px;border-top:1px solid rgba(255,255,255,.15);padding-top:8px}.action-btn{color:#fff;border:none;border-radius:4px;padding:5px 8px;font-size:10px;cursor:pointer;font-weight:600;transition:all .12s;width:100%;text-align:left}.action-btn.explain{background:#4f46e5}.action-btn.explain:hover{background:#6366f1}.action-btn.rerun{background:#334155}.action-btn.rerun:hover{background:#475569}.chart-export-menu{position:relative;z-index:50}.export-trigger{padding:4px 10px;font-size:11px;font-weight:600;color:var(--ngx-chart-axis-text, #64748b);background:#f1f5f9cc;backdrop-filter:blur(8px);border:1px solid var(--ngx-chart-grid, #e2e8f0);border-radius:6px;cursor:pointer;transition:all .15s}.export-trigger:hover{background:#fff;color:#4f46e5;border-color:#4f46e5}.export-dropdown{position:absolute;right:0;top:calc(100% + 4px);background:#fff;border:1px solid var(--ngx-chart-grid, #e2e8f0);border-radius:8px;box-shadow:0 10px 15px -3px #0000001a;padding:4px;display:flex;flex-direction:column;gap:2px;min-width:120px}.export-dropdown button{background:none;border:none;padding:6px 10px;font-size:11px;text-align:left;cursor:pointer;color:#1e293b;border-radius:4px;width:100%;transition:all .12s}.export-dropdown button:hover{background:#4f46e50f;color:#4f46e5}.zoom-controls{position:absolute;bottom:12px;right:12px;display:flex;align-items:center;gap:6px;background:#0f172acc;backdrop-filter:blur(8px);border:1px solid rgba(255,255,255,.1);border-radius:8px;padding:4px 8px;box-shadow:0 4px 6px #0000001a;z-index:10}.zoom-controls button{background:#ffffff26;border:none;color:#fff;width:24px;height:24px;border-radius:4px;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:10px;transition:background .15s}.zoom-controls button:hover{background:#ffffff4d}.zoom-level{color:#ffffffd9;font-size:10px;font-weight:600;font-family:monospace;padding-left:4px;min-width:32px;text-align:right}\n"] }]
|
|
36000
|
-
}], ctorParameters: () => [], propDecorators: {
|
|
36578
|
+
`, styles: [":host{display:block;width:100%;height:100%}.ngx-topology-wrapper{width:100%;height:100%;padding:16px 20px;background:var(--bg-secondary, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:12px;box-shadow:var(--shadow-sm, 0 1px 2px rgba(0,0,0,.05));position:relative}.ngx-topology-container{position:relative;width:100%;overflow:hidden}.ngx-topology-svg{width:100%;height:100%;display:block;overflow:visible}.topology-link-path{transition:stroke .25s,stroke-width .25s}.link-active-flow{stroke-dasharray:6,4;animation:linkFlow .8s linear infinite}@keyframes linkFlow{0%{stroke-dashoffset:20}to{stroke-dashoffset:0}}.edge-label{font-size:9px;fill:var(--text-secondary, #64748b);font-family:system-ui,sans-serif;pointer-events:none}.link-delete-btn{cursor:pointer;opacity:.8;transition:opacity .15s}.link-delete-btn:hover{opacity:1}.link-delete-btn circle{transition:r .15s ease,fill .15s ease}.link-delete-btn:hover circle{r:9;fill:#dc2626}.temporary-drag-link{stroke:#f97316;stroke-width:2;stroke-dasharray:4,4;pointer-events:none}.connection-port{fill:#fff;stroke:#4f46e5;stroke-width:1.5;cursor:crosshair;transition:r .15s,fill .15s}.connection-port:hover{r:6.5;fill:#4f46e5}.node-delete-btn{cursor:pointer;opacity:.8;transition:opacity .15s}.node-delete-btn:hover{opacity:1}.node-delete-btn circle{transition:r .15s ease,fill .15s ease}.node-delete-btn:hover circle{r:8.5;fill:#dc2626}.node-group{cursor:pointer;transition:transform .2s ease-out}.node-backdrop{fill:#fff;stroke:#cbd5e1;stroke-width:1.5px;transition:all .2s}.node-group:hover .node-backdrop{stroke-width:2px;filter:drop-shadow(0 8px 12px rgba(99,102,241,.18))}.node-html-container{overflow:hidden;border-radius:10px;pointer-events:none}.hover-preview-container{overflow:visible;pointer-events:none}.hover-preview{display:inline-flex;align-items:center;gap:6px;padding:3px 8px;background:#0f172ae0;backdrop-filter:blur(6px);border-radius:10px;font-family:system-ui,sans-serif;pointer-events:none;white-space:nowrap;max-width:100%}.hover-preview-label{font-size:11px;font-weight:600;color:#f8fafc;overflow:hidden;text-overflow:ellipsis}.hover-preview-badge{font-size:8px;font-weight:700;text-transform:uppercase;padding:1px 5px;border-radius:6px;letter-spacing:.04em}.badge-idle{background:#334155;color:#94a3b8}.badge-thinking{background:#6366f140;color:#a5b4fc}.badge-success{background:#22c55e40;color:#86efac}.badge-error{background:#ef444440;color:#fca5a5}.node-card{width:100%;height:100%;padding:8px 10px;box-sizing:border-box;display:flex;flex-direction:column;font-family:system-ui,sans-serif}.node-card-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:4px}.node-type{font-size:8px;font-weight:700;color:#64748b;letter-spacing:.05em}.status-indicator{width:6px;height:6px;border-radius:50%;background:#94a3b8}.node-label{font-size:11px;font-weight:700;color:#0f172a;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.node-prompt-preview{font-size:8px;color:#64748b;margin-top:3px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.node-card.thinking .status-indicator{background:#6366f1;box-shadow:0 0 #6366f1b3;animation:statusIndicatorPulse 1.2s infinite}@keyframes statusIndicatorPulse{0%{box-shadow:0 0 #6366f180}70%{box-shadow:0 0 0 4px #6366f100}to{box-shadow:0 0 #6366f100}}.node-group.node-thinking .node-backdrop{stroke-width:2px;filter:drop-shadow(0 4px 10px rgba(99,102,241,.15))}.node-card.success .status-indicator{background:#22c55e}.node-card.error .status-indicator{background:#ef4444}.node-status-thinking{animation:thinkingPulse 2s ease-in-out infinite}@keyframes thinkingPulse{0%{transform:var(--node-translate) scale(1);filter:drop-shadow(0 0 0 rgba(99,102,241,0))}50%{transform:var(--node-translate) scale(1.03);filter:drop-shadow(0 0 8px rgba(99,102,241,.35))}to{transform:var(--node-translate) scale(1);filter:drop-shadow(0 0 0 rgba(99,102,241,0))}}.node-status-success{animation:successFlash .6s ease-out 1}@keyframes successFlash{0%{filter:drop-shadow(0 0 0 rgba(34,197,94,0))}30%{filter:drop-shadow(0 0 10px rgba(34,197,94,.5))}to{filter:drop-shadow(0 0 0 rgba(34,197,94,0))}}.node-status-error{animation:errorShake .4s ease-in-out 1}@keyframes errorShake{0%{transform:var(--node-translate) translate(0)}20%{transform:var(--node-translate) translate(-3px)}40%{transform:var(--node-translate) translate(3px)}60%{transform:var(--node-translate) translate(-2px)}80%{transform:var(--node-translate) translate(2px)}to{transform:var(--node-translate) translate(0)}}.chart-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.topology-title{font-size:14px;font-weight:700;color:var(--text-primary, #1e293b)}.topology-subtitle{font-size:11px;color:var(--text-secondary, #64748b);margin-top:2px}.highlight-val{font-weight:700;color:#6366f1;font-family:monospace}.editor-toolbar{display:flex;justify-content:space-between;align-items:center;background:#f1f5f9b3;backdrop-filter:blur(8px);border:1px solid var(--border-color, #e2e8f0);border-radius:10px;padding:8px 14px;margin-bottom:14px;gap:12px;flex-wrap:wrap}.toolbar-section{display:flex;align-items:center;gap:8px}.tb-btn{padding:6px 12px;font-size:11px;font-weight:600;background:#fff;border:1px solid #cbd5e1;border-radius:6px;color:#334155;cursor:pointer;transition:all .15s;display:flex;align-items:center;gap:4px}.tb-btn:hover:not(:disabled){background:#f8fafc;border-color:#94a3b8}.tb-btn:disabled{opacity:.5;cursor:not-allowed}.tb-btn.primary{background:#4f46e5;color:#fff;border-color:#4f46e5}.tb-btn.primary:hover:not(:disabled){background:#4338ca}.tb-btn.active{background:#e0e7ff;border-color:#6366f1;color:#4f46e5}.tb-divider{height:16px;width:1px;background:#cbd5e1}.validation-badge{font-size:11px;font-weight:600;padding:4px 10px;border-radius:6px;background:#fee2e2;color:#ef4444;display:flex;align-items:center;gap:4px}.validation-badge.valid{background:#dcfce7;color:#15803d}.topology-tooltip{position:absolute;z-index:100;background:var(--ngx-chart-tooltip-bg, rgba(15, 23, 42, .94));backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);color:var(--ngx-chart-tooltip-color, #f8fafc);padding:12px 14px;border-radius:12px;font-size:11px;box-shadow:0 10px 25px -5px #0000004d,0 8px 10px -6px #0000004d;border:1px solid rgba(255,255,255,.1);transform:translate(-50%,-105%);width:210px;pointer-events:auto;font-family:system-ui,sans-serif}.tt-cat{font-weight:700;margin-bottom:6px;font-size:12px;color:#38bdf8;border-bottom:1px solid rgba(255,255,255,.15);padding-bottom:4px}.tt-section{margin-top:6px;display:flex;flex-direction:column;gap:2px}.section-title{font-weight:700;color:#38bdf8;font-size:9px;text-transform:uppercase;letter-spacing:.05em}.section-content{margin:0;color:#f8fafcd9;font-style:italic;font-family:monospace;font-size:10px;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.action-buttons-row{margin-top:10px;display:flex;flex-direction:column;gap:6px;border-top:1px solid rgba(255,255,255,.15);padding-top:8px}.action-btn{color:#fff;border:none;border-radius:4px;padding:5px 8px;font-size:10px;cursor:pointer;font-weight:600;transition:all .12s;width:100%;text-align:left}.action-btn.explain{background:#4f46e5}.action-btn.explain:hover{background:#6366f1}.action-btn.rerun{background:#334155}.action-btn.rerun:hover{background:#475569}.modal-backdrop{position:fixed;top:0;left:0;width:100vw;height:100vh;background:#0f172a73;backdrop-filter:blur(8px);-webkit-backdrop-filter:blur(8px);z-index:1000;display:flex;justify-content:center;align-items:center}.modal-card{background:var(--ngx-chart-bg, #ffffff);border:1px solid var(--border-color, #e2e8f0);border-radius:16px;box-shadow:0 20px 25px -5px #0000001a,0 10px 10px -5px #0000000a;width:90%;max-width:440px;padding:24px;box-sizing:border-box;display:flex;flex-direction:column;gap:16px;animation:modalAppear .2s cubic-bezier(.16,1,.3,1) forwards}@keyframes modalAppear{0%{transform:scale(.95);opacity:0}to{transform:scale(1);opacity:1}}.modal-header{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid #e2e8f0;padding-bottom:12px}.modal-header h3{margin:0;font-size:15px;font-weight:700;color:#0f172a}.modal-close{background:none;border:none;font-size:22px;color:#64748b;cursor:pointer}.modal-body{display:flex;flex-direction:column;gap:14px}.form-group{display:flex;flex-direction:column;gap:5px}.form-group label{font-size:10px;font-weight:700;color:#475569;text-transform:uppercase;letter-spacing:.05em}.form-group input,.form-group select,.form-group textarea{padding:8px 12px;border:1px solid #cbd5e1;border-radius:6px;font-size:12px;font-family:inherit;color:#0f172a;outline:none;background:#fff;transition:border-color .15s}.form-group input:focus,.form-group select:focus,.form-group textarea:focus{border-color:#6366f1}.form-row{display:flex;gap:12px}.form-group.half{flex:1}.modal-footer{display:flex;justify-content:flex-end;gap:8px;border-top:1px solid #e2e8f0;padding-top:14px}.btn{padding:8px 16px;font-size:11px;font-weight:600;border-radius:6px;cursor:pointer;border:1px solid transparent;transition:all .15s}.btn-secondary{background:#fff;border-color:#cbd5e1;color:#334155}.btn-secondary:hover{background:#f1f5f9}.btn-primary{background:#4f46e5;color:#fff}.btn-primary:hover{background:#4338ca}.zoom-controls{position:absolute;bottom:12px;right:12px;display:flex;align-items:center;gap:6px;background:#0f172acc;backdrop-filter:blur(8px);border:1px solid rgba(255,255,255,.1);border-radius:8px;padding:4px 8px;box-shadow:0 4px 6px #0000001a;z-index:10}.zoom-controls button{background:#ffffff26;border:none;color:#fff;width:24px;height:24px;border-radius:4px;cursor:pointer;display:flex;align-items:center;justify-content:center;font-size:10px;transition:background .15s}.zoom-controls button:hover{background:#ffffff4d}.zoom-level{color:#ffffffd9;font-size:10px;font-weight:600;font-family:monospace;padding-left:4px;min-width:32px;text-align:right}\n"] }]
|
|
36579
|
+
}], ctorParameters: () => [], propDecorators: { handleKeyDown: [{
|
|
36001
36580
|
type: HostListener,
|
|
36002
|
-
args: ['document:
|
|
36581
|
+
args: ['document:keydown', ['$event']]
|
|
36003
36582
|
}] } });
|
|
36004
36583
|
|
|
36005
36584
|
class TransformerAttentionHeatmapComponent {
|