@datasynx/agentic-ai-cartography 2.4.0 → 2.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.cts CHANGED
@@ -881,6 +881,99 @@ declare const ComplianceReportSchema: z.ZodObject<{
881
881
  }, z.core.$strip>;
882
882
  type ComplianceReport = z.infer<typeof ComplianceReportSchema>;
883
883
 
884
+ /**
885
+ * RBAC identity types (4.5). A bearer credential resolves to a {@link Principal}
886
+ * `{ subject, tenant, role }`; the HTTP surfaces (MCP transport + REST/GraphQL API)
887
+ * enforce a deny-by-default `can(role, action)` matrix and pin every read to the
888
+ * principal's tenant. Kept dependency-light and free of any import from `db.ts`/
889
+ * `server.ts` so it can be reused by both transports without a cycle.
890
+ */
891
+
892
+ /** Roles, least → most privileged. `admin ⊇ operator ⊇ viewer` (rank-ordered). */
893
+ declare const ROLES: readonly ["viewer", "operator", "admin"];
894
+ type Role = typeof ROLES[number];
895
+ declare const RoleSchema: z.ZodEnum<{
896
+ viewer: "viewer";
897
+ operator: "operator";
898
+ admin: "admin";
899
+ }>;
900
+ /**
901
+ * Gated action classes:
902
+ * - `read` — any read-only query/resource (viewer+).
903
+ * - `discovery` — trigger a scan that mutates the catalog, e.g. `run_discovery` (operator+).
904
+ * - `admin` — manage credentials / admin-only surfaces (admin only).
905
+ */
906
+ declare const ACTIONS: readonly ["read", "discovery", "admin"];
907
+ type Action = typeof ACTIONS[number];
908
+ declare const ActionSchema: z.ZodEnum<{
909
+ read: "read";
910
+ admin: "admin";
911
+ discovery: "discovery";
912
+ }>;
913
+ /** The authenticated caller, bound to exactly one tenant. */
914
+ interface Principal {
915
+ /** Stable identity (token label / username / OIDC `sub`). */
916
+ subject: string;
917
+ /** Org-scope this principal may read/act within. */
918
+ tenant: string;
919
+ role: Role;
920
+ }
921
+ declare const PrincipalSchema: z.ZodObject<{
922
+ subject: z.ZodString;
923
+ tenant: z.ZodString;
924
+ role: z.ZodEnum<{
925
+ viewer: "viewer";
926
+ operator: "operator";
927
+ admin: "admin";
928
+ }>;
929
+ }, z.core.$strip>;
930
+ /** A seeded credential (config-supplied). The token is hashed before storage; never persisted raw. */
931
+ declare const CredentialConfigSchema: z.ZodObject<{
932
+ token: z.ZodString;
933
+ subject: z.ZodString;
934
+ tenant: z.ZodOptional<z.ZodString>;
935
+ role: z.ZodDefault<z.ZodEnum<{
936
+ viewer: "viewer";
937
+ operator: "operator";
938
+ admin: "admin";
939
+ }>>;
940
+ }, z.core.$strip>;
941
+ type CredentialConfig = z.infer<typeof CredentialConfigSchema>;
942
+ /**
943
+ * Opt-in auth block on {@link CartographyConfig}. Absent → today's behavior exactly
944
+ * (loopback no-token → implicit admin; a configured shared token → one implicit admin).
945
+ * When `credentials` are present (here or in the SQLite store), the server runs in RBAC
946
+ * mode: only a known token resolves to a principal, everything else is 401.
947
+ */
948
+ declare const AuthConfigSchema: z.ZodObject<{
949
+ credentials: z.ZodOptional<z.ZodArray<z.ZodObject<{
950
+ token: z.ZodString;
951
+ subject: z.ZodString;
952
+ tenant: z.ZodOptional<z.ZodString>;
953
+ role: z.ZodDefault<z.ZodEnum<{
954
+ viewer: "viewer";
955
+ operator: "operator";
956
+ admin: "admin";
957
+ }>>;
958
+ }, z.core.$strip>>>;
959
+ required: z.ZodOptional<z.ZodBoolean>;
960
+ }, z.core.$strip>;
961
+ type AuthConfig = z.infer<typeof AuthConfigSchema>;
962
+ /** A stored credential record (token already hashed). */
963
+ interface CredentialRecord {
964
+ tokenHash: string;
965
+ subject: string;
966
+ tenant: string;
967
+ role: Role;
968
+ createdAt: string;
969
+ }
970
+ /** Resolves a stored credential by its token hash. Implemented over SQLite (and, later, OIDC). */
971
+ interface CredentialStore {
972
+ /** Number of stored credentials — `0` means "no RBAC configured" (fall back to shared/loopback). */
973
+ count(): number;
974
+ findByHash(tokenHash: string): CredentialRecord | undefined;
975
+ }
976
+
884
977
  /** Attribution applied by an enrichment pass (3.3). `null` clears the field; `undefined` leaves it unchanged. */
