feat(agent): move 'Vad din agent vet' into settings (Assistenten -> Kunskap) (#1008)

Relocates the ledger-knowledge surface off the top nav and into the
assistant settings hub as a third tab (Minne / Kompetens / Kunskap), per
the code's own "minne + kunskap under Assistenten" intent and the #935
flag that this was an easy call to change.

Because both settings surfaces (the full-page rail and the intercepting
settings modal) mount each section as a propless component via
SETTINGS_SECTIONS, the knowledge data must be fetched client-side rather
than passed as a server prop:

- New GET /api/agent/knowledge aggregates buildLedgerContext +
  buildDeepEntities + buildAgentCompetence + company name (read-only,
  company-scoped via withRouteContext).
- AgentKnowledgeView + AgentCompetenceSections converted from async
  server components to client components (getTranslations ->
  useTranslations; no other server-only usage).
- New AgentKnowledgePanel client wrapper lazy-fetches the payload when
  the Kunskap tab opens (Radix unmounts inactive tabs), with Skeleton and
  error states matching the memory/skills panels.
- Removed the Brain/agent-knowledge entry (and its now-unused import)
  from the Analys nav group.
- /agent-knowledge kept as a redirect to /settings/assistant?view=knowledge
  so old links/bookmarks resolve.

Tests: new route test (auth 401, no-company 400, happy-path aggregation).
i18n: load_error_* keys added to both locales (parity kept).

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Jakob Wennberg
2026-07-12 22:21:08 +02:00
committed by GitHub
co-authored by Claude Fable 5
parent 4b51af3d80
commit dcd33997b7
10 changed files with 238 additions and 67 deletions
+2 -4
View File
@@ -40,7 +40,6 @@ import {
CalendarClock,
CalendarRange,
FileCheck,
Brain,
FileSpreadsheet,
ScrollText,
} from 'lucide-react'
@@ -191,9 +190,8 @@ const navItems: NavItem[] = [
// Rapporter surface (nav_ia_redesign §F) is built.
{ href: '/kpi', labelKey: 'kpi', icon: TrendingUp, group: 'analys' },
{ href: '/reports', labelKey: 'reports', icon: BarChart3, group: 'analys' },
// "Vad din agent vet": read-only profile of how this company books, the
// human render of the agent's ledger-context (dev_docs/ledger_context_resource.md).
{ href: '/agent-knowledge', labelKey: 'agent_knowledge', icon: Brain, group: 'analys' },
// "Vad din agent vet" now lives inside Settings (Assistenten -> Kunskap),
// reachable via /settings/assistant?view=knowledge, not the top nav.
// Data: master-data registers + data plumbing. Anställda is a register
// (you edit an employee rarely, you run payroll monthly), so it lives here
// while the Löner flow stays in Arbeta.