fix(goals): start GoalTracker on boot + surface AI proposals inline

startGoalTracker was only ever called from tests, so DrinkLogged /
TaskCompleted / MealLogged events never incremented currentValue and
GoalReached never fired — the progress bars were cosmetic. Wire it into
the (app)/+layout idle boot next to startStreakTracker, with matching
teardown in onDestroy.

Also drop <AiProposalInbox module="goals"/> into the module ListView so
create_goal / pause_goal / resume_goal / complete_goal proposals are
reviewable inline (previously only visible in the mission-detail view).

Refresh the tool-coverage tables while we're at it: apps/mana/CLAUDE.md
now reflects the real catalog state (59 tools, 19 modules — was 37/12),
and services/mana-ai/CLAUDE.md shows the correct server-side propose
subset (31 tools, 16 modules). Also fixes a stale 'location_log' →
'get_current_location' typo in the places row.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-04-20 14:24:39 +02:00
parent c119fd7a62
commit 52d008dd34
4 changed files with 35 additions and 7 deletions

View file

@ -206,16 +206,16 @@ The companion is a **second actor** that works alongside the human in every modu
- **Scene lens** — workbench scenes can bind to an agent via `scene.viewingAsAgentId` (context menu → "An Agent binden…"). Pure UI lens, not a data-scope change. `SceneAppBar` shows the agent avatar on bound scene tabs.
- **Workbench timeline**`/ai-workbench` renders every AI-attributed event grouped by mission iteration with per-**agent** filter, per-module, per-mission. Each bucket header shows agent avatar + name + mission title. Per-bucket **Revert button** undoes the iteration's writes via `data/ai/revert/` (TaskCreated → delete, TaskCompleted → uncomplete, etc., newest-first). Separate **"Datenzugriff"** tab exposes the server-side decrypt audit (for missions with Key-Grants).
### Tool Coverage (37 tools, 12 modules)
### Tool Coverage (59 tools, 19 modules)
Agents interact with the app through tools — each one either auto (executes silently during reasoning) or propose (creates a Proposal card the user must approve). Canonical list in `@mana/shared-ai/src/policy/proposable-tools.ts`; server-side definitions in `services/mana-ai/src/planner/tools.ts`; webapp auto-tool list in `src/lib/data/ai/policy.ts`.
Agents interact with the app through tools — each one either auto (executes silently during reasoning) or propose (creates a Proposal card the user must approve). Source of truth: `AI_TOOL_CATALOG` in `@mana/shared-ai/src/tools/schemas.ts` — both webapp policy (`src/lib/data/ai/policy.ts`) and server-side planner (`services/mana-ai/src/planner/tools.ts`) derive from it automatically, so drift is structurally impossible.
| Module | Propose | Auto |
|--------|---------|------|
| todo | `create_task`, `complete_task`, `complete_tasks_by_title` | `get_task_stats`, `list_tasks` |
| calendar | `create_event` | `get_todays_events` |
| notes | `create_note`, `update_note`, `append_to_note`, `add_tag_to_note` | `list_notes` |
| places | `create_place`, `visit_place` | `get_places`, `location_log` |
| places | `create_place`, `visit_place` | `get_places`, `get_current_location` |
| drink | `undo_drink` | `get_drink_progress`, `log_drink` |
| food | — | `nutrition_summary`, `log_meal` |
| news | `save_news_article` | — |
@ -224,6 +224,13 @@ Agents interact with the app through tools — each one either auto (executes si
| habits | `create_habit`, `log_habit` | `get_habits` |
| contacts | `create_contact` | `get_contacts` |
| quiz | `create_quiz`, `update_quiz`, `add_quiz_question`, `update_quiz_question`, `delete_quiz_question` | `list_quizzes`, `get_quiz_questions`, `get_quiz_stats` |
| goals | `create_goal`, `pause_goal`, `resume_goal`, `complete_goal` | `list_goals`, `get_goal_progress` |
| mood | `log_mood` | `get_mood_today`, `get_mood_insights` |
| myday | — | `get_myday_summary` |
| events | `suggest_event` | `discover_events` |
| finance | `add_transaction` | `get_month_summary`, `list_transactions` |
| times | `start_timer`, `stop_timer` | `get_time_stats`, `get_timer_status`, `list_projects` |
| wetter | — | `get_weather`, `get_rain_forecast` |
**Server-side web-research**: mana-ai calls mana-api's `/api/v1/news-research/discover` + `/search` directly before the planner prompt is built (pre-planning injection). Missions with research-keyword objectives get real article URLs + excerpts injected as a synthetic ResolvedInput. See `services/mana-ai/src/planner/news-research-client.ts`.

View file

@ -6,6 +6,7 @@
import { goalStore, useAllGoals, GOAL_TEMPLATES } from '$lib/companion/goals';
import type { LocalGoal } from '$lib/companion/goals/types';
import GoalEditor from './GoalEditor.svelte';
import AiProposalInbox from '$lib/components/ai/AiProposalInbox.svelte';
const goals = useAllGoals();
let showTemplates = $state(false);
@ -28,6 +29,8 @@
</script>
<div class="goals-page">
<AiProposalInbox module="goals" />
<div class="header">
<button class="add-btn" onclick={() => (showEditor = true)}>
<PencilSimple size={14} weight="bold" /> Eigenes

View file

@ -15,6 +15,7 @@
import { initTools } from '$lib/data/tools/init';
import { startEventBridge, stopEventBridge } from '$lib/triggers/event-bridge';
import { startStreakTracker, stopStreakTracker } from '$lib/data/projections/streaks';
import { startGoalTracker, stopGoalTracker } from '$lib/companion/goals';
import { initByok } from '$lib/byok';
import { bottomBarStore } from '$lib/stores/bottom-bar.svelte';
import { locale, _ } from 'svelte-i18n';
@ -549,6 +550,7 @@
initTools();
startEventBridge();
startStreakTracker();
startGoalTracker();
initByok();
startLlmQueue();
startMemoroLlmWatcher();
@ -667,6 +669,7 @@
stopEventStore();
stopEventBridge();
stopStreakTracker();
stopGoalTracker();
stopMissionTick();
stopServerIterationStaging();
guestMode?.destroy();

View file

@ -77,14 +77,29 @@ Der Runner wird agent-bewusst — Missionen gehoeren einem benannten Agent, Poli
## Status: v0.6 (Server-side Web-Research + erweiterte Tools)
Der Runner kann jetzt vor dem Planner-Call eigenstaendig Web-Recherche ausfuehren (ohne Browser) und hat Zugriff auf 28 Tools ueber 11 Module.
Der Runner kann jetzt vor dem Planner-Call eigenstaendig Web-Recherche ausfuehren (ohne Browser). Serverseitig werden 31 propose-Tools ueber 16 Module vom Planner vorgeschlagen (auto-Tools laufen ausschliesslich in der Webapp-Reasoning-Loop — der Server sieht nur propose).
- [x] `NewsResearchClient` (`planner/news-research-client.ts`) — HTTP-Client fuer `mana-api`'s `/api/v1/news-research/discover` + `/search`. Timeouts 15s/30s, graceful-null bei Fehler.
- [x] Pre-Planning-Research-Step in `cron/tick.ts` — bei Mission-Objectives mit Research-Keywords (`recherchier|research|news|today|historisch|...`) wird automatisch vor dem Planner-Call RSS-Discovery + Search ausgefuehrt. Ergebnisse als `ResolvedInput` mit `id='__web-research__'` injiziert.
- [x] `config.manaApiUrl` + Docker-Compose-Wiring (`MANA_API_URL: http://mana-api:3060`, `depends_on: mana-api`).
- [x] 28 Tools ueber 11 Module (17 propose, 11 auto):
- Propose: `create_task`, `complete_task`, `complete_tasks_by_title`, `create_event`, `create_note`, `update_note`, `append_to_note`, `add_tag_to_note`, `create_place`, `visit_place`, `undo_drink`, `save_news_article`, `create_journal_entry`, `create_habit`, `log_habit`, `research_news`, `create_contact`
- Auto: `get_task_stats`, `list_tasks`, `list_notes`, `get_todays_events`, `get_drink_progress`, `log_drink`, `nutrition_summary`, `log_meal`, `get_places`, `location_log`, `get_habits`, `get_contacts`
- [x] 31 propose-Tools ueber 16 Module (Server-Sicht — auto-Tools sind nur in der Webapp):
- todo: `create_task`, `complete_task`, `complete_tasks_by_title`
- calendar: `create_event`
- notes: `create_note`, `update_note`, `append_to_note`, `add_tag_to_note`
- places: `create_place`, `visit_place`
- drink: `undo_drink`
- news: `save_news_article`
- news-research: `research_news`
- journal: `create_journal_entry`
- habits: `create_habit`, `log_habit`
- contacts: `create_contact`
- quiz: `create_quiz`, `update_quiz`, `add_quiz_question`, `update_quiz_question`, `delete_quiz_question`
- goals: `create_goal`, `pause_goal`, `resume_goal`, `complete_goal`
- mood: `log_mood`
- events: `suggest_event`
- finance: `add_transaction`
- times: `start_timer`, `stop_timer`
- [x] Volle Tool-Liste inkl. der 28 auto-Tools: siehe `apps/mana/CLAUDE.md` §Tool Coverage. Einzige Wahrheitsquelle ist `AI_TOOL_CATALOG` in `@mana/shared-ai/src/tools/schemas.ts`; beide Seiten deriven daraus, Drift-Guard in `src/planner/tools.ts` blockt Regressionen.
## Port: 3067