885
978
  interface NodeAttribution {
886
979
  owner?: string | null;
@@ -1158,7 +1251,28 @@ declare class CartographyDB {
1158
1251
  limit?: number;
1159
1252
  offset?: number;
1160
1253
  }): EdgeRow[];
1161
- insertEvent(sessionId: string, event: Pick<EventRow, 'eventType' | 'process' | 'pid' | 'target' | 'targetType' | 'port'> & Partial<Pick<EventRow, 'command' | 'resultBytes'>>, taskId?: string): void;
1254
+ insertEvent(sessionId: string, event: Pick<EventRow, 'eventType' | 'process' | 'pid' | 'target' | 'targetType' | 'port'> & Partial<Pick<EventRow, 'command' | 'resultBytes'>>, taskId?: string,
1255
+ /** Authenticated actor (4.5 RBAC) — stamped into the audit trail when present. */
1256
+ actor?: {
1257
+ subject: string;
1258
+ role: string;
1259
+ tenant: string;
1260
+ }): void;
1261
+ /** Number of stored credentials. `0` ⇒ no RBAC configured (fall back to shared/loopback). */
1262
+ countCredentials(): number;
1263
+ /** Look up a credential by its sha256 token hash. */
1264
+ findCredentialByHash(tokenHash: string): CredentialRecord | undefined;
1265
+ /** Upsert a credential (idempotent on the token hash). Stores only the hash, never the raw token. */
1266
+ addCredential(rec: {
1267
+ tokenHash: string;
1268
+ subject: string;
1269
+ tenant: string;
1270
+ role: string;
1271
+ }): void;
1272
+ /** List all credentials (token hashes only — the raw token is unrecoverable). */
1273
+ listCredentials(): Array<CredentialRecord>;
1274
+ /** Revoke every credential for a subject. Returns the number removed. */
1275
+ revokeCredentialsBySubject(subject: string): number;
1162
1276
  getEvents(sessionId: string, since?: string): EventRow[];
1163
1277
  startTask(sessionId: string, description?: string): string;
1164
1278
  endCurrentTask(sessionId: string): void;
@@ -2020,6 +2134,13 @@ interface CreateMcpServerOptions {
2020
2134
  * behaviour exactly. The org is normalized to a tenant.
2021
2135
  */
2022
2136
  org?: string;
2137
+ /**
2138
+ * The authenticated principal (4.5 RBAC). When set, mutating tools (`run_discovery`)
2139
+ * are gated by role: a `viewer` is refused with a forbidden error. Read tools are
2140
+ * unaffected (any principal is at least `viewer`). Unset → no role gating (the
2141
+ * transport already handled 401, or it's an in-process/stdio caller).
2142
+ */
2143
+ principal?: Principal;
2023
2144
  }
2024
2145
  /**
2025
2146
  * Build a fully-configured Cartography MCP server. Call `.connect(transport)` to run it.
@@ -2060,12 +2181,25 @@ interface HttpOptions {
2060
2181
  status: number;
2061
2182
  body: unknown;
2062
2183
  };
2184
+ /**
2185
+ * RBAC (4.5). When `store` holds credentials, the transport runs in RBAC mode: a
2186
+ * request's bearer token must resolve to a {@link Principal} (else 401), and the
2187
+ * principal is passed to `factory(principal)` so the per-session server is pinned to
2188
+ * the principal's tenant and gates mutating tools by role. Without a populated store
2189
+ * the legacy shared-token / open-loopback behavior is preserved.
2190
+ */
2191
+ auth?: {
2192
+ store?: CredentialStore;
2193
+ required?: boolean;
2194
+ };
2195
+ /** Tenant assigned to implicit (shared/loopback) admin principals. */
2196
+ defaultTenant?: string;
2063
2197
  }
2064
2198
  /**
2065
2199
  * Start a Streamable HTTP server. A fresh MCP server instance is created per
2066
2200
  * session via `factory`, so multiple clients can connect concurrently.
2067
2201
  */
2068
- declare function runHttp(factory: () => McpServer, opts?: HttpOptions): Promise<http.Server>;
2202
+ declare function runHttp(factory: (principal?: Principal) => McpServer, opts?: HttpOptions): Promise<http.Server>;
2069
2203
 
2070
2204
  /**
2071
2205
  * Shared HTTP auth + bind-hardening primitives.
@@ -2166,6 +2300,18 @@ interface ApiServerOptions extends BindGuardOptions {
2166
2300
  tenant?: TenantOptions;
2167
2301
  /** Expose `/graphql` (default true). */
2168
2302
  graphql?: boolean;
