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 / Service | File | Description |
|---|---|---|
PentestCoordinator | pentestCoordinator.service.ts | Main orchestrator for the 6-phase scanning pipeline. Manages agent lifecycle, shared blackboard, and phase transitions. |
SharedBlackboard | sharedBlackboard.service.ts | In-memory shared state during a scan. Stores discovered endpoints, auth tokens, parameters, and inter-agent communication. |
FindingValidator | findingValidator.service.ts | Applies heuristic rules (H1-H16) to filter false positives before AI validation. |
ValidationEngine | validationEngine.service.ts | Computes confidence tiers (high/medium/low) for each finding based on evidence quality. |
TargetProfiler | targetProfiler.service.ts | Fingerprints target applications during Phase 0/1 (tech stack, frameworks, auth type). |
BudgetAllocator | budgetAllocator.service.ts | Distributes scan time budget across agents based on target profile and priority. |
IntelligentDiscovery | intelligentDiscovery.service.ts | AI-powered endpoint discovery that adapts based on observed API patterns. |
FindingDeduplicator | findingDeduplicator.service.ts | Removes semantically duplicate findings across agents. |
ChainReplayEngine | (within coordinator) | Links related findings into multi-step exploit chains. |
OobCallbackServer | oobCallbackServer.service.ts | Out-of-band callback server for detecting blind SSRF and blind XSS. |
Core Platformβ
| Class / Service | File | Description |
|---|---|---|
AggregationService | aggregation.service.ts | ~2900-line service computing all KPI metrics, trends, MTTR, and risk distributions. |
TenableService | tenable.service.ts | Tenable.io API client for asset and vulnerability sync. |
SyncService | sync.service.ts | Orchestrates chunk-based data synchronization from Tenable.io. |
SettingsService | settings.service.ts | System settings management with validation. |
LicenseService | license.service.ts | JWT license token validation and module entitlement checking. |
FeatureFlagService | featureFlags.service.ts | Runtime feature flag evaluation for operator-level toggles. |
AI Servicesβ
| Class / Service | File | Description |
|---|---|---|
AiOrchestrator | aiOrchestrator.service.ts | Central dispatcher for all AI-powered features (fix plans, tickets, summaries). |
AiProviderService | aiProvider.service.ts | Abstraction layer over LLM providers (Anthropic Claude, OpenAI GPT, local models). |
AiPromptService | aiPrompt.service.ts | Template management for AI prompts with versioning. |
AiCacheService | aiCache.service.ts | Caching layer to prevent duplicate LLM calls for identical inputs. |
AiUsageService | aiUsage.service.ts | Token counting and cost tracking for AI API calls. |
Key Interfacesβ
| Interface | Description |
|---|---|
AuthenticatedRequest | Express request extended with user object containing userId, tenantId, roles |
ScannerPolicy | Configuration for scanner behavior (timeouts, concurrency, payload limits) |
SharedBlackboard | Type definition for the in-memory scan state (endpoints, tokens, parameters) |
FilterCondition | Dynamic 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