style(web): fix prettier config, format entire web/ tree
.prettierrc.json was missing "semi": false, so prettier wanted to add semicolons to a codebase written without them (763 semicolon-free statements vs. 150 with, in hand-written .ts; zero hand-written .svelte files use them at all). That's why prettier --check failed on 249 files — not because the code was unformatted, but because the config didn't match the actual house style. Added "semi": false; left printWidth/etc as configured (printWidth barely moves the failure count: 218/213/212 files at 100/120/140). Ran `prettier --write .` with the corrected config. Verified semantics-preserving before and after: - eslint: 142 problems both before and after, byte-identical - build passes, 38/38 tests pass - token-stream diff (whitespace/semicolons/quotes normalized) on all 218 changed files: only 52 had any remaining token change, all either trailing-comma removal (matching trailingComma: "none") or import/ ternary reflow — no semantic changes - live smoke test: Knowledge, Tasks, Fleet map, and a chat window (AgentTrace, markdown, Scope graph, activity rail) all render correctly, no console errors Most of the diff is shadcn/ui vendor files (lib/components/ui/) moving from the CLI's own style (double quotes, tabs, semicolons) to house style; re-running `shadcn-svelte add` on a component will need a follow-up format pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,13 @@
|
||||
import { writable, derived, get, type Writable, type Readable } from 'svelte/store'
|
||||
import { liveEvents, subscribeEvents } from './events'
|
||||
import { currentSession, sessions, loadSessions } from './chat'
|
||||
import { fetchPlan, fetchQuestions, type PlanStep, type SessionQuestion, type Session } from '$lib/api'
|
||||
import {
|
||||
fetchPlan,
|
||||
fetchQuestions,
|
||||
type PlanStep,
|
||||
type SessionQuestion,
|
||||
type Session
|
||||
} from '$lib/api'
|
||||
import type {
|
||||
PlanProposedData,
|
||||
PlanStepEventData,
|
||||
@@ -67,13 +73,18 @@ export const healthDiffs = globalWorkspace.healthDiffs
|
||||
// The task's own fields (goal/status/outcome/summary) live on the session row.
|
||||
// Rather than a dedicated endpoint, derive from the sessions list (already
|
||||
// fetched for the task board) and keep it fresh here on task-lifecycle events.
|
||||
export const currentTask = derived([sessions, currentSession], ([$sessions, $id]) =>
|
||||
$sessions.find((s) => s.id === $id) ?? null
|
||||
export const currentTask = derived(
|
||||
[sessions, currentSession],
|
||||
([$sessions, $id]) => $sessions.find((s) => s.id === $id) ?? null
|
||||
)
|
||||
|
||||
// Events that can change agent_sessions.status/goal/outcome — see applyEventTo.
|
||||
const STATUS_AFFECTING = new Set([
|
||||
'goal.set', 'task.status', 'plan.proposed', 'question.raised', 'question.answered'
|
||||
'goal.set',
|
||||
'task.status',
|
||||
'plan.proposed',
|
||||
'question.raised',
|
||||
'question.answered'
|
||||
])
|
||||
|
||||
let refreshTimer: ReturnType<typeof setTimeout> | null = null
|
||||
@@ -89,7 +100,11 @@ function applyPlanStepEventTo(ws: WorkspaceState, data: PlanStepEventData) {
|
||||
const i = steps.findIndex((s) => (stepID && s.id === stepID) || (seq != null && s.seq === seq))
|
||||
if (i === -1) return steps
|
||||
const next = [...steps]
|
||||
next[i] = { ...next[i], status: data.status ?? next[i].status, execution_id: data.execution_id ?? next[i].execution_id }
|
||||
next[i] = {
|
||||
...next[i],
|
||||
status: data.status ?? next[i].status,
|
||||
execution_id: data.execution_id ?? next[i].execution_id
|
||||
}
|
||||
return next
|
||||
})
|
||||
}
|
||||
@@ -97,7 +112,11 @@ function applyPlanStepEventTo(ws: WorkspaceState, data: PlanStepEventData) {
|
||||
// Applies a live event to `ws` if it belongs to session `sid` — shared by the
|
||||
// global "current session" watcher and every per-session floating-window
|
||||
// watcher, each passing its own target state and session id.
|
||||
function applyEventTo(ws: WorkspaceState, sid: string, ev: { type: string; correlation_id?: string | null; data?: unknown }) {
|
||||
function applyEventTo(
|
||||
ws: WorkspaceState,
|
||||
sid: string,
|
||||
ev: { type: string; correlation_id?: string | null; data?: unknown }
|
||||
) {
|
||||
if (ev.correlation_id !== sid) return
|
||||
const data = (ev.data ?? {}) as Record<string, unknown>
|
||||
|
||||
@@ -120,8 +139,12 @@ function applyEventTo(ws: WorkspaceState, sid: string, ev: { type: string; corre
|
||||
const d = data as unknown as PlanProposedData
|
||||
if (Array.isArray(d.steps)) {
|
||||
const incoming = d.steps.map((s) => ({
|
||||
id: s.id, seq: s.seq, title: s.title, detail: s.detail ?? '',
|
||||
status: 'pending' as const, target_slug: s.target_slug || undefined
|
||||
id: s.id,
|
||||
seq: s.seq,
|
||||
title: s.title,
|
||||
detail: s.detail ?? '',
|
||||
status: 'pending' as const,
|
||||
target_slug: s.target_slug || undefined
|
||||
}))
|
||||
ws.planSteps.update((existing) => (d.appended ? [...existing, ...incoming] : incoming))
|
||||
}
|
||||
@@ -135,9 +158,11 @@ function applyEventTo(ws: WorkspaceState, sid: string, ev: { type: string; corre
|
||||
const d = data as unknown as QuestionRaisedData
|
||||
ws.questions.update((qs) => [
|
||||
{
|
||||
id: d.question_id, prompt: d.prompt ?? '',
|
||||
id: d.question_id,
|
||||
prompt: d.prompt ?? '',
|
||||
context: { why: d.why, options: d.options, entities: d.entities },
|
||||
status: 'open', created_at: new Date().toISOString()
|
||||
status: 'open',
|
||||
created_at: new Date().toISOString()
|
||||
},
|
||||
...qs.filter((q) => q.id !== d.question_id)
|
||||
])
|
||||
@@ -154,7 +179,9 @@ function applyEventTo(ws: WorkspaceState, sid: string, ev: { type: string; corre
|
||||
const d = data as unknown as EntityTouchedData
|
||||
if (d.slug) {
|
||||
const now = Date.now()
|
||||
ws.touched.update((t) => [{ slug: d.slug, tool: d.tool ?? '', ts: now }, ...t].slice(0, TOUCHED_MAX))
|
||||
ws.touched.update((t) =>
|
||||
[{ slug: d.slug, tool: d.tool ?? '', ts: now }, ...t].slice(0, TOUCHED_MAX)
|
||||
)
|
||||
}
|
||||
break
|
||||
}
|
||||
@@ -172,7 +199,12 @@ function applyHealthChangedTo(ws: WorkspaceState, ev: { type: string; data?: unk
|
||||
if (!data.slug) return
|
||||
const isRelevant = get(ws.touched).some((t) => t.slug === data.slug)
|
||||
if (!isRelevant) return
|
||||
ws.healthDiffs.update((d) => [{ slug: data.slug, from: data.from ?? '', to: data.to ?? '', ts: Date.now() }, ...d].slice(0, 8))
|
||||
ws.healthDiffs.update((d) =>
|
||||
[{ slug: data.slug, from: data.from ?? '', to: data.to ?? '', ts: Date.now() }, ...d].slice(
|
||||
0,
|
||||
8
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
let hydratedFor: string | null = null
|
||||
|
||||
Reference in New Issue
Block a user