2303
+ /**
2304
+ * RBAC (4.5). When `store` holds credentials, the API runs in RBAC mode: a request's
2305
+ * bearer token must resolve to a {@link Principal} (else 401), the principal's role must
2306
+ * permit `read` (else 403), and reads are **pinned to the principal's tenant** (any
2307
+ * caller-supplied tenant header/param is ignored). Without a populated store the legacy
2308
+ * behavior is preserved: the configured shared `token` (or open loopback) is one implicit
2309
+ * admin that may still select a tenant via header/param.
2310
+ */
2311
+ auth?: {
2312
+ store?: CredentialStore;
2313
+ required?: boolean;
2314
+ };
2169
2315
  /** Access logger (stderr). */
2170
2316
  log?: (msg: string) => void;
2171
2317
  }
@@ -2227,6 +2373,78 @@ declare function handleGraphqlGet(): {
2227
2373
  body: string;
2228
2374
  };
2229
2375
 
2376
+ /**
2377
+ * The RBAC decision core (4.5): a pure, deny-by-default `can(role, action)` matrix
2378
+ * and the `authorize`/`assertSameTenant` guards the transports call. No I/O, no DB —
2379
+ * trivially unit-testable and identical for the MCP transport and the REST/GraphQL API.
2380
+ */
2381
+
2382
+ /** True iff `role` is at least the minimum role required for `action`. */
2383
+ declare function can(role: Role, action: Action): boolean;
2384
+ /** Thrown when an authenticated principal lacks the role for an action → HTTP 403. */
2385
+ declare class AuthorizationError extends Error {
2386
+ readonly action: Action;
2387
+ readonly role: Role;
2388
+ constructor(action: Action, role: Role);
2389
+ }
2390
+ /** Throw {@link AuthorizationError} unless `principal` may perform `action`. */
2391
+ declare function authorize(principal: Principal, action: Action): void;
2392
+ /** Thrown when a principal references a tenant other than its own → HTTP 403. */
2393
+ declare class TenantMismatchError extends Error {
2394
+ constructor();
2395
+ }
2396
+ /**
2397
+ * The tenant a principal's reads are pinned to. Callers MUST use this rather than any
2398
+ * caller-supplied tenant header/param, so a principal can never read another tenant by
2399
+ * spoofing the request — isolation is structural, not advisory.
2400
+ */
2401
+ declare function scopeReads(principal: Principal): string;
2402
+ /** Throw {@link TenantMismatchError} if `requestedTenant` differs from the principal's tenant. */
2403
+ declare function assertSameTenant(principal: Principal, requestedTenant: string): void;
2404
+
2405
+ /**
2406
+ * Identity resolution (4.5): turn a presented bearer token into a {@link Principal},
2407
+ * or `undefined` (→ 401). Three modes, in precedence order:
2408
+ * 1. **RBAC** — a populated SQLite {@link CredentialStore} is the source of truth; the
2409
+ * token is sha256-hashed and looked up (tokens are never stored or compared raw).
2410
+ * 2. **Shared token** — a single configured token resolves to one implicit `admin`
2411
+ * (today's behavior; constant-time compare).
2412
+ * 3. **Open/loopback dev** — no token configured → implicit `admin`, unless `required`.
2413
+ *
2414
+ * The hash-and-store design means a DB leak never exposes a usable credential, and the
2415
+ * OIDC seam is just another {@link CredentialStore}/resolver behind this one function.
2416
+ */
2417
+
2418
+ /** Stable sha256 hex of a token — the only form ever persisted or compared in the store. */
2419
+ declare function hashToken(token: string): string;
2420
+ /** Minimal DB surface the SQLite credential store needs (CartographyDB satisfies it structurally). */
2421
+ interface CredentialDb {
2422
+ countCredentials(): number;
2423
+ findCredentialByHash(tokenHash: string): CredentialRecord | undefined;
2424
+ }
2425
+ /** {@link CredentialStore} backed by `CartographyDB`'s `auth_credentials` table. */
2426
+ declare class SqliteCredentialStore implements CredentialStore {
2427
+ private readonly db;
2428
+ constructor(db: CredentialDb);
2429
+ count(): number;
2430
+ findByHash(tokenHash: string): CredentialRecord | undefined;
2431
+ }
2432
+ interface ResolveOptions {
2433
+ /** Populated → RBAC mode (source of truth). */
2434
+ store?: CredentialStore;
2435
+ /** Single shared token (one implicit admin) when no store credentials exist. */
2436
+ sharedToken?: string;
2437
+ /** Tenant assigned to implicit (shared/loopback) admin principals. */
2438
+ defaultTenant?: string;
2439
+ /** Reject unauthenticated requests even when neither store nor shared token is set. */
2440
+ required?: boolean;
2441
+ }
2442
+ /**
2443
+ * Resolve an already-parsed bearer token to a {@link Principal}, or `undefined` (→ 401).
2444
+ * `presentedToken` is the value from `bearerToken(authorizationHeader)` (may be undefined).
2445
+ */
2446
+ declare function resolvePrincipal(presentedToken: string | undefined, opts: ResolveOptions): Principal | undefined;
2447
+
2230
2448
  /**
2231
2449
  * Shared entry logic for the read-only API server (4.2), used by both the dedicated
2232
2450
  * `cartography-api` binary and the `api` CLI sub-command. Mirrors `src/mcp/start.ts`:
@@ -2247,6 +2465,8 @@ interface StartApiOptions {
2247
2465
  graphql?: boolean;
2248
2466
  /** Default tenant served when a request names none. */
