Skip to main content

TypeScript API Reference

Auto-generated TypeScript documentation for the ThreatWeaver backend codebase, produced by TypeDoc.

Browse the Reference​

Generate locally before browsing

The TypeDoc reference is generated on demand β€” it is not bundled with the deployed site. Run the command below to generate it, then open kb-site/static/generated/typedoc/index.html in your browser.

cd backend
npx typedoc --out ../kb-site/static/generated/typedoc src/index.ts

The generated reference includes all exported classes, interfaces, functions, types, and enums from the backend source code.

Key Classes and Services​

Scanner Pipeline​

Class / ServiceFileDescription
PentestCoordinatorpentestCoordinator.service.tsMain orchestrator for the 6-phase scanning pipeline. Manages agent lifecycle, shared blackboard, and phase transitions.
SharedBlackboardsharedBlackboard.service.tsIn-memory shared state during a scan. Stores discovered endpoints, auth tokens, parameters, and inter-agent communication.
FindingValidatorfindingValidator.service.tsApplies heuristic rules (H1-H16) to filter false positives before AI validation.
ValidationEnginevalidationEngine.service.tsComputes confidence tiers (high/medium/low) for each finding based on evidence quality.
TargetProfilertargetProfiler.service.tsFingerprints target applications during Phase 0/1 (tech stack, frameworks, auth type).
BudgetAllocatorbudgetAllocator.service.tsDistributes scan time budget across agents based on target profile and priority.
IntelligentDiscoveryintelligentDiscovery.service.tsAI-powered endpoint discovery that adapts based on observed API patterns.
FindingDeduplicatorfindingDeduplicator.service.tsRemoves semantically duplicate findings across agents.
ChainReplayEngine(within coordinator)Links related findings into multi-step exploit chains.
OobCallbackServeroobCallbackServer.service.tsOut-of-band callback server for detecting blind SSRF and blind XSS.

Core Platform​

Class / ServiceFileDescription
AggregationServiceaggregation.service.ts~2900-line service computing all KPI metrics, trends, MTTR, and risk distributions.
TenableServicetenable.service.tsTenable.io API client for asset and vulnerability sync.
SyncServicesync.service.tsOrchestrates chunk-based data synchronization from Tenable.io.
SettingsServicesettings.service.tsSystem settings management with validation.
LicenseServicelicense.service.tsJWT license token validation and module entitlement checking.
FeatureFlagServicefeatureFlags.service.tsRuntime feature flag evaluation for operator-level toggles.

AI Services​

Class / ServiceFileDescription
AiOrchestratoraiOrchestrator.service.tsCentral dispatcher for all AI-powered features (fix plans, tickets, summaries).
AiProviderServiceaiProvider.service.tsAbstraction layer over LLM providers (Anthropic Claude, OpenAI GPT, local models).
AiPromptServiceaiPrompt.service.tsTemplate management for AI prompts with versioning.
AiCacheServiceaiCache.service.tsCaching layer to prevent duplicate LLM calls for identical inputs.
AiUsageServiceaiUsage.service.tsToken counting and cost tracking for AI API calls.

Key Interfaces​

InterfaceDescription
AuthenticatedRequestExpress request extended with user object containing userId, tenantId, roles
ScannerPolicyConfiguration for scanner behavior (timeouts, concurrency, payload limits)
SharedBlackboardType definition for the in-memory scan state (endpoints, tokens, parameters)
FilterConditionDynamic filter structure used by the AI parameter extractor

Regenerating the Docs​

TypeDoc is run as part of the docs-bible.yml GitHub Actions workflow on every commit. To regenerate locally:

cd backend
npx typedoc --out ../kb-site/static/generated/typedoc src/index.ts

What Is Documented​

  • All exported services and their public methods
  • Entity definitions and TypeORM column decorators
  • Route handler request/response types
  • Middleware interfaces and options
  • Scanner agent class hierarchies
  • Utility functions and type guards