style(web): fix prettier config, format entire web/ tree
Some checks failed
ci / build-test (push) Has been cancelled
ci / docker-build (push) Has been cancelled
ci / web (push) Has been cancelled
Desktop App / Build Linux (amd64) (push) Has been cancelled
Desktop App / Attach to Release (push) Has been cancelled

.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:
2026-07-27 12:56:07 +02:00
parent b345783eef
commit 873b00ac42
217 changed files with 4945 additions and 3538 deletions

View File

@@ -1,5 +1,11 @@
import { writable, get, type Writable } from 'svelte/store'
import { streamChat, fetchSessions, fetchMessages, fetchMessagesOrNotFound, deleteSession as apiDeleteSession } from '$lib/api'
import {
streamChat,
fetchSessions,
fetchMessages,
fetchMessagesOrNotFound,
deleteSession as apiDeleteSession
} from '$lib/api'
import type { ChatEvent, Session, Message } from '$lib/api'
import type { ToolCallResult } from '$lib/types'
@@ -46,7 +52,11 @@ function extractApprovals(tools: ToolCallResult[]): PendingApproval[] {
const purpose = typeof args.purpose === 'string' ? args.purpose : undefined
out.push({
executionId: m[1],
action: purpose ? purpose.slice(0, 60) : typeof args.action === 'string' ? args.action : t.name,
action: purpose
? purpose.slice(0, 60)
: typeof args.action === 'string'
? args.action
: t.name,
target: typeof args.target === 'string' ? args.target : 'unknown',
destructive: /\bDESTRUCTIVE\b/.test(text),
command: typeof args.command === 'string' ? args.command : undefined,
@@ -78,7 +88,6 @@ export function addChatError(message: string, action?: string) {
chatErrors.update((e) => [...e, { id: crypto.randomUUID(), message, action }])
}
// Per-session controller tracking. Multiple tasks can stream concurrently
// (see sendMessage's session guard above this used to be a single global
// `activeController`, which meant cancelStream()/newChat() always aborted
@@ -281,9 +290,7 @@ export function sendMessage(text: string) {
messages.update((ms) => {
const last = ms[ms.length - 1]
if (last && last.role === 'assistant') {
const tools = last.tools.map((t) =>
t.id === ev.data.id ? updated : t
)
const tools = last.tools.map((t) => (t.id === ev.data.id ? updated : t))
ms[ms.length - 1] = { ...last, tools, pendingApprovals: extractApprovals(tools) }
}
return [...ms]
@@ -428,7 +435,10 @@ export function reconnect() {
(_ev: ChatEvent) => {},
(_err: string) => {
connectionState.set('disconnected')
addChatError('Reconnect failed. The task may still be running — try sending a message to wake the agent.', 'Dismiss')
addChatError(
'Reconnect failed. The task may still be running — try sending a message to wake the agent.',
'Dismiss'
)
},
() => {
if (get(currentSession) === sid) {
@@ -579,7 +589,13 @@ export function sendSessionMessage(sessionId: string, text: string) {
const userMsg: ChatMessage = { id: mid(), role: 'user', text, tools: [], pendingApprovals: [] }
chat.messages.update((ms) => [...ms, userMsg])
const assistantMsg: ChatMessage = { id: mid(), role: 'assistant', text: '', tools: [], pendingApprovals: [] }
const assistantMsg: ChatMessage = {
id: mid(),
role: 'assistant',
text: '',
tools: [],
pendingApprovals: []
}
chat.messages.update((ms) => [...ms, assistantMsg])
const activeTools: Map<string, ToolCallResult> = new Map()
@@ -591,7 +607,12 @@ export function sendSessionMessage(sessionId: string, text: string) {
(ev: ChatEvent) => {
if (ev.type === 'session') return // sessionId is already known for a window
if (ev.type === 'tool_use') {
const tr: ToolCallResult = { type: 'tool_use', name: ev.data.name, id: ev.data.id, args: ev.data.args }
const tr: ToolCallResult = {
type: 'tool_use',
name: ev.data.name,
id: ev.data.id,
args: ev.data.args
}
activeTools.set(ev.data.id, tr)
chat.messages.update((ms) => {
const last = ms[ms.length - 1]
@@ -603,7 +624,12 @@ export function sendSessionMessage(sessionId: string, text: string) {
} else if (ev.type === 'tool_result') {
const existing = activeTools.get(ev.data.id)
if (existing) {
const updated: ToolCallResult = { ...existing, type: 'tool_result', result: ev.data.result, error: ev.data.error }
const updated: ToolCallResult = {
...existing,
type: 'tool_result',
result: ev.data.result,
error: ev.data.error
}
activeTools.set(ev.data.id, updated)
chat.messages.update((ms) => {
const last = ms[ms.length - 1]
@@ -689,7 +715,13 @@ export function cancelSessionStream(sessionId: string) {
// window behaves exactly like any other task window.
export function startTask(text: string, onSession: (sessionId: string) => void): void {
const userMsg: ChatMessage = { id: mid(), role: 'user', text, tools: [], pendingApprovals: [] }
const assistantMsg: ChatMessage = { id: mid(), role: 'assistant', text: '', tools: [], pendingApprovals: [] }
const assistantMsg: ChatMessage = {
id: mid(),
role: 'assistant',
text: '',
tools: [],
pendingApprovals: []
}
const activeTools: Map<string, ToolCallResult> = new Map()
let receivedDone = false
let sessionId: string | null = null
@@ -700,7 +732,12 @@ export function startTask(text: string, onSession: (sessionId: string) => void):
const c = chat
if (!c || !sessionId) return
if (ev.type === 'tool_use') {
const tr: ToolCallResult = { type: 'tool_use', name: ev.data.name, id: ev.data.id, args: ev.data.args }
const tr: ToolCallResult = {
type: 'tool_use',
name: ev.data.name,
id: ev.data.id,
args: ev.data.args
}
activeTools.set(ev.data.id, tr)
c.messages.update((ms) => {
const last = ms[ms.length - 1]
@@ -712,7 +749,12 @@ export function startTask(text: string, onSession: (sessionId: string) => void):
} else if (ev.type === 'tool_result') {
const existing = activeTools.get(ev.data.id)
if (existing) {
const updated: ToolCallResult = { ...existing, type: 'tool_result', result: ev.data.result, error: ev.data.error }
const updated: ToolCallResult = {
...existing,
type: 'tool_result',
result: ev.data.result,
error: ev.data.error
}
activeTools.set(ev.data.id, updated)
c.messages.update((ms) => {
const last = ms[ms.length - 1]
@@ -792,7 +834,8 @@ export function startTask(text: string, onSession: (sessionId: string) => void):
},
() => {
if (chat) chat.streaming.set(false)
if (sessionId && activeControllers.get(sessionId) === controller) activeControllers.delete(sessionId)
if (sessionId && activeControllers.get(sessionId) === controller)
activeControllers.delete(sessionId)
loadSessions()
}
)