2249
2467
  tenant?: string;
2468
+ /** Reject unauthenticated requests even on loopback (RBAC `required` mode). */
2469
+ authRequired?: boolean;
2250
2470
  log?: (msg: string) => void;
2251
2471
  }
2252
2472
  interface ParsedApiArgs extends StartApiOptions {
@@ -3869,4 +4089,4 @@ declare function logInfo(message: string, context?: Record<string, unknown>): vo
3869
4089
  declare function logWarn(message: string, context?: Record<string, unknown>): void;
3870
4090
  declare function logError(message: string, context?: Record<string, unknown>): void;
3871
4091
 
3872
- export { ANOMALY_KINDS, ANOMALY_SEVERITIES, 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 BindGuardOptions, 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 CronFields, CsvCostSource, type CsvCostSourceOptions, DEFAULT_ANOMALY_THRESHOLDS, DEFAULT_FAST_MODEL, DEFAULT_LEAD_MODEL, DEFAULT_SERVER_NAME, DEFAULT_TENANT, DOMAIN_COLORS, DOMAIN_PALETTE, DRIFT_FIELDS, 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, type GraphSummary, type HealthResult, type HttpOptions, INGEST_SCHEMA_VERSION, type IngestEnvelope, IngestEnvelopeSchema, type IngestHandler, 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 ProviderFactory, type ProviderName, ProviderRegistry, type PushItem, type PushOptions, type PushResult, type QueryBackend, RELATION_TO_DIRECTION, type ResolveContext, type RuleCheck, RuleCheckSchema, type RuleScope, type Ruleset, RulesetSchema, type RunDriftOptions, SCAN_ARG_PATTERNS, 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, SqliteQueryBackend, SqliteStoreBackend, type StartApiOptions, StdoutSink, type StoreBackend, type SyncClassifyOptions, type SyncClassifyResult, TENANT_HEADER, type TenantContext, type TenantOptions, type ToolResult, type TopologyDelta, type TopologyDiff, type TopologyInput, type TraversalResult, VectorStore, WebhookSink, type WebhookSinkOptions, applyInstall, applySharingLevel, assertReadOnly, assertSafeBind, assertSafeScanArg, assignColors, bearerToken, bookmarksScanner, buildCartographyToolHandlers, buildMapData, buildOpenApiDocument, buildReport, buildSinks, 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, databasesScanner, deepMerge, defaultAllowedHosts, defaultConfig, defaultContext, defaultProviderRegistry, defaultRegistry, defaultServerEntry, definePlugin, deriveSessionName, detectAnomalies, detectOrphans, detectShadowIt, diffTopology, edgesToConnections, enrichCosts, 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, 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, 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, resolveSharingLevel, resolveTenant, revalidateAnonymized, reversalKey, reversePseudonym, rotateOrgKey, runApi, runDiscovery, runDrift, runHttp, runLocalDiscovery, runOnce, runStdio, runSyncClassify, safeEnv, safeJson, safetyHook, sanitizeUntrusted, sanitizeValue, scoreTopology, securityRelevantChange, serializeConfig, serviceConfigScanner, setVerbose, shadeVariant, shapeToJsonSchema, shareHash, splitSegments, stableStringify, startApi, stripSensitive, timingSafeEqual, validateScanner, vscodeDeeplink, zodToJsonSchema };
4092
+ 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 BindGuardOptions, 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_LEAD_MODEL, DEFAULT_SERVER_NAME, DEFAULT_TENANT, DOMAIN_COLORS, DOMAIN_PALETTE, DRIFT_FIELDS, 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, type GraphSummary, type HealthResult, type HttpOptions, INGEST_SCHEMA_VERSION, type IngestEnvelope, IngestEnvelopeSchema, type IngestHandler, 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, RELATION_TO_DIRECTION, ROLES, type ResolveContext, type ResolveOptions, type Role, RoleSchema, type RuleCheck, RuleCheckSchema, type RuleScope, type Ruleset, RulesetSchema, type RunDriftOptions, SCAN_ARG_PATTERNS, 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 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, databasesScanner, deepMerge, defaultAllowedHosts, defaultConfig, defaultContext, defaultProviderRegistry, defaultRegistry, defaultServerEntry, definePlugin, deriveSessionName, detectAnomalies, detectOrphans, detectShadowIt, diffTopology, edgesToConnections, enrichCosts, 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, 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, validateScanner, vscodeDeeplink, zodToJsonSchema };
package/dist/index.d.ts CHANGED
@@ -881,6 +881,99 @@ declare const ComplianceReportSchema: z.ZodObject<{
881
881
  }, z.core.$strip>;
