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:
@@ -7,9 +7,19 @@ export { type ToolCallResult }
|
||||
|
||||
export interface ActivityEntry {
|
||||
id: string
|
||||
type: 'goal' | 'plan' | 'step_running' | 'step_done' | 'step_failed' |
|
||||
'tool_running' | 'tool_done' | 'tool_error' |
|
||||
'knowledge' | 'complete' | 'question' | 'error'
|
||||
type:
|
||||
| 'goal'
|
||||
| 'plan'
|
||||
| 'step_running'
|
||||
| 'step_done'
|
||||
| 'step_failed'
|
||||
| 'tool_running'
|
||||
| 'tool_done'
|
||||
| 'tool_error'
|
||||
| 'knowledge'
|
||||
| 'complete'
|
||||
| 'question'
|
||||
| 'error'
|
||||
description: string
|
||||
detail?: string
|
||||
args?: string
|
||||
@@ -43,13 +53,23 @@ function stringifyResult(result: unknown): string {
|
||||
// Pure derivation, parameterized so it can back both the global "current
|
||||
// session" activityLog below and a per-session activityLogFor(sessionId) for
|
||||
// a floating task window.
|
||||
function computeActivityLog($msgs: ChatMessage[], $steps: PlanStep[], $task: Session | null): ActivityEntry[] {
|
||||
function computeActivityLog(
|
||||
$msgs: ChatMessage[],
|
||||
$steps: PlanStep[],
|
||||
$task: Session | null
|
||||
): ActivityEntry[] {
|
||||
const entries: ActivityEntry[] = []
|
||||
const now = Date.now()
|
||||
|
||||
// Goal
|
||||
if ($task?.goal) {
|
||||
entries.push({ id: 'goal', type: 'goal', description: $task.goal, timestamp: 0, status: 'done' })
|
||||
entries.push({
|
||||
id: 'goal',
|
||||
type: 'goal',
|
||||
description: $task.goal,
|
||||
timestamp: 0,
|
||||
status: 'done'
|
||||
})
|
||||
}
|
||||
|
||||
// Plan steps
|
||||
@@ -58,7 +78,8 @@ function computeActivityLog($msgs: ChatMessage[], $steps: PlanStep[], $task: Ses
|
||||
const stepLabel = s.title || `Step ${s.seq}`
|
||||
entries.push({
|
||||
id: s.id,
|
||||
type: s.status === 'running' ? 'step_running' : s.status === 'done' ? 'step_done' : 'step_failed',
|
||||
type:
|
||||
s.status === 'running' ? 'step_running' : s.status === 'done' ? 'step_done' : 'step_failed',
|
||||
description: `Step ${s.seq}: ${stepLabel}`,
|
||||
detail: s.detail || undefined,
|
||||
timestamp: s.started_at ? new Date(s.started_at).getTime() : now,
|
||||
@@ -96,8 +117,8 @@ function computeActivityLog($msgs: ChatMessage[], $steps: PlanStep[], $task: Ses
|
||||
status: 'running'
|
||||
})
|
||||
} else if (t.type === 'tool_result') {
|
||||
const running = entries.find((e) =>
|
||||
e.type === 'tool_running' && e.id === t.id && e.status === 'running'
|
||||
const running = entries.find(
|
||||
(e) => e.type === 'tool_running' && e.id === t.id && e.status === 'running'
|
||||
)
|
||||
if (running && t.error) {
|
||||
running.type = 'tool_error'
|
||||
@@ -182,7 +203,9 @@ export function activityLogFor(sessionId: string): Readable<ActivityEntry[]> {
|
||||
const chat = chatFor(sessionId)
|
||||
const ws = workspaceFor(sessionId)
|
||||
const task = taskFor(sessionId)
|
||||
return derived([chat.messages, ws.planSteps, task], ([$msgs, $steps, $task]) => computeActivityLog($msgs, $steps, $task))
|
||||
return derived([chat.messages, ws.planSteps, task], ([$msgs, $steps, $task]) =>
|
||||
computeActivityLog($msgs, $steps, $task)
|
||||
)
|
||||
}
|
||||
|
||||
// Humanized, past/present-tense description of what a tool call is doing
|
||||
@@ -190,18 +213,28 @@ export function activityLogFor(sessionId: string): Readable<ActivityEntry[]> {
|
||||
// so the chat's agent trace can read as a thinking log instead of an API log.
|
||||
export function toolActivityLabel(t: ToolCallResult): string {
|
||||
const args = t.args ?? {}
|
||||
const str = (v: unknown): string => typeof v === 'string' ? v : ''
|
||||
const str = (v: unknown): string => (typeof v === 'string' ? v : '')
|
||||
switch (t.name) {
|
||||
case 'set_goal': return 'Set goal'
|
||||
case 'propose_plan': return 'Proposed plan'
|
||||
case 'search_knowledge': return `Research: ${str(args.query)}`
|
||||
case 'get_entity': return `Lookup: ${str(args.slug_or_id)}`
|
||||
case 'get_entity_knowledge': return 'Check prior knowledge'
|
||||
case 'get_relations': return 'Check relationships'
|
||||
case 'list_lxcs': return 'List containers'
|
||||
case 'list_entities': return 'List entities'
|
||||
case 'get_health_summary': return 'Fleet health'
|
||||
case 'get_state_snapshot': return 'State snapshot'
|
||||
case 'set_goal':
|
||||
return 'Set goal'
|
||||
case 'propose_plan':
|
||||
return 'Proposed plan'
|
||||
case 'search_knowledge':
|
||||
return `Research: ${str(args.query)}`
|
||||
case 'get_entity':
|
||||
return `Lookup: ${str(args.slug_or_id)}`
|
||||
case 'get_entity_knowledge':
|
||||
return 'Check prior knowledge'
|
||||
case 'get_relations':
|
||||
return 'Check relationships'
|
||||
case 'list_lxcs':
|
||||
return 'List containers'
|
||||
case 'list_entities':
|
||||
return 'List entities'
|
||||
case 'get_health_summary':
|
||||
return 'Fleet health'
|
||||
case 'get_state_snapshot':
|
||||
return 'State snapshot'
|
||||
case 'run': {
|
||||
const purpose = str(args.purpose)
|
||||
const target = str(args.target)
|
||||
@@ -209,14 +242,21 @@ export function toolActivityLabel(t: ToolCallResult): string {
|
||||
if (target) return `Run on ${target}`
|
||||
return 'Run command'
|
||||
}
|
||||
case 'get_execution_status': return 'Check execution'
|
||||
case 'update_plan_step': return 'Update plan'
|
||||
case 'upsert_knowledge': return 'Record knowledge'
|
||||
case 'complete_task': return 'Complete task'
|
||||
case 'ping_service': return 'Check service'
|
||||
case 'ask_operator': return 'Ask operator'
|
||||
case 'get_execution_status':
|
||||
return 'Check execution'
|
||||
case 'update_plan_step':
|
||||
return 'Update plan'
|
||||
case 'upsert_knowledge':
|
||||
return 'Record knowledge'
|
||||
case 'complete_task':
|
||||
return 'Complete task'
|
||||
case 'ping_service':
|
||||
return 'Check service'
|
||||
case 'ask_operator':
|
||||
return 'Ask operator'
|
||||
// Unmapped tool (new/uncommon) — humanize the raw name rather than
|
||||
// showing it verbatim, e.g. "revoke_execution" -> "Revoke execution".
|
||||
default: return t.name.replace(/_/g, ' ').replace(/^./, (c) => c.toUpperCase())
|
||||
default:
|
||||
return t.name.replace(/_/g, ' ').replace(/^./, (c) => c.toUpperCase())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user