Files
strata/apps/host/src/components/SubagentRow.tsx
T
Niko1221 0b3299a019 apps/host: the owner's UI and the Node App Host
The UI source from the 14 October handoff (src/, public/, index.html, vite and
tsconfig, tests, audit-fixes, design docs) and the App Host (server/*.mjs): model
import and monitor routes, API-provider catalog and streaming (OpenAI chat, OpenAI Responses,
the Messages API), serving, tunnel, tasks, plus the host routes for Time-skip
(server/timeskip.mjs) and the tuning plan/reports. src/lib/time-skip.ts renders a real
job's own record.

The UI design is unchanged. The rebuild routed #/tuning to a new TunePanel; that is
reverted: src/screens/ModelRun.tsx and src/main.tsx are the handoff's again (#/tuning
goes where the handoff sends it), and src/components/TunePanel.tsx and
src/styles/tuning.css, which only that route used, are not carried over. Left out of
git on purpose: dist/ (build output), node_modules, and docs/evidence + docs/checkpoints
(170 MB of screenshots, kept in StrataSplit\evidence-archive).

From the owner's rebuild branch strata/rebuild-2026-10.
2026-10-15 10:24:09 +02:00

28 lines
1.9 KiB
TypeScript

import { tr } from '../lib/i18n';
import { useRef, useState } from 'react';
import { Btn, Dialog, type IconName } from './ui';
import { compactTokens, elapsed } from '../lib/chat-metrics';
import type { Session } from '../lib/types';
type Agent = NonNullable<Session['agents']>[number];
const states: Record<Agent['status'], {
label: string;
icon: IconName;
}> = {
working: { label: 'In progress', icon: 'clock' }, completed: { label: 'Completed', icon: 'check' },
failed: { label: 'Failed', icon: 'error' }, queued: { label: 'Queued', icon: 'clock' }, cancelled: { label: 'Cancelled', icon: 'x' },
};
export function SubagentRow({ agent: a, now = Date.now() }: {
agent: Agent;
now?: number;
}) {
const [log, setLog] = useState(false);
const observedAt = useRef(Date.now());
const duration = a.durationMs + (a.status === 'working' ? Math.max(0, now - (a.updatedAt ?? observedAt.current)) : 0);
const state = states[a.status] ?? states.queued;
return <div className="subagent-row" data-status={a.status}>
<span className="subagent-row__dot" aria-label={tr(state.label)}/>
<div className="subagent-row__copy"><div className="subagent-row__title"><strong title={a.name}>{a.name}</strong><span className="subagent-row__status">{tr(state.label)}</span></div><p title={a.description}>{a.description}</p>{tr(a.status === 'failed' ? <button className="text-action" onClick={() => setLog(true)}>{tr("View log")}</button> : null)}</div>
<div className="subagent-row__metrics"><span>{tr(compactTokens(a.tokens))}{tr(" tok")}</span><span>{tr(elapsed(duration))}</span></div>
<Dialog open={log} title={tr("{0} \u00B7 log", [a.name])} onClose={() => setLog(false)} actions={<Btn onClick={() => setLog(false)}>{tr("Done")}</Btn>}><p>{a.description}</p><p className="small muted">{tr("Status: ")}{tr(state.label)} · {tr(elapsed(a.durationMs))} · {tr(compactTokens(a.tokens))}{tr(" tokens")}</p></Dialog></div>;
}