882
882
  type ComplianceReport = z.infer<typeof ComplianceReportSchema>;
883
883
 
884
+ /**
885
+ * RBAC identity types (4.5). A bearer credential resolves to a {@link Principal}
886
+ * `{ subject, tenant, role }`; the HTTP surfaces (MCP transport + REST/GraphQL API)
887
+ * enforce a deny-by-default `can(role, action)` matrix and pin every read to the
888
+ * principal's tenant. Kept dependency-light and free of any import from `db.ts`/
889
+ * `server.ts` so it can be reused by both transports without a cycle.
890
+ */
891
+
892
+ /** Roles, least → most privileged. `admin ⊇ operator ⊇ viewer` (rank-ordered). */
893
+ declare const ROLES: readonly ["viewer", "operator", "admin"];
894
+ type Role = typeof ROLES[number];
895
+ declare const RoleSchema: z.ZodEnum<{
896
+ viewer: "viewer";
897
+ operator: "operator";
898
+ admin: "admin";
899
+ }>;
900
+ /**
901
+ * Gated action classes:
902
+ * - `read` — any read-only query/resource (viewer+).
903
+ * - `discovery` — trigger a scan that mutates the catalog, e.g. `run_discovery` (operator+).
904
+ * - `admin` — manage credentials / admin-only surfaces (admin only).
905
+ */
906
+ declare const ACTIONS: readonly ["read", "discovery", "admin"];
907
+ type Action = typeof ACTIONS[number];
908
+ declare const ActionSchema: z.ZodEnum<{
909
+ read: "read";
910
+ admin: "admin";
911
+ discovery: "discovery";
912
+ }>;
913
+ /** The authenticated caller, bound to exactly one tenant. */
914
+ interface Principal {
915
+ /** Stable identity (token label / username / OIDC `sub`). */
916
+ subject: string;
917
+ /** Org-scope this principal may read/act within. */
918
+ tenant: string;
919
+ role: Role;
920
+ }
921
+ declare const PrincipalSchema: z.ZodObject<{
922
+ subject: z.ZodString;
923
+ tenant: z.ZodString;
924
+ role: z.ZodEnum<{
925
+ viewer: "viewer";
926
+ operator: "operator";
927
+ admin: "admin";
928
+ }>;
929
+ }, z.core.$strip>;
930
+ /** A seeded credential (config-supplied). The token is hashed before storage; never persisted raw. */
931
+ declare const CredentialConfigSchema: z.ZodObject<{
932
+ token: z.ZodString;
933
+ subject: z.ZodString;
934
+ tenant: z.ZodOptional<z.ZodString>;
935
+ role: z.ZodDefault<z.ZodEnum<{
936
+ viewer: "viewer";
937
+ operator: "operator";
938
+ admin: "admin";
939
+ }>>;
940
+ }, z.core.$strip>;
941
+ type CredentialConfig = z.infer<typeof CredentialConfigSchema>;
942
+ /**
943
+ * Opt-in auth block on {@link CartographyConfig}. Absent → today's behavior exactly
944
+ * (loopback no-token → implicit admin; a configured shared token → one implicit admin).
945
+ * When `credentials` are present (here or in the SQLite store), the server runs in RBAC
946
+ * mode: only a known token resolves to a principal, everything else is 401.
947
+ */
948
+ declare const AuthConfigSchema: z.ZodObject<{
949
+ credentials: z.ZodOptional<z.ZodArray<z.ZodObject<{
950
+ token: z.ZodString;
951
+ subject: z.ZodString;
952
+ tenant: z.ZodOptional<z.ZodString>;
953
+ role: z.ZodDefault<z.ZodEnum<{
954
+ viewer: "viewer";
955
+ operator: "operator";
956
+ admin: "admin";
957
+ }>>;
958
+ }, z.core.$strip>>>;
959
+ required: z.ZodOptional<z.ZodBoolean>;
960
+ }, z.core.$strip>;
961
+ type AuthConfig = z.infer<typeof AuthConfigSchema>;
962
+ /** A stored credential record (token already hashed). */
963
+ interface CredentialRecord {
964
+ tokenHash: string;
965
+ subject: string;
966
+ tenant: string;
967
+ role: Role;
968
+ createdAt: string;
969
+ }
970
+ /** Resolves a stored credential by its token hash. Implemented over SQLite (and, later, OIDC). */
971
+ interface CredentialStore {
972
+ /** Number of stored credentials — `0` means "no RBAC configured" (fall back to shared/loopback). */
973
+ count(): number;
974
+ findByHash(tokenHash: string): CredentialRecord | undefined;
975
+ }
976
+
884
977
  /** Attribution applied by an enrichment pass (3.3). `null` clears the field; `undefined` leaves it unchanged. */
