@datasynx/agentic-ai-cartography 0.3.3 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -13,6 +13,9 @@ declare const NodeSchema: z.ZodObject<{
13
13
  confidence: z.ZodDefault<z.ZodNumber>;
14
14
  metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
15
15
  tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
16
+ domain: z.ZodOptional<z.ZodString>;
17
+ subDomain: z.ZodOptional<z.ZodString>;
18
+ qualityScore: z.ZodOptional<z.ZodNumber>;
16
19
  }, "strip", z.ZodTypeAny, {
17
20
  id: string;
18
21
  type: "host" | "database_server" | "database" | "table" | "web_service" | "api_endpoint" | "cache_server" | "message_broker" | "queue" | "topic" | "container" | "pod" | "k8s_cluster" | "config_file" | "saas_tool" | "unknown";
@@ -21,6 +24,9 @@ declare const NodeSchema: z.ZodObject<{
21
24
  confidence: number;
22
25
  metadata: Record<string, unknown>;
23
26
  tags: string[];
27
+ domain?: string | undefined;
28
+ subDomain?: string | undefined;
29
+ qualityScore?: number | undefined;
24
30
  }, {
25
31
  id: string;
26
32
  type: "host" | "database_server" | "database" | "table" | "web_service" | "api_endpoint" | "cache_server" | "message_broker" | "queue" | "topic" | "container" | "pod" | "k8s_cluster" | "config_file" | "saas_tool" | "unknown";
@@ -29,6 +35,9 @@ declare const NodeSchema: z.ZodObject<{
29
35
  confidence?: number | undefined;
30
36
  metadata?: Record<string, unknown> | undefined;
31
37
  tags?: string[] | undefined;
38
+ domain?: string | undefined;
39
+ subDomain?: string | undefined;
40
+ qualityScore?: number | undefined;
32
41
  }>;
33
42
  type DiscoveryNode = z.infer<typeof NodeSchema>;
34
43
  declare const EdgeSchema: z.ZodObject<{
@@ -127,6 +136,115 @@ declare const SOPSchema: z.ZodObject<{
127
136
  frequency: string;
128
137
  }>;
129
138
  type SOP = z.infer<typeof SOPSchema>;
139
+ declare const DataAssetSchema: z.ZodObject<{
140
+ id: z.ZodString;
141
+ name: z.ZodString;
142
+ domain: z.ZodString;
143
+ subDomain: z.ZodOptional<z.ZodString>;
144
+ qualityScore: z.ZodOptional<z.ZodNumber>;
145
+ metadata: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
146
+ position: z.ZodObject<{
147
+ q: z.ZodNumber;
148
+ r: z.ZodNumber;
149
+ }, "strip", z.ZodTypeAny, {
150
+ q: number;
151
+ r: number;
152
+ }, {
153
+ q: number;
154
+ r: number;
155
+ }>;
156
+ }, "strip", z.ZodTypeAny, {
157
+ id: string;
158
+ name: string;
159
+ metadata: Record<string, unknown>;
160
+ domain: string;
161
+ position: {
162
+ q: number;
163
+ r: number;
164
+ };
165
+ subDomain?: string | undefined;
166
+ qualityScore?: number | undefined;
167
+ }, {
168
+ id: string;
169
+ name: string;
170
+ domain: string;
171
+ position: {
172
+ q: number;
173
+ r: number;
174
+ };
175
+ metadata?: Record<string, unknown> | undefined;
176
+ subDomain?: string | undefined;
177
+ qualityScore?: number | undefined;
178
+ }>;
179
+ type DataAsset = z.infer<typeof DataAssetSchema>;
180
+ declare const ClusterSchema: z.ZodObject<{
181
+ id: z.ZodString;
182
+ label: z.ZodString;
183
+ domain: z.ZodString;
184
+ color: z.ZodString;
185
+ assetIds: z.ZodArray<z.ZodString, "many">;
186
+ centroid: z.ZodObject<{
187
+ x: z.ZodNumber;
188
+ y: z.ZodNumber;
189
+ }, "strip", z.ZodTypeAny, {
190
+ x: number;
191
+ y: number;
192
+ }, {
193
+ x: number;
194
+ y: number;
195
+ }>;
196
+ }, "strip", z.ZodTypeAny, {
197
+ id: string;
198
+ domain: string;
199
+ label: string;
200
+ color: string;
201
+ assetIds: string[];
202
+ centroid: {
203
+ x: number;
204
+ y: number;
205
+ };
206
+ }, {
207
+ id: string;
208
+ domain: string;
209
+ label: string;
210
+ color: string;
211
+ assetIds: string[];
212
+ centroid: {
213
+ x: number;
214
+ y: number;
215
+ };
216
+ }>;
217
+ type Cluster = z.infer<typeof ClusterSchema>;
218
+ declare const ConnectionSchema: z.ZodObject<{
219
+ id: z.ZodString;
220
+ sourceAssetId: z.ZodString;
221
+ targetAssetId: z.ZodString;
222
+ type: z.ZodOptional<z.ZodString>;
223
+ }, "strip", z.ZodTypeAny, {
224
+ id: string;
225
+ sourceAssetId: string;
226
+ targetAssetId: string;
227
+ type?: string | undefined;
228
+ }, {
229
+ id: string;
230
+ sourceAssetId: string;
231
+ targetAssetId: string;
232
+ type?: string | undefined;
233
+ }>;
234
+ type Connection = z.infer<typeof ConnectionSchema>;
235
+ interface CartographyMapData {
236
+ assets: DataAsset[];
237
+ clusters: Cluster[];
238
+ connections: Connection[];
239
+ meta: {
240
+ exportedAt: string;
241
+ theme: 'light' | 'dark';
242
+ };
243
+ }
244
+ /** Navy → medium blue → periwinkle → teal/cyan palette */
245
+ declare const DOMAIN_COLORS: Record<string, string>;
246
+ /** Ordered palette for dynamic domain assignment */
247
+ declare const DOMAIN_PALETTE: readonly ["#1a2e5a", "#1e3a8a", "#1d4ed8", "#2563eb", "#3b82f6", "#6366f1", "#818cf8", "#7c9fc3", "#0e7490", "#0891b2", "#06b6d4", "#22d3ee", "#0d9488", "#14b8a6", "#2dd4bf", "#5eead4"];
130
248
  interface NodeRow extends DiscoveryNode {
131
249
  sessionId: string;
132
250
  discoveredAt: string;
@@ -158,6 +276,10 @@ interface CartographyConfig {
158
276
  }
159
277
  declare function defaultConfig(overrides?: Partial<CartographyConfig>): CartographyConfig;
160
278
 
279
+ interface ConnectionRow extends Connection {
280
+ sessionId: string;
281
+ createdAt: string;
282
+ }
161
283
  interface EventRow {
162
284
  id: string;
163
285
  sessionId: string;
@@ -207,6 +329,7 @@ declare class CartographyDB {
207
329
  private mapSession;
208
330
  upsertNode(sessionId: string, node: DiscoveryNode, depth?: number): void;
209
331
  getNodes(sessionId: string): NodeRow[];
332
+ private mapNode;
210
333
  deleteNode(sessionId: string, nodeId: string): void;
211
334
  insertEdge(sessionId: string, edge: DiscoveryEdge): void;
212
335
  getEdges(sessionId: string): EdgeRow[];
@@ -233,6 +356,9 @@ declare class CartographyDB {
233
356
  workflowId: string;
234
357
  generatedAt: string;
235
358
  }>;
359
+ upsertConnection(sessionId: string, conn: Omit<Connection, 'id'>): string;
360
+ getConnections(sessionId: string): ConnectionRow[];
361
+ deleteConnection(sessionId: string, connectionId: string): void;
236
362
  setApproval(pattern: string, action: 'save' | 'ignore' | 'auto'): void;
237
363
  getApproval(pattern: string): string | undefined;
238
364
  getStats(sessionId: string): {
@@ -285,8 +411,104 @@ declare function exportSOPDashboard(sops: Array<SOP & {
285
411
  workflowId: string;
286
412
  generatedAt?: string;
287
413
  }>): string;
414
+ declare function exportCartographyMap(nodes: NodeRow[], edges: EdgeRow[], options?: {
415
+ theme?: 'light' | 'dark';
416
+ }): string;
288
417
  declare function exportAll(db: CartographyDB, sessionId: string, outputDir: string, formats?: string[]): void;
289
418
 
419
+ /**
420
+ * Hex Grid Engine — flat-top axial coordinate system.
421
+ * Reference: https://www.redblobgames.com/grids/hexagons/
422
+ */
423
+ interface AxialCoord {
424
+ q: number;
425
+ r: number;
426
+ }
427
+ interface PixelCoord {
428
+ x: number;
429
+ y: number;
430
+ }
431
+ /**
432
+ * Convert axial hex coordinates to pixel coordinates (flat-top).
433
+ */
434
+ declare function hexToPixel(q: number, r: number, size: number): PixelCoord;
435
+ /**
436
+ * Convert pixel coordinates to nearest axial hex (flat-top).
437
+ */
438
+ declare function pixelToHex(x: number, y: number, size: number): AxialCoord;
439
+ /**
440
+ * Return the 6 pixel corners of a flat-top hexagon.
441
+ */
442
+ declare function hexCorners(cx: number, cy: number, size: number): PixelCoord[];
443
+ declare function hexNeighbors(q: number, r: number): AxialCoord[];
444
+ declare function hexDistance(a: AxialCoord, b: AxialCoord): number;
445
+ /**
446
+ * Generate all hex coordinates on a given ring around center.
447
+ */
448
+ declare function hexRing(center: AxialCoord, radius: number): AxialCoord[];
449
+ /**
450
+ * Generate a spiral sequence of hex positions (ring 0, ring 1, ring 2, …).
451
+ * Returns exactly `count` positions.
452
+ */
453
+ declare function hexSpiral(center: AxialCoord, count: number): AxialCoord[];
454
+
455
+ /**
456
+ * Domain-based clustering and hex grid positioning.
457
+ * Groups data assets by domain, assigns organic hex positions via spiral fill,
458
+ * computes cluster centroids and assigns colors from the domain palette.
459
+ */
460
+
461
+ /**
462
+ * Assign colors to all domains in the dataset.
463
+ */
464
+ declare function assignColors(domains: string[]): Record<string, string>;
465
+ /**
466
+ * Generate a slightly lighter shade of a hex color string.
467
+ */
468
+ declare function shadeVariant(hex: string, amount: number): string;
469
+ /**
470
+ * Group assets by their `domain` field.
471
+ */
472
+ declare function groupByDomain(assets: DataAsset[]): Map<string, DataAsset[]>;
473
+ /**
474
+ * Arrange domain clusters on the hex grid without overlap.
475
+ * Places largest clusters first at the origin, subsequent clusters spiral outward.
476
+ */
477
+ declare function layoutClusters(groups: Map<string, DataAsset[]>, hexSize: number): {
478
+ clusters: Cluster[];
479
+ assets: DataAsset[];
480
+ };
481
+ declare function computeCentroid(positions: AxialCoord[], hexSize: number): {
482
+ x: number;
483
+ y: number;
484
+ };
485
+ declare function computeClusterBounds(assets: DataAsset[], hexSize: number): {
486
+ minX: number;
487
+ minY: number;
488
+ maxX: number;
489
+ maxY: number;
490
+ };
491
+
492
+ /**
493
+ * Node-zu-Asset Mapping.
494
+ * Converts existing DiscoveryNode/Edge data into the CartographyMap data model.
495
+ */
496
+
497
+ /**
498
+ * Convert NodeRow[] to DataAsset[].
499
+ */
500
+ declare function nodesToAssets(nodes: NodeRow[]): DataAsset[];
501
+ /**
502
+ * Convert EdgeRow[] to Connection[].
503
+ */
504
+ declare function edgesToConnections(edges: EdgeRow[]): Connection[];
505
+ /**
506
+ * Build a complete CartographyMapData from raw nodes and edges.
507
+ */
508
+ declare function buildMapData(nodes: NodeRow[], edges: EdgeRow[], options?: {
509
+ theme?: 'light' | 'dark';
510
+ }): CartographyMapData;
511
+
290
512
  declare function checkPrerequisites(): void;
291
513
 
292
- export { type CartographyConfig, CartographyDB, type DiscoveryEdge, type DiscoveryEvent, type DiscoveryNode, EDGE_RELATIONSHIPS, type EdgeRelationship, type EdgeRow, EdgeSchema, NODE_TYPES, type NodeRow, NodeSchema, type NodeType, type SOP, SOPSchema, type SOPStep, SOPStepSchema, type SessionRow, checkPrerequisites, createCartographyTools, CartographyDB as default, defaultConfig, exportAll, exportBackstageYAML, exportHTML, exportJSON, exportSOPDashboard, exportSOPMarkdown, generateDependencyMermaid, generateTopologyMermaid, generateWorkflowMermaid, runDiscovery, safetyHook, stripSensitive };
514
+ export { type CartographyConfig, CartographyDB, type CartographyMapData, type Cluster, ClusterSchema, type Connection, ConnectionSchema, DOMAIN_COLORS, DOMAIN_PALETTE, type DataAsset, DataAssetSchema, type DiscoveryEdge, type DiscoveryEvent, type DiscoveryNode, EDGE_RELATIONSHIPS, type EdgeRelationship, type EdgeRow, EdgeSchema, NODE_TYPES, type NodeRow, NodeSchema, type NodeType, type SOP, SOPSchema, type SOPStep, SOPStepSchema, type SessionRow, assignColors, buildMapData, checkPrerequisites, computeCentroid, computeClusterBounds, createCartographyTools, CartographyDB as default, defaultConfig, edgesToConnections, exportAll, exportBackstageYAML, exportCartographyMap, exportHTML, exportJSON, exportSOPDashboard, exportSOPMarkdown, generateDependencyMermaid, generateTopologyMermaid, generateWorkflowMermaid, groupByDomain, hexCorners, hexDistance, hexNeighbors, hexRing, hexSpiral, hexToPixel, layoutClusters, nodesToAssets, pixelToHex, runDiscovery, safetyHook, shadeVariant, stripSensitive };