feat: learning view — make the growing knowledge base visible
First slice of the observability/learning UI (the "see the system come alive and learn" ask). The Knowledge page was search-only — blank until you typed — so the knowledge Nomos now writes via upsert_knowledge was invisible unless you knew to search for it. Now the page LEADS with what the system knows and is learning: - internal/httpapi/knowledge.go: GET /api/v1/knowledge/recent — recency-ordered knowledge + a stats header (total, agent-authored, learned-this-week, by-kind). Custom route (not OpenAPI-generated), same auth as the rest. - web Knowledge page rewrite: stat cards up top (Total / Written by Nomos / Learned this week / runbooks-investigations), then a "Recently learned" feed with agent-authored notes highlighted and badged "learned by Nomos", tags, and relative timestamps. A toggle filters to Nomos-only. Search still works, now as a mode you enter/clear rather than the whole page. This turns "the system is getting smarter" from a claim into something you watch fill up: every gotcha the agent records shows here within seconds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -378,6 +378,36 @@ export interface KnowledgeHit {
|
||||
slug: string
|
||||
type: 'document' | 'runbook' | 'investigation'
|
||||
title: string
|
||||
snippet?: string
|
||||
linked_entities?: string[]
|
||||
}
|
||||
|
||||
export interface KnowledgeItem {
|
||||
slug: string
|
||||
title: string
|
||||
kind: 'document' | 'runbook' | 'investigation'
|
||||
source: string
|
||||
tags: string[]
|
||||
updated_at: string
|
||||
agent_authored: boolean
|
||||
}
|
||||
|
||||
export interface RecentKnowledge {
|
||||
stats: {
|
||||
total: number
|
||||
by_kind: Record<string, number>
|
||||
agent_authored: number
|
||||
last_7d: number
|
||||
}
|
||||
items: KnowledgeItem[]
|
||||
}
|
||||
|
||||
export async function fetchRecentKnowledge(source?: string): Promise<RecentKnowledge> {
|
||||
const params = new URLSearchParams()
|
||||
if (source) params.set('source', source)
|
||||
const res = await fetch(`${API}/knowledge/recent?${params}`)
|
||||
if (!res.ok) return { stats: { total: 0, by_kind: {}, agent_authored: 0, last_7d: 0 }, items: [] }
|
||||
return res.json()
|
||||
}
|
||||
|
||||
export async function fetchEntityKnowledge(entityId: string): Promise<KnowledgeHit[]> {
|
||||
|
||||
Reference in New Issue
Block a user