885
978
  interface NodeAttribution {
886
979
  owner?: string | null;
@@ -1158,7 +1251,28 @@ declare class CartographyDB {
1158
1251
  limit?: number;
1159
1252
  offset?: number;
1160
1253
  }): EdgeRow[];
1161
- insertEvent(sessionId: string, event: Pick<EventRow, 'eventType' | 'process' | 'pid' | 'target' | 'targetType' | 'port'> & Partial<Pick<EventRow, 'command' | 'resultBytes'>>, taskId?: string): void;
1254
+ insertEvent(sessionId: string, event: Pick<EventRow, 'eventType' | 'process' | 'pid' | 'target' | 'targetType' | 'port'> & Partial<Pick<EventRow, 'command' | 'resultBytes'>>, taskId?: string,
1255
+ /** Authenticated actor (4.5 RBAC) — stamped into the audit trail when present. */
1256
+ actor?: {
1257
+ subject: string;
1258
+ role: string;
1259
+ tenant: string;
1260
+ }): void;
1261
+ /** Number of stored credentials. `0` ⇒ no RBAC configured (fall back to shared/loopback). */
1262
+ countCredentials(): number;
1263
+ /** Look up a credential by its sha256 token hash. */
1264
+ findCredentialByHash(tokenHash: string): CredentialRecord | undefined;
1265
+ /** Upsert a credential (idempotent on the token hash). Stores only the hash, never the raw token. */
1266
+ addCredential(rec: {
1267
+ tokenHash: string;
1268
+ subject: string;
1269
+ tenant: string;
1270
+ role: string;
1271
+ }): void;
1272
+ /** List all credentials (token hashes only — the raw token is unrecoverable). */
1273
+ listCredentials(): Array<CredentialRecord>;
1274
+ /** Revoke every credential for a subject. Returns the number removed. */
1275
+ revokeCredentialsBySubject(subject: string): number;
1162
1276
  getEvents(sessionId: string, since?: string): EventRow[];
1163
1277
  startTask(sessionId: string, description?: string): string;
1164
1278
  endCurrentTask(sessionId: string): void;
@@ -2020,6 +2134,13 @@ interface CreateMcpServerOptions {
2020
2134
  * behaviour exactly. The org is normalized to a tenant.
2021
2135
  */
2022
2136
  org?: string;
2137
+ /**
2138
+ * The authenticated principal (4.5 RBAC). When set, mutating tools (`run_discovery`)
2139
+ * are gated by role: a `viewer` is refused with a forbidden error. Read tools are
2140
+ * unaffected (any principal is at least `viewer`). Unset → no role gating (the
2141
+ * transport already handled 401, or it's an in-process/stdio caller).
2142
+ */
2143
+ principal?: Principal;
2023
2144
  }
2024
2145
  /**
2025
2146
  * Build a fully-configured Cartography MCP server. Call `.connect(transport)` to run it.
@@ -2060,12 +2181,25 @@ interface HttpOptions {
2060
2181
  status: number;
2061
2182
  body: unknown;
2062
2183
  };
2184
+ /**
2185
+ * RBAC (4.5). When `store` holds credentials, the transport runs in RBAC mode: a
2186
+ * request's bearer token must resolve to a {@link Principal} (else 401), and the
2187
+ * principal is passed to `factory(principal)` so the per-session server is pinned to
2188
+ * the principal's tenant and gates mutating tools by role. Without a populated store
2189
+ * the legacy shared-token / open-loopback behavior is preserved.
2190
+ */
2191
+ auth?: {
2192
+ store?: CredentialStore;
2193
+ required?: boolean;
2194
+ };
2195
+ /** Tenant assigned to implicit (shared/loopback) admin principals. */
2196
+ defaultTenant?: string;
2063
2197
  }
2064
2198
  /**
2065
2199
  * Start a Streamable HTTP server. A fresh MCP server instance is created per
2066
2200
  * session via `factory`, so multiple clients can connect concurrently.
2067
2201
  */
2068
- declare function runHttp(factory: () => McpServer, opts?: HttpOptions): Promise<http.Server>;
2202
+ declare function runHttp(factory: (principal?: Principal) => McpServer, opts?: HttpOptions): Promise<http.Server>;
2069
2203
 
2070
2204
  /**
2071
2205
  * Shared HTTP auth + bind-hardening primitives.
@@ -2166,6 +2300,18 @@ interface ApiServerOptions extends BindGuardOptions {
2166
2300
  tenant?: TenantOptions;
2167
2301
  /** Expose `/graphql` (default true). */
2168
2302
  graphql?: boolean;
