refactor(web): delete dead code (R2) — 1736 lines removed

Tool-renderer registry (21 files, ~1.5k lines):
- src/lib/tool-renderers.ts — registry + getToolRenderer (exported, never
  imported anywhere)
- src/lib/renderers/index.ts + 10 .ts registrars + 10 .svelte components
- main.ts: removed the requestAnimationFrame(() => import('./lib/renderers'))
  that was the only thing keeping the dead subsystem alive

Dead components (never imported):
- ToolCallGroup, PlanProgress, GoalHeader, InlineApproval, SessionDigest

Dead store exports (written, never read):
- context.ts: pendingApprovals writable (+ Approval type import)
- events.ts: connectionState writable (+ its .set() calls)

Dead API surface:
- api.ts: SessionDigest interface + fetchSessionDigest (only caller was the
  dead SessionDigest.svelte)

Dead npm deps:
- mode-watcher (0 imports; superseded by stores/theme.svelte.ts)
- @internationalized/date (0 imports)

Also: fix stale comments referencing deleted symbols, update plan R1/R2
status. Build clean (4683 modules, down from 4706; one Svelte 5 warning
gone — the dead HealthSummary.svelte was emitting state_referenced_locally).
This commit is contained in:
2026-07-17 22:10:27 +02:00
parent c3973e7ac9
commit 0a3654b08f
35 changed files with 8 additions and 1736 deletions

View File

@@ -161,7 +161,7 @@ export const activityLog = derived([messages, planSteps, currentTask], ([$msgs,
// which caused the AgentIndicator to latch onto a stale "Approval: ..."
// entry and never clear — even after the session completed. Approvals
// are tracked via the REST /approvals endpoint (context.ts, Ops.svelte)
// and rendered as InlineApproval cards in the chat (or Ops page), not
// and rendered as inline approval cards in the chat (or Ops page), not
// in the activity log.
// Sort oldest first

View File

@@ -1,5 +1,5 @@
import { writable, get } from 'svelte/store'
import { fetchDashboardSummary, fetchApprovals, type DashboardSummary, type Approval } from '$lib/api'
import { fetchDashboardSummary, fetchApprovals, type DashboardSummary } from '$lib/api'
import { liveEvents, subscribeEvents, type OikosEvent } from './events'
// Shared operational context: dashboard summary + pending approvals,
@@ -7,7 +7,6 @@ import { liveEvents, subscribeEvents, type OikosEvent } from './events'
// so the poll only runs while something on screen displays it.
export const summary = writable<DashboardSummary | null>(null)
export const pendingApprovals = writable<Approval[]>([])
let refs = 0
let pollTimer: ReturnType<typeof setInterval> | null = null
@@ -16,9 +15,8 @@ let unsubscribeStore: (() => void) | null = null
let lastSeenEventId = 0
export async function refreshContext() {
const [s, approvals] = await Promise.all([fetchDashboardSummary(), fetchApprovals('pending')])
const [s] = await Promise.all([fetchDashboardSummary(), fetchApprovals('pending')])
if (s) summary.set(s)
pendingApprovals.set(approvals)
}
function onEvent(ev: OikosEvent) {

View File

@@ -15,20 +15,16 @@ export interface OikosEvent {
const MAX_BUFFERED = 200
export const liveEvents = writable<OikosEvent[]>([])
export const connectionState = writable<'connecting' | 'open' | 'closed'>('connecting')
let source: EventSource | null = null
let subscriberCount = 0
async function connect() {
if (source) return
connectionState.set('connecting')
// The browser's EventSource sends Last-event-ID automatically on reconnect.
// sseUrl is async so the OIDC access token is refreshed if expired.
source = new EventSource(await sseUrl('/api/v1/events/stream'))
source.onopen = () => connectionState.set('open')
source.onmessage = (ev) => {
try {
const parsed: OikosEvent = JSON.parse(ev.data)
@@ -39,7 +35,7 @@ async function connect() {
}
source.onerror = () => {
connectionState.set('closed')
// browser will auto-reconnect; nothing to surface here
}
}

View File

@@ -83,7 +83,7 @@ function applyEvent(ev: { type: string; correlation_id?: string | null; data?: u
const data = (ev.data ?? {}) as any
// Task fields (status/goal/outcome) live on the session row — refetch the
// (cheap) session list so GoalHeader picks up the change without a
// (cheap) session list so the UI picks up the change without a
// dedicated endpoint. Every event that can change agent_sessions.status
// (goal.set → planning, propose_plan → executing, ask_operator →
// awaiting_input, answerQuestion → executing, complete_task → done/failed)
@@ -138,8 +138,7 @@ function applyEvent(ev: { type: string; correlation_id?: string | null; data?: u
}
break
case 'knowledge.recorded':
// No dedicated store yet — the outcome/knowledge card reads this task's
// digest (fetchSessionDigest) on completion, which already lists it.
// No dedicated store knowledge cards refetch on completion signal.
break
}
}