Documented tree replacement (the history has no git-subtree metadata): 3-way merge of the old subtree (570201a:engine/strata) against upstream 41cf05a06a25dd29103b7b27a2279a3f60c21876 (2026-10-25), merge base = the old pin d9ab8435 (tree-identical to upstream 5b734e42; d9ab8435 is not an ancestor of upstream main). Local patches re-applied by hand where they conflicted (15 files): STRATA_CUDA_STATIC profile, experimental KAR experts and KAR PLE arms, keyless V-only arm (now beside upstream's K8V4 hybrid KV and fused norm+rope). Details, conflict table and left-out files are in docs/upstream.md. Left out (weights, captures, logs, media): new bench/results (2022 files), binary media and app assets (61), docs/work/evidence (24), *.bin / *.gguf data files, and the 7 files the first import already left out. scripts/build-cpu.sh: build the 11 CPU tests upstream registered since the old pin (they ran as "Not Run"). Checked: build-cpu.sh 16/16 ctest in WSL; sm_86 CUDA objects of the patched files compile, also with the KAR macros on. No GPU run, no quality gate. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
46 lines
3.2 KiB
TypeScript
46 lines
3.2 KiB
TypeScript
import { tr, localeTag } from '../lib/i18n';
|
|
import { Icon } from './ui';
|
|
import { Markdown } from './Markdown';
|
|
import { ErrorNotice } from './ui';
|
|
import type { Task } from '../lib/tasks';
|
|
|
|
const FREQUENCY: Record<string, string> = { hourly: 'Every hour', daily: 'Every day', weekdays: 'Weekdays', weekly: 'Every week' };
|
|
const WEEKDAYS = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
const MODE: Record<string, string> = { plan: 'Look only, change nothing', manual: 'Stop and tell me before changing anything', bypass: 'Bypass permissions' };
|
|
|
|
const when = (iso?: string) => (iso ? new Date(iso).toLocaleString(localeTag(), { dateStyle: 'medium', timeStyle: 'short' }) : '');
|
|
|
|
/** The schedule in one line: "Weekdays · 08:00", "Every week · Friday · 16:00". */
|
|
export function scheduleText(t: Task): string {
|
|
const base = tr(FREQUENCY[t.frequency] ?? t.frequency);
|
|
if (t.frequency === 'hourly') return base;
|
|
return [base, t.frequency === 'weekly' ? tr(WEEKDAYS[t.weekday] ?? '') : '', t.at].filter(Boolean).join(' · ');
|
|
}
|
|
|
|
export type TaskState = 'running' | 'active' | 'paused';
|
|
export const taskState = (t: Task): TaskState => (t.status === 'running' ? 'running' : t.enabled ? 'active' : 'paused');
|
|
|
|
/**
|
|
* An opened task, skimmable: when it runs, what it may do, what it did last, then the instructions and the last answer.
|
|
* The title, the state and the actions (pause or resume, delete, Edit, Run now) are in the header the screen draws.
|
|
*/
|
|
export function TaskDetail({ task }: { task: Task }) {
|
|
const state = taskState(task);
|
|
const result = task.status === 'running' ? { label: 'Running…', tone: '' }
|
|
: task.error ? { label: 'Last run failed', tone: 'is-bad' }
|
|
: task.lastRunAt || task.output ? { label: 'Done', tone: 'is-good' } : { label: 'Not run yet', tone: '' };
|
|
return <div className="task-detail">
|
|
<h2 className="task-name">{task.title}</h2>
|
|
<section className="st-card task-facts" aria-label={tr("Task summary")}>
|
|
<div><span className="label">{tr("Schedule")}</span><strong><Icon name="clock" size={16}/>{scheduleText(task)}</strong>
|
|
<span className="small muted">{tr(state === 'paused' ? 'Paused' : task.nextRunAt ? tr("Next: {0}", [when(task.nextRunAt)]) : 'Calculating the next run…')}</span></div>
|
|
<div><span className="label">{tr("What it may do")}</span><strong><Icon name="shield" size={16}/>{tr(MODE[task.mode ?? 'plan'])}</strong></div>
|
|
<div><span className="label">{tr("Last result")}</span><strong className={result.tone}>{result.tone === 'is-good' ? <Icon name="check" size={16}/> : null}{tr(result.label)}</strong>
|
|
<span className="small muted">{when(task.lastRunAt)}</span></div>
|
|
</section>
|
|
<section className="st-card"><h2 className="label">{tr("What it does")}</h2><p className="task-instructions">{task.prompt}</p></section>
|
|
<section className="st-card"><h2 className="label">{tr("Last answer")}{task.demo ? tr(' · Example') : ''}</h2>
|
|
{task.error ? <ErrorNotice message={task.error} next={tr("Try running this task again.")}/> : task.output ? <div className="task-answer"><Markdown text={task.output}/></div> : <p className="small muted">{tr("Run this task to see its first result here.")}</p>}</section>
|
|
</div>;
|
|
}
|