2303
+ /**
2304
+ * RBAC (4.5). When `store` holds credentials, the API runs in RBAC mode: a request's
2305
+ * bearer token must resolve to a {@link Principal} (else 401), the principal's role must
2306
+ * permit `read` (else 403), and reads are **pinned to the principal's tenant** (any
2307
+ * caller-supplied tenant header/param is ignored). Without a populated store the legacy
2308
+ * behavior is preserved: the configured shared `token` (or open loopback) is one implicit
2309
+ * admin that may still select a tenant via header/param.
2310
+ */
2311
+ auth?: {
2312
+ store?: CredentialStore;
2313
+ required?: boolean;
2314
+ };
2169
2315
  /** Access logger (stderr). */
2170
2316
  log?: (msg: string) => void;
2171
2317
  }
@@ -2227,6 +2373,78 @@ declare function handleGraphqlGet(): {
2227
2373
  body: string;
2228
2374
  };
2229
2375
 
2376
+ /**
2377
+ * The RBAC decision core (4.5): a pure, deny-by-default `can(role, action)` matrix
2378
+ * and the `authorize`/`assertSameTenant` guards the transports call. No I/O, no DB —
2379
+ * trivially unit-testable and identical for the MCP transport and the REST/GraphQL API.
2380
+ */
2381
+
2382
+ /** True iff `role` is at least the minimum role required for `action`. */
2383
+ declare function can(role: Role, action: Action): boolean;
2384
+ /** Thrown when an authenticated principal lacks the role for an action → HTTP 403. */
2385
+ declare class AuthorizationError extends Error {
2386
+ readonly action: Action;
2387
+ readonly role: Role;
2388
+ constructor(action: Action, role: Role);
2389
+ }
2390
+ /** Throw {@link AuthorizationError} unless `principal` may perform `action`. */
2391
+ declare function authorize(principal: Principal, action: Action): void;
2392
+ /** Thrown when a principal references a tenant other than its own → HTTP 403. */
2393
+ declare class TenantMismatchError extends Error {
2394
+ constructor();
2395
+ }
2396
+ /**
2397
+ * The tenant a principal's reads are pinned to. Callers MUST use this rather than any
2398
+ * caller-supplied tenant header/param, so a principal can never read another tenant by
2399
+ * spoofing the request — isolation is structural, not advisory.
2400
+ */
2401
+ declare function scopeReads(principal: Principal): string;
2402
+ /** Throw {@link TenantMismatchError} if `requestedTenant` differs from the principal's tenant. */
2403
+ declare function assertSameTenant(principal: Principal, requestedTenant: string): void;
2404
+
2405
+ /**
2406
+ * Identity resolution (4.5): turn a presented bearer token into a {@link Principal},
2407
+ * or `undefined` (→ 401). Three modes, in precedence order:
2408
+ * 1. **RBAC** — a populated SQLite {@link CredentialStore} is the source of truth; the
2409
+ * token is sha256-hashed and looked up (tokens are never stored or compared raw).
2410
+ * 2. **Shared token** — a single configured token resolves to one implicit `admin`
2411
+ * (today's behavior; constant-time compare).
2412
+ * 3. **Open/loopback dev** — no token configured → implicit `admin`, unless `required`.
2413
+ *
2414
+ * The hash-and-store design means a DB leak never exposes a usable credential, and the
2415
+ * OIDC seam is just another {@link CredentialStore}/resolver behind this one function.
2416
+ */
2417
+
2418
+ /** Stable sha256 hex of a token — the only form ever persisted or compared in the store. */
2419
+ declare function hashToken(token: string): string;
2420
+ /** Minimal DB surface the SQLite credential store needs (CartographyDB satisfies it structurally). */
2421
+ interface CredentialDb {
2422
+ countCredentials(): number;
2423
+ findCredentialByHash(tokenHash: string): CredentialRecord | undefined;
2424
+ }
2425
+ /** {@link CredentialStore} backed by `CartographyDB`'s `auth_credentials` table. */
2426
+ declare class SqliteCredentialStore implements CredentialStore {
2427
+ private readonly db;
2428
+ constructor(db: CredentialDb);
2429
+ count(): number;
2430
+ findByHash(tokenHash: string): CredentialRecord | undefined;
2431
+ }
2432
+ interface ResolveOptions {
2433
+ /** Populated → RBAC mode (source of truth). */
2434
+ store?: CredentialStore;
2435
+ /** Single shared token (one implicit admin) when no store credentials exist. */
2436
+ sharedToken?: string;
2437
+ /** Tenant assigned to implicit (shared/loopback) admin principals. */
2438
+ defaultTenant?: string;
2439
+ /** Reject unauthenticated requests even when neither store nor shared token is set. */
2440
+ required?: boolean;
2441
+ }
2442
+ /**
2443
+ * Resolve an already-parsed bearer token to a {@link Principal}, or `undefined` (→ 401).
2444
+ * `presentedToken` is the value from `bearerToken(authorizationHeader)` (may be undefined).
2445
+ */
2446
+ declare function resolvePrincipal(presentedToken: string | undefined, opts: ResolveOptions): Principal | undefined;
2447
+
2230
2448
  /**
2231
2449
  * Shared entry logic for the read-only API server (4.2), used by both the dedicated
2232
2450
  * `cartography-api` binary and the `api` CLI sub-command. Mirrors `src/mcp/start.ts`:
@@ -2247,6 +2465,8 @@ interface StartApiOptions {
2247
2465
  graphql?: boolean;
2248
2466
  /** Default tenant served when a request names none. */
