updates on the ai agents and time series prediction and updates on the api to

This commit is contained in:
2026-10-09 13:50:30 +05:30
parent 29690c56f2
commit 153be40e5c
42 changed files with 4889 additions and 186 deletions

20
main.go
View File

@@ -13,11 +13,13 @@ import (
"doormile/config"
"doormile/controllers"
"doormile/db"
"doormile/internal/ai/outcomes"
"doormile/internal/ai/playground"
"doormile/internal/ai/telemetry"
"doormile/internal/assignment"
"doormile/internal/milergeo"
"doormile/internal/notify"
"doormile/internal/prediction"
"doormile/internal/routing"
"doormile/internal/sms"
"doormile/internal/worker"
@@ -242,9 +244,27 @@ func main() {
// Retries every unassigned pending booking on a timer, so a booking whose
// retry window closed while no rider was free is still picked up later.
go assignment.StartPendingSweeper()
// Recalibrates the ETA estimate from the system's own past predictions
// (bookingassignments.etaminutes) against what actually happened. Until
// ROUTE_OPTIMIZER_URL is configured there is nothing to calibrate, the
// calibration stays empty, and every ETA comes from the existing promise
// tables exactly as before. See docs/prediction-plan.md rung 1.1.
go prediction.StartCalibrationSweeper()
// Judges what the engine's past decisions actually achieved, which is what
// makes them retrievable: /internal/agent-decisions/similar filters on
// `outcome IS NOT NULL`, so an unjudged decision is invisible to recall.
// Also prunes past the retention window — this table had none.
// Skill-finding retention rides the outcome sweeper's tick. Assigned here
// rather than called directly, to keep internal/ai/outcomes free of a
// controllers import.
outcomes.PruneFindings = controllers.PruneAIFindings
go outcomes.StartOutcomeSweeper()
// 9. Point the stop sequencer at the Route Optimization API.
routing.BaseURL = cfg.RouteOptimizerURL
// Where AI_engine's health surface lives, for the console's agent-status
// proxy. Empty disables it and the console keeps using its snapshot.
controllers.AIEngineBaseURL = cfg.AIEngineBaseURL
// 10. Record AI_engine agent runs (telemetry.task) and live state
// (telemetry.agent). Observability only: a nil NATS connection logs and