diff --git a/DECISIONS.md b/DECISIONS.md index 6d780cfa..e982a5fb 100644 --- a/DECISIONS.md +++ b/DECISIONS.md @@ -200,3 +200,4 @@ One line per decision: `[YYYY-MM-DD] : `. Appended by agents and [2026-07-10] Reopened the no-LLM call for account intelligence (founder directive): dev_docs/data_quality_master.md v2.1 revises D6. AI is scoped to where the deterministic engine has zero signal (supplier cold-start classification, no-hard-key residue, fleet-cluster naming) under D8 guardrails: persist-first (no model calls on booking hot paths), approval-gated suggest-band only (never preselect, never auto-book), AI priors in a sidecar table not categorization_templates, reuse the existing eu-north-1 Bedrock client (BFL residency), self-hosted/no-creds degrades to deterministic. The deterministic floor still ships first in every workstream; the AI-subsystem removal migration stays valid for what it removed (the auto-booking agent), not for AI as such. [2026-07-12] Issue #988 (transaction stuck on a removed verifikat): root cause was predicate divergence, the re-booking guards treated ANY non-null transactions.journal_entry_id as linked while the UI counts only status='posted'. Fix is a shared hasLiveJournalEntryLink() so stale pointers (reversed/cancelled/missing) are re-linkable, failing CLOSED on read errors, plus optimistic locks on the exact previous pointer instead of always .is(null). Chose guard self-heal over a null-on-reverse DB trigger because a trigger would fight correctEntry's re-point-to-correction behavior and race the correction insert; reverseEntry/correctEntry re-links stay best-effort. match-invoice/match-supplier-invoice untouched (they key on invoice ids; prod had zero dangling there). [2026-07-15] Issue #735 result-appropriation: did NOT run the mass 2099-to-2098 backfill. Prod audit showed the script read the FROZEN opening-balance 2099, not the CURRENT posted balance: 202 of 360 planned periods already carried their own disposition (mostly via SIE import) and 43 would have double-moved equity (worst case tens of MSEK on a single company), while periods without an OB entry fabricated balances via the cumulative-history fallback. Posted ONE verified entry for the reporting company (unblocking their arsredovisning) and rewrote the script to a current-balance-safe backfill: eligibility decided from current posted 2099, explicit OB entry required, already-disposed and ambiguous periods skipped to a manual-review report. planResultAppropriation/generateResultAppropriation untouched (steady-state year-end path, covered by pg-real tests); the safety lives in the sweep. +[2026-07-17] Assistenten settings opens on Kunskap (konteringskarta) instead of Minne; dropped the nested Kompetens/Minne tab row inside Kunskap: it duplicated the top-level tabs one row above. diff --git a/app/(dashboard)/agent-knowledge/page.tsx b/app/(dashboard)/agent-knowledge/page.tsx index 38b5469e..aa0201c9 100644 --- a/app/(dashboard)/agent-knowledge/page.tsx +++ b/app/(dashboard)/agent-knowledge/page.tsx @@ -1,7 +1,8 @@ import { redirect } from 'next/navigation' -// "Vad din agent vet" moved into Settings (Assistenten -> Kunskap). This -// route is kept as a permanent redirect so old links/bookmarks still resolve. +// "Vad din agent vet" moved into Settings (Assistenten -> Kunskap, the default +// view). This route is kept as a permanent redirect so old links/bookmarks +// still resolve. export default function AgentKnowledgeRedirect() { - redirect('/settings/assistant?view=knowledge') + redirect('/settings/assistant') } diff --git a/app/(dashboard)/settings/agent-memory/page.tsx b/app/(dashboard)/settings/agent-memory/page.tsx index 6601d3ed..5967bbca 100644 --- a/app/(dashboard)/settings/agent-memory/page.tsx +++ b/app/(dashboard)/settings/agent-memory/page.tsx @@ -4,5 +4,5 @@ import { redirect } from 'next/navigation' // links (e.g. AgentChat's "what I remember" affordance) and old bookmarks land // in the right place. export default function AgentMemorySettingsPage() { - redirect('/settings/assistant') + redirect('/settings/assistant?view=memory') } diff --git a/components/agent-knowledge/AgentCompetenceSections.tsx b/components/agent-knowledge/AgentCompetenceSections.tsx index 89543931..92877c88 100644 --- a/components/agent-knowledge/AgentCompetenceSections.tsx +++ b/components/agent-knowledge/AgentCompetenceSections.tsx @@ -111,7 +111,7 @@ export function FactsCard({ competence }: { competence: AgentCompetence }) { {factsActiveTotal > facts.length ? t('facts_more', { n: factsActiveTotal - facts.length }) : ''} - + )} diff --git a/components/agent-knowledge/AgentKnowledgePanel.tsx b/components/agent-knowledge/AgentKnowledgePanel.tsx index 0b62f706..6bd0d1ef 100644 --- a/components/agent-knowledge/AgentKnowledgePanel.tsx +++ b/components/agent-knowledge/AgentKnowledgePanel.tsx @@ -60,11 +60,17 @@ export function AgentKnowledgePanel() { } if (!payload) { + // Mirrors the loaded layout: graph hero, section header, two profile cards. return ( -
- - - +
+ +
+ +
+ + +
+
) } diff --git a/components/agent-knowledge/AgentKnowledgeView.tsx b/components/agent-knowledge/AgentKnowledgeView.tsx index 931605ac..33ba0aa4 100644 --- a/components/agent-knowledge/AgentKnowledgeView.tsx +++ b/components/agent-knowledge/AgentKnowledgeView.tsx @@ -26,7 +26,6 @@ import type { DeepLedgerContext } from '@/lib/agent-context/ledger-deep' import type { AgentCompetence } from '@/lib/agent-context/agent-competence' import { LedgerGraph } from './LedgerGraph' import { CompetenceCard, FactsCard } from './AgentCompetenceSections' -import { KnowledgeTabs } from './KnowledgeTabs' // Swedish VAT (moms) treatment codes stay Swedish in both locales, like BAS // account names and momsdeklaration labels (.claude/rules/i18n.md). @@ -74,7 +73,7 @@ export function AgentKnowledgeView({ // No bookings yet, but the agent still ships with competence and may // already remember facts: show those rather than a dead end. return ( - <> +
- +
) } @@ -110,7 +109,9 @@ export function AgentKnowledgeView({ ? t('period_yearly') : (vat_profile.moms_period ?? t('unknown')) - // "Regler & profil" tab: user-authored rules + observed VAT + conventions. + // "Regler & profil": user-authored rules + observed VAT + conventions. + // Rendered inline below the graph; Minne and Kompetens have their own + // top-level tabs, so nesting a second tab row here would just duplicate them. const configContent = ( <> {explicit_rules.length > 0 && ( @@ -218,24 +219,22 @@ export function AgentKnowledgeView({ ) - const tabs = [ - { value: 'competence', label: t('tab_competence'), content: }, - { value: 'memory', label: t('tab_memory'), content: }, - { value: 'config', label: t('tab_config'), content: configContent }, - ] - return ( - <> +
{/* The cinematic hero: a self-contained dark panel with its own header */} - {/* Supporting detail, tabbed so it doesn't stack into a long scroll */} - +
+

+ {t('tab_config')} +

+ {configContent} +

{t('footer_basis', { entries: meta.coverage.posted_entries_window, date: formatDateLong(meta.computed_at) })}

- +
) } diff --git a/components/agent-knowledge/KnowledgeTabs.tsx b/components/agent-knowledge/KnowledgeTabs.tsx deleted file mode 100644 index 541d4ea3..00000000 --- a/components/agent-knowledge/KnowledgeTabs.tsx +++ /dev/null @@ -1,33 +0,0 @@ -'use client' - -import type { ReactNode } from 'react' -import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs' - -/** - * Client wrapper that organizes the page's supporting detail into tabs so the - * booking map stays the hero and the rest doesn't stack into a long scroll. - * Content is server-rendered upstream and handed in as ReactNode slots. - */ -export function KnowledgeTabs({ - tabs, -}: { - tabs: { value: string; label: string; content: ReactNode }[] -}) { - if (tabs.length === 0) return null - return ( - - - {tabs.map((t) => ( - - {t.label} - - ))} - - {tabs.map((t) => ( - - {t.content} - - ))} - - ) -} diff --git a/components/agent/AgentChat.tsx b/components/agent/AgentChat.tsx index 3bc0009a..9f5fd6f2 100644 --- a/components/agent/AgentChat.tsx +++ b/components/agent/AgentChat.tsx @@ -842,7 +842,7 @@ function MemoryChip({ event }: { event: MemoryEvent }) { : null return ( diff --git a/components/dashboard/DashboardNav.tsx b/components/dashboard/DashboardNav.tsx index 064aa164..dfc93475 100644 --- a/components/dashboard/DashboardNav.tsx +++ b/components/dashboard/DashboardNav.tsx @@ -189,8 +189,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" now lives inside Settings (Assistenten -> Kunskap), - // reachable via /settings/assistant?view=knowledge, not the top nav. + // "Vad din agent vet" now lives inside Settings (Assistenten -> Kunskap, + // the default view), reachable via /settings/assistant, 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. diff --git a/components/settings/sections/AssistantSettingsContent.tsx b/components/settings/sections/AssistantSettingsContent.tsx index 503efe45..95041b1a 100644 --- a/components/settings/sections/AssistantSettingsContent.tsx +++ b/components/settings/sections/AssistantSettingsContent.tsx @@ -6,48 +6,49 @@ import { AgentMemoryPanel } from '@/components/settings/AgentMemoryPanel' import { AgentSkillsPanel } from '@/components/settings/AgentSkillsPanel' import { AgentKnowledgePanel } from '@/components/agent-knowledge/AgentKnowledgePanel' -// "Assistenten": what the assistant remembers about this company (Minne, -// editable), the domain knowledge it ships with (Kompetens, read-only), and -// the ledger profile it reads before booking (Kunskap = "Vad din agent vet", -// read-only). Tabs keep all three one click away instead of stacked. -type View = 'memory' | 'skills' | 'knowledge' +// "Assistenten": the ledger profile the agent reads before booking (Kunskap = +// "Vad din agent vet", opens on the konteringskarta and is the default view), +// what the assistant remembers about this company (Minne, editable), and the +// domain knowledge it ships with (Kompetens, read-only). Tabs keep all three +// one click away instead of stacked. +type View = 'knowledge' | 'memory' | 'skills' const VIEW_ROUTE: Record = { - memory: '/settings/assistant', + knowledge: '/settings/assistant', + memory: '/settings/assistant?view=memory', skills: '/settings/assistant?view=skills', - knowledge: '/settings/assistant?view=knowledge', } export function AssistantSettingsContent() { const searchParams = useSearchParams() const router = useRouter() const raw = searchParams.get('view') - const view: View = raw === 'skills' ? 'skills' : raw === 'knowledge' ? 'knowledge' : 'memory' + const view: View = raw === 'skills' ? 'skills' : raw === 'memory' ? 'memory' : 'knowledge' function setView(next: string) { - // 'memory' is the default: keep its URL clean (no query string). - router.replace(VIEW_ROUTE[next as View] ?? VIEW_ROUTE.memory, { scroll: false }) + // 'knowledge' is the default: keep its URL clean (no query string). + router.replace(VIEW_ROUTE[next as View] ?? VIEW_ROUTE.knowledge, { scroll: false }) } return ( + Kunskap Minne Kompetens - Kunskap {/* Radix unmounts the inactive panel, so each panel's data is fetched lazily the first time its tab is opened. */} + + + - - - ) } diff --git a/messages/en.json b/messages/en.json index 38b2e712..0ec653e9 100644 --- a/messages/en.json +++ b/messages/en.json @@ -192,8 +192,6 @@ "source_user_taught": "You taught me", "source_agent_learned": "I noted", "source_derived": "Derived", - "tab_competence": "Competence", - "tab_memory": "Memory", "tab_config": "Rules & profile", "footer_basis": "Based on {entries} posted vouchers · updated {date}", "cp_title": "Booking patterns by counterparty", diff --git a/messages/sv.json b/messages/sv.json index b472068b..3f9156db 100644 --- a/messages/sv.json +++ b/messages/sv.json @@ -192,8 +192,6 @@ "source_user_taught": "Du lärde mig", "source_agent_learned": "Jag noterade", "source_derived": "Härlett", - "tab_competence": "Kompetens", - "tab_memory": "Minne", "tab_config": "Regler & profil", "footer_basis": "Baserat på {entries} bokförda verifikat · uppdaterad {date}", "cp_title": "Konteringsmönster per motpart",