Lead Machine

Technical description

Node 22+, zero dependencies (`node:http`, built-in `fetch`). Every client has a JSON knowledge base and a `config/client.json`; a new vertical is a new JSON file, not new code.

How to run it

node src/cli.mjs serve                    # HTTP (PORT, default 8788; this demo runs on 8798)
node _qa/smoke.mjs                        # 12/12 checks, offline, $0
node src/cli.mjs test --file sample/lead-implant.json
node src/cli.mjs metrics
node src/cli.mjs digest --day 2026-10-21

# live model (production): "llm": { "mode": "live" } + DEEPSEEK_API_KEY
# without a key the machine falls back to offline rules

API

methodpathwhat it does
POST/leadnew inquiry (JSON or form) — the channel connects here
POST/lead/:id/messagethe next turn of the conversation
GET/lead/:idthe whole conversation
POST/lead/:id/takeovera human takes the conversation over
POST/lead/:id/human-replya human reply in the same thread
POST/learna new rule in one sentence
GET/watchoperator dashboard
GET/metricsnumbers: totals, exceptions, average and p95 reply time, SLA
GET/digest?day=daily report (the same text sent to Telegram)

Data

Limits — what this demo does not do

How it is deployed

One Node process behind nginx, a systemd unit, Let’s Encrypt. Recipe: E:\poslovi\DEMO-REGISTAR.md.

The demo cannot spend money: it runs offline and no `DEEPSEEK_API_KEY` is present in the environment.