2249
2467
  tenant?: string;
2468
+ /** Reject unauthenticated requests even on loopback (RBAC `required` mode). */
2469
+ authRequired?: boolean;
2250
2470
  log?: (msg: string) => void;
2251
2471
  }
2252
2472
  interface ParsedApiArgs extends StartApiOptions {
@@ -3869,4 +4089,4 @@ declare function logInfo(message: string, context?: Record<string, unknown>): vo
3869
4089
  declare function logWarn(message: string, context?: Record<string, unknown>): void;
3870
4090
  declare function logError(message: string, context?: Record<string, unknown>): void;
3871
4091
 
3872
- export { ANOMALY_KINDS, ANOMALY_SEVERITIES, 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 BindGuardOptions, 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 CronFields, CsvCostSource, type CsvCostSourceOptions, DEFAULT_ANOMALY_THRESHOLDS, DEFAULT_FAST_MODEL, DEFAULT_LEAD_MODEL, DEFAULT_SERVER_NAME, DEFAULT_TENANT, DOMAIN_COLORS, DOMAIN_PALETTE, DRIFT_FIELDS, 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, type GraphSummary, type HealthResult, type HttpOptions, INGEST_SCHEMA_VERSION, type IngestEnvelope, IngestEnvelopeSchema, type IngestHandler, 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 ProviderFactory, type ProviderName, ProviderRegistry, type PushItem, type PushOptions, type PushResult, type QueryBackend, RELATION_TO_DIRECTION, type ResolveContext, type RuleCheck, RuleCheckSchema, type RuleScope, type Ruleset, RulesetSchema, type RunDriftOptions, SCAN_ARG_PATTERNS, 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, SqliteQueryBackend, SqliteStoreBackend, type StartApiOptions, StdoutSink, type StoreBackend, type SyncClassifyOptions, type SyncClassifyResult, TENANT_HEADER, type TenantContext, type TenantOptions, type ToolResult, type TopologyDelta, type TopologyDiff, type TopologyInput, type TraversalResult, VectorStore, WebhookSink, type WebhookSinkOptions, applyInstall, applySharingLevel, assertReadOnly, assertSafeBind, assertSafeScanArg, assignColors, bearerToken, bookmarksScanner, buildCartographyToolHandlers, buildMapData, buildOpenApiDocument, buildReport, buildSinks, 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, databasesScanner, deepMerge, defaultAllowedHosts, defaultConfig, defaultContext, defaultProviderRegistry, defaultRegistry, defaultServerEntry, definePlugin, deriveSessionName, detectAnomalies, detectOrphans, detectShadowIt, diffTopology, edgesToConnections, enrichCosts, 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, 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, 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, resolveSharingLevel, resolveTenant, revalidateAnonymized, reversalKey, reversePseudonym, rotateOrgKey, runApi, runDiscovery, runDrift, runHttp, runLocalDiscovery, runOnce, runStdio, runSyncClassify, safeEnv, safeJson, safetyHook, sanitizeUntrusted, sanitizeValue, scoreTopology, securityRelevantChange, serializeConfig, serviceConfigScanner, setVerbose, shadeVariant, shapeToJsonSchema, shareHash, splitSegments, stableStringify, startApi, stripSensitive, timingSafeEqual, validateScanner, vscodeDeeplink, zodToJsonSchema };
4092
+ 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 BindGuardOptions, 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_LEAD_MODEL, DEFAULT_SERVER_NAME, DEFAULT_TENANT, DOMAIN_COLORS, DOMAIN_PALETTE, DRIFT_FIELDS, 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, type GraphSummary, type HealthResult, type HttpOptions, INGEST_SCHEMA_VERSION, type IngestEnvelope, IngestEnvelopeSchema, type IngestHandler, 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, RELATION_TO_DIRECTION, ROLES, type ResolveContext, type ResolveOptions, type Role, RoleSchema, type RuleCheck, RuleCheckSchema, type RuleScope, type Ruleset, RulesetSchema, type RunDriftOptions, SCAN_ARG_PATTERNS, 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 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, databasesScanner, deepMerge, defaultAllowedHosts, defaultConfig, defaultContext, defaultProviderRegistry, defaultRegistry, defaultServerEntry, definePlugin, deriveSessionName, detectAnomalies, detectOrphans, detectShadowIt, diffTopology, edgesToConnections, enrichCosts, 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, 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, validateScanner, vscodeDeeplink, zodToJsonSchema };