managarten/apps/mana/apps
Till JS 8299bf004d feat(ai): reasoning loop — agent chains auto tools before asking for approval
The runner was one-shot: one planner call per iteration, no feedback
from tool outputs. "Lies alle Notizen und tagge sie" needed two manual
runs (list_notes, then tagging) because the planner never saw the
list_tasks output.

Now runMission loops up to MAX_REASONING_LOOP_ITERATIONS (5):

  loop: plan → classify steps by policy
        │
        ├─ auto  → execute inline, capture {message, data}, feed back
        │          as a synthetic ResolvedInput for the next planner call
        │
        ├─ propose → stage proposal, mark humanInLoop, EXIT after this round
        │            (human has to approve before we plan further — we don't
        │             know what they'll accept yet)
        │
        └─ none/0-steps → agent considers the task done, EXIT

Tool outputs become a ResolvedInput titled "Zwischenergebnisse (Runde N)"
so the planner sees them structured and labelled. StageOutcome gains
`autoData` + `autoMessage` so the loop can thread the executor's
payload back through without a second call.

AiDebugEntry now holds `plannerCalls[]` and `loopSteps[]` instead of a
single planner snapshot — so Debug-Panel shows every LLM round + every
auto-tool output, each collapsible. Summary chip shows "3× LLM · 4200ms
· 2× Auto-Tool" when a loop ran.

Side-effects for existing use cases:
- One-shot missions (single propose tool) behave identically (loop
  exits after round 1 with humanInLoop=true).
- "Tag all notes" missions now finish in a single run: loop iter 1
  runs list_notes auto, iter 2 stages N add_tag_to_note proposals,
  exits.
- Server-side mana-ai runner NOT touched — this is foreground-only
  for now; the server still runs one plan/tick.

All 8 runner.test.ts tests pass unchanged (the existing test suite
only exercises the single-step path, which is a subset of the loop).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 00:43:52 +02:00
..
landing refactor: rename zitare -> quotes (Zitate) 2026-04-14 20:59:16 +02:00
mobile refactor: rename zitare -> quotes (Zitate) 2026-04-14 20:59:16 +02:00
web feat(ai): reasoning loop — agent chains auto tools before asking for approval 2026-04-16 00:43:52 +02:00