ngx-core-components 0.3.25 → 0.3.26
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/fesm2022/ngx-core-components-charts.mjs +670 -123
- 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/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
|
@@ -3,6 +3,8 @@ import { inject, PLATFORM_ID, Injectable, input, output, signal, HostListener, C
|
|
|
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.
|
|
@@ -35041,14 +35043,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
35041
35043
|
}] } });
|
|
35042
35044
|
|
|
35043
35045
|
class AgenticCognitiveTopologyComponent {
|
|
35046
|
+
exportSvc = inject(ChartExportService);
|
|
35044
35047
|
nodes = input.required();
|
|
35045
35048
|
links = input.required();
|
|
35046
35049
|
width = input(650);
|
|
35047
35050
|
height = input(450);
|
|
35048
35051
|
colors = input(CHART_COLORS);
|
|
35049
35052
|
showExport = input(true);
|
|
35053
|
+
// Interactive Editor Inputs
|
|
35054
|
+
editable = input(false);
|
|
35055
|
+
gridSize = input(20);
|
|
35050
35056
|
nodeActionClick = output();
|
|
35051
35057
|
nodePositionChange = output();
|
|
35058
|
+
// Interactive Editor Outputs
|
|
35059
|
+
nodesChange = output();
|
|
35060
|
+
linksChange = output();
|
|
35061
|
+
validationError = output();
|
|
35052
35062
|
// State
|
|
35053
35063
|
exportMenuOpen = signal(false);
|
|
35054
35064
|
tooltipData = signal(null);
|
|
@@ -35065,16 +35075,50 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35065
35075
|
translateY = signal(0);
|
|
35066
35076
|
isPanning = signal(false);
|
|
35067
35077
|
zoomPercent = computed(() => Math.round(this.scale() * 100));
|
|
35068
|
-
transformString = computed(() => `translate(${this.translateX()}
|
|
35078
|
+
transformString = computed(() => `translate(${this.translateX()}, ${this.translateY()}) scale(${this.scale()})`);
|
|
35069
35079
|
startX = 0;
|
|
35070
35080
|
startY = 0;
|
|
35071
35081
|
svgEl = viewChild('svgEl');
|
|
35072
35082
|
// Node Dimensions
|
|
35073
35083
|
nodeWidth = 135;
|
|
35074
35084
|
nodeHeight = 55;
|
|
35085
|
+
// Interactive Editor State Signals
|
|
35086
|
+
activeEditingNode = signal(null);
|
|
35087
|
+
activePortDrag = signal(null);
|
|
35088
|
+
portDragCurrentMouse = signal(null);
|
|
35089
|
+
snapToGridActive = signal(true);
|
|
35090
|
+
undoStack = signal([]);
|
|
35091
|
+
redoStack = signal([]);
|
|
35092
|
+
// Functional Overrides to avoid syncing state anomalies
|
|
35093
|
+
addedNodes = signal([]);
|
|
35094
|
+
deletedNodeIds = signal(new Set());
|
|
35095
|
+
editedNodesMap = signal(new Map());
|
|
35096
|
+
addedLinks = signal([]);
|
|
35097
|
+
deletedLinks = signal(new Set());
|
|
35098
|
+
// Merge functional state signals reactively
|
|
35099
|
+
effectiveNodes = computed(() => {
|
|
35100
|
+
const base = this.nodes();
|
|
35101
|
+
const added = this.addedNodes();
|
|
35102
|
+
const deleted = this.deletedNodeIds();
|
|
35103
|
+
const edited = this.editedNodesMap();
|
|
35104
|
+
let combined = [...base, ...added];
|
|
35105
|
+
combined = combined.filter(n => !deleted.has(n.id));
|
|
35106
|
+
combined = combined.map(n => edited.has(n.id) ? edited.get(n.id) : n);
|
|
35107
|
+
return combined;
|
|
35108
|
+
});
|
|
35109
|
+
effectiveLinks = computed(() => {
|
|
35110
|
+
const base = this.links();
|
|
35111
|
+
const added = this.addedLinks();
|
|
35112
|
+
const deleted = this.deletedLinks();
|
|
35113
|
+
const deletedNodes = this.deletedNodeIds();
|
|
35114
|
+
let combined = [...base, ...added];
|
|
35115
|
+
combined = combined.filter(l => !deleted.has(`${l.source}-${l.target}`));
|
|
35116
|
+
combined = combined.filter(l => !deletedNodes.has(l.source) && !deletedNodes.has(l.target));
|
|
35117
|
+
return combined;
|
|
35118
|
+
});
|
|
35075
35119
|
/** Color map: maps lowercase node type string to a color from the colors input */
|
|
35076
35120
|
typeColorMap = computed(() => {
|
|
35077
|
-
const rawNodes = this.
|
|
35121
|
+
const rawNodes = this.effectiveNodes();
|
|
35078
35122
|
const c = this.colors();
|
|
35079
35123
|
const map = new Map();
|
|
35080
35124
|
let idx = 0;
|
|
@@ -35111,12 +35155,12 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35111
35155
|
});
|
|
35112
35156
|
}
|
|
35113
35157
|
activeAgentsCount = computed(() => {
|
|
35114
|
-
return this.
|
|
35158
|
+
return this.effectiveNodes().filter(n => n.status !== 'idle').length;
|
|
35115
35159
|
});
|
|
35116
35160
|
// Balanced Layered DAG layout algorithm calculated in-component
|
|
35117
35161
|
computedNodes = computed(() => {
|
|
35118
|
-
const rawNodes = this.
|
|
35119
|
-
const rawLinks = this.
|
|
35162
|
+
const rawNodes = this.effectiveNodes();
|
|
35163
|
+
const rawLinks = this.effectiveLinks();
|
|
35120
35164
|
const overrides = this.nodePositionOverrides();
|
|
35121
35165
|
if (!rawNodes.length)
|
|
35122
35166
|
return [];
|
|
@@ -35191,7 +35235,6 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35191
35235
|
const w = this.width();
|
|
35192
35236
|
const h = this.height();
|
|
35193
35237
|
// Map each group horizontally/vertically
|
|
35194
|
-
// Let's do a top-to-bottom layout
|
|
35195
35238
|
const levelsCount = maxDepth + 1;
|
|
35196
35239
|
const paddingY = 40;
|
|
35197
35240
|
const availableH = h - paddingY * 2;
|
|
@@ -35241,7 +35284,7 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35241
35284
|
});
|
|
35242
35285
|
computedLinks = computed(() => {
|
|
35243
35286
|
const nodes = this.computedNodes();
|
|
35244
|
-
const rawLinks = this.
|
|
35287
|
+
const rawLinks = this.effectiveLinks();
|
|
35245
35288
|
const nodeMap = new Map();
|
|
35246
35289
|
nodes.forEach(n => nodeMap.set(n.id, n));
|
|
35247
35290
|
return rawLinks.map(link => {
|
|
@@ -35325,9 +35368,48 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35325
35368
|
};
|
|
35326
35369
|
});
|
|
35327
35370
|
});
|
|
35371
|
+
// SVG port connection path trace (Cubic bezier curved connector from port center to mouse)
|
|
35372
|
+
temporaryDragLinkPath = computed(() => {
|
|
35373
|
+
const drag = this.activePortDrag();
|
|
35374
|
+
const mouse = this.portDragCurrentMouse();
|
|
35375
|
+
if (!drag || !mouse)
|
|
35376
|
+
return '';
|
|
35377
|
+
const x1 = drag.portX;
|
|
35378
|
+
const y1 = drag.portY;
|
|
35379
|
+
const x2 = mouse.x;
|
|
35380
|
+
const y2 = mouse.y;
|
|
35381
|
+
const cp1x = x1 + drag.dir[0] * 60;
|
|
35382
|
+
const cp1y = y1 + drag.dir[1] * 60;
|
|
35383
|
+
return `M ${x1} ${y1} C ${cp1x} ${cp1y}, ${cp1x} ${cp1y}, ${x2} ${y2}`;
|
|
35384
|
+
});
|
|
35385
|
+
// Validation report generator
|
|
35386
|
+
validationReport = computed(() => {
|
|
35387
|
+
const nodes = this.effectiveNodes();
|
|
35388
|
+
const links = this.effectiveLinks();
|
|
35389
|
+
const incoming = {};
|
|
35390
|
+
const outgoing = {};
|
|
35391
|
+
nodes.forEach(n => {
|
|
35392
|
+
incoming[n.id] = 0;
|
|
35393
|
+
outgoing[n.id] = 0;
|
|
35394
|
+
});
|
|
35395
|
+
links.forEach(l => {
|
|
35396
|
+
if (incoming[l.target] !== undefined)
|
|
35397
|
+
incoming[l.target]++;
|
|
35398
|
+
if (outgoing[l.source] !== undefined)
|
|
35399
|
+
outgoing[l.source]++;
|
|
35400
|
+
});
|
|
35401
|
+
const orphans = nodes.filter(n => incoming[n.id] === 0 && outgoing[n.id] === 0).map(n => n.id);
|
|
35402
|
+
const hasCycles = this.detectCyclesGlobal();
|
|
35403
|
+
return {
|
|
35404
|
+
orphans,
|
|
35405
|
+
hasCycles,
|
|
35406
|
+
isValid: orphans.length === 0 && !hasCycles
|
|
35407
|
+
};
|
|
35408
|
+
});
|
|
35328
35409
|
onNodeClick(node, event) {
|
|
35410
|
+
if (this.editable())
|
|
35411
|
+
return; // Don't trigger action tooltip menu in edit mode
|
|
35329
35412
|
event.stopPropagation();
|
|
35330
|
-
// Position tooltip right above or below node card, transformed by current scale and translation
|
|
35331
35413
|
const svg = this.svgEl()?.nativeElement;
|
|
35332
35414
|
if (!svg)
|
|
35333
35415
|
return;
|
|
@@ -35350,15 +35432,7 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35350
35432
|
this.nodeActionClick.emit({ nodeId, action });
|
|
35351
35433
|
this.closeTooltip();
|
|
35352
35434
|
}
|
|
35353
|
-
toggleExportMenu(event) {
|
|
35354
|
-
event.stopPropagation();
|
|
35355
|
-
this.exportMenuOpen.set(!this.exportMenuOpen());
|
|
35356
|
-
}
|
|
35357
|
-
closeExportMenu() {
|
|
35358
|
-
this.exportMenuOpen.set(false);
|
|
35359
|
-
}
|
|
35360
35435
|
onExport(type) {
|
|
35361
|
-
this.exportMenuOpen.set(false);
|
|
35362
35436
|
if (type === 'json')
|
|
35363
35437
|
this.exportToJson();
|
|
35364
35438
|
else if (type === 'csv')
|
|
@@ -35369,72 +35443,22 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35369
35443
|
this.exportToPdf();
|
|
35370
35444
|
}
|
|
35371
35445
|
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);
|
|
35446
|
+
const payload = { nodes: this.effectiveNodes(), links: this.effectiveLinks() };
|
|
35447
|
+
this.exportSvc.downloadJson(payload, 'topology-flow-data.json');
|
|
35380
35448
|
}
|
|
35381
35449
|
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);
|
|
35450
|
+
const links = this.effectiveLinks();
|
|
35451
|
+
if (!links.length)
|
|
35452
|
+
return;
|
|
35453
|
+
const headers = ['Source', 'Target', 'Active'];
|
|
35454
|
+
const rows = links.map(l => [l.source, l.target, !!l.active ? 'true' : 'false']);
|
|
35455
|
+
this.exportSvc.downloadCsv(headers, rows, 'topology-flow-data.csv');
|
|
35393
35456
|
}
|
|
35394
35457
|
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);
|
|
35458
|
+
this.exportSvc.downloadSvg(this.svgEl()?.nativeElement, 'cognitive-topology.svg');
|
|
35411
35459
|
}
|
|
35412
35460
|
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();
|
|
35461
|
+
this.exportSvc.downloadPdf(this.svgEl()?.nativeElement, 'Chart Export', 'cognitive-topology.pdf');
|
|
35438
35462
|
}
|
|
35439
35463
|
// ── Color helpers ──
|
|
35440
35464
|
/** Returns the border color for a node, based on status (priority) or type (from colors input) */
|
|
@@ -35454,7 +35478,6 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35454
35478
|
const x1 = link.cp1X;
|
|
35455
35479
|
const x2 = link.cp2X;
|
|
35456
35480
|
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
35481
|
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
35482
|
}
|
|
35460
35483
|
getMidpointY(link) {
|
|
@@ -35465,6 +35488,198 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35465
35488
|
const y3 = link.destY;
|
|
35466
35489
|
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
35490
|
}
|
|
35491
|
+
// ── Undo/Redo & State History Snapshots ──
|
|
35492
|
+
saveHistory() {
|
|
35493
|
+
const snapshot = {
|
|
35494
|
+
addedNodes: [...this.addedNodes()],
|
|
35495
|
+
deletedNodeIds: new Set(this.deletedNodeIds()),
|
|
35496
|
+
editedNodesMap: new Map(this.editedNodesMap()),
|
|
35497
|
+
addedLinks: [...this.addedLinks()],
|
|
35498
|
+
deletedLinks: new Set(this.deletedLinks()),
|
|
35499
|
+
nodePositionOverrides: new Map(this.nodePositionOverrides())
|
|
35500
|
+
};
|
|
35501
|
+
this.undoStack.update(stack => [...stack, snapshot]);
|
|
35502
|
+
this.redoStack.set([]); // Clear redo stack on new action
|
|
35503
|
+
}
|
|
35504
|
+
applySnapshot(snap) {
|
|
35505
|
+
this.addedNodes.set(snap.addedNodes);
|
|
35506
|
+
this.deletedNodeIds.set(snap.deletedNodeIds);
|
|
35507
|
+
this.editedNodesMap.set(snap.editedNodesMap);
|
|
35508
|
+
this.addedLinks.set(snap.addedLinks);
|
|
35509
|
+
this.deletedLinks.set(snap.deletedLinks);
|
|
35510
|
+
this.nodePositionOverrides.set(snap.nodePositionOverrides);
|
|
35511
|
+
// Emit changes to parent
|
|
35512
|
+
this.nodesChange.emit(this.effectiveNodes());
|
|
35513
|
+
this.linksChange.emit(this.effectiveLinks());
|
|
35514
|
+
}
|
|
35515
|
+
undo() {
|
|
35516
|
+
const stack = this.undoStack();
|
|
35517
|
+
if (stack.length === 0)
|
|
35518
|
+
return;
|
|
35519
|
+
// Save current state to redo stack
|
|
35520
|
+
const current = {
|
|
35521
|
+
addedNodes: [...this.addedNodes()],
|
|
35522
|
+
deletedNodeIds: new Set(this.deletedNodeIds()),
|
|
35523
|
+
editedNodesMap: new Map(this.editedNodesMap()),
|
|
35524
|
+
addedLinks: [...this.addedLinks()],
|
|
35525
|
+
deletedLinks: new Set(this.deletedLinks()),
|
|
35526
|
+
nodePositionOverrides: new Map(this.nodePositionOverrides())
|
|
35527
|
+
};
|
|
35528
|
+
this.redoStack.update(rStack => [...rStack, current]);
|
|
35529
|
+
const previous = stack[stack.length - 1];
|
|
35530
|
+
this.undoStack.set(stack.slice(0, -1));
|
|
35531
|
+
this.applySnapshot(previous);
|
|
35532
|
+
}
|
|
35533
|
+
redo() {
|
|
35534
|
+
const rStack = this.redoStack();
|
|
35535
|
+
if (rStack.length === 0)
|
|
35536
|
+
return;
|
|
35537
|
+
// Save current state to undo stack
|
|
35538
|
+
const current = {
|
|
35539
|
+
addedNodes: [...this.addedNodes()],
|
|
35540
|
+
deletedNodeIds: new Set(this.deletedNodeIds()),
|
|
35541
|
+
editedNodesMap: new Map(this.editedNodesMap()),
|
|
35542
|
+
addedLinks: [...this.addedLinks()],
|
|
35543
|
+
deletedLinks: new Set(this.deletedLinks()),
|
|
35544
|
+
nodePositionOverrides: new Map(this.nodePositionOverrides())
|
|
35545
|
+
};
|
|
35546
|
+
this.undoStack.update(stack => [...stack, current]);
|
|
35547
|
+
const next = rStack[rStack.length - 1];
|
|
35548
|
+
this.redoStack.set(rStack.slice(0, -1));
|
|
35549
|
+
this.applySnapshot(next);
|
|
35550
|
+
}
|
|
35551
|
+
// Keyboard shortcut listener
|
|
35552
|
+
handleKeyDown(event) {
|
|
35553
|
+
if (!this.editable())
|
|
35554
|
+
return;
|
|
35555
|
+
const target = event.target;
|
|
35556
|
+
if (target.tagName === 'INPUT' || target.tagName === 'TEXTAREA') {
|
|
35557
|
+
return;
|
|
35558
|
+
}
|
|
35559
|
+
if (event.ctrlKey || event.metaKey) {
|
|
35560
|
+
if (event.key.toLowerCase() === 'z') {
|
|
35561
|
+
event.preventDefault();
|
|
35562
|
+
this.undo();
|
|
35563
|
+
}
|
|
35564
|
+
else if (event.key.toLowerCase() === 'y') {
|
|
35565
|
+
event.preventDefault();
|
|
35566
|
+
this.redo();
|
|
35567
|
+
}
|
|
35568
|
+
}
|
|
35569
|
+
}
|
|
35570
|
+
autoLayout() {
|
|
35571
|
+
this.saveHistory();
|
|
35572
|
+
this.nodePositionOverrides.set(new Map());
|
|
35573
|
+
// Clear manual x,y on any added nodes so they layout topological
|
|
35574
|
+
this.addedNodes.update(nodes => nodes.map(n => {
|
|
35575
|
+
const { x, y, ...rest } = n;
|
|
35576
|
+
return rest;
|
|
35577
|
+
}));
|
|
35578
|
+
this.nodesChange.emit(this.effectiveNodes());
|
|
35579
|
+
}
|
|
35580
|
+
addNode() {
|
|
35581
|
+
this.saveHistory();
|
|
35582
|
+
const nextId = 'node_' + Math.random().toString(36).substring(2, 8);
|
|
35583
|
+
const newNode = {
|
|
35584
|
+
id: nextId,
|
|
35585
|
+
label: 'New Agent',
|
|
35586
|
+
status: 'idle',
|
|
35587
|
+
type: 'agent',
|
|
35588
|
+
prompt: '',
|
|
35589
|
+
response: '',
|
|
35590
|
+
x: this.width() / 2 - this.translateX(),
|
|
35591
|
+
y: this.height() / 2 - this.translateY()
|
|
35592
|
+
};
|
|
35593
|
+
// Snapped default positioning
|
|
35594
|
+
const overrides = new Map(this.nodePositionOverrides());
|
|
35595
|
+
let x = newNode.x;
|
|
35596
|
+
let y = newNode.y;
|
|
35597
|
+
if (this.snapToGridActive()) {
|
|
35598
|
+
const grid = this.gridSize();
|
|
35599
|
+
x = Math.round(x / grid) * grid;
|
|
35600
|
+
y = Math.round(y / grid) * grid;
|
|
35601
|
+
}
|
|
35602
|
+
overrides.set(nextId, { x, y });
|
|
35603
|
+
this.nodePositionOverrides.set(overrides);
|
|
35604
|
+
this.addedNodes.update(nodes => [...nodes, newNode]);
|
|
35605
|
+
this.nodesChange.emit(this.effectiveNodes());
|
|
35606
|
+
}
|
|
35607
|
+
deleteNode(nodeId, event) {
|
|
35608
|
+
event.stopPropagation();
|
|
35609
|
+
this.saveHistory();
|
|
35610
|
+
const overrides = new Map(this.nodePositionOverrides());
|
|
35611
|
+
overrides.delete(nodeId);
|
|
35612
|
+
this.nodePositionOverrides.set(overrides);
|
|
35613
|
+
this.deletedNodeIds.update(set => {
|
|
35614
|
+
const copy = new Set(set);
|
|
35615
|
+
copy.add(nodeId);
|
|
35616
|
+
return copy;
|
|
35617
|
+
});
|
|
35618
|
+
this.nodesChange.emit(this.effectiveNodes());
|
|
35619
|
+
this.linksChange.emit(this.effectiveLinks());
|
|
35620
|
+
}
|
|
35621
|
+
deleteLink(source, target, event) {
|
|
35622
|
+
event.stopPropagation();
|
|
35623
|
+
this.saveHistory();
|
|
35624
|
+
const linkKey = `${source}-${target}`;
|
|
35625
|
+
this.deletedLinks.update(set => {
|
|
35626
|
+
const copy = new Set(set);
|
|
35627
|
+
copy.add(linkKey);
|
|
35628
|
+
return copy;
|
|
35629
|
+
});
|
|
35630
|
+
// Also remove from addedLinks if present
|
|
35631
|
+
this.addedLinks.update(links => links.filter(l => !(l.source === source && l.target === target)));
|
|
35632
|
+
this.linksChange.emit(this.effectiveLinks());
|
|
35633
|
+
}
|
|
35634
|
+
onNodeDblClick(node, event) {
|
|
35635
|
+
if (!this.editable())
|
|
35636
|
+
return;
|
|
35637
|
+
event.stopPropagation();
|
|
35638
|
+
this.activeEditingNode.set({ ...node });
|
|
35639
|
+
}
|
|
35640
|
+
saveNodeEdit() {
|
|
35641
|
+
const edited = this.activeEditingNode();
|
|
35642
|
+
if (!edited)
|
|
35643
|
+
return;
|
|
35644
|
+
this.saveHistory();
|
|
35645
|
+
this.editedNodesMap.update(map => {
|
|
35646
|
+
const copy = new Map(map);
|
|
35647
|
+
copy.set(edited.id, edited);
|
|
35648
|
+
return copy;
|
|
35649
|
+
});
|
|
35650
|
+
this.activeEditingNode.set(null);
|
|
35651
|
+
this.nodesChange.emit(this.effectiveNodes());
|
|
35652
|
+
}
|
|
35653
|
+
// ── Drag connection drawing logic ──
|
|
35654
|
+
onPortMouseDown(node, dir, event) {
|
|
35655
|
+
if (!this.editable())
|
|
35656
|
+
return;
|
|
35657
|
+
event.stopPropagation();
|
|
35658
|
+
event.preventDefault();
|
|
35659
|
+
const w = this.nodeWidth;
|
|
35660
|
+
const h = this.nodeHeight;
|
|
35661
|
+
let portX = node.x;
|
|
35662
|
+
let portY = node.y;
|
|
35663
|
+
if (dir[0] === 0 && dir[1] === -1) {
|
|
35664
|
+
portY -= h / 2;
|
|
35665
|
+
}
|
|
35666
|
+
else if (dir[0] === 0 && dir[1] === 1) {
|
|
35667
|
+
portY += h / 2;
|
|
35668
|
+
}
|
|
35669
|
+
else if (dir[0] === -1 && dir[1] === 0) {
|
|
35670
|
+
portX -= w / 2;
|
|
35671
|
+
}
|
|
35672
|
+
else if (dir[0] === 1 && dir[1] === 0) {
|
|
35673
|
+
portX += w / 2;
|
|
35674
|
+
}
|
|
35675
|
+
this.activePortDrag.set({
|
|
35676
|
+
nodeId: node.id,
|
|
35677
|
+
portX,
|
|
35678
|
+
portY,
|
|
35679
|
+
dir
|
|
35680
|
+
});
|
|
35681
|
+
this.portDragCurrentMouse.set({ x: portX, y: portY });
|
|
35682
|
+
}
|
|
35468
35683
|
// ── Node drag-to-reposition ──
|
|
35469
35684
|
onNodeMouseDown(node, event) {
|
|
35470
35685
|
if (event.button !== 0)
|
|
@@ -35476,24 +35691,24 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35476
35691
|
return;
|
|
35477
35692
|
const rect = svg.getBoundingClientRect();
|
|
35478
35693
|
const currentScale = this.scale();
|
|
35479
|
-
// Convert client coords to SVG-space coords
|
|
35480
35694
|
const svgX = (event.clientX - rect.left - this.translateX()) / currentScale;
|
|
35481
35695
|
const svgY = (event.clientY - rect.top - this.translateY()) / currentScale;
|
|
35482
35696
|
this.dragOffsetX = svgX - node.x;
|
|
35483
35697
|
this.dragOffsetY = svgY - node.y;
|
|
35484
35698
|
this.draggingNodeId.set(node.id);
|
|
35699
|
+
// Save history point before dragging start
|
|
35700
|
+
if (this.editable()) {
|
|
35701
|
+
this.saveHistory();
|
|
35702
|
+
}
|
|
35485
35703
|
}
|
|
35486
35704
|
// Zoom & Pan Mouse Interaction Event Handlers
|
|
35487
35705
|
onMouseDown(event) {
|
|
35488
|
-
// Only drag panning with left click
|
|
35489
35706
|
if (event.button !== 0)
|
|
35490
35707
|
return;
|
|
35491
|
-
|
|
35492
|
-
if (this.draggingNodeId())
|
|
35708
|
+
if (this.draggingNodeId() || this.activePortDrag())
|
|
35493
35709
|
return;
|
|
35494
|
-
// Ignore drags that originate on buttons, tooltips, or node cards
|
|
35495
35710
|
const target = event.target;
|
|
35496
|
-
if (target.closest('.node-group') || target.closest('.topology-tooltip') || target.closest('.zoom-controls') || target.closest('.chart-export-menu')) {
|
|
35711
|
+
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
35712
|
return;
|
|
35498
35713
|
}
|
|
35499
35714
|
event.preventDefault();
|
|
@@ -35502,8 +35717,8 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35502
35717
|
this.startY = event.clientY - this.translateY();
|
|
35503
35718
|
}
|
|
35504
35719
|
onMouseMove(event) {
|
|
35505
|
-
// Node dragging takes priority over canvas panning
|
|
35506
35720
|
const dragId = this.draggingNodeId();
|
|
35721
|
+
const portDrag = this.activePortDrag();
|
|
35507
35722
|
if (dragId) {
|
|
35508
35723
|
const svg = this.svgEl()?.nativeElement;
|
|
35509
35724
|
if (!svg)
|
|
@@ -35514,11 +35729,29 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35514
35729
|
const svgY = (event.clientY - rect.top - this.translateY()) / currentScale;
|
|
35515
35730
|
const newX = svgX - this.dragOffsetX;
|
|
35516
35731
|
const newY = svgY - this.dragOffsetY;
|
|
35732
|
+
let x = newX;
|
|
35733
|
+
let y = newY;
|
|
35734
|
+
if (this.editable() && this.snapToGridActive()) {
|
|
35735
|
+
const grid = this.gridSize();
|
|
35736
|
+
x = Math.round(newX / grid) * grid;
|
|
35737
|
+
y = Math.round(newY / grid) * grid;
|
|
35738
|
+
}
|
|
35517
35739
|
const current = new Map(this.nodePositionOverrides());
|
|
35518
|
-
current.set(dragId, { x
|
|
35740
|
+
current.set(dragId, { x, y });
|
|
35519
35741
|
this.nodePositionOverrides.set(current);
|
|
35520
35742
|
return;
|
|
35521
35743
|
}
|
|
35744
|
+
if (portDrag) {
|
|
35745
|
+
const svg = this.svgEl()?.nativeElement;
|
|
35746
|
+
if (!svg)
|
|
35747
|
+
return;
|
|
35748
|
+
const rect = svg.getBoundingClientRect();
|
|
35749
|
+
const currentScale = this.scale();
|
|
35750
|
+
const svgX = (event.clientX - rect.left - this.translateX()) / currentScale;
|
|
35751
|
+
const svgY = (event.clientY - rect.top - this.translateY()) / currentScale;
|
|
35752
|
+
this.portDragCurrentMouse.set({ x: svgX, y: svgY });
|
|
35753
|
+
return;
|
|
35754
|
+
}
|
|
35522
35755
|
if (!this.isPanning())
|
|
35523
35756
|
return;
|
|
35524
35757
|
this.translateX.set(event.clientX - this.startX);
|
|
@@ -35526,6 +35759,7 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35526
35759
|
}
|
|
35527
35760
|
onMouseUp() {
|
|
35528
35761
|
const dragId = this.draggingNodeId();
|
|
35762
|
+
const portDrag = this.activePortDrag();
|
|
35529
35763
|
if (dragId) {
|
|
35530
35764
|
const pos = this.nodePositionOverrides().get(dragId);
|
|
35531
35765
|
if (pos) {
|
|
@@ -35534,6 +35768,33 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35534
35768
|
this.draggingNodeId.set(null);
|
|
35535
35769
|
return;
|
|
35536
35770
|
}
|
|
35771
|
+
if (portDrag) {
|
|
35772
|
+
const targetId = this.hoveredNodeId();
|
|
35773
|
+
const sourceId = portDrag.nodeId;
|
|
35774
|
+
if (targetId && targetId !== sourceId) {
|
|
35775
|
+
const introducesCycle = this.checkCycle(targetId, sourceId); // Cycles check
|
|
35776
|
+
const alreadyConnected = this.effectiveLinks().some(l => l.source === sourceId && l.target === targetId);
|
|
35777
|
+
if (alreadyConnected) {
|
|
35778
|
+
this.validationError.emit(`Connection already exists between ${sourceId} and ${targetId}.`);
|
|
35779
|
+
}
|
|
35780
|
+
else if (introducesCycle) {
|
|
35781
|
+
this.validationError.emit(`Cannot connect: introducing a cyclic dependency.`);
|
|
35782
|
+
}
|
|
35783
|
+
else {
|
|
35784
|
+
this.saveHistory();
|
|
35785
|
+
const newLink = {
|
|
35786
|
+
source: sourceId,
|
|
35787
|
+
target: targetId,
|
|
35788
|
+
active: false
|
|
35789
|
+
};
|
|
35790
|
+
this.addedLinks.update(links => [...links, newLink]);
|
|
35791
|
+
this.linksChange.emit(this.effectiveLinks());
|
|
35792
|
+
}
|
|
35793
|
+
}
|
|
35794
|
+
this.activePortDrag.set(null);
|
|
35795
|
+
this.portDragCurrentMouse.set(null);
|
|
35796
|
+
return;
|
|
35797
|
+
}
|
|
35537
35798
|
this.isPanning.set(false);
|
|
35538
35799
|
}
|
|
35539
35800
|
onMouseLeave() {
|
|
@@ -35545,6 +35806,8 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35545
35806
|
}
|
|
35546
35807
|
this.draggingNodeId.set(null);
|
|
35547
35808
|
}
|
|
35809
|
+
this.activePortDrag.set(null);
|
|
35810
|
+
this.portDragCurrentMouse.set(null);
|
|
35548
35811
|
this.isPanning.set(false);
|
|
35549
35812
|
this.hoveredNodeId.set(null);
|
|
35550
35813
|
}
|
|
@@ -35589,31 +35852,141 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35589
35852
|
this.translateX.set(0);
|
|
35590
35853
|
this.translateY.set(0);
|
|
35591
35854
|
}
|
|
35855
|
+
// ── DAG Helper validations ──
|
|
35856
|
+
checkCycle(start, target) {
|
|
35857
|
+
const links = this.effectiveLinks();
|
|
35858
|
+
const adj = {};
|
|
35859
|
+
this.effectiveNodes().forEach(n => adj[n.id] = []);
|
|
35860
|
+
links.forEach(l => {
|
|
35861
|
+
if (adj[l.source])
|
|
35862
|
+
adj[l.source].push(l.target);
|
|
35863
|
+
});
|
|
35864
|
+
const queue = [start];
|
|
35865
|
+
const visited = new Set();
|
|
35866
|
+
while (queue.length > 0) {
|
|
35867
|
+
const cur = queue.shift();
|
|
35868
|
+
if (cur === target)
|
|
35869
|
+
return true;
|
|
35870
|
+
if (visited.has(cur))
|
|
35871
|
+
continue;
|
|
35872
|
+
visited.add(cur);
|
|
35873
|
+
const neighbors = adj[cur] || [];
|
|
35874
|
+
for (const n of neighbors) {
|
|
35875
|
+
if (!visited.has(n)) {
|
|
35876
|
+
queue.push(n);
|
|
35877
|
+
}
|
|
35878
|
+
}
|
|
35879
|
+
}
|
|
35880
|
+
return false;
|
|
35881
|
+
}
|
|
35882
|
+
detectCyclesGlobal() {
|
|
35883
|
+
const nodes = this.effectiveNodes();
|
|
35884
|
+
const links = this.effectiveLinks();
|
|
35885
|
+
const adj = {};
|
|
35886
|
+
nodes.forEach(n => adj[n.id] = []);
|
|
35887
|
+
links.forEach(l => {
|
|
35888
|
+
if (adj[l.source])
|
|
35889
|
+
adj[l.source].push(l.target);
|
|
35890
|
+
});
|
|
35891
|
+
const visited = new Set();
|
|
35892
|
+
const recStack = new Set();
|
|
35893
|
+
const dfs = (nodeId) => {
|
|
35894
|
+
if (recStack.has(nodeId))
|
|
35895
|
+
return true;
|
|
35896
|
+
if (visited.has(nodeId))
|
|
35897
|
+
return false;
|
|
35898
|
+
visited.add(nodeId);
|
|
35899
|
+
recStack.add(nodeId);
|
|
35900
|
+
const neighbors = adj[nodeId] || [];
|
|
35901
|
+
for (const neighbor of neighbors) {
|
|
35902
|
+
if (dfs(neighbor))
|
|
35903
|
+
return true;
|
|
35904
|
+
}
|
|
35905
|
+
recStack.delete(nodeId);
|
|
35906
|
+
return false;
|
|
35907
|
+
};
|
|
35908
|
+
for (const node of nodes) {
|
|
35909
|
+
if (!visited.has(node.id)) {
|
|
35910
|
+
if (dfs(node.id))
|
|
35911
|
+
return true;
|
|
35912
|
+
}
|
|
35913
|
+
}
|
|
35914
|
+
return false;
|
|
35915
|
+
}
|
|
35916
|
+
exportWorkflowSchema() {
|
|
35917
|
+
const payload = {
|
|
35918
|
+
schemaVersion: "1.0.0",
|
|
35919
|
+
description: "Cognitive workflow schema exported from ngx-agentic-cognitive-topology",
|
|
35920
|
+
graph: {
|
|
35921
|
+
nodes: this.effectiveNodes().map(n => ({
|
|
35922
|
+
id: n.id,
|
|
35923
|
+
label: n.label,
|
|
35924
|
+
type: n.type || 'agent',
|
|
35925
|
+
metadata: {
|
|
35926
|
+
prompt: n.prompt || '',
|
|
35927
|
+
response: n.response || ''
|
|
35928
|
+
}
|
|
35929
|
+
})),
|
|
35930
|
+
edges: this.effectiveLinks().map(l => ({
|
|
35931
|
+
source: l.source,
|
|
35932
|
+
target: l.target,
|
|
35933
|
+
label: l.label || ''
|
|
35934
|
+
}))
|
|
35935
|
+
}
|
|
35936
|
+
};
|
|
35937
|
+
if (typeof navigator !== 'undefined' && navigator.clipboard) {
|
|
35938
|
+
navigator.clipboard.writeText(JSON.stringify(payload, null, 2))
|
|
35939
|
+
.then(() => this.validationError.emit("Workflow schema copied to clipboard!"))
|
|
35940
|
+
.catch(() => console.error("Clipboard copy failed"));
|
|
35941
|
+
}
|
|
35942
|
+
}
|
|
35592
35943
|
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:
|
|
35944
|
+
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
35945
|
<div class="ngx-topology-wrapper">
|
|
35595
35946
|
<div class="chart-header" (mousemove)="$event.stopPropagation()" (mouseleave)="closeTooltip()">
|
|
35596
35947
|
<div class="chart-title-space">
|
|
35597
35948
|
<div class="topology-title">Agentic Cognitive Topology (DAG)</div>
|
|
35598
35949
|
<div class="topology-subtitle">
|
|
35599
|
-
Active Agents: <span class="highlight-val">{{ activeAgentsCount() }}</span> / {{
|
|
35950
|
+
Active Agents: <span class="highlight-val">{{ activeAgentsCount() }}</span> / {{ effectiveNodes().length }}
|
|
35600
35951
|
</div>
|
|
35601
35952
|
</div>
|
|
35602
35953
|
@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>
|
|
35954
|
+
<ngx-chart-export-menu (exportClicked)="onExport($event)" />
|
|
35614
35955
|
}
|
|
35615
35956
|
</div>
|
|
35616
35957
|
|
|
35958
|
+
<!-- Editor Toolbar (Renders in Edit Mode) -->
|
|
35959
|
+
@if (editable()) {
|
|
35960
|
+
<div class="editor-toolbar">
|
|
35961
|
+
<div class="toolbar-section">
|
|
35962
|
+
<button class="tb-btn primary" (click)="addNode()" title="Add Node">➕ Add Agent</button>
|
|
35963
|
+
<span class="tb-divider"></span>
|
|
35964
|
+
<button class="tb-btn" [disabled]="undoStack().length === 0" (click)="undo()" title="Undo (Ctrl+Z)">↩️ Undo ({{ undoStack().length }})</button>
|
|
35965
|
+
<button class="tb-btn" [disabled]="redoStack().length === 0" (click)="redo()" title="Redo (Ctrl+Y)">↪️ Redo ({{ redoStack().length }})</button>
|
|
35966
|
+
<span class="tb-divider"></span>
|
|
35967
|
+
<button class="tb-btn" [class.active]="snapToGridActive()" (click)="snapToGridActive.set(!snapToGridActive())" title="Toggle Snap to Grid">
|
|
35968
|
+
🧲 Snap ({{ gridSize() }}px)
|
|
35969
|
+
</button>
|
|
35970
|
+
<button class="tb-btn" (click)="autoLayout()" title="Rearrange Nodes Automatically">
|
|
35971
|
+
🔀 Rearrange
|
|
35972
|
+
</button>
|
|
35973
|
+
</div>
|
|
35974
|
+
<div class="toolbar-section">
|
|
35975
|
+
<button class="tb-btn" (click)="exportWorkflowSchema()" title="Copy Workflow JSON Schema">📋 Copy JSON Flow</button>
|
|
35976
|
+
|
|
35977
|
+
<div class="validation-badge" [class.valid]="validationReport().isValid">
|
|
35978
|
+
@if (validationReport().isValid) {
|
|
35979
|
+
✅ DAG Solid
|
|
35980
|
+
} @else {
|
|
35981
|
+
⚠️ Warning:
|
|
35982
|
+
@if (validationReport().hasCycles) { Cycle detected! }
|
|
35983
|
+
@if (validationReport().orphans.length > 0) { Isolated nodes present! }
|
|
35984
|
+
}
|
|
35985
|
+
</div>
|
|
35986
|
+
</div>
|
|
35987
|
+
</div>
|
|
35988
|
+
}
|
|
35989
|
+
|
|
35617
35990
|
<div class="ngx-topology-container" [style.height.px]="height()">
|
|
35618
35991
|
<!-- SVG DAG Drawing Canvas -->
|
|
35619
35992
|
<svg
|
|
@@ -35626,7 +35999,7 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35626
35999
|
(mousemove)="onMouseMove($event)"
|
|
35627
36000
|
(mouseup)="onMouseUp()"
|
|
35628
36001
|
(mouseleave)="onMouseLeave()"
|
|
35629
|
-
[style.cursor]="draggingNodeId() ? 'grabbing' : isPanning() ? 'grabbing' : 'grab'"
|
|
36002
|
+
[style.cursor]="draggingNodeId() ? 'grabbing' : isPanning() ? 'grabbing' : activePortDrag() ? 'crosshair' : 'grab'"
|
|
35630
36003
|
>
|
|
35631
36004
|
<!-- Grid background dots -->
|
|
35632
36005
|
<defs>
|
|
@@ -35672,8 +36045,14 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35672
36045
|
class="topology-link-path"
|
|
35673
36046
|
/>
|
|
35674
36047
|
|
|
35675
|
-
<!--
|
|
35676
|
-
@if (
|
|
36048
|
+
<!-- Link Delete Button (Renders in Edit Mode) -->
|
|
36049
|
+
@if (editable()) {
|
|
36050
|
+
<g class="link-delete-btn" [attr.transform]="'translate(' + getMidpointX(link) + ',' + getMidpointY(link) + ')'" (click)="deleteLink(link.source, link.target, $event)">
|
|
36051
|
+
<circle r="7" fill="#ef4444" stroke="#ffffff" stroke-width="1.2" />
|
|
36052
|
+
<text text-anchor="middle" dominant-baseline="middle" fill="#ffffff" font-size="8" font-weight="900" y="-0.5">×</text>
|
|
36053
|
+
</g>
|
|
36054
|
+
} @else if (link.label) {
|
|
36055
|
+
<!-- Optional edge label -->
|
|
35677
36056
|
<text
|
|
35678
36057
|
class="edge-label"
|
|
35679
36058
|
[attr.x]="getMidpointX(link)"
|
|
@@ -35684,6 +36063,11 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35684
36063
|
}
|
|
35685
36064
|
}
|
|
35686
36065
|
|
|
36066
|
+
<!-- Temporary connector drawing edge (renders when dragging a port link) -->
|
|
36067
|
+
@if (temporaryDragLinkPath()) {
|
|
36068
|
+
<path [attr.d]="temporaryDragLinkPath()" class="temporary-drag-link" fill="none" />
|
|
36069
|
+
}
|
|
36070
|
+
|
|
35687
36071
|
<!-- Nodes rendering via foreignObject -->
|
|
35688
36072
|
@for (node of computedNodes(); track node.id) {
|
|
35689
36073
|
<g
|
|
@@ -35697,6 +36081,7 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35697
36081
|
[style.--node-translate]="'translate(' + (node.x - nodeWidth / 2) + 'px,' + (node.y - nodeHeight / 2) + 'px)'"
|
|
35698
36082
|
class="node-group"
|
|
35699
36083
|
(click)="onNodeClick(node, $event)"
|
|
36084
|
+
(dblclick)="onNodeDblClick(node, $event)"
|
|
35700
36085
|
(mousedown)="onNodeMouseDown(node, $event)"
|
|
35701
36086
|
(mouseenter)="hoveredNodeId.set(node.id)"
|
|
35702
36087
|
(mouseleave)="hoveredNodeId.set(null)"
|
|
@@ -35730,8 +36115,22 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35730
36115
|
</div>
|
|
35731
36116
|
</foreignObject>
|
|
35732
36117
|
|
|
36118
|
+
<!-- Connection Ports Handles (Renders in Edit Mode) -->
|
|
36119
|
+
@if (editable()) {
|
|
36120
|
+
<circle cx="67.5" cy="0" r="4" class="connection-port top" (mousedown)="onPortMouseDown(node, [0, -1], $event)" title="Drag connection" />
|
|
36121
|
+
<circle cx="67.5" cy="55" r="4" class="connection-port bottom" (mousedown)="onPortMouseDown(node, [0, 1], $event)" title="Drag connection" />
|
|
36122
|
+
<circle cx="0" cy="27.5" r="4" class="connection-port left" (mousedown)="onPortMouseDown(node, [-1, 0], $event)" title="Drag connection" />
|
|
36123
|
+
<circle cx="135" cy="27.5" r="4" class="connection-port right" (mousedown)="onPortMouseDown(node, [1, 0], $event)" title="Drag connection" />
|
|
36124
|
+
|
|
36125
|
+
<!-- Node Delete Badge -->
|
|
36126
|
+
<g class="node-delete-btn" transform="translate(132, 3)" (click)="deleteNode(node.id, $event)">
|
|
36127
|
+
<circle r="6" fill="#ef4444" stroke="#ffffff" stroke-width="1" />
|
|
36128
|
+
<text text-anchor="middle" dominant-baseline="middle" fill="#ffffff" font-size="8" font-weight="900" y="-0.5">×</text>
|
|
36129
|
+
</g>
|
|
36130
|
+
}
|
|
36131
|
+
|
|
35733
36132
|
<!-- Hover preview pill -->
|
|
35734
|
-
@if (hoveredNodeId() === node.id && !tooltipData()) {
|
|
36133
|
+
@if (!editable() && hoveredNodeId() === node.id && !tooltipData()) {
|
|
35735
36134
|
<foreignObject
|
|
35736
36135
|
[attr.x]="0"
|
|
35737
36136
|
[attr.y]="-28"
|
|
@@ -35789,36 +36188,108 @@ class AgenticCognitiveTopologyComponent {
|
|
|
35789
36188
|
</div>
|
|
35790
36189
|
</div>
|
|
35791
36190
|
}
|
|
36191
|
+
|
|
36192
|
+
<!-- Glassmorphic Property Editor Modal -->
|
|
36193
|
+
@if (activeEditingNode(); as node) {
|
|
36194
|
+
<div class="modal-backdrop" (click)="activeEditingNode.set(null)">
|
|
36195
|
+
<div class="modal-card" (click)="$event.stopPropagation()">
|
|
36196
|
+
<div class="modal-header">
|
|
36197
|
+
<h3>Edit Agent Node</h3>
|
|
36198
|
+
<button class="modal-close" (click)="activeEditingNode.set(null)">×</button>
|
|
36199
|
+
</div>
|
|
36200
|
+
<div class="modal-body">
|
|
36201
|
+
<div class="form-group">
|
|
36202
|
+
<label>Agent Label</label>
|
|
36203
|
+
<input type="text" [(ngModel)]="node.label" placeholder="Enter label..." />
|
|
36204
|
+
</div>
|
|
36205
|
+
<div class="form-row">
|
|
36206
|
+
<div class="form-group half">
|
|
36207
|
+
<label>Type</label>
|
|
36208
|
+
<select [(ngModel)]="node.type">
|
|
36209
|
+
<option value="orchestrator">Orchestrator</option>
|
|
36210
|
+
<option value="agent">Agent</option>
|
|
36211
|
+
<option value="tool">Tool</option>
|
|
36212
|
+
<option value="critic">Critic</option>
|
|
36213
|
+
</select>
|
|
36214
|
+
</div>
|
|
36215
|
+
<div class="form-group half">
|
|
36216
|
+
<label>Status</label>
|
|
36217
|
+
<select [(ngModel)]="node.status">
|
|
36218
|
+
<option value="idle">Idle</option>
|
|
36219
|
+
<option value="thinking">Thinking</option>
|
|
36220
|
+
<option value="success">Success</option>
|
|
36221
|
+
<option value="error">Error</option>
|
|
36222
|
+
</select>
|
|
36223
|
+
</div>
|
|
36224
|
+
</div>
|
|
36225
|
+
<div class="form-group">
|
|
36226
|
+
<label>Prompt Template</label>
|
|
36227
|
+
<textarea [(ngModel)]="node.prompt" rows="3" placeholder="Define agent prompt rules..."></textarea>
|
|
36228
|
+
</div>
|
|
36229
|
+
<div class="form-group">
|
|
36230
|
+
<label>Latest Response</label>
|
|
36231
|
+
<textarea [(ngModel)]="node.response" rows="3" placeholder="Mock agent response..."></textarea>
|
|
36232
|
+
</div>
|
|
36233
|
+
</div>
|
|
36234
|
+
<div class="modal-footer">
|
|
36235
|
+
<button class="btn btn-secondary" (click)="activeEditingNode.set(null)">Cancel</button>
|
|
36236
|
+
<button class="btn btn-primary" (click)="saveNodeEdit()">Save Changes</button>
|
|
36237
|
+
</div>
|
|
36238
|
+
</div>
|
|
36239
|
+
</div>
|
|
36240
|
+
}
|
|
35792
36241
|
</div>
|
|
35793
36242
|
</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 });
|
|
36243
|
+
`, 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
36244
|
}
|
|
35796
36245
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImport: i0, type: AgenticCognitiveTopologyComponent, decorators: [{
|
|
35797
36246
|
type: Component,
|
|
35798
|
-
args: [{ selector: 'ngx-agentic-cognitive-topology', standalone: true, imports: [CommonModule, UpperCasePipe], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
36247
|
+
args: [{ selector: 'ngx-agentic-cognitive-topology', standalone: true, imports: [CommonModule, UpperCasePipe, FormsModule, ChartExportMenuComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
35799
36248
|
<div class="ngx-topology-wrapper">
|
|
35800
36249
|
<div class="chart-header" (mousemove)="$event.stopPropagation()" (mouseleave)="closeTooltip()">
|
|
35801
36250
|
<div class="chart-title-space">
|
|
35802
36251
|
<div class="topology-title">Agentic Cognitive Topology (DAG)</div>
|
|
35803
36252
|
<div class="topology-subtitle">
|
|
35804
|
-
Active Agents: <span class="highlight-val">{{ activeAgentsCount() }}</span> / {{
|
|
36253
|
+
Active Agents: <span class="highlight-val">{{ activeAgentsCount() }}</span> / {{ effectiveNodes().length }}
|
|
35805
36254
|
</div>
|
|
35806
36255
|
</div>
|
|
35807
36256
|
@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>
|
|
36257
|
+
<ngx-chart-export-menu (exportClicked)="onExport($event)" />
|
|
35819
36258
|
}
|
|
35820
36259
|
</div>
|
|
35821
36260
|
|
|
36261
|
+
<!-- Editor Toolbar (Renders in Edit Mode) -->
|
|
36262
|
+
@if (editable()) {
|
|
36263
|
+
<div class="editor-toolbar">
|
|
36264
|
+
<div class="toolbar-section">
|
|
36265
|
+
<button class="tb-btn primary" (click)="addNode()" title="Add Node">➕ Add Agent</button>
|
|
36266
|
+
<span class="tb-divider"></span>
|
|
36267
|
+
<button class="tb-btn" [disabled]="undoStack().length === 0" (click)="undo()" title="Undo (Ctrl+Z)">↩️ Undo ({{ undoStack().length }})</button>
|
|
36268
|
+
<button class="tb-btn" [disabled]="redoStack().length === 0" (click)="redo()" title="Redo (Ctrl+Y)">↪️ Redo ({{ redoStack().length }})</button>
|
|
36269
|
+
<span class="tb-divider"></span>
|
|
36270
|
+
<button class="tb-btn" [class.active]="snapToGridActive()" (click)="snapToGridActive.set(!snapToGridActive())" title="Toggle Snap to Grid">
|
|
36271
|
+
🧲 Snap ({{ gridSize() }}px)
|
|
36272
|
+
</button>
|
|
36273
|
+
<button class="tb-btn" (click)="autoLayout()" title="Rearrange Nodes Automatically">
|
|
36274
|
+
🔀 Rearrange
|
|
36275
|
+
</button>
|
|
36276
|
+
</div>
|
|
36277
|
+
<div class="toolbar-section">
|
|
36278
|
+
<button class="tb-btn" (click)="exportWorkflowSchema()" title="Copy Workflow JSON Schema">📋 Copy JSON Flow</button>
|
|
36279
|
+
|
|
36280
|
+
<div class="validation-badge" [class.valid]="validationReport().isValid">
|
|
36281
|
+
@if (validationReport().isValid) {
|
|
36282
|
+
✅ DAG Solid
|
|
36283
|
+
} @else {
|
|
36284
|
+
⚠️ Warning:
|
|
36285
|
+
@if (validationReport().hasCycles) { Cycle detected! }
|
|
36286
|
+
@if (validationReport().orphans.length > 0) { Isolated nodes present! }
|
|
36287
|
+
}
|
|
36288
|
+
</div>
|
|
36289
|
+
</div>
|
|
36290
|
+
</div>
|
|
36291
|
+
}
|
|
36292
|
+
|
|
35822
36293
|
<div class="ngx-topology-container" [style.height.px]="height()">
|
|
35823
36294
|
<!-- SVG DAG Drawing Canvas -->
|
|
35824
36295
|
<svg
|
|
@@ -35831,7 +36302,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
35831
36302
|
(mousemove)="onMouseMove($event)"
|
|
35832
36303
|
(mouseup)="onMouseUp()"
|
|
35833
36304
|
(mouseleave)="onMouseLeave()"
|
|
35834
|
-
[style.cursor]="draggingNodeId() ? 'grabbing' : isPanning() ? 'grabbing' : 'grab'"
|
|
36305
|
+
[style.cursor]="draggingNodeId() ? 'grabbing' : isPanning() ? 'grabbing' : activePortDrag() ? 'crosshair' : 'grab'"
|
|
35835
36306
|
>
|
|
35836
36307
|
<!-- Grid background dots -->
|
|
35837
36308
|
<defs>
|
|
@@ -35877,8 +36348,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
35877
36348
|
class="topology-link-path"
|
|
35878
36349
|
/>
|
|
35879
36350
|
|
|
35880
|
-
<!--
|
|
35881
|
-
@if (
|
|
36351
|
+
<!-- Link Delete Button (Renders in Edit Mode) -->
|
|
36352
|
+
@if (editable()) {
|
|
36353
|
+
<g class="link-delete-btn" [attr.transform]="'translate(' + getMidpointX(link) + ',' + getMidpointY(link) + ')'" (click)="deleteLink(link.source, link.target, $event)">
|
|
36354
|
+
<circle r="7" fill="#ef4444" stroke="#ffffff" stroke-width="1.2" />
|
|
36355
|
+
<text text-anchor="middle" dominant-baseline="middle" fill="#ffffff" font-size="8" font-weight="900" y="-0.5">×</text>
|
|
36356
|
+
</g>
|
|
36357
|
+
} @else if (link.label) {
|
|
36358
|
+
<!-- Optional edge label -->
|
|
35882
36359
|
<text
|
|
35883
36360
|
class="edge-label"
|
|
35884
36361
|
[attr.x]="getMidpointX(link)"
|
|
@@ -35889,6 +36366,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
35889
36366
|
}
|
|
35890
36367
|
}
|
|
35891
36368
|
|
|
36369
|
+
<!-- Temporary connector drawing edge (renders when dragging a port link) -->
|
|
36370
|
+
@if (temporaryDragLinkPath()) {
|
|
36371
|
+
<path [attr.d]="temporaryDragLinkPath()" class="temporary-drag-link" fill="none" />
|
|
36372
|
+
}
|
|
36373
|
+
|
|
35892
36374
|
<!-- Nodes rendering via foreignObject -->
|
|
35893
36375
|
@for (node of computedNodes(); track node.id) {
|
|
35894
36376
|
<g
|
|
@@ -35902,6 +36384,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
35902
36384
|
[style.--node-translate]="'translate(' + (node.x - nodeWidth / 2) + 'px,' + (node.y - nodeHeight / 2) + 'px)'"
|
|
35903
36385
|
class="node-group"
|
|
35904
36386
|
(click)="onNodeClick(node, $event)"
|
|
36387
|
+
(dblclick)="onNodeDblClick(node, $event)"
|
|
35905
36388
|
(mousedown)="onNodeMouseDown(node, $event)"
|
|
35906
36389
|
(mouseenter)="hoveredNodeId.set(node.id)"
|
|
35907
36390
|
(mouseleave)="hoveredNodeId.set(null)"
|
|
@@ -35935,8 +36418,22 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
35935
36418
|
</div>
|
|
35936
36419
|
</foreignObject>
|
|
35937
36420
|
|
|
36421
|
+
<!-- Connection Ports Handles (Renders in Edit Mode) -->
|
|
36422
|
+
@if (editable()) {
|
|
36423
|
+
<circle cx="67.5" cy="0" r="4" class="connection-port top" (mousedown)="onPortMouseDown(node, [0, -1], $event)" title="Drag connection" />
|
|
36424
|
+
<circle cx="67.5" cy="55" r="4" class="connection-port bottom" (mousedown)="onPortMouseDown(node, [0, 1], $event)" title="Drag connection" />
|
|
36425
|
+
<circle cx="0" cy="27.5" r="4" class="connection-port left" (mousedown)="onPortMouseDown(node, [-1, 0], $event)" title="Drag connection" />
|
|
36426
|
+
<circle cx="135" cy="27.5" r="4" class="connection-port right" (mousedown)="onPortMouseDown(node, [1, 0], $event)" title="Drag connection" />
|
|
36427
|
+
|
|
36428
|
+
<!-- Node Delete Badge -->
|
|
36429
|
+
<g class="node-delete-btn" transform="translate(132, 3)" (click)="deleteNode(node.id, $event)">
|
|
36430
|
+
<circle r="6" fill="#ef4444" stroke="#ffffff" stroke-width="1" />
|
|
36431
|
+
<text text-anchor="middle" dominant-baseline="middle" fill="#ffffff" font-size="8" font-weight="900" y="-0.5">×</text>
|
|
36432
|
+
</g>
|
|
36433
|
+
}
|
|
36434
|
+
|
|
35938
36435
|
<!-- Hover preview pill -->
|
|
35939
|
-
@if (hoveredNodeId() === node.id && !tooltipData()) {
|
|
36436
|
+
@if (!editable() && hoveredNodeId() === node.id && !tooltipData()) {
|
|
35940
36437
|
<foreignObject
|
|
35941
36438
|
[attr.x]="0"
|
|
35942
36439
|
[attr.y]="-28"
|
|
@@ -35994,12 +36491,62 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.20", ngImpo
|
|
|
35994
36491
|
</div>
|
|
35995
36492
|
</div>
|
|
35996
36493
|
}
|
|
36494
|
+
|
|
36495
|
+
<!-- Glassmorphic Property Editor Modal -->
|
|
36496
|
+
@if (activeEditingNode(); as node) {
|
|
36497
|
+
<div class="modal-backdrop" (click)="activeEditingNode.set(null)">
|
|
36498
|
+
<div class="modal-card" (click)="$event.stopPropagation()">
|
|
36499
|
+
<div class="modal-header">
|
|
36500
|
+
<h3>Edit Agent Node</h3>
|
|
36501
|
+
<button class="modal-close" (click)="activeEditingNode.set(null)">×</button>
|
|
36502
|
+
</div>
|
|
36503
|
+
<div class="modal-body">
|
|
36504
|
+
<div class="form-group">
|
|
36505
|
+
<label>Agent Label</label>
|
|
36506
|
+
<input type="text" [(ngModel)]="node.label" placeholder="Enter label..." />
|
|
36507
|
+
</div>
|
|
36508
|
+
<div class="form-row">
|
|
36509
|
+
<div class="form-group half">
|
|
36510
|
+
<label>Type</label>
|
|
36511
|
+
<select [(ngModel)]="node.type">
|
|
36512
|
+
<option value="orchestrator">Orchestrator</option>
|
|
36513
|
+
<option value="agent">Agent</option>
|
|
36514
|
+
<option value="tool">Tool</option>
|
|
36515
|
+
<option value="critic">Critic</option>
|
|
36516
|
+
</select>
|
|
36517
|
+
</div>
|
|
36518
|
+
<div class="form-group half">
|
|
36519
|
+
<label>Status</label>
|
|
36520
|
+
<select [(ngModel)]="node.status">
|
|
36521
|
+
<option value="idle">Idle</option>
|
|
36522
|
+
<option value="thinking">Thinking</option>
|
|
36523
|
+
<option value="success">Success</option>
|
|
36524
|
+
<option value="error">Error</option>
|
|
36525
|
+
</select>
|
|
36526
|
+
</div>
|
|
36527
|
+
</div>
|
|
36528
|
+
<div class="form-group">
|
|
36529
|
+
<label>Prompt Template</label>
|
|
36530
|
+
<textarea [(ngModel)]="node.prompt" rows="3" placeholder="Define agent prompt rules..."></textarea>
|
|
36531
|
+
</div>
|
|
36532
|
+
<div class="form-group">
|
|
36533
|
+
<label>Latest Response</label>
|
|
36534
|
+
<textarea [(ngModel)]="node.response" rows="3" placeholder="Mock agent response..."></textarea>
|
|
36535
|
+
</div>
|
|
36536
|
+
</div>
|
|
36537
|
+
<div class="modal-footer">
|
|
36538
|
+
<button class="btn btn-secondary" (click)="activeEditingNode.set(null)">Cancel</button>
|
|
36539
|
+
<button class="btn btn-primary" (click)="saveNodeEdit()">Save Changes</button>
|
|
36540
|
+
</div>
|
|
36541
|
+
</div>
|
|
36542
|
+
</div>
|
|
36543
|
+
}
|
|
35997
36544
|
</div>
|
|
35998
36545
|
</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: {
|
|
36546
|
+
`, 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"] }]
|
|
36547
|
+
}], ctorParameters: () => [], propDecorators: { handleKeyDown: [{
|
|
36001
36548
|
type: HostListener,
|
|
36002
|
-
args: ['document:
|
|
36549
|
+
args: ['document:keydown', ['$event']]
|
|
36003
36550
|
}] } });
|
|
36004
36551
|
|
|
36005
36552
|
class TransformerAttentionHeatmapComponent {
|