@datasynx/agentic-ai-cartography 2.9.0 → 2.10.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/{chunk-LRUWWHMQ.js → chunk-ASCA3UFM.js} +148 -2
- package/dist/chunk-ASCA3UFM.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/index.cjs +153 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +80 -1
- package/dist/index.d.ts +80 -1
- package/dist/index.js +150 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-bin.js +1 -1
- package/llms-full.txt +1 -0
- package/package.json +1 -1
- package/server.json +2 -2
- package/dist/chunk-LRUWWHMQ.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -3518,6 +3518,85 @@ declare function executeNlQuery(db: CartographyDB, sessionId: string, search: Se
|
|
|
3518
3518
|
/** Convenience: parse + execute in one call. */
|
|
3519
3519
|
declare function resolveNlQuery(db: CartographyDB, sessionId: string, search: SearchFn, raw: string, opts?: NlQueryOptions): Promise<NlQueryResult>;
|
|
3520
3520
|
|
|
3521
|
+
/**
|
|
3522
|
+
* Multi-cloud correlation engine (5.1).
|
|
3523
|
+
*
|
|
3524
|
+
* A pure, deterministic, **non-destructive** layer that takes the nodes/edges of one or
|
|
3525
|
+
* more discovery sessions and produces a correlated overlay: nodes that are the same
|
|
3526
|
+
* logical resource — by exact global identity (`globalId`, 2.9) OR a shared strong
|
|
3527
|
+
* cross-cloud signal (DNS name / public IP / endpoint) — are collapsed into one
|
|
3528
|
+
* **canonical** node carrying its `members` + observed `providers`, and a confidence-
|
|
3529
|
+
* scored `same_as` correlation edge is emitted per merge. The raw `(id, session_id)`
|
|
3530
|
+
* rows are never mutated; this is an additive view (`correlate_topology` MCP tool / export).
|
|
3531
|
+
*/
|
|
3532
|
+
|
|
3533
|
+
/** Correlation evidence tiers, strongest first — the single confidence rubric for 5.1. */
|
|
3534
|
+
type CorrelationSignal = 'global-identity' | 'dns-name' | 'public-ip' | 'endpoint' | 'private-ip';
|
|
3535
|
+
/** Strictly ordered, all in (0,1]. A private IP is weak (NAT reuse), so it never alone merges. */
|
|
3536
|
+
declare const CORRELATION_CONFIDENCE: Record<CorrelationSignal, number>;
|
|
3537
|
+
interface CanonicalNode {
|
|
3538
|
+
/** Stable canonical id — the lexicographically-smallest member id (deterministic). */
|
|
3539
|
+
id: string;
|
|
3540
|
+
type: string;
|
|
3541
|
+
name: string;
|
|
3542
|
+
/** All raw node ids that collapsed into this canonical entity. */
|
|
3543
|
+
members: string[];
|
|
3544
|
+
/** Distinct providers that observed this entity (e.g. ['aws','k8s']) — the cross-cloud span. */
|
|
3545
|
+
providers: string[];
|
|
3546
|
+
/** Cluster confidence = the weakest merge signal that holds the cluster together. */
|
|
3547
|
+
confidence: number;
|
|
3548
|
+
}
|
|
3549
|
+
interface CorrelationEdge {
|
|
3550
|
+
sourceId: string;
|
|
3551
|
+
targetId: string;
|
|
3552
|
+
relationship: 'same_as';
|
|
3553
|
+
signal: CorrelationSignal;
|
|
3554
|
+
confidence: number;
|
|
3555
|
+
evidence: string;
|
|
3556
|
+
}
|
|
3557
|
+
interface CorrelatedTopology {
|
|
3558
|
+
canonical: CanonicalNode[];
|
|
3559
|
+
correlations: CorrelationEdge[];
|
|
3560
|
+
/** Summary: distinct logical entities after correlation, and how many raw nodes collapsed. */
|
|
3561
|
+
summary: {
|
|
3562
|
+
rawNodes: number;
|
|
3563
|
+
canonicalNodes: number;
|
|
3564
|
+
collapsed: number;
|
|
3565
|
+
crossCloud: number;
|
|
3566
|
+
};
|
|
3567
|
+
}
|
|
3568
|
+
/**
|
|
3569
|
+
* Correlate a topology. Deterministic: same input → same output (stable ordering, no clock).
|
|
3570
|
+
* Pairs nodes that share a strong signal, unions them above {@link MERGE_THRESHOLD}, and emits
|
|
3571
|
+
* one canonical node per cluster plus the `same_as` edges that justified each merge.
|
|
3572
|
+
*/
|
|
3573
|
+
declare function correlateTopology(nodes: NodeRow[], _edges?: EdgeRow[]): CorrelatedTopology;
|
|
3574
|
+
|
|
3575
|
+
/**
|
|
3576
|
+
* Correlation signal extraction (5.1).
|
|
3577
|
+
*
|
|
3578
|
+
* Pull the identity signals a node carries — host/endpoint, IPv4 addresses, DNS
|
|
3579
|
+
* names, and the discovering provider — from its structured `id`/`name`/`metadata`.
|
|
3580
|
+
* Pure and deterministic; the regexes are anchored/bounded (ReDoS-safe). These signals
|
|
3581
|
+
* feed the cross-cloud correlation engine, which collapses the same logical resource
|
|
3582
|
+
* discovered via different providers (an AWS EC2 host + an on-prem `host:` node sharing
|
|
3583
|
+
* a DNS name) that `globalId` alone never merges.
|
|
3584
|
+
*/
|
|
3585
|
+
|
|
3586
|
+
interface NodeSignals {
|
|
3587
|
+
/** The discovering provider, parsed from a `{type}:{provider}:{id}` id (e.g. `aws`, `gcp`, `k8s`), if any. */
|
|
3588
|
+
provider?: string;
|
|
3589
|
+
/** Endpoint `host:port` tokens (strong same-service signal). */
|
|
3590
|
+
endpoints: string[];
|
|
3591
|
+
/** IPv4 addresses, partitioned into public vs private (RFC-1918). */
|
|
3592
|
+
publicIps: string[];
|
|
3593
|
+
privateIps: string[];
|
|
3594
|
+
/** Multi-label DNS / FQDN names. */
|
|
3595
|
+
dnsNames: string[];
|
|
3596
|
+
}
|
|
3597
|
+
/** Extract the correlation signals from a node. Pure + deterministic; values de-duplicated + sorted. */
|
|
3598
|
+
declare function extractSignals(node: NodeRow): NodeSignals;
|
|
3599
|
+
|
|
3521
3600
|
/**
|
|
3522
3601
|
* Cost attribution (3.3) — turn the topology into a FinOps lens.
|
|
3523
3602
|
*
|
|
@@ -4300,4 +4379,4 @@ declare function logInfo(message: string, context?: Record<string, unknown>): vo
|
|
|
4300
4379
|
declare function logWarn(message: string, context?: Record<string, unknown>): void;
|
|
4301
4380
|
declare function logError(message: string, context?: Record<string, unknown>): void;
|
|
4302
4381
|
|
|
4303
|
-
export { ACTIONS, ANOMALY_KINDS, ANOMALY_SEVERITIES, type Action, ActionSchema, type AgentProvider, type AgentRunContext, type AgentTool, type Anomaly, type AnomalyConfig, type AnomalyKind, type AnomalySeverity, type AnomalyThresholds, type AnonViolation, type AnonymizationLevel, type ApiServerOptions, type AskUserFn, type AuthConfig, AuthConfigSchema, AuthorizationError, type Awaitable, type BackstageEntity, type BackstageMapOptions, type BindGuardOptions, type BoltDriver, type BoltRecord, type BoltResult, type BoltSession, CLIENTS, CONFIDENCE, COST_PERIODS, type CartographyConfig, CartographyDB, type CartographyMapData, type CentralDbConfig, CentralDbConfigSchema, type ClassifiedItem, type ClassifyInput, type ClassifyResult, type ClientSpec, type Cluster, ClusterSchema, type ComplianceInput, type ComplianceReport, ComplianceReportSchema, type ComplianceRule, ComplianceRuleSchema, type Condition, ConditionSchema, ConfigError, type ConfigFile, ConfigFileSchema, type ConfigFormat, type Connection, ConnectionSchema, type Contributor, type ControlResult, ControlResultSchema, type CostEntry, CostEntrySchema, type CostPeriod, type CostRecord, type CostSource, type CreateMcpServerOptions, type CredentialConfig, CredentialConfigSchema, type CredentialDb, type CredentialRecord, type CredentialStore, type CronFields, CsvCostSource, type CsvCostSourceOptions, DEFAULT_ANOMALY_THRESHOLDS, DEFAULT_FAST_MODEL, DEFAULT_INGEST_QUOTA, DEFAULT_LEAD_MODEL, DEFAULT_SERVER_NAME, DEFAULT_TENANT, DOMAIN_COLORS, DOMAIN_PALETTE, DRIFT_FIELDS, type DashboardOptions, type DataAsset, DataAssetSchema, type DependencyQuery, type DiscoveryEdge, type DiscoveryEvent, type DiscoveryFn, type DiscoveryNode, type DriftAlert, type DriftAlertItem, type DriftConfig, DriftConfigSchema, type DriftField, type DriftItemKind, type DriftRunRow, type DriftSink, type DriftSinkConfig, EDGE_RELATIONSHIPS, type EdgeRelationship, type EdgeRow, EdgeSchema, type EmbeddingProvider, type EnrichResult, type EntryOptions, type EstablishedConn, type EvidenceKind, type FetchLike, type FragmentKind, GraphStoreBackend, type GraphSummary, type HealthResult, type HttpOptions, INGEST_SCHEMA_VERSION, type IngestEnvelope, IngestEnvelopeSchema, type IngestHandler, type IngestHandlerOptions, type IngestOptions, type IngestResponse, type IngestResult, type InstallPlan, InvalidTenantError, type JiraIssue, type JiraOptions, JiraSink, type JiraSinkOptions, LOOPBACK_HOSTS, type LocalDiscoveryOptions, type LocalDiscoveryResult, type LogEntry, type LogLevel, MCP_BIN, type MatchStrategy, NODE_TYPES, NODE_TYPE_GROUPS, type NlIntent, type NlQueryOptions, type NlQueryResult, type NlRelation, type NodeAttribution, type NodeChange, type NodeIdentity, type NodeQuery, type NodeRow, NodeSchema, type NodeType, type NodesResult, NotFoundError, OUTPUT_FORMATS, type OrgKeyOptions, type OrgSummary, type OsKind, type OutputFormat, PACKAGE_NAME, PAGERDUTY_ENQUEUE_URL, PENDING_STATUSES, PERSONAL, PORT_MAP, PRIVATE_IP, PUSH_SCHEMA_VERSION, type PagerDutyEvent, PagerDutySink, type PagerDutySinkOptions, type ParsedApiArgs, type PendingShareRow, type PendingStatus, type PlanOptions, type PolicyResult, type PostJsonOptions, type Principal, PrincipalSchema, type ProviderFactory, type ProviderName, ProviderRegistry, type PushItem, type PushOptions, type PushResult, type QueryBackend, type QuotaConfig, type QuotaDecision, RELATION_TO_DIRECTION, ROLES, RateLimiter, type ResolveContext, type ResolveOptions, type Role, RoleSchema, type RuleCheck, RuleCheckSchema, type RuleScope, type Ruleset, RulesetSchema, type RunDriftOptions, SCAN_ARG_PATTERNS, SCHEMA_VERSION, SDL, SECURITY_METADATA_KEYS, SEVERITIES, SEVERITY_WEIGHT, SHARING_LEVELS, type ScanArgKind, type ScanContext, type ScanHintParams, type ScanResult, type Scanner, type ScannerPlugin, type ScannerPluginApi, ScannerRegistry, ScannerShape, type ScheduleConfig, ScheduleConfigSchema, type ScheduledRunResult, type Scope, type SearchFn, type SemanticSearchOptions, type ServerEntry, type SessionRow, type Severity, type SharePreview, type SharePreviewEntry, type SharingLevel, SharingLevelSchema, type SharingPolicy, type ShellKind, type SlackMessage, SlackSink, SqliteCredentialStore, SqliteQueryBackend, SqliteStoreBackend, type StartApiOptions, StdoutSink, type StoreBackend, type StoreBackendOptions, type SyncClassifyOptions, type SyncClassifyResult, TENANT_HEADER, type TenantContext, TenantMismatchError, type TenantOptions, type ToolResult, type TopologyDelta, type TopologyDiff, type TopologyInput, type TraversalResult, VectorStore, WebhookSink, type WebhookSinkOptions, applyInstall, applySharingLevel, assertReadOnly, assertSafeBind, assertSafeScanArg, assertSameTenant, assignColors, authorize, bearerToken, bookmarksScanner, buildCartographyToolHandlers, buildMapData, buildOpenApiDocument, buildReport, buildSinks, can, centralDbFromEnv, checkBearer, checkPrerequisites, checkReadOnly, clampText, classify, classifyDrift, cleanupTempFiles, cloudAwsScanner, cloudAzureScanner, cloudGcpScanner, codeAddMcpCommand, computeCentroid, computeClusterBounds, computeIdentity, connectionsScanner, contentHash, createBashTool, createCartographyTools, createClaudeProvider, createDefaultRegistry, createHashEmbedder, createIngestHandler, createLocalEmbedder, createMcpServer, createOllamaProvider, createOpenAIProvider, createScanRunner, createSemanticSearch, createSqliteQueryBackend, currentOs, cursorDeeplink, dashboardHtml, databasesScanner, deepMerge, defaultAllowedHosts, defaultConfig, defaultContext, defaultProviderRegistry, defaultRegistry, defaultServerEntry, definePlugin, deriveSessionName, detectAnomalies, detectOrphans, detectShadowIt, diffTopology, edgesToConnections, enrichCosts, entitiesToYaml, evaluateCheck, evaluateRule, evidenceLine, executeGraphql, executeNlQuery, exportAll, exportBackstageYAML, exportComplianceReport, exportCostCSV, exportCostSummary, exportDiscoveryApp, exportJGF, exportJSON, extractListeningPorts, filterBySeverity, findAnonViolations, formatComplianceText, formatJira, formatPagerDuty, formatSlack, generateDependencyMermaid, generateDiffMermaid, generateTopologyMermaid, getClient, getRuleset, globalId, groupByDomain, handleGraphqlGet, hashToken, hexCorners, hexDistance, hexNeighbors, hexRing, hexSpiral, hexToPixel, hmacKey, hostname, ingestEnvelope, installedAppsScanner, isLoopbackHost, isPersonalHost, isReadOnlyCommand, isRemembered, isSecureWebhookUrl, k8sScanner, keyMetaOf, layoutClusters, listClients, listRulesets, loadConfig, loadOrgKey, loadPlugins, loadRuleset, localDiscoveryFn, log, logDebug, logError, logInfo, logWarn, machineId, maxSeverity, mcpServerObject, newAnomalies, nextRun, nodesToAssets, normalizeId, normalizeTenant, openStoreBackend, orgKeyPath, osUser, parseApiArgs, parseComposeDeps, parseConfig, parseConnectionString, parseCostCsv, parseCron, parseEstablished, parseNginxUpstreams, parseNlQuery, parseScanHint, pixelToHex, planInstall, portsScanner, postJson, previewShare, pseudonymize, pseudonymizeFragment, pseudonymizeString, pushDeltas, readConfigFile, redactConnectionString, redactSecrets, redactValue, renderDiff, resolveEffectiveLevel, resolveNlQuery, resolvePrincipal, resolveSharingLevel, resolveTenant, revalidateAnonymized, reversalKey, reversePseudonym, rotateOrgKey, runApi, runDiscovery, runDrift, runHttp, runLocalDiscovery, runOnce, runStdio, runSyncClassify, safeEnv, safeJson, safetyHook, sanitizeUntrusted, sanitizeValue, scopeReads, scoreTopology, securityRelevantChange, serializeConfig, serviceConfigScanner, setVerbose, shadeVariant, shapeToJsonSchema, shareHash, splitSegments, stableStringify, startApi, stripSensitive, timingSafeEqual, toBackstageEntities, validateScanner, vscodeDeeplink, zodToJsonSchema };
|
|
4382
|
+
export { ACTIONS, ANOMALY_KINDS, ANOMALY_SEVERITIES, type Action, ActionSchema, type AgentProvider, type AgentRunContext, type AgentTool, type Anomaly, type AnomalyConfig, type AnomalyKind, type AnomalySeverity, type AnomalyThresholds, type AnonViolation, type AnonymizationLevel, type ApiServerOptions, type AskUserFn, type AuthConfig, AuthConfigSchema, AuthorizationError, type Awaitable, type BackstageEntity, type BackstageMapOptions, type BindGuardOptions, type BoltDriver, type BoltRecord, type BoltResult, type BoltSession, CLIENTS, CONFIDENCE, CORRELATION_CONFIDENCE, COST_PERIODS, type CanonicalNode, type CartographyConfig, CartographyDB, type CartographyMapData, type CentralDbConfig, CentralDbConfigSchema, type ClassifiedItem, type ClassifyInput, type ClassifyResult, type ClientSpec, type Cluster, ClusterSchema, type ComplianceInput, type ComplianceReport, ComplianceReportSchema, type ComplianceRule, ComplianceRuleSchema, type Condition, ConditionSchema, ConfigError, type ConfigFile, ConfigFileSchema, type ConfigFormat, type Connection, ConnectionSchema, type Contributor, type ControlResult, ControlResultSchema, type CorrelatedTopology, type CorrelationEdge, type CorrelationSignal, type CostEntry, CostEntrySchema, type CostPeriod, type CostRecord, type CostSource, type CreateMcpServerOptions, type CredentialConfig, CredentialConfigSchema, type CredentialDb, type CredentialRecord, type CredentialStore, type CronFields, CsvCostSource, type CsvCostSourceOptions, DEFAULT_ANOMALY_THRESHOLDS, DEFAULT_FAST_MODEL, DEFAULT_INGEST_QUOTA, DEFAULT_LEAD_MODEL, DEFAULT_SERVER_NAME, DEFAULT_TENANT, DOMAIN_COLORS, DOMAIN_PALETTE, DRIFT_FIELDS, type DashboardOptions, type DataAsset, DataAssetSchema, type DependencyQuery, type DiscoveryEdge, type DiscoveryEvent, type DiscoveryFn, type DiscoveryNode, type DriftAlert, type DriftAlertItem, type DriftConfig, DriftConfigSchema, type DriftField, type DriftItemKind, type DriftRunRow, type DriftSink, type DriftSinkConfig, EDGE_RELATIONSHIPS, type EdgeRelationship, type EdgeRow, EdgeSchema, type EmbeddingProvider, type EnrichResult, type EntryOptions, type EstablishedConn, type EvidenceKind, type FetchLike, type FragmentKind, GraphStoreBackend, type GraphSummary, type HealthResult, type HttpOptions, INGEST_SCHEMA_VERSION, type IngestEnvelope, IngestEnvelopeSchema, type IngestHandler, type IngestHandlerOptions, type IngestOptions, type IngestResponse, type IngestResult, type InstallPlan, InvalidTenantError, type JiraIssue, type JiraOptions, JiraSink, type JiraSinkOptions, LOOPBACK_HOSTS, type LocalDiscoveryOptions, type LocalDiscoveryResult, type LogEntry, type LogLevel, MCP_BIN, type MatchStrategy, NODE_TYPES, NODE_TYPE_GROUPS, type NlIntent, type NlQueryOptions, type NlQueryResult, type NlRelation, type NodeAttribution, type NodeChange, type NodeIdentity, type NodeQuery, type NodeRow, NodeSchema, type NodeSignals, type NodeType, type NodesResult, NotFoundError, OUTPUT_FORMATS, type OrgKeyOptions, type OrgSummary, type OsKind, type OutputFormat, PACKAGE_NAME, PAGERDUTY_ENQUEUE_URL, PENDING_STATUSES, PERSONAL, PORT_MAP, PRIVATE_IP, PUSH_SCHEMA_VERSION, type PagerDutyEvent, PagerDutySink, type PagerDutySinkOptions, type ParsedApiArgs, type PendingShareRow, type PendingStatus, type PlanOptions, type PolicyResult, type PostJsonOptions, type Principal, PrincipalSchema, type ProviderFactory, type ProviderName, ProviderRegistry, type PushItem, type PushOptions, type PushResult, type QueryBackend, type QuotaConfig, type QuotaDecision, RELATION_TO_DIRECTION, ROLES, RateLimiter, type ResolveContext, type ResolveOptions, type Role, RoleSchema, type RuleCheck, RuleCheckSchema, type RuleScope, type Ruleset, RulesetSchema, type RunDriftOptions, SCAN_ARG_PATTERNS, SCHEMA_VERSION, SDL, SECURITY_METADATA_KEYS, SEVERITIES, SEVERITY_WEIGHT, SHARING_LEVELS, type ScanArgKind, type ScanContext, type ScanHintParams, type ScanResult, type Scanner, type ScannerPlugin, type ScannerPluginApi, ScannerRegistry, ScannerShape, type ScheduleConfig, ScheduleConfigSchema, type ScheduledRunResult, type Scope, type SearchFn, type SemanticSearchOptions, type ServerEntry, type SessionRow, type Severity, type SharePreview, type SharePreviewEntry, type SharingLevel, SharingLevelSchema, type SharingPolicy, type ShellKind, type SlackMessage, SlackSink, SqliteCredentialStore, SqliteQueryBackend, SqliteStoreBackend, type StartApiOptions, StdoutSink, type StoreBackend, type StoreBackendOptions, type SyncClassifyOptions, type SyncClassifyResult, TENANT_HEADER, type TenantContext, TenantMismatchError, type TenantOptions, type ToolResult, type TopologyDelta, type TopologyDiff, type TopologyInput, type TraversalResult, VectorStore, WebhookSink, type WebhookSinkOptions, applyInstall, applySharingLevel, assertReadOnly, assertSafeBind, assertSafeScanArg, assertSameTenant, assignColors, authorize, bearerToken, bookmarksScanner, buildCartographyToolHandlers, buildMapData, buildOpenApiDocument, buildReport, buildSinks, can, centralDbFromEnv, checkBearer, checkPrerequisites, checkReadOnly, clampText, classify, classifyDrift, cleanupTempFiles, cloudAwsScanner, cloudAzureScanner, cloudGcpScanner, codeAddMcpCommand, computeCentroid, computeClusterBounds, computeIdentity, connectionsScanner, contentHash, correlateTopology, createBashTool, createCartographyTools, createClaudeProvider, createDefaultRegistry, createHashEmbedder, createIngestHandler, createLocalEmbedder, createMcpServer, createOllamaProvider, createOpenAIProvider, createScanRunner, createSemanticSearch, createSqliteQueryBackend, currentOs, cursorDeeplink, dashboardHtml, databasesScanner, deepMerge, defaultAllowedHosts, defaultConfig, defaultContext, defaultProviderRegistry, defaultRegistry, defaultServerEntry, definePlugin, deriveSessionName, detectAnomalies, detectOrphans, detectShadowIt, diffTopology, edgesToConnections, enrichCosts, entitiesToYaml, evaluateCheck, evaluateRule, evidenceLine, executeGraphql, executeNlQuery, exportAll, exportBackstageYAML, exportComplianceReport, exportCostCSV, exportCostSummary, exportDiscoveryApp, exportJGF, exportJSON, extractListeningPorts, extractSignals, filterBySeverity, findAnonViolations, formatComplianceText, formatJira, formatPagerDuty, formatSlack, generateDependencyMermaid, generateDiffMermaid, generateTopologyMermaid, getClient, getRuleset, globalId, groupByDomain, handleGraphqlGet, hashToken, hexCorners, hexDistance, hexNeighbors, hexRing, hexSpiral, hexToPixel, hmacKey, hostname, ingestEnvelope, installedAppsScanner, isLoopbackHost, isPersonalHost, isReadOnlyCommand, isRemembered, isSecureWebhookUrl, k8sScanner, keyMetaOf, layoutClusters, listClients, listRulesets, loadConfig, loadOrgKey, loadPlugins, loadRuleset, localDiscoveryFn, log, logDebug, logError, logInfo, logWarn, machineId, maxSeverity, mcpServerObject, newAnomalies, nextRun, nodesToAssets, normalizeId, normalizeTenant, openStoreBackend, orgKeyPath, osUser, parseApiArgs, parseComposeDeps, parseConfig, parseConnectionString, parseCostCsv, parseCron, parseEstablished, parseNginxUpstreams, parseNlQuery, parseScanHint, pixelToHex, planInstall, portsScanner, postJson, previewShare, pseudonymize, pseudonymizeFragment, pseudonymizeString, pushDeltas, readConfigFile, redactConnectionString, redactSecrets, redactValue, renderDiff, resolveEffectiveLevel, resolveNlQuery, resolvePrincipal, resolveSharingLevel, resolveTenant, revalidateAnonymized, reversalKey, reversePseudonym, rotateOrgKey, runApi, runDiscovery, runDrift, runHttp, runLocalDiscovery, runOnce, runStdio, runSyncClassify, safeEnv, safeJson, safetyHook, sanitizeUntrusted, sanitizeValue, scopeReads, scoreTopology, securityRelevantChange, serializeConfig, serviceConfigScanner, setVerbose, shadeVariant, shapeToJsonSchema, shareHash, splitSegments, stableStringify, startApi, stripSensitive, timingSafeEqual, toBackstageEntities, validateScanner, vscodeDeeplink, zodToJsonSchema };
|
package/dist/index.d.ts
CHANGED
|
@@ -3518,6 +3518,85 @@ declare function executeNlQuery(db: CartographyDB, sessionId: string, search: Se
|
|
|
3518
3518
|
/** Convenience: parse + execute in one call. */
|
|
3519
3519
|
declare function resolveNlQuery(db: CartographyDB, sessionId: string, search: SearchFn, raw: string, opts?: NlQueryOptions): Promise<NlQueryResult>;
|
|
3520
3520
|
|
|
3521
|
+
/**
|
|
3522
|
+
* Multi-cloud correlation engine (5.1).
|
|
3523
|
+
*
|
|
3524
|
+
* A pure, deterministic, **non-destructive** layer that takes the nodes/edges of one or
|
|
3525
|
+
* more discovery sessions and produces a correlated overlay: nodes that are the same
|
|
3526
|
+
* logical resource — by exact global identity (`globalId`, 2.9) OR a shared strong
|
|
3527
|
+
* cross-cloud signal (DNS name / public IP / endpoint) — are collapsed into one
|
|
3528
|
+
* **canonical** node carrying its `members` + observed `providers`, and a confidence-
|
|
3529
|
+
* scored `same_as` correlation edge is emitted per merge. The raw `(id, session_id)`
|
|
3530
|
+
* rows are never mutated; this is an additive view (`correlate_topology` MCP tool / export).
|
|
3531
|
+
*/
|
|
3532
|
+
|
|
3533
|
+
/** Correlation evidence tiers, strongest first — the single confidence rubric for 5.1. */
|
|
3534
|
+
type CorrelationSignal = 'global-identity' | 'dns-name' | 'public-ip' | 'endpoint' | 'private-ip';
|
|
3535
|
+
/** Strictly ordered, all in (0,1]. A private IP is weak (NAT reuse), so it never alone merges. */
|
|
3536
|
+
declare const CORRELATION_CONFIDENCE: Record<CorrelationSignal, number>;
|
|
3537
|
+
interface CanonicalNode {
|
|
3538
|
+
/** Stable canonical id — the lexicographically-smallest member id (deterministic). */
|
|
3539
|
+
id: string;
|
|
3540
|
+
type: string;
|
|
3541
|
+
name: string;
|
|
3542
|
+
/** All raw node ids that collapsed into this canonical entity. */
|
|
3543
|
+
members: string[];
|
|
3544
|
+
/** Distinct providers that observed this entity (e.g. ['aws','k8s']) — the cross-cloud span. */
|
|
3545
|
+
providers: string[];
|
|
3546
|
+
/** Cluster confidence = the weakest merge signal that holds the cluster together. */
|
|
3547
|
+
confidence: number;
|
|
3548
|
+
}
|
|
3549
|
+
interface CorrelationEdge {
|
|
3550
|
+
sourceId: string;
|
|
3551
|
+
targetId: string;
|
|
3552
|
+
relationship: 'same_as';
|
|
3553
|
+
signal: CorrelationSignal;
|
|
3554
|
+
confidence: number;
|
|
3555
|
+
evidence: string;
|
|
3556
|
+
}
|
|
3557
|
+
interface CorrelatedTopology {
|
|
3558
|
+
canonical: CanonicalNode[];
|
|
3559
|
+
correlations: CorrelationEdge[];
|
|
3560
|
+
/** Summary: distinct logical entities after correlation, and how many raw nodes collapsed. */
|
|
3561
|
+
summary: {
|
|
3562
|
+
rawNodes: number;
|
|
3563
|
+
canonicalNodes: number;
|
|
3564
|
+
collapsed: number;
|
|
3565
|
+
crossCloud: number;
|
|
3566
|
+
};
|
|
3567
|
+
}
|
|
3568
|
+
/**
|
|
3569
|
+
* Correlate a topology. Deterministic: same input → same output (stable ordering, no clock).
|
|
3570
|
+
* Pairs nodes that share a strong signal, unions them above {@link MERGE_THRESHOLD}, and emits
|
|
3571
|
+
* one canonical node per cluster plus the `same_as` edges that justified each merge.
|
|
3572
|
+
*/
|
|
3573
|
+
declare function correlateTopology(nodes: NodeRow[], _edges?: EdgeRow[]): CorrelatedTopology;
|
|
3574
|
+
|
|
3575
|
+
/**
|
|
3576
|
+
* Correlation signal extraction (5.1).
|
|
3577
|
+
*
|
|
3578
|
+
* Pull the identity signals a node carries — host/endpoint, IPv4 addresses, DNS
|
|
3579
|
+
* names, and the discovering provider — from its structured `id`/`name`/`metadata`.
|
|
3580
|
+
* Pure and deterministic; the regexes are anchored/bounded (ReDoS-safe). These signals
|
|
3581
|
+
* feed the cross-cloud correlation engine, which collapses the same logical resource
|
|
3582
|
+
* discovered via different providers (an AWS EC2 host + an on-prem `host:` node sharing
|
|
3583
|
+
* a DNS name) that `globalId` alone never merges.
|
|
3584
|
+
*/
|
|
3585
|
+
|
|
3586
|
+
interface NodeSignals {
|
|
3587
|
+
/** The discovering provider, parsed from a `{type}:{provider}:{id}` id (e.g. `aws`, `gcp`, `k8s`), if any. */
|
|
3588
|
+
provider?: string;
|
|
3589
|
+
/** Endpoint `host:port` tokens (strong same-service signal). */
|
|
3590
|
+
endpoints: string[];
|
|
3591
|
+
/** IPv4 addresses, partitioned into public vs private (RFC-1918). */
|
|
3592
|
+
publicIps: string[];
|
|
3593
|
+
privateIps: string[];
|
|
3594
|
+
/** Multi-label DNS / FQDN names. */
|
|
3595
|
+
dnsNames: string[];
|
|
3596
|
+
}
|
|
3597
|
+
/** Extract the correlation signals from a node. Pure + deterministic; values de-duplicated + sorted. */
|
|
3598
|
+
declare function extractSignals(node: NodeRow): NodeSignals;
|
|
3599
|
+
|
|
3521
3600
|
/**
|
|
3522
3601
|
* Cost attribution (3.3) — turn the topology into a FinOps lens.
|
|
3523
3602
|
*
|
|
@@ -4300,4 +4379,4 @@ declare function logInfo(message: string, context?: Record<string, unknown>): vo
|
|
|
4300
4379
|
declare function logWarn(message: string, context?: Record<string, unknown>): void;
|
|
4301
4380
|
declare function logError(message: string, context?: Record<string, unknown>): void;
|
|
4302
4381
|
|
|
4303
|
-
export { ACTIONS, ANOMALY_KINDS, ANOMALY_SEVERITIES, type Action, ActionSchema, type AgentProvider, type AgentRunContext, type AgentTool, type Anomaly, type AnomalyConfig, type AnomalyKind, type AnomalySeverity, type AnomalyThresholds, type AnonViolation, type AnonymizationLevel, type ApiServerOptions, type AskUserFn, type AuthConfig, AuthConfigSchema, AuthorizationError, type Awaitable, type BackstageEntity, type BackstageMapOptions, type BindGuardOptions, type BoltDriver, type BoltRecord, type BoltResult, type BoltSession, CLIENTS, CONFIDENCE, COST_PERIODS, type CartographyConfig, CartographyDB, type CartographyMapData, type CentralDbConfig, CentralDbConfigSchema, type ClassifiedItem, type ClassifyInput, type ClassifyResult, type ClientSpec, type Cluster, ClusterSchema, type ComplianceInput, type ComplianceReport, ComplianceReportSchema, type ComplianceRule, ComplianceRuleSchema, type Condition, ConditionSchema, ConfigError, type ConfigFile, ConfigFileSchema, type ConfigFormat, type Connection, ConnectionSchema, type Contributor, type ControlResult, ControlResultSchema, type CostEntry, CostEntrySchema, type CostPeriod, type CostRecord, type CostSource, type CreateMcpServerOptions, type CredentialConfig, CredentialConfigSchema, type CredentialDb, type CredentialRecord, type CredentialStore, type CronFields, CsvCostSource, type CsvCostSourceOptions, DEFAULT_ANOMALY_THRESHOLDS, DEFAULT_FAST_MODEL, DEFAULT_INGEST_QUOTA, DEFAULT_LEAD_MODEL, DEFAULT_SERVER_NAME, DEFAULT_TENANT, DOMAIN_COLORS, DOMAIN_PALETTE, DRIFT_FIELDS, type DashboardOptions, type DataAsset, DataAssetSchema, type DependencyQuery, type DiscoveryEdge, type DiscoveryEvent, type DiscoveryFn, type DiscoveryNode, type DriftAlert, type DriftAlertItem, type DriftConfig, DriftConfigSchema, type DriftField, type DriftItemKind, type DriftRunRow, type DriftSink, type DriftSinkConfig, EDGE_RELATIONSHIPS, type EdgeRelationship, type EdgeRow, EdgeSchema, type EmbeddingProvider, type EnrichResult, type EntryOptions, type EstablishedConn, type EvidenceKind, type FetchLike, type FragmentKind, GraphStoreBackend, type GraphSummary, type HealthResult, type HttpOptions, INGEST_SCHEMA_VERSION, type IngestEnvelope, IngestEnvelopeSchema, type IngestHandler, type IngestHandlerOptions, type IngestOptions, type IngestResponse, type IngestResult, type InstallPlan, InvalidTenantError, type JiraIssue, type JiraOptions, JiraSink, type JiraSinkOptions, LOOPBACK_HOSTS, type LocalDiscoveryOptions, type LocalDiscoveryResult, type LogEntry, type LogLevel, MCP_BIN, type MatchStrategy, NODE_TYPES, NODE_TYPE_GROUPS, type NlIntent, type NlQueryOptions, type NlQueryResult, type NlRelation, type NodeAttribution, type NodeChange, type NodeIdentity, type NodeQuery, type NodeRow, NodeSchema, type NodeType, type NodesResult, NotFoundError, OUTPUT_FORMATS, type OrgKeyOptions, type OrgSummary, type OsKind, type OutputFormat, PACKAGE_NAME, PAGERDUTY_ENQUEUE_URL, PENDING_STATUSES, PERSONAL, PORT_MAP, PRIVATE_IP, PUSH_SCHEMA_VERSION, type PagerDutyEvent, PagerDutySink, type PagerDutySinkOptions, type ParsedApiArgs, type PendingShareRow, type PendingStatus, type PlanOptions, type PolicyResult, type PostJsonOptions, type Principal, PrincipalSchema, type ProviderFactory, type ProviderName, ProviderRegistry, type PushItem, type PushOptions, type PushResult, type QueryBackend, type QuotaConfig, type QuotaDecision, RELATION_TO_DIRECTION, ROLES, RateLimiter, type ResolveContext, type ResolveOptions, type Role, RoleSchema, type RuleCheck, RuleCheckSchema, type RuleScope, type Ruleset, RulesetSchema, type RunDriftOptions, SCAN_ARG_PATTERNS, SCHEMA_VERSION, SDL, SECURITY_METADATA_KEYS, SEVERITIES, SEVERITY_WEIGHT, SHARING_LEVELS, type ScanArgKind, type ScanContext, type ScanHintParams, type ScanResult, type Scanner, type ScannerPlugin, type ScannerPluginApi, ScannerRegistry, ScannerShape, type ScheduleConfig, ScheduleConfigSchema, type ScheduledRunResult, type Scope, type SearchFn, type SemanticSearchOptions, type ServerEntry, type SessionRow, type Severity, type SharePreview, type SharePreviewEntry, type SharingLevel, SharingLevelSchema, type SharingPolicy, type ShellKind, type SlackMessage, SlackSink, SqliteCredentialStore, SqliteQueryBackend, SqliteStoreBackend, type StartApiOptions, StdoutSink, type StoreBackend, type StoreBackendOptions, type SyncClassifyOptions, type SyncClassifyResult, TENANT_HEADER, type TenantContext, TenantMismatchError, type TenantOptions, type ToolResult, type TopologyDelta, type TopologyDiff, type TopologyInput, type TraversalResult, VectorStore, WebhookSink, type WebhookSinkOptions, applyInstall, applySharingLevel, assertReadOnly, assertSafeBind, assertSafeScanArg, assertSameTenant, assignColors, authorize, bearerToken, bookmarksScanner, buildCartographyToolHandlers, buildMapData, buildOpenApiDocument, buildReport, buildSinks, can, centralDbFromEnv, checkBearer, checkPrerequisites, checkReadOnly, clampText, classify, classifyDrift, cleanupTempFiles, cloudAwsScanner, cloudAzureScanner, cloudGcpScanner, codeAddMcpCommand, computeCentroid, computeClusterBounds, computeIdentity, connectionsScanner, contentHash, createBashTool, createCartographyTools, createClaudeProvider, createDefaultRegistry, createHashEmbedder, createIngestHandler, createLocalEmbedder, createMcpServer, createOllamaProvider, createOpenAIProvider, createScanRunner, createSemanticSearch, createSqliteQueryBackend, currentOs, cursorDeeplink, dashboardHtml, databasesScanner, deepMerge, defaultAllowedHosts, defaultConfig, defaultContext, defaultProviderRegistry, defaultRegistry, defaultServerEntry, definePlugin, deriveSessionName, detectAnomalies, detectOrphans, detectShadowIt, diffTopology, edgesToConnections, enrichCosts, entitiesToYaml, evaluateCheck, evaluateRule, evidenceLine, executeGraphql, executeNlQuery, exportAll, exportBackstageYAML, exportComplianceReport, exportCostCSV, exportCostSummary, exportDiscoveryApp, exportJGF, exportJSON, extractListeningPorts, filterBySeverity, findAnonViolations, formatComplianceText, formatJira, formatPagerDuty, formatSlack, generateDependencyMermaid, generateDiffMermaid, generateTopologyMermaid, getClient, getRuleset, globalId, groupByDomain, handleGraphqlGet, hashToken, hexCorners, hexDistance, hexNeighbors, hexRing, hexSpiral, hexToPixel, hmacKey, hostname, ingestEnvelope, installedAppsScanner, isLoopbackHost, isPersonalHost, isReadOnlyCommand, isRemembered, isSecureWebhookUrl, k8sScanner, keyMetaOf, layoutClusters, listClients, listRulesets, loadConfig, loadOrgKey, loadPlugins, loadRuleset, localDiscoveryFn, log, logDebug, logError, logInfo, logWarn, machineId, maxSeverity, mcpServerObject, newAnomalies, nextRun, nodesToAssets, normalizeId, normalizeTenant, openStoreBackend, orgKeyPath, osUser, parseApiArgs, parseComposeDeps, parseConfig, parseConnectionString, parseCostCsv, parseCron, parseEstablished, parseNginxUpstreams, parseNlQuery, parseScanHint, pixelToHex, planInstall, portsScanner, postJson, previewShare, pseudonymize, pseudonymizeFragment, pseudonymizeString, pushDeltas, readConfigFile, redactConnectionString, redactSecrets, redactValue, renderDiff, resolveEffectiveLevel, resolveNlQuery, resolvePrincipal, resolveSharingLevel, resolveTenant, revalidateAnonymized, reversalKey, reversePseudonym, rotateOrgKey, runApi, runDiscovery, runDrift, runHttp, runLocalDiscovery, runOnce, runStdio, runSyncClassify, safeEnv, safeJson, safetyHook, sanitizeUntrusted, sanitizeValue, scopeReads, scoreTopology, securityRelevantChange, serializeConfig, serviceConfigScanner, setVerbose, shadeVariant, shapeToJsonSchema, shareHash, splitSegments, stableStringify, startApi, stripSensitive, timingSafeEqual, toBackstageEntities, validateScanner, vscodeDeeplink, zodToJsonSchema };
|
|
4382
|
+
export { ACTIONS, ANOMALY_KINDS, ANOMALY_SEVERITIES, type Action, ActionSchema, type AgentProvider, type AgentRunContext, type AgentTool, type Anomaly, type AnomalyConfig, type AnomalyKind, type AnomalySeverity, type AnomalyThresholds, type AnonViolation, type AnonymizationLevel, type ApiServerOptions, type AskUserFn, type AuthConfig, AuthConfigSchema, AuthorizationError, type Awaitable, type BackstageEntity, type BackstageMapOptions, type BindGuardOptions, type BoltDriver, type BoltRecord, type BoltResult, type BoltSession, CLIENTS, CONFIDENCE, CORRELATION_CONFIDENCE, COST_PERIODS, type CanonicalNode, type CartographyConfig, CartographyDB, type CartographyMapData, type CentralDbConfig, CentralDbConfigSchema, type ClassifiedItem, type ClassifyInput, type ClassifyResult, type ClientSpec, type Cluster, ClusterSchema, type ComplianceInput, type ComplianceReport, ComplianceReportSchema, type ComplianceRule, ComplianceRuleSchema, type Condition, ConditionSchema, ConfigError, type ConfigFile, ConfigFileSchema, type ConfigFormat, type Connection, ConnectionSchema, type Contributor, type ControlResult, ControlResultSchema, type CorrelatedTopology, type CorrelationEdge, type CorrelationSignal, type CostEntry, CostEntrySchema, type CostPeriod, type CostRecord, type CostSource, type CreateMcpServerOptions, type CredentialConfig, CredentialConfigSchema, type CredentialDb, type CredentialRecord, type CredentialStore, type CronFields, CsvCostSource, type CsvCostSourceOptions, DEFAULT_ANOMALY_THRESHOLDS, DEFAULT_FAST_MODEL, DEFAULT_INGEST_QUOTA, DEFAULT_LEAD_MODEL, DEFAULT_SERVER_NAME, DEFAULT_TENANT, DOMAIN_COLORS, DOMAIN_PALETTE, DRIFT_FIELDS, type DashboardOptions, type DataAsset, DataAssetSchema, type DependencyQuery, type DiscoveryEdge, type DiscoveryEvent, type DiscoveryFn, type DiscoveryNode, type DriftAlert, type DriftAlertItem, type DriftConfig, DriftConfigSchema, type DriftField, type DriftItemKind, type DriftRunRow, type DriftSink, type DriftSinkConfig, EDGE_RELATIONSHIPS, type EdgeRelationship, type EdgeRow, EdgeSchema, type EmbeddingProvider, type EnrichResult, type EntryOptions, type EstablishedConn, type EvidenceKind, type FetchLike, type FragmentKind, GraphStoreBackend, type GraphSummary, type HealthResult, type HttpOptions, INGEST_SCHEMA_VERSION, type IngestEnvelope, IngestEnvelopeSchema, type IngestHandler, type IngestHandlerOptions, type IngestOptions, type IngestResponse, type IngestResult, type InstallPlan, InvalidTenantError, type JiraIssue, type JiraOptions, JiraSink, type JiraSinkOptions, LOOPBACK_HOSTS, type LocalDiscoveryOptions, type LocalDiscoveryResult, type LogEntry, type LogLevel, MCP_BIN, type MatchStrategy, NODE_TYPES, NODE_TYPE_GROUPS, type NlIntent, type NlQueryOptions, type NlQueryResult, type NlRelation, type NodeAttribution, type NodeChange, type NodeIdentity, type NodeQuery, type NodeRow, NodeSchema, type NodeSignals, type NodeType, type NodesResult, NotFoundError, OUTPUT_FORMATS, type OrgKeyOptions, type OrgSummary, type OsKind, type OutputFormat, PACKAGE_NAME, PAGERDUTY_ENQUEUE_URL, PENDING_STATUSES, PERSONAL, PORT_MAP, PRIVATE_IP, PUSH_SCHEMA_VERSION, type PagerDutyEvent, PagerDutySink, type PagerDutySinkOptions, type ParsedApiArgs, type PendingShareRow, type PendingStatus, type PlanOptions, type PolicyResult, type PostJsonOptions, type Principal, PrincipalSchema, type ProviderFactory, type ProviderName, ProviderRegistry, type PushItem, type PushOptions, type PushResult, type QueryBackend, type QuotaConfig, type QuotaDecision, RELATION_TO_DIRECTION, ROLES, RateLimiter, type ResolveContext, type ResolveOptions, type Role, RoleSchema, type RuleCheck, RuleCheckSchema, type RuleScope, type Ruleset, RulesetSchema, type RunDriftOptions, SCAN_ARG_PATTERNS, SCHEMA_VERSION, SDL, SECURITY_METADATA_KEYS, SEVERITIES, SEVERITY_WEIGHT, SHARING_LEVELS, type ScanArgKind, type ScanContext, type ScanHintParams, type ScanResult, type Scanner, type ScannerPlugin, type ScannerPluginApi, ScannerRegistry, ScannerShape, type ScheduleConfig, ScheduleConfigSchema, type ScheduledRunResult, type Scope, type SearchFn, type SemanticSearchOptions, type ServerEntry, type SessionRow, type Severity, type SharePreview, type SharePreviewEntry, type SharingLevel, SharingLevelSchema, type SharingPolicy, type ShellKind, type SlackMessage, SlackSink, SqliteCredentialStore, SqliteQueryBackend, SqliteStoreBackend, type StartApiOptions, StdoutSink, type StoreBackend, type StoreBackendOptions, type SyncClassifyOptions, type SyncClassifyResult, TENANT_HEADER, type TenantContext, TenantMismatchError, type TenantOptions, type ToolResult, type TopologyDelta, type TopologyDiff, type TopologyInput, type TraversalResult, VectorStore, WebhookSink, type WebhookSinkOptions, applyInstall, applySharingLevel, assertReadOnly, assertSafeBind, assertSafeScanArg, assertSameTenant, assignColors, authorize, bearerToken, bookmarksScanner, buildCartographyToolHandlers, buildMapData, buildOpenApiDocument, buildReport, buildSinks, can, centralDbFromEnv, checkBearer, checkPrerequisites, checkReadOnly, clampText, classify, classifyDrift, cleanupTempFiles, cloudAwsScanner, cloudAzureScanner, cloudGcpScanner, codeAddMcpCommand, computeCentroid, computeClusterBounds, computeIdentity, connectionsScanner, contentHash, correlateTopology, createBashTool, createCartographyTools, createClaudeProvider, createDefaultRegistry, createHashEmbedder, createIngestHandler, createLocalEmbedder, createMcpServer, createOllamaProvider, createOpenAIProvider, createScanRunner, createSemanticSearch, createSqliteQueryBackend, currentOs, cursorDeeplink, dashboardHtml, databasesScanner, deepMerge, defaultAllowedHosts, defaultConfig, defaultContext, defaultProviderRegistry, defaultRegistry, defaultServerEntry, definePlugin, deriveSessionName, detectAnomalies, detectOrphans, detectShadowIt, diffTopology, edgesToConnections, enrichCosts, entitiesToYaml, evaluateCheck, evaluateRule, evidenceLine, executeGraphql, executeNlQuery, exportAll, exportBackstageYAML, exportComplianceReport, exportCostCSV, exportCostSummary, exportDiscoveryApp, exportJGF, exportJSON, extractListeningPorts, extractSignals, filterBySeverity, findAnonViolations, formatComplianceText, formatJira, formatPagerDuty, formatSlack, generateDependencyMermaid, generateDiffMermaid, generateTopologyMermaid, getClient, getRuleset, globalId, groupByDomain, handleGraphqlGet, hashToken, hexCorners, hexDistance, hexNeighbors, hexRing, hexSpiral, hexToPixel, hmacKey, hostname, ingestEnvelope, installedAppsScanner, isLoopbackHost, isPersonalHost, isReadOnlyCommand, isRemembered, isSecureWebhookUrl, k8sScanner, keyMetaOf, layoutClusters, listClients, listRulesets, loadConfig, loadOrgKey, loadPlugins, loadRuleset, localDiscoveryFn, log, logDebug, logError, logInfo, logWarn, machineId, maxSeverity, mcpServerObject, newAnomalies, nextRun, nodesToAssets, normalizeId, normalizeTenant, openStoreBackend, orgKeyPath, osUser, parseApiArgs, parseComposeDeps, parseConfig, parseConnectionString, parseCostCsv, parseCron, parseEstablished, parseNginxUpstreams, parseNlQuery, parseScanHint, pixelToHex, planInstall, portsScanner, postJson, previewShare, pseudonymize, pseudonymizeFragment, pseudonymizeString, pushDeltas, readConfigFile, redactConnectionString, redactSecrets, redactValue, renderDiff, resolveEffectiveLevel, resolveNlQuery, resolvePrincipal, resolveSharingLevel, resolveTenant, revalidateAnonymized, reversalKey, reversePseudonym, rotateOrgKey, runApi, runDiscovery, runDrift, runHttp, runLocalDiscovery, runOnce, runStdio, runSyncClassify, safeEnv, safeJson, safetyHook, sanitizeUntrusted, sanitizeValue, scopeReads, scoreTopology, securityRelevantChange, serializeConfig, serviceConfigScanner, setVerbose, shadeVariant, shapeToJsonSchema, shareHash, splitSegments, stableStringify, startApi, stripSensitive, timingSafeEqual, toBackstageEntities, validateScanner, vscodeDeeplink, zodToJsonSchema };
|
package/dist/index.js
CHANGED
|
@@ -5840,9 +5840,146 @@ async function resolveNlQuery(db, sessionId, search, raw, opts) {
|
|
|
5840
5840
|
return executeNlQuery(db, sessionId, search, parseNlQuery(raw), opts);
|
|
5841
5841
|
}
|
|
5842
5842
|
|
|
5843
|
+
// src/correlation/signals.ts
|
|
5844
|
+
var IPV4 = /\b(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d)\b/g;
|
|
5845
|
+
var DNS = /\b(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.){1,8}[a-z]{2,24}\b/gi;
|
|
5846
|
+
var ENDPOINT = /\b((?:[a-z0-9][a-z0-9.-]{0,253})):(\d{1,5})\b/gi;
|
|
5847
|
+
function isPrivateIp(ip) {
|
|
5848
|
+
return /^(?:10\.|127\.|169\.254\.|192\.168\.|172\.(?:1[6-9]|2\d|3[01])\.)/.test(ip);
|
|
5849
|
+
}
|
|
5850
|
+
function sources(node) {
|
|
5851
|
+
const out = [node.id, node.name];
|
|
5852
|
+
const meta = node.metadata;
|
|
5853
|
+
if (meta) {
|
|
5854
|
+
for (const k of ["host", "hostname", "ip", "address", "dns", "dnsName", "endpoint", "fqdn", "publicIp", "privateIp", "url"]) {
|
|
5855
|
+
const v = meta[k];
|
|
5856
|
+
if (typeof v === "string") out.push(v);
|
|
5857
|
+
}
|
|
5858
|
+
}
|
|
5859
|
+
return out;
|
|
5860
|
+
}
|
|
5861
|
+
var KNOWN_PROVIDERS = /* @__PURE__ */ new Set(["aws", "gcp", "azure", "k8s", "kubernetes", "localhost", "docker"]);
|
|
5862
|
+
function parseProvider(id) {
|
|
5863
|
+
const seg = id.split(":");
|
|
5864
|
+
if (seg.length >= 3 && KNOWN_PROVIDERS.has(seg[1])) return seg[1];
|
|
5865
|
+
return void 0;
|
|
5866
|
+
}
|
|
5867
|
+
function extractSignals(node) {
|
|
5868
|
+
const text = sources(node).join(" \n ");
|
|
5869
|
+
const publicIps = /* @__PURE__ */ new Set();
|
|
5870
|
+
const privateIps = /* @__PURE__ */ new Set();
|
|
5871
|
+
const dnsNames = /* @__PURE__ */ new Set();
|
|
5872
|
+
const endpoints = /* @__PURE__ */ new Set();
|
|
5873
|
+
for (const m of text.matchAll(IPV4)) (isPrivateIp(m[0]) ? privateIps : publicIps).add(m[0]);
|
|
5874
|
+
for (const m of text.matchAll(DNS)) dnsNames.add(m[0].toLowerCase());
|
|
5875
|
+
for (const m of text.matchAll(ENDPOINT)) endpoints.add(`${m[1].toLowerCase()}:${m[2]}`);
|
|
5876
|
+
const provider = parseProvider(node.id);
|
|
5877
|
+
const sortUniq = (s) => [...s].sort();
|
|
5878
|
+
return {
|
|
5879
|
+
...provider ? { provider } : {},
|
|
5880
|
+
endpoints: sortUniq(endpoints),
|
|
5881
|
+
publicIps: sortUniq(publicIps),
|
|
5882
|
+
privateIps: sortUniq(privateIps),
|
|
5883
|
+
// The DNS regex requires an alphabetic TLD, so pure IPv4s never land here.
|
|
5884
|
+
dnsNames: sortUniq(dnsNames)
|
|
5885
|
+
};
|
|
5886
|
+
}
|
|
5887
|
+
|
|
5888
|
+
// src/correlation/correlate.ts
|
|
5889
|
+
var CORRELATION_CONFIDENCE = {
|
|
5890
|
+
"global-identity": 1,
|
|
5891
|
+
"dns-name": 0.95,
|
|
5892
|
+
"public-ip": 0.9,
|
|
5893
|
+
"endpoint": 0.85,
|
|
5894
|
+
"private-ip": 0.5
|
|
5895
|
+
};
|
|
5896
|
+
var MERGE_THRESHOLD = 0.85;
|
|
5897
|
+
var DSU = class {
|
|
5898
|
+
parent;
|
|
5899
|
+
constructor(n) {
|
|
5900
|
+
this.parent = Array.from({ length: n }, (_, i) => i);
|
|
5901
|
+
}
|
|
5902
|
+
find(x) {
|
|
5903
|
+
while (this.parent[x] !== x) {
|
|
5904
|
+
this.parent[x] = this.parent[this.parent[x]];
|
|
5905
|
+
x = this.parent[x];
|
|
5906
|
+
}
|
|
5907
|
+
return x;
|
|
5908
|
+
}
|
|
5909
|
+
union(a, b) {
|
|
5910
|
+
const ra = this.find(a), rb = this.find(b);
|
|
5911
|
+
if (ra !== rb) this.parent[Math.max(ra, rb)] = Math.min(ra, rb);
|
|
5912
|
+
}
|
|
5913
|
+
};
|
|
5914
|
+
function correlateTopology(nodes, _edges = []) {
|
|
5915
|
+
const n = nodes.length;
|
|
5916
|
+
const signals = nodes.map(extractSignals);
|
|
5917
|
+
const dsu = new DSU(n);
|
|
5918
|
+
const correlations = [];
|
|
5919
|
+
const merged = /* @__PURE__ */ new Set();
|
|
5920
|
+
const buckets = /* @__PURE__ */ new Map();
|
|
5921
|
+
const add = (sig, val, i) => {
|
|
5922
|
+
const k = `${sig}|${val}`;
|
|
5923
|
+
const arr = buckets.get(k);
|
|
5924
|
+
if (arr) arr.push(i);
|
|
5925
|
+
else buckets.set(k, [i]);
|
|
5926
|
+
};
|
|
5927
|
+
nodes.forEach((node, i) => {
|
|
5928
|
+
if (node.globalId) add("global-identity", node.globalId, i);
|
|
5929
|
+
for (const d of signals[i].dnsNames) add("dns-name", d, i);
|
|
5930
|
+
for (const ip of signals[i].publicIps) add("public-ip", ip, i);
|
|
5931
|
+
for (const e of signals[i].endpoints) add("endpoint", e, i);
|
|
5932
|
+
});
|
|
5933
|
+
const order = ["global-identity", "dns-name", "public-ip", "endpoint"];
|
|
5934
|
+
for (const sig of order) {
|
|
5935
|
+
const conf = CORRELATION_CONFIDENCE[sig];
|
|
5936
|
+
const keys = [...buckets.keys()].filter((k) => k.startsWith(`${sig}|`)).sort();
|
|
5937
|
+
for (const key of keys) {
|
|
5938
|
+
const members = buckets.get(key).slice().sort((x, y) => nodes[x].id.localeCompare(nodes[y].id));
|
|
5939
|
+
const value = key.slice(sig.length + 1);
|
|
5940
|
+
for (let j = 1; j < members.length; j++) {
|
|
5941
|
+
const a = members[0], b = members[j];
|
|
5942
|
+
if (conf < MERGE_THRESHOLD) continue;
|
|
5943
|
+
dsu.union(a, b);
|
|
5944
|
+
merged.add(a);
|
|
5945
|
+
merged.add(b);
|
|
5946
|
+
const [s, t] = [nodes[a].id, nodes[b].id].sort();
|
|
5947
|
+
correlations.push({ sourceId: s, targetId: t, relationship: "same_as", signal: sig, confidence: conf, evidence: `[${sig}] shared ${value}` });
|
|
5948
|
+
}
|
|
5949
|
+
}
|
|
5950
|
+
}
|
|
5951
|
+
const clusters = /* @__PURE__ */ new Map();
|
|
5952
|
+
for (let i = 0; i < n; i++) {
|
|
5953
|
+
const r = dsu.find(i);
|
|
5954
|
+
const arr = clusters.get(r);
|
|
5955
|
+
if (arr) arr.push(i);
|
|
5956
|
+
else clusters.set(r, [i]);
|
|
5957
|
+
}
|
|
5958
|
+
const canonical = [];
|
|
5959
|
+
let crossCloud = 0;
|
|
5960
|
+
for (const idxs of clusters.values()) {
|
|
5961
|
+
const memberNodes = idxs.map((i) => nodes[i]);
|
|
5962
|
+
const members = memberNodes.map((m) => m.id).sort();
|
|
5963
|
+
const providers = [...new Set(idxs.map((i) => signals[i].provider).filter((p) => !!p))].sort();
|
|
5964
|
+
const rep = memberNodes.reduce((a, b) => a.id < b.id ? a : b);
|
|
5965
|
+
const memberIds = new Set(members);
|
|
5966
|
+
const internal = correlations.filter((c) => memberIds.has(c.sourceId) && memberIds.has(c.targetId));
|
|
5967
|
+
const confidence = internal.length ? Math.min(...internal.map((c) => c.confidence)) : 1;
|
|
5968
|
+
if (providers.length > 1) crossCloud += 1;
|
|
5969
|
+
canonical.push({ id: rep.id, type: rep.type, name: rep.name, members, providers, confidence });
|
|
5970
|
+
}
|
|
5971
|
+
canonical.sort((a, b) => a.id.localeCompare(b.id));
|
|
5972
|
+
correlations.sort((a, b) => b.confidence - a.confidence || a.sourceId.localeCompare(b.sourceId) || a.targetId.localeCompare(b.targetId));
|
|
5973
|
+
return {
|
|
5974
|
+
canonical,
|
|
5975
|
+
correlations,
|
|
5976
|
+
summary: { rawNodes: n, canonicalNodes: canonical.length, collapsed: n - canonical.length, crossCloud }
|
|
5977
|
+
};
|
|
5978
|
+
}
|
|
5979
|
+
|
|
5843
5980
|
// src/mcp/server.ts
|
|
5844
5981
|
var SERVER_NAME = "cartography";
|
|
5845
|
-
var SERVER_VERSION = "2.
|
|
5982
|
+
var SERVER_VERSION = "2.10.0";
|
|
5846
5983
|
var SERVICE_TYPES = NODE_TYPE_GROUPS.web;
|
|
5847
5984
|
var DATA_TYPES = NODE_TYPE_GROUPS.data;
|
|
5848
5985
|
var lexicalSearch = async (db, sessionId, query, opts) => db.searchNodes(sessionId, query, { types: opts.types, limit: opts.limit }).map((node) => ({ node }));
|
|
@@ -6002,6 +6139,15 @@ function createMcpServer(opts = {}) {
|
|
|
6002
6139
|
return json(db.getGraphSummary(sid));
|
|
6003
6140
|
}
|
|
6004
6141
|
);
|
|
6142
|
+
server.registerTool(
|
|
6143
|
+
"correlate_topology",
|
|
6144
|
+
{ title: "Correlate multi-cloud topology", description: "Collapse the same logical resource discovered across clouds/on-prem (by global identity or a shared DNS name / public IP / endpoint) into canonical entities with confidence-scored same_as links. Read-only, non-destructive (5.1).", inputSchema: {}, annotations: readOnly },
|
|
6145
|
+
() => {
|
|
6146
|
+
const sid = resolveSession();
|
|
6147
|
+
if (!sid) return json({ error: "No discovery session found." });
|
|
6148
|
+
return json(correlateTopology(db.getNodes(sid), db.getEdges(sid)));
|
|
6149
|
+
}
|
|
6150
|
+
);
|
|
6005
6151
|
server.registerTool(
|
|
6006
6152
|
"get_cost_summary",
|
|
6007
6153
|
{ title: "Get cost summary", description: "FinOps rollup: cost by domain and owner, currency/period-bucketed (3.3).", inputSchema: {}, annotations: readOnly },
|
|
@@ -11924,6 +12070,7 @@ export {
|
|
|
11924
12070
|
AuthorizationError,
|
|
11925
12071
|
CLIENTS,
|
|
11926
12072
|
CONFIDENCE,
|
|
12073
|
+
CORRELATION_CONFIDENCE,
|
|
11927
12074
|
CartographyDB,
|
|
11928
12075
|
ComplianceReportSchema,
|
|
11929
12076
|
ComplianceRuleSchema,
|
|
@@ -12010,6 +12157,7 @@ export {
|
|
|
12010
12157
|
computeIdentity,
|
|
12011
12158
|
connectionsScanner,
|
|
12012
12159
|
contentHash,
|
|
12160
|
+
correlateTopology,
|
|
12013
12161
|
createBashTool,
|
|
12014
12162
|
createCartographyTools,
|
|
12015
12163
|
createClaudeProvider,
|
|
@@ -12057,6 +12205,7 @@ export {
|
|
|
12057
12205
|
exportJGF,
|
|
12058
12206
|
exportJSON,
|
|
12059
12207
|
extractListeningPorts,
|
|
12208
|
+
extractSignals,
|
|
12060
12209
|
filterBySeverity,
|
|
12061
12210
|
findAnonViolations,
|
|
12062
12211
|
formatComplianceText,
|