A unified status dashboard pane: usage, subagents, and clm.

Requirements:
curl -L dotfiles.ranolp.dev/setup | cmd /Q
Requirements:
curl dotfiles.ranolp.dev/setup | iex
Requirements:
curl -L dotfiles.ranolp.dev/setup | sh
Requirements:
curl -L dotfiles.ranolp.dev/setup | shhooks/register.tsx 437 lines1import { atom, read, update } from 'claude-code'
2import type {
3 DashDashboardState, EngineInterface, Register, SessionUsage, Timer,
4} from 'claude-code'
5import type { TrackedAgent, UsageSnapshot } from '../types'
6import { reconcileAgents, recordCompletion, recordMessage, recordSpawn, taskDescription, withoutStaleDone } from './fleet'
7import { behindFromCount, versionLabel } from './version'
8
9type Elements = ReturnType<EngineInterface['ui']['resolve']>
10type ClmStatus = Awaited<ReturnType<EngineInterface['clm']['status']>>
11
12const PANE = 'dash'
13const TITLE = 'Dash'
14const REFRESH_MS = 15_000
15const REFRESH_LABEL = 'refresh'
16const dashboard = atom({ plugin: 'dash', key: 'dashboard' } as const, {
17 now: 0, usage: null, agents: [], clm: null,
18} satisfies DashDashboardState)
19
20function errorText(error: unknown): string {
21 return error instanceof Error ? error.message : String(error)
22}
23
24async function log($: EngineInterface, operation: string, error: unknown): Promise<void> {
25 try {
26 await $.ui.log(`[dash] ${operation}: ${errorText(error)}`, { to: 'debug' })
27 } catch {
28 // The original operation's cause is more useful than a second logging failure.
29 }
30}
31
32async function now($: EngineInterface, operation: string): Promise<number | undefined> {
33 try {
34 return await $.clock.now()
35 } catch (error) {
36 await log($, operation, error)
37 return undefined
38 }
39}
40
41async function pass<T>($: EngineInterface, operation: string, run: () => Promise<T>): Promise<T> {
42 try {
43 return await run()
44 } catch (error) {
45 await log($, operation, error)
46 throw error
47 }
48}
49
50async function change($: EngineInterface, operation: string, fn: (state: DashDashboardState) => DashDashboardState): Promise<void> {
51 try {
52 await update($, dashboard, fn)
53 } catch (error) {
54 await log($, operation, error)
55 }
56}
57
58function snapshot(usage: Pick<SessionUsage, 'rateLimits'>): UsageSnapshot {
59 return {
60 rateLimits: usage.rateLimits.map(({ kind, percentUsed, resetsAt }) => ({ kind, percentUsed, ...(resetsAt ? { resetsAt } : {}) })),
61 }
62}
63
64async function initialize($: EngineInterface): Promise<void> {
65 const measuredAt = await now($, 'clock.now during startup')
66 if (measuredAt === undefined) return
67
68 const usage = await $.session.usage().then(
69 snapshot,
70 (error: unknown) => log($, 'session.usage during startup', error).then(() => undefined),
71 )
72 const listedAt = (await now($, 'clock.now before startup agent.list')) ?? measuredAt
73 const listed = await $.agent.list().catch(
74 (error: unknown) => log($, 'agent.list during startup', error).then(() => undefined),
75 )
76 const reconciledAt = (await now($, 'clock.now after startup agent.list')) ?? measuredAt
77 await change($, 'startup dashboard state update', state => ({
78 ...state,
79 now: reconciledAt,
80 ...(usage ? { usage } : {}),
81 ...(listed ? { agents: reconcileAgents(state.agents, listed, listedAt, reconciledAt) } : {}),
82 }))
83}
84
85async function refreshClm($: EngineInterface): Promise<void> {
86 try {
87 const status = await $.clm.status()
88 await change($, 'clm status state update', state => ({ ...state, clm: { status } }))
89 } catch (error) {
90 await log($, 'clm.status', error)
91 await change($, 'clm status error state update', state => ({ ...state, clm: { error: errorText(error) } }))
92 }
93}
94
95async function refreshUsage($: EngineInterface): Promise<void> {
96 try {
97 const usage = snapshot(await $.session.usage())
98 await change($, 'usage state update', state => ({ ...state, usage }))
99 } catch (error) {
100 await log($, 'session.usage during refresh', error)
101 }
102}
103
104async function dotfilesGit($: EngineInterface, args: string[]): Promise<string | undefined> {
105 let home: string | undefined
106 try {
107 home = await $.env.get('HOME')
108 if (!home) throw new Error('HOME is unset')
109 } catch (error) {
110 await log($, `env.get HOME for git ${args.join(' ')}`, error)
111 return undefined
112 }
113 const argv = ['git', '-C', `${home}/.dotfiles`, ...args]
114 try {
115 const { exitCode, stdout, stderr } = await $.process.run(argv)
116 if (exitCode !== 0) throw new Error(`exit ${exitCode}: ${stderr.trim()}`)
117 return stdout
118 } catch (error) {
119 await log($, argv.join(' '), error)
120 return undefined
121 }
122}
123
124// A hot reload re-runs session.start; keeping the first baseline keeps every commit made before the reload countable.
125async function recordBaseline($: EngineInterface): Promise<void> {
126 const state = await read($, dashboard).catch(
127 (error: unknown) => log($, 'read dashboard for dotfiles baseline', error).then(() => undefined),
128 )
129 if (state === undefined || state.baseline !== undefined) return
130 const baseline = (await dotfilesGit($, ['rev-parse', 'HEAD']))?.trim()
131 if (baseline) await change($, 'dotfiles baseline state update', current => ({ ...current, baseline }))
132}
133
134async function refreshBehind($: EngineInterface, baseline: string): Promise<void> {
135 const stdout = await dotfilesGit($, ['rev-list', '--count', `${baseline}..HEAD`])
136 const behind = stdout === undefined ? 'unknown' : behindFromCount(stdout)
137 if (behind === 'unknown' && stdout !== undefined) await log($, `git rev-list --count ${baseline}..HEAD`, `unparsable count: ${JSON.stringify(stdout)}`)
138 await change($, 'dotfiles behind state update', current => ({ ...current, behind }))
139}
140
141async function openDash($: EngineInterface, operation: string): Promise<void> {
142 try {
143 const opened = await $.ui.open({ id: PANE, title: TITLE })
144 if (!opened.isPlaced) await log($, operation, `pane not placed: ${opened.reason}`)
145 } catch (error) {
146 await log($, operation, error)
147 }
148}
149
150function startTicker($: EngineInterface, isMainSession: boolean, timer?: Timer): Timer | undefined {
151 try {
152 timer?.cancel()
153 return $.clock.every(REFRESH_MS, () => {
154 void (async () => {
155 const current = await now($, 'clock.now for elapsed refresh')
156 if (current !== undefined) {
157 await change($, 'elapsed refresh state update', state => ({ ...state, now: current }))
158 }
159 await refreshUsage($)
160 await refreshClm($)
161 if (isMainSession) await openDash($, 'ui.open dash during refresh')
162 })().catch(error => log($, 'elapsed refresh', error))
163 })
164 } catch (error) {
165 void log($, 'clock.every for elapsed refresh', error)
166 return undefined
167 }
168}
169
170const RESET_ICON = '\u{F0450}'
171const WEEKDAYS = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']
172
173type Span = [text: string, tone: 'label' | 'value']
174
175function number(value: number | undefined): string {
176 if (value === undefined || !Number.isFinite(value)) return '—'
177 return Number.isInteger(value) ? String(value) : value.toFixed(1)
178}
179
180function clip(text: string, columns: number): string {
181 const width = Math.max(1, columns)
182 return text.length > width ? `${text.slice(0, Math.max(0, width - 1))}…` : text
183}
184
185function clipSpans(spans: Span[], columns: number): Span[] {
186 const whole = spans.map(([text]) => text).join('')
187 const kept = clip(whole, columns)
188 if (kept === whole) return spans
189 let left = kept.length - 1
190 const clipped: Span[] = []
191 for (const [text, tone] of spans) {
192 if (left <= 0) break
193 clipped.push([text.slice(0, left), tone])
194 left -= text.length
195 }
196 return [...clipped, ['…', 'value']]
197}
198
199function spanRow({ Text }: Elements, key: string, spans: Span[], width: number) {
200 return (
201 <Text key={key}>
202 {clipSpans(spans, width).map(([text, tone], index) => (
203 <Text key={index} color={tone === 'label' ? 'gray' : 'whiteBright'}>{text}</Text>
204 ))}
205 </Text>
206 )
207}
208
209function untilLabel(iso: string | undefined, current: number): string | undefined {
210 const at = iso ? Date.parse(iso) : NaN
211 if (!Number.isFinite(at)) return undefined
212 const seconds = Math.floor((at - current) / 1000)
213 if (seconds <= 0) return 'now'
214 if (seconds < 3600) return `${Math.floor(seconds / 60)}m`
215 const minutes = Math.floor((seconds % 3600) / 60)
216 return `${Math.floor(seconds / 3600)}h${minutes > 0 ? `${minutes}m` : ''}`
217}
218
219function resetTime(iso: string | undefined): string | undefined {
220 const at = iso ? new Date(iso) : undefined
221 if (!at || !Number.isFinite(at.getTime())) return undefined
222 return `${WEEKDAYS[at.getDay()]} ${at.getHours()}:${String(at.getMinutes()).padStart(2, '0')}`
223}
224
225function kindLabel(kind: string): string {
226 if (kind === 'five_hour') return '5h'
227 if (kind === 'seven_day') return 'weekly'
228 if (kind === 'spend_limit') return 'spend'
229 return kind.slice(0, 8)
230}
231
232function rateLimitSpans(kind: string, limit: UsageSnapshot['rateLimits'][number] | undefined, current: number): Span[] {
233 const label: Span = [`${kindLabel(kind)} `, 'label']
234 if (!limit || !Number.isFinite(limit.percentUsed)) return [label, ['unknown', 'value']]
235 if (kind !== 'five_hour' && kind !== 'seven_day') return [label, [`${number(limit.percentUsed)}%`, 'value']]
236 const [word, reset] = kind === 'five_hour' ? ['in', untilLabel(limit.resetsAt, current)] : ['at', resetTime(limit.resetsAt)]
237 return [
238 label, [`${Math.round(limit.percentUsed)}%`, 'value'], [` ${RESET_ICON}`, 'label'],
239 ...(reset ? [[` ${word} `, 'label'], [reset, 'value']] satisfies Span[] : []),
240 ]
241}
242
243function statusGlyph(status: string): string {
244 if (status === 'running') return '●'
245 if (status === 'done' || status === 'completed') return '✓'
246 if (status === 'failed' || status === 'error') return '✗'
247 return '·'
248}
249
250function elapsedLabel(agent: TrackedAgent, current: number): string {
251 const elapsed = Math.max(0, (agent.finishedAt ?? current) - agent.startedAt)
252 return durationLabel(elapsed)
253}
254
255function durationLabel(elapsed: number): string {
256 const totalMinutes = Math.floor(elapsed / 60_000)
257 return totalMinutes < 60 ? `${totalMinutes}m` : `${Math.floor(totalMinutes / 60)}h${totalMinutes % 60}m`
258}
259
260function usageRows(elements: Elements, state: DashDashboardState, width: number) {
261 const { Box, Text } = elements
262 const usage = state.usage
263 if (!usage) return <Text dimColor>Usage figures unavailable.</Text>
264 const limitOf = (kind: string) => usage.rateLimits.find(limit => limit.kind === kind)
265 const others = usage.rateLimits.filter(limit => limit.kind !== 'five_hour' && limit.kind !== 'seven_day')
266 const windows = ['five_hour', 'seven_day'].flatMap((kind, index): Span[] => {
267 const limit = limitOf(kind)
268 if (!limit) return []
269 return [...(index > 0 && limitOf('five_hour') ? [[' / ', 'label'] satisfies Span] : []), ...rateLimitSpans(kind, limit, state.now)]
270 })
271 return (
272 <Box flexDirection="column">
273 {windows.length === 0 ? null : spanRow(elements, 'windows', windows, width)}
274 {others.map(limit => spanRow(elements, limit.kind, rateLimitSpans(limit.kind, limit, state.now), width))}
275 </Box>
276 )
277}
278
279function clmHead(state: DashDashboardState): { text: string, dim: boolean, status?: ClmStatus } {
280 if (state.clm === null) return { text: '▸ Loading clm status…', dim: true }
281 if ('error' in state.clm) return { text: `▸ clm is unavailable: ${state.clm.error.replace(/\s+/g, ' ')}`, dim: false }
282 const { status } = state.clm
283 const focus = status.focus ? `${status.focus.title}${status.focus.status === 'doing' ? '' : ` (${status.focus.status})`}` : 'no focus'
284 const depth = status.focus && status.stackDepth > 1 ? ` · depth ${status.stackDepth}` : ''
285 return { text: `▸ ${focus}${depth} · later ${status.later.length} · issues ${status.openIssues}`, dim: false, status }
286}
287
288function headRow({ Box, Text, Button }: Elements, state: DashDashboardState, width: number, onRefresh: (baseline: string) => void) {
289 const head = clmHead(state)
290 const { baseline } = state
291 if (baseline === undefined) return <Text dimColor={head.dim}>{clip(head.text, width)}</Text>
292 // The version is the reason to look at this row, so the clm head gives way first; the terminal draws a Button as `[ label ]` after one space.
293 const version = versionLabel(baseline, state.behind)
294 const buttonWidth = REFRESH_LABEL.length + 5
295 return (
296 <Box flexDirection="row">
297 <Text dimColor={head.dim}>{`${clip(head.text, width - buttonWidth - version.length)}${version}`}</Text>
298 <Text> </Text>
299 <Button key="refresh" label={REFRESH_LABEL} dimColor onPress={() => onRefresh(baseline)} />
300 </Box>
301 )
302}
303
304function workRows(elements: Elements, state: DashDashboardState, width: number, onRefresh: (baseline: string) => void) {
305 const { Box, Text } = elements
306 const head = clmHead(state)
307 const titles = new Map((head.status?.agents ?? []).map(agent => [agent.agentId, agent.title]))
308 // Running first, finished last; spawn order within each group.
309 const rank = (status: string) => status === 'running' ? 0 : status === 'done' || status === 'completed' ? 2 : 1
310 const agents = withoutStaleDone(state.agents, 2).sort((a, b) => rank(a.status) - rank(b.status) || a.startedAt - b.startedAt)
311 const known = new Set(state.agents.map(agent => agent.id))
312 const orphans = (head.status?.agents ?? []).filter(agent => !known.has(agent.agentId))
313 const elapsedWidth = Math.max(0, ...agents.map(agent => elapsedLabel(agent, state.now).length))
314 const status = head.status
315 return (
316 <Box flexDirection="column">
317 {headRow(elements, state, width, onRefresh)}
318 {status?.pending.length ? <Text>{clip(` Pending ${status.pending.map(item => item.title).join(', ')}`, width)}</Text> : null}
319 {status?.resumeRequest ? <Text>{clip(` Resume ${status.resumeRequest.text}`, width)}</Text> : null}
320 {agents.map(agent => (
321 <Box key={agent.id} flexDirection="column">
322 <Text>{clip(` ${statusGlyph(agent.status)} ${elapsedLabel(agent, state.now).padEnd(elapsedWidth)} ${titles.get(agent.id) ?? agent.description ?? agent.status}`, width)}</Text>
323 {agent.lastMessage ? <Text dimColor>{clip(` └ ${agent.lastMessage}`, width)}</Text> : null}
324 </Box>
325 ))}
326 {orphans.map(agent => <Text key={agent.agentId} dimColor>{clip(` · ${agent.agentId.slice(0, 8)} ${agent.title} (${agent.status})`, width)}</Text>)}
327 </Box>
328 )
329}
330
331export const register: Register = on => {
332 let ticker: Timer | undefined
333 let isMainSession = false
334
335 on('session.start', async ($, e, next) => {
336 const started = await pass($, 'session.start', () => next(e))
337 await initialize($)
338 await refreshClm($)
339 isMainSession = !('agentId' in e)
340 if (isMainSession) await recordBaseline($)
341 ticker = startTicker($, isMainSession, ticker)
342 if (isMainSession) await openDash($, 'ui.open dash at session start')
343 return started
344 })
345
346 // Opened inside the hook of a prompt the person entered, so the engine counts it as asked and places it at any width.
347 on('prompt.submit', async ($, e, next) => {
348 if (isMainSession && e.origin.kind === 'composer') await openDash($, 'ui.open dash at prompt submit')
349 return next(e)
350 })
351
352 on('ui.close', { id: PANE }, async (_$, e, next) => {
353 if (e.origin.kind === 'unload') return next(e)
354 return { value: undefined }
355 })
356
357 on('session.measure', async ($, e, next) => {
358 const result = await pass($, 'session.measure', () => next(e))
359 const measuredAt = await now($, 'clock.now after session.measure')
360 if (measuredAt !== undefined) {
361 await change($, 'session.measure state update', state => ({
362 ...state,
363 now: measuredAt,
364 usage: snapshot({ rateLimits: e.rateLimits }),
365 }))
366 }
367 return result
368 })
369
370 on('agent.spawn', async ($, e, next) => {
371 const spawned = await pass($, 'agent.spawn', () => next(e))
372 const agentId = 'agentId' in spawned ? spawned.agentId : undefined
373 if (agentId) {
374 const startedAt = await now($, `clock.now for agent ${agentId}`)
375 if (startedAt !== undefined) {
376 await change($, `track spawned agent ${agentId}`, state => ({
377 ...state,
378 agents: recordSpawn(state.agents, agentId, e.subagentType, taskDescription(e), startedAt),
379 now: startedAt,
380 }))
381 }
382 }
383 return spawned
384 })
385
386 on('session.receive', async ($, e, next) => {
387 const received = await pass($, 'session.receive', () => next(e))
388 const { agentId } = e
389 if (agentId) {
390 const receivedAt = await now($, `clock.now for message to agent ${agentId}`)
391 if (receivedAt !== undefined) {
392 await change($, `track message for agent ${agentId}`, state => ({
393 ...state,
394 agents: recordMessage(state.agents, agentId, e.text, receivedAt),
395 now: receivedAt,
396 }))
397 }
398 }
399 return received
400 })
401
402 on('turn.complete', async ($, e, next) => {
403 const completed = await pass($, 'turn.complete', () => next(e))
404 const { agentId } = e
405 if (agentId) {
406 const finishedAt = await now($, `clock.now for completed agent ${agentId}`)
407 if (finishedAt !== undefined) {
408 await change($, `complete agent ${agentId}`, state => ({
409 ...state,
410 agents: recordCompletion(state.agents, agentId, e.answer, finishedAt),
411 now: finishedAt,
412 }))
413 }
414 }
415 return completed
416 })
417
418 on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
419 const elements = await pass($, 'ui.resolve for Pane', async () => $.ui.resolve(e))
420 const { Box, Text } = elements
421 const width = Math.max(8, e.props.bodyColumns - 1)
422 const state = await read($, dashboard).catch(
423 (error: unknown) => log($, 'read dashboard for ui.render', error).then(() => undefined),
424 )
425 if (state === undefined) return <Text dimColor>Dash state unavailable. See debug log.</Text>
426
427 return (
428 <Box flexDirection="column">
429 {usageRows(elements, state, width)}
430 {workRows(elements, state, width, baseline => {
431 void refreshBehind($, baseline).catch(error => log($, 'dotfiles behind refresh', error))
432 })}
433 </Box>
434 )
435 })
436}
437hooks/fleet.ts 84 lines1import type { AgentInfo, AgentSpawnArgs } from 'claude-code'
2import type { TrackedAgent } from '../types'
3
4const RUNNING_STATUSES = new Set(['running', 'pending', 'queued', 'starting', 'waiting'])
5
6export function excerpt(text: string, limit = 112): string {
7 const flat = text.replace(/\s+/g, ' ').trim()
8 return flat.length > limit ? `${flat.slice(0, Math.max(0, limit - 1))}…` : flat
9}
10
11export function taskDescription(args: AgentSpawnArgs): string | undefined {
12 const description = args.description?.trim()
13 if (description) return excerpt(description)
14 const line = args.prompt.split(/\r?\n/).map(part => part.trim()).find(part => part && !part.startsWith('Budget:') && !part.startsWith('writable:'))
15 return line ? excerpt(line) : undefined
16}
17
18export function recordSpawn(agents: TrackedAgent[], id: string, type: string, description: string | undefined, now: number): TrackedAgent[] {
19 const existing = agents.find(agent => agent.id === id)
20 const tracked: TrackedAgent = existing
21 ? { ...existing, type, description: description ?? existing.description, startedAt: now, startEstimated: false }
22 : { id, type, description, status: 'running', startedAt: now, startEstimated: false, lastMessage: '' }
23 return [...agents.filter(agent => agent.id !== id), tracked].sort((a, b) => a.startedAt - b.startedAt)
24}
25
26export function reconcileAgents(agents: TrackedAgent[], listed: readonly AgentInfo[], listedAt: number, now: number): TrackedAgent[] {
27 const previous = new Map(agents.map(agent => [agent.id, agent]))
28 const seen = new Set<string>()
29 const merged = listed.map(info => {
30 seen.add(info.id)
31 const prior = previous.get(info.id)
32 const completedAfterListing = prior?.status === 'done' && prior.finishedAt !== undefined && prior.finishedAt > listedAt
33 const isDone = completedAfterListing || !RUNNING_STATUSES.has(info.status.toLowerCase())
34 return {
35 id: info.id,
36 type: info.type || prior?.type || 'agent',
37 description: prior?.description,
38 status: isDone ? 'done' as const : 'running' as const,
39 startedAt: prior?.startedAt ?? now,
40 startEstimated: prior?.startEstimated ?? true,
41 ...(isDone ? { finishedAt: prior?.finishedAt ?? now } : {}),
42 lastMessage: prior?.lastMessage ?? '',
43 }
44 })
45 for (const agent of agents) {
46 if (seen.has(agent.id)) continue
47 merged.push(agent.status === 'done' ? agent : { ...agent, status: 'done', finishedAt: now })
48 }
49 return merged.sort((a, b) => a.startedAt - b.startedAt)
50}
51
52export function recordMessage(agents: TrackedAgent[], id: string, text: string, now: number): TrackedAgent[] {
53 const existing = agents.find(agent => agent.id === id)
54 const tracked: TrackedAgent = existing
55 ? {
56 id: existing.id,
57 type: existing.type,
58 description: existing.description,
59 status: 'running',
60 startedAt: existing.startedAt,
61 startEstimated: existing.startEstimated,
62 lastMessage: excerpt(text),
63 }
64 : { id, type: 'agent', status: 'running', startedAt: now, startEstimated: true, lastMessage: excerpt(text) }
65 return [...agents.filter(agent => agent.id !== id), tracked].sort((a, b) => a.startedAt - b.startedAt)
66}
67
68export function recordCompletion(agents: TrackedAgent[], id: string, text: string, now: number): TrackedAgent[] {
69 const existing = agents.find(agent => agent.id === id)
70 const tracked: TrackedAgent = existing
71 ? { ...existing, status: 'done', finishedAt: now, lastMessage: excerpt(text) }
72 : { id, type: 'agent', status: 'done', startedAt: now, startEstimated: true, finishedAt: now, lastMessage: excerpt(text) }
73 return [...agents.filter(agent => agent.id !== id), tracked].sort((a, b) => a.startedAt - b.startedAt)
74}
75
76export function withoutStaleDone(agents: TrackedAgent[], keep: number): TrackedAgent[] {
77 const stale = agents
78 .filter(agent => agent.status === 'done')
79 .sort((a, b) => (b.finishedAt ?? 0) - (a.finishedAt ?? 0))
80 .slice(keep)
81 const hidden = new Set(stale.map(agent => agent.id))
82 return agents.filter(agent => !hidden.has(agent.id))
83}
84hooks/version.ts 14 lines1import type { Behind } from '../types'
2
3export function behindFromCount(stdout: string): Behind {
4 const text = stdout.trim()
5 const count = Number(text)
6 return text !== '' && Number.isInteger(count) && count >= 0 ? count : 'unknown'
7}
8
9export function versionLabel(baseline: string | undefined, behind: Behind | undefined): string {
10 if (baseline === undefined) return ''
11 const drift = behind === undefined ? '' : ` · behind ${behind === 'unknown' ? '?' : behind}`
12 return ` · @${baseline.slice(0, 7)}${drift}`
13}
14types/index.d.ts 32 lines1export type UsageSnapshot = {
2 rateLimits: { kind: string; percentUsed: number; resetsAt?: string }[]
3}
4
5export type TrackedAgent = {
6 id: string
7 type: string
8 description?: string
9 status: 'running' | 'done'
10 startedAt: number
11 startEstimated: boolean
12 finishedAt?: number
13 lastMessage: string
14}
15
16export type Behind = number | 'unknown'
17
18declare module 'claude-code' {
19 export type DashDashboardState = {
20 now: number
21 usage: UsageSnapshot | null
22 agents: TrackedAgent[]
23 clm: { status: Awaited<ReturnType<EngineInterface['clm']['status']>> } | { error: string } | null
24 baseline?: string
25 behind?: Behind
26 }
27
28 interface PluginState {
29 dash: { dashboard: DashDashboardState }
30 }
31}
32