Pulse is a standalone, protocol-first, serverless-first AI runtime for safe model training, promotion, inference, feedback, drift detection, and self-retraining. It follows explicit Queries, Mutations, and Events contracts in a Signal-style envelope while remaining fully decoupled from live client schemas.
This scaffold treats client databases as first-class sources and enforces a hard rule: training never runs on mutable live data. Every training job must use a versioned dataset snapshot materialized from a controlled extraction job.
apps/
api/ HTTP API exposing named protocol operations and convenience endpoints
worker/ background orchestration for recovery and scheduled retraining checks
packages/
contracts/ explicit versioned Pulse envelopes and operation payloads
runtime/ orchestration engine and state transitions
core/ domain entities, lineage, and policy logic
storage/ metadata stores, object stores, encryption, and Drizzle SQL migration scaffold
ml/ deterministic feature building, baseline training, evaluation, and drift logic
connectors/pluggable datasource connectors and SQL executor abstractions
sdk/ API client for Pulse operations
shared/ ids, hashing, stable JSON, and time helpers
tests/ end-to-end runtime tests
- Protocol-first contracts with explicit names like
pulse.source.sql.extract.v1. - Serverless-first runtime design with externalized metadata and object storage.
- Read-only datasource access by default, encrypted connection configs, and allowlisted SQL objects.
- Snapshot-before-training enforcement for reproducibility and auditability.
- Idempotent mutations, replay-safe events, explicit statuses, and lineage edges across the pipeline.
- Retraining decisions driven by drift, feedback, data freshness, and scheduled policies.
Pulse supports these datasource types:
postgresmysqlsqlserverhttp(reserved for future implementation)object_storage
Each connector implements:
inspectSchema()validateConnection()extractSnapshot()streamData()estimateSize()
SQL extraction is intentionally constrained to allowlisted views, stored queries, or predefined query identifiers. Arbitrary SQL is not enabled by default.
pulse.datasource.register.v1pulse.datasource.validate.v1pulse.source.sql.extract.v1- Snapshot written incrementally to object storage
pulse.dataset.snapshot.create.v1- Dataset version locked and used by
pulse.training.start.v1
Training accepts only datasetId and datasetVersion.
Convenience endpoints:
POST /datasourcesGET /datasources/:idPOST /datasources/:id/validatePOST /extractionsGET /extractions/:idPOST /datasets/snapshot
Generic protocol endpoints:
POST /mutations/:namePOST /queries/:name
Pulse is dependency-light and uses Node's standard library in this scaffold. The default API bootstrap wires a static SQL executor with example allowlisted views (ai_orders_v1, ai_customer_features_v1, ai_labels_v1) so the end-to-end flow is runnable without external infrastructure.
npm install
npm run build
npm test
npm run start:api
npm run start:workerDefault local state is stored under .pulse/:
.pulse/metadata.jsonfor metadata and events.pulse/objects/for snapshots, models, and evaluation artifacts
Register a datasource:
{
"protocol": "pulse",
"kind": "mutation",
"name": "pulse.datasource.register.v1",
"version": "v1",
"messageId": "msg_123",
"timestamp": "2026-03-26T00:00:00.000Z",
"idempotencyKey": "datasource-tenant-a-orders",
"tenantId": "tenant_a",
"payload": {
"name": "Orders Warehouse",
"type": "postgres",
"connectionConfig": {
"dsn": "postgres://readonly@warehouse/orders"
},
"allowedSchemas": ["public"],
"allowedTables": [],
"allowedViews": ["ai_orders_v1"]
},
"metadata": {}
}Create a snapshot extraction:
{
"protocol": "pulse",
"kind": "mutation",
"name": "pulse.source.sql.extract.v1",
"version": "v1",
"messageId": "msg_124",
"timestamp": "2026-03-26T00:00:01.000Z",
"tenantId": "tenant_a",
"payload": {
"dataSourceId": "ds_...",
"queryDefinition": {
"kind": "view",
"identifier": "ai_orders_v1",
"cursorField": "updated_at"
},
"extractionMode": "full_snapshot",
"chunkSize": 500
},
"metadata": {}
}Trace lineage:
{
"protocol": "pulse",
"kind": "query",
"name": "pulse.lineage.trace.v1",
"version": "v1",
"messageId": "msg_125",
"timestamp": "2026-03-26T00:00:02.000Z",
"tenantId": "tenant_a",
"payload": {
"entityId": "pred_...",
"entityType": "prediction"
},
"metadata": {}
}packages/storage/drizzle/0000_init.sqldefines the metadata schema expected in PostgreSQL.packages/connectors/src/sql-common.tsenforces allowlists and exposes a DB-driver-agnostic executor seam.packages/runtime/src/runtime.tsis the operational core for datasource registration, extraction, dataset snapshotting, training, evaluation, promotion, prediction, feedback, drift detection, retraining, and lineage.apps/workerresumes failed extraction jobs and performs scheduled retraining checks.
- Replace the static SQL executor with real Postgres, MySQL, and SQL Server drivers behind the
SqlExecutorinterface. - Swap the file-based metadata/object stores for PostgreSQL + object storage implementations.
- Add authentication, tenant isolation enforcement, secrets management, and structured observability.
- Extend the ML package beyond the deterministic baseline model to your target frameworks and evaluators.