mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-05 15:07:13 +01:00
The action queue had executors (Telegram/email/calendar/commitment) and an approval UI, but almost nothing PRODUCED actions — chat-Loki was pure text-in/text-out, so the executors (incl. the calendar drain) were built for actions nothing generated. This adds the missing mouth. - extract-proposal.ts: a model-agnostic Groq JSON pass that detects when the operator asked Loki to do something external (send_message/send_email/ create_event/create_commitment) and returns a structured proposal. Pure parse/validate core (parseProposalJson) is fail-closed and unit-tested (13 cases, wired into test:home). Only the four WIRED executor types are extracted; deferred no-op types are never proposed. - enqueue-proposal.ts: shared producer step (extract → proposeAction draft → audit 'proposed'), kept DB-out of the testable core. IRON RULE holds — only status='draft' is inserted; the operator approves before anything runs. - Wired into BOTH chat surfaces (/api/loki and the main conversations route), running in parallel with the answer so it adds no latency; best-effort so a failure never breaks the reply. Deterministic parsers (create-project, profile-update) still run first; this only fires for the four external types. - Transcript shows a "Added to your approval queue" footer linking to Today. Verified live against Groq: correct type/payload per intent, relative dates resolved (next monday → date, friday → date), questions classified non-actionable. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>