Files
loki/scripts
Mao NakamotoandClaude Opus 4.8 00aba6d952 feat(loki): wire the action-queue producer — chat can now propose actions
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>
2026-07-13 08:59:13 +02:00
..