Skip to content

Repository files navigation

@agentix-e/anomaly-detector

CI Coverage License: MIT TypeScript Node.js

Embedded time-series anomaly detection engine. Dual-runtime (Node.js + Browser). Zero-config startup — one line to production-grade anomaly detection with forecast-enhanced calibration.

Packages

Package npm Runtime Description
@agentix-e/anomaly-detector-core npm Node + Browser Detection, forecasting, calibration, utilities
@agentix-e/anomaly-detector-node npm Node.js TimesFM foundation-model forecasting
@agentix-e/anomaly-detector-web npm Browser TimesFM Web (onnxruntime-web) forecasting

Quick Start

npm install @agentix-e/anomaly-detector-core
import { createDetector } from '@agentix-e/anomaly-detector-core'

const detector = createDetector()

for (const point of stream) {
  const result = await detector.analyze(point, history)
  if (result.jointConfidence > 0.95) {
    // Your alert logic — library outputs confidence, you decide the threshold
    fireAlert(result)
  }
}

Capabilities

  • Streaming anomaly detection — RRCF via trcf-ts, < 1ms per point
  • Multivariate attribution — leave-one-out Shapley decomposition
  • Concept drift detection — ADWIN / KSWIN with adaptive thresholds
  • 40+ forecasting models — ARIMA, ETS, Theta, TBATS, GARCH, VAR via anofox-forecast
  • Three calibration modes — Forecast-Guided, Anomaly-Guided, Joint Confidence
  • Framework-agnostic chartsChartData output compatible with any visualization library
  • TimesFM (optional) — Google Research's foundation model for zero-shot forecasting
  • State persistence — versioned serialization for hot-reload

Philosophy

The library outputs confidence — you decide. No hardcoded alert levels. No opinionated notification pipelines. Just a jointConfidence number and rich diagnostic data (attribution, drift, predictions, residuals).

Project Structure

anomaly-detector/
├── packages/
│   ├── anomaly-detector-core/    # Core analysis engine
│   │   ├── src/
│   │   │   ├── detect/           # TrcfDetector + Attribution + Drift
│   │   │   ├── forecast/         # AnofoxForecaster + AutoModelSelector
│   │   │   ├── calibrate/        # 3 calibration modes
│   │   │   ├── visualize/        # Framework-agnostic ChartData
│   │   │   ├── utils/            # classifyByLevels + suppressFlapping
│   │   │   ├── engine.ts         # createDetector() factory
│   │   │   └── types.ts          # All DI interfaces
│   │   └── test/
│   ├── anomaly-detector-node/    # TimesFM Node.js adapter
│   └── anomaly-detector-web/     # TimesFM Browser adapter
├── docs/
│   ├── ARCHITECTURE.md
│   └── index.html                # GitHub Pages landing
└── .github/workflows/
    ├── _quality.yml              # Reusable lint + typecheck + test
    ├── ci.yml                    # CI + GitHub Pages
    └── release.yml               # npm publish (OIDC)

Documentation & Reports

Resource Link
Architecture docs/ARCHITECTURE.md
Coverage Report agentix-e.github.io/anomaly-detector/coverage/
GitHub Pages agentix-e.github.io/anomaly-detector/

Development

pnpm install
pnpm -r lint          # ESLint across all packages
pnpm -r typecheck     # TypeScript type checking
pnpm -r test          # Run all tests
pnpm -r test:coverage # Tests with coverage reports

License

MIT

About

Embedded time-series anomaly detection engine. Dual-runtime (Node + Browser) support. 40+ forecasting models, RRCF streaming, TimesFM foundation model, Shapley attribution.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages