mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-21 16:46:43 +02:00
3 commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a08e45ca16 |
feat(templates): generalise to WorkbenchTemplate + ship Calmness pilot (T1)
First pass of the workbench-templates plan (docs/plans/workbench-
templates.md) — templates are no longer agent-centric but a general
"starter kit" bundle: optional agent + optional scene + optional
missions + optional per-module seeds. Pilot non-AI template "Calmness"
ships alongside.
Shape generalisation (packages/shared-ai/src/agents/templates/types.ts):
- AgentTemplate renamed to WorkbenchTemplate; all fields now optional
(agent, scene, missions, seeds). Back-compat AgentTemplate alias
kept so research/context/today keep compiling.
- Added `category: 'ai'|'wellness'|'work'|'lifeEvent'|'delight'` +
`icon` (for non-agent templates that have no avatar) + `version`
field (for future update-detection).
- New WorkbenchTemplateSeedItem shape: `{stableId?, data: unknown}`.
Module-specific seed payloads are typed at the handler side.
- Existing three AI templates nachgezogen: category='ai' (or
'delight' for today-agent), icon, version='1'.
Seed infrastructure:
- apps/mana/apps/web/src/lib/data/ai/agents/seed-registry.ts — in-
memory handler map keyed by module name; module-local seed.ts files
register themselves at import time.
- apps/mana/apps/web/src/lib/modules/meditate/seed.ts — first handler:
createPreset-based, idempotent via stableId embedded as HTML
comment in the preset description (T1 pragmatism; T2 adds a proper
column on the preset schema).
- data/ai/missions/setup.ts pulls `import '$lib/modules/meditate/seed'`
so the handler is registered before any template is applied.
Applicator upgrades (data/ai/agents/apply-template.ts):
- Agent step now optional — skipped cleanly when template has no
agent part.
- New step 4: seeds. Walks template.seeds, looks up the handler for
each module, aggregates per-item outcomes (created/skipped-exists/
failed) into result.seedOutcomes. Missing handler = warning, not
fatal. Crypto/encryption unchanged — seeds go through the same
module stores that module code already uses.
- Result shape gains `seedOutcomes: Record<string, SeedOutcome[]>`
so the gallery can show "3 new, 1 already there".
Calmness pilot (packages/shared-ai/src/agents/templates/calmness.ts):
- category='wellness', NO agent, scene with meditate/mood/journal/
sleep apps, two meditate preset seeds:
* 4-7-8 Atmung (breathing preset)
* Body-Scan 10min (bodyscan preset with 9 scan steps)
- Each seed has a stableId so re-apply is idempotent.
Gallery updates (routes/(app)/agents/templates/+page.svelte):
- Card avatar falls back to t.icon when no agent. "Agent" chip shows
only for agent-templates; "N Seeds" chip shows for templates with
seeds.
- Detail header shows "Workbench-Setup ohne AI-Agent" when no agent.
- New "Seeds" preview section: lists per-module counts + item names.
- Options section gains a "Seed-Daten in Module einpflegen" checkbox.
- Success panel shows seed summary: "3 Seeds neu, 1 bereits
vorhanden".
Tests: shared-ai 26/26, webapp svelte-check 0 errors, 0 warnings.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
||
|
|
7822340ea0 |
feat(ai-agents): Template gallery — 3 ready-to-use agent bundles
First pass of the Multi-Agent discoverability UX. A new /agents/ templates route showcases pre-configured agents; clicking one creates agent + scene + starter mission(s) as a single bundle. Addresses the "blank form anxiety" + "user doesn't know what agents are for" observations from the UX brainstorm. Three templates for v1 (shared-ai/src/agents/templates/): - 🔍 Recherche-Agent — reads sources one by one, writes a note per source, summarizes into a report. Manual-cadence mission; all writes propose so user curates. - 🧭 Kontext-Agent — learns about the user via a weekly check-in. Reads kontext/notes/goals, asks 2-3 questions, proposes a diff- style context update. Weekly Sunday cadence. - 🌅 Today-Agent — researches "on this day" history each morning, writes a 4-8 line German poem, proposes a journal note. Daily 7am cadence. A "delight" agent, not a productive one. Each template packs (agent config, scene layout, starter mission): - AgentTemplate type lives in @mana/shared-ai — pure data, no runtime imports. Adding a new template = drop a file in templates/ and extend ALL_TEMPLATES. - Template-specific policies derive from the proposable-tool list so drift-guard catches divergence from the canonical set. - Starter missions default to startPaused=true — user sees the mission ready-to-go and hits Play when ready. Prevents surprise autonomous work on first apply. Applicator (data/ai/agents/apply-template.ts): - Creates agent → scene (if template defines one) → missions in order. Agent failure = abort; scene/mission failures surface as warnings in the result without blocking. - Duplicate-name handling: falls through to findByName, returns existing agent with wasExisting=true; scene is skipped in that case to avoid clone-proliferation. Gallery page /(app)/agents/templates/+page.svelte: - Three large cards side-by-side (stacks on mobile) with avatar / label / tagline / meta chips (Scene, N Missionen). - Click opens detail panel with full description, scene preview (app-ids + widths), mission preview (title / objective / cadence), and override checkboxes (create scene, create missions, start active vs paused). - Success panel shows what landed with warnings inline; CTA back to workbench. Discoverability in /ai-agents module: - Bar now has two buttons: "Aus Template" (primary, goto templates route) + "Eigener Agent" (secondary, opens the existing blank-form create mode). - When only the default "Mana" agent exists, render a dashed promo banner at the top linking to the template gallery. Disappears as soon as the user has a second agent. Tests: webapp svelte-check 0 errors, 0 warnings. shared-ai 26/26. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
bc77b36234 |
feat(agents): Agent CRUD + default bootstrap + Mission.agentId (Phase 2)
Second phase of the Multi-Agent Workbench rollout (docs/plans/
multi-agent-workbench.md). Builds on Phase 1's identity-aware Actor.
Adds the Agent primitive — a named AI persona that owns Missions,
carries its own policy + memory, and (from Phase 3 on) drives the
Workbench lens. Everything is wired; a single user currently has one
"Mana" default agent until the UI (Phase 5) lets them create more.
Shared types (@mana/shared-ai):
- agents/types.ts: Agent, AgentState, DEFAULT_AGENT_ID/NAME constants
- policy/types.ts: AiPolicy + PolicyDecision (moved from webapp so
Agent.policy can reference it without a runtime dep on the web app)
- missions/types.ts: new optional Mission.agentId field
Webapp data layer:
- data/ai/agents/{types,store,queries,bootstrap}.ts
- Dexie schema v19 adds `agents` table (indexes on state, name,
[state+name]); sync registered under the existing ai app-id
- Encryption registry: agents.systemPrompt + agents.memory encrypted;
name/role/avatar/policy stay plaintext for search + UI rendering
- DuplicateAgentNameError thrown at write time (not a Dexie unique
index — bootstrap races between tabs would otherwise hit
ConstraintError; store now resolves via getOrCreateAgent)
- bootstrap.ts: ensureDefaultAgent + backfillMissionsAgentId. The
backfill runs once per device (localStorage sentinel) so missions
that pre-date the rollout get stamped with the default agent's id.
Called fire-and-forget from startMissionTick() during layout init.
Runner threading (already merged into
|