Skip to content

Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.

C++

Round 8: project folder chip above the message box, Time-skip as two agents (plan, lever with its why, A and B progress, Keep A / Keep B), working view reachable while a run has no files yet

Niko1221490fda265743
diff --git a/apps/host/src/components/FolderChip.tsx b/apps/host/src/components/FolderChip.tsx
new file mode 100644
index 000000000..56b121c1d
--- /dev/null
+++ b/apps/host/src/components/FolderChip.tsx
@@ -0,0 +1,28 @@
+import { useState } from 'react';
+import { tr } from '../lib/i18n';
+import { chooseChatFolder, setChatFolder, useChatFolder } from '../lib/chat-folder';
+import { pushToast } from '../lib/store';
+import { plainFailureText } from '../lib/plain-errors';
+import { Icon } from './ui';
+
+/**
+ * The chat's project folder, above the message box on the left: its name (the full path on hover), or "Select a folder". A click opens the
+ * system folder picker; the small x goes back to the default folder. The assistant works inside this folder and nowhere else.
+ */
+export function FolderChip({ chatId, disabled }: { chatId: string | null | undefined; disabled?: boolean }) {
+ const folder = useChatFolder(chatId);
+ const [busy, setBusy] = useState(false);
+ if (!chatId) return null;
+ const run = async (fn: () => Promise<unknown>) => {
+ setBusy(true);
+ try { await fn(); } catch (e) { pushToast('error', tr("The folder was not changed"), plainFailureText(e instanceof Error ? e.message : String(e)).message); }
+ finally { setBusy(false); }
+ };
+ const label = folder ? folder.name : tr("Select a folder");
+ return <div className="folderchip" data-set={folder ? 'true' : undefined} data-missing={folder && !folder.exists ? 'true' : undefined}>
+ <button type="button" className="folderchip__pick" disabled={busy || disabled} title={folder ? folder.path : tr("Choose the folder this chat works in")} aria-label={folder ? tr("Project folder: {0}. Change it.", [folder.name]) : tr("Select a folder")} onClick={() => void run(() => chooseChatFolder(chatId))}>
+ <Icon name="folder" size={15}/><span>{label}</span>
+ </button>
+ {folder ? <button type="button" className="folderchip__x" disabled={busy || disabled} title={tr("Use the default folder")} aria-label={tr("Use the default folder")} onClick={() => void run(() => setChatFolder(chatId, null))}><Icon name="x" size={12}/></button> : null}
+ </div>;
+}
diff --git a/apps/host/src/components/TimeSkipPanel.tsx b/apps/host/src/components/TimeSkipPanel.tsx
index a12d1fbea..385e0971c 100644
--- a/apps/host/src/components/TimeSkipPanel.tsx
+++ b/apps/host/src/components/TimeSkipPanel.tsx
@@ -4,10 +4,12 @@ import type { PreviewArtifact } from '../lib/artifacts';
import { plainTimeSkipError, replayTimeSkip, setTimeSkipResult, stopTimeSkip } from '../lib/store';
import { realTimeSkipDocuments, timeSkipCheckOutcomes, timeSkipDocumentMarkdown, timeSkipDocuments, timeSkipExample, timeSkipResultState, type TimeSkipDocument, type TimeSkipRun, type TimeSkipVersion } from '../lib/time-skip';
import { TimeSkipWorking } from './TimeSkipWorking';
+import { isForkJob } from '../lib/time-skip';
import { FloatingMenu } from './FloatingMenu';
import { TimeSkipCompare } from './TimeSkipCompare';
import { Btn, Dialog, Icon } from './ui';
-function VersionTabs({ version, onChange, done }: {
+function VersionTabs({ version, onChange, done, fork }: {
+ fork?: boolean;
version: TimeSkipVersion;
onChange: (version: TimeSkipVersion) => void;
done: boolean;
@@ -22,7 +24,7 @@ function VersionTabs({ version, onChange, done }: {
const next = event.key === 'Home' ? 0 : event.key === 'End' ? 1 : (i + 1) % 2;
onChange(options[next]);
event.currentTarget.parentElement?.querySelectorAll<HTMLButtonElement>('[role="tab"]')[next]?.focus();
- }}><Icon name={which === 'original' ? 'file' : 'pencil'} size={14}/><span>{tr(which === 'original' ? 'Original' : done ? 'Updated' : 'Update')}</span></button>))}
+ }}><Icon name={which === 'original' ? 'file' : 'pencil'} size={14}/><span>{tr(fork ? (which === 'original' ? 'A' : 'B') : which === 'original' ? 'Original' : done ? 'Updated' : 'Update')}</span></button>))}
</div>;
}
function ImageResult({ document, original, compare }: {
@@ -133,6 +135,7 @@ export function TimeSkipPanel({ run, sessionId, inline, expanded, onCompare, onC
// Snapshot IDs include the run clock, so replaying never reuses an old artifact.
onPreview({ id: `${run.id}-${run.startedAt}-${which}`, kind: 'markdown', title: `${which}-${document.code ? 'counter' : 'launch-plan'}.md`, content: timeSkipDocumentMarkdown(document), demo: true });
}
+ const forkRun = isForkJob(run.job);
function restore(which: TimeSkipVersion) {
setTimeSkipResult(sessionId, run.id, which);
setVersion(which);
@@ -143,12 +146,12 @@ export function TimeSkipPanel({ run, sessionId, inline, expanded, onCompare, onC
const content = <aside ref={panel} className="ts-panel" id="time-skip-content" aria-label={tr("Time-skip")} data-expanded={expanded || undefined}>
<div className="ts-scroll">
<div className="ts-content">
- <div className="ts-heading"><h2 aria-live="polite"><span className="ts-status-icon">{tr(!frame.done ? <span className="ts-activity"/> : <Icon name={kept === 'original' ? 'file' : 'shield'} size={21}/>)}</span><span>{tr(status)}</span></h2></div>
- <p className="ts-caption">{tr(frame.done ? kept === 'original' ? 'The updated result is still available.' : 'The original is always available.' : frame.pass === 2 ? 'Trying one more revision. Your progress is saved.' : 'Improving the saved draft.')}</p>
+ <div className="ts-heading"><h2 aria-live="polite"><span className="ts-status-icon">{tr(!frame.done ? <span className="ts-activity"/> : <Icon name={kept === 'original' ? 'file' : 'shield'} size={21}/>)}</span><span>{tr(forkRun && frame.done && (run.job?.files?.length ?? 0) > 0 ? (run.retainedVersion === 'original' ? 'Version A kept' : run.retainedVersion === 'updated' ? 'Version B kept' : 'Two versions to compare') : status)}</span></h2></div>
+ <p className="ts-caption">{tr(forkRun && frame.done ? 'A and B each went all the way through. Keep the one you like.' : frame.done ? kept === 'original' ? 'The updated result is still available.' : 'The original is always available.' : frame.pass === 2 ? 'Trying one more revision. Your progress is saved.' : 'Improving the saved draft.')}</p>
{tr(workingReal ? <TimeSkipWorking run={run} sessionId={sessionId}/> : compareReal ? <><TimeSkipCompare jobId={run.job!.id} files={run.job!.files!} more={run.job!.moreFiles ?? 0}/></> : realEmpty ? <p className="ts-empty">{tr(frame.done && run.job?.phase && ['failed', 'cancelled', 'interrupted'].includes(run.job.phase) ? 'Nothing was kept from this run. Your files were not changed.' : 'The assistant did not change anything, so there is nothing to compare. Your files were not changed.')}</p> : <>
{tr(expanded ? <div className="ts-compare-heading"><h3>{tr("Compare results")}</h3><Btn size="sm" variant="ghost" icon="contract" onClick={() => onCompare(false)}>{tr(inline ? 'Back to chat' : 'Done comparing')}</Btn></div> : null)}
<div className="ts-switch-row" data-comparing={expanded || undefined}>
- <VersionTabs version={version} onChange={which => { setVersion(which); setImageCompare(false); }} done={frame.done}/>
+ <VersionTabs version={version} onChange={which => { setVersion(which); setImageCompare(false); }} done={frame.done} fork={forkRun}/>
{tr(!expanded ? <button type="button" className="st-btn st-btn--ghost st-btn--sm ts-compare-button" aria-pressed={documents.updated.image ? imageCompare : undefined} disabled={!ready} onClick={() => { if (documents.updated.image) {
setVersion('updated');
setImageCompare(value => !value);
@@ -158,14 +161,18 @@ export function TimeSkipPanel({ run, sessionId, inline, expanded, onCompare, onC
</div>
{tr(expanded ? <div id="ts-result" className="ts-comparison" role={sideBySide ? 'group' : 'tabpanel'} aria-label={tr(sideBySide ? 'Result comparison' : undefined)} aria-labelledby={sideBySide ? undefined : `ts-result-tab-${version}`}>
{tr((['original', 'updated'] as const).map(which => <section key={which} className="ts-comparison-column" data-version={which} data-selected={version === which || undefined}>
- <div className="ts-column-heading"><h4>{tr(which === 'original' ? 'Original' : 'Updated')}</h4><span>{tr(which === kept && frame.done ? <><Icon name="check" size={12}/>{tr("Kept result")}</> : which === 'original' ? 'Saved draft' : ready ? 'Changes highlighted' : 'In progress')}</span></div>
+ <div className="ts-column-heading"><h4>{tr(forkRun ? (which === 'original' ? 'A' : 'B') : which === 'original' ? 'Original' : 'Updated')}</h4><span>{tr(which === kept && frame.done ? <><Icon name="check" size={12}/>{tr("Kept result")}</> : which === 'original' ? 'Saved draft' : ready ? 'Changes highlighted' : 'In progress')}</span></div>
{tr(result(which))}
</section>))}
</div> : <div id="ts-result" role="tabpanel" aria-labelledby={`ts-result-tab-${version}`} className="ts-selected" key={version}>{tr(result(version))}</div>)}
</>)}
{tr(!compareReal && ready && (!real || documents.changes.length > 0) ? <section className="ts-changes"><h3><Icon name="sliders" size={14}/>{tr("What changed")}<span>{tr(documents.changes.length)}{tr(" updates")}</span></h3><ul>{tr(documents.changes.map((change, i) => <li key={change}><Icon name={i === documents.changes.length - 1 ? 'shield' : 'pencil'} size={14}/><span>{tr(change)}</span><Icon name="check" size={11}/></li>))}</ul></section> : null)}
{tr(!real && kept === 'original' && frame.done ? <div className="ts-restored" role="status"><span>{tr("Original restored in this example.")}</span><button onClick={() => restore('updated')}>{tr("Undo")}</button></div> : null)}
- {real && frame.done && (run.job?.files?.length ?? 0) > 0 ? <section className="ts-keep" aria-label={tr('Keep the update')}>
+ {real && forkRun && frame.done && (run.job?.files?.length ?? 0) > 0 ? <section className="ts-keep" aria-label={tr('Keep a version')}>
+ <p>{tr(run.retainedVersion === 'original' ? 'Version A is in your files.' : run.retainedVersion === 'updated' ? 'Version B is in your files.' : 'Your files are unchanged. Choose the version to put in your folder; you can switch later.')}</p>
+ <span className="ts-keep__buttons"><Btn variant="secondary" icon={run.retainedVersion === 'original' ? 'check' : undefined} disabled={run.retainedVersion === 'original'} onClick={() => restore('original')}>{tr('Keep A')}</Btn><Btn variant="secondary" icon={run.retainedVersion === 'updated' ? 'check' : undefined} disabled={run.retainedVersion === 'updated'} onClick={() => restore('updated')}>{tr('Keep B')}</Btn></span>
+ </section> : null}
+ {real && !forkRun && frame.done && (run.job?.files?.length ?? 0) > 0 ? <section className="ts-keep" aria-label={tr('Keep the update')}>
<p>{tr(run.retainedVersion === 'updated' ? 'The update is in your files. You can put the original back.' : 'Your files are unchanged. Keep the update to put it in your folder; you can put the original back later.')}</p>
{run.retainedVersion === 'updated' ? <Btn variant="secondary" icon="refresh" onClick={() => restore('original')}>{tr('Put the original back')}</Btn> : <Btn variant="primary" icon="check" onClick={() => restore('updated')}>{tr('Keep the update')}</Btn>}
</section> : null}
diff --git a/apps/host/src/components/TimeSkipWorking.tsx b/apps/host/src/components/TimeSkipWorking.tsx
index c659f6c74..e45c8ae66 100644
--- a/apps/host/src/components/TimeSkipWorking.tsx
+++ b/apps/host/src/components/TimeSkipWorking.tsx
@@ -1,6 +1,6 @@
import { useEffect, useState } from 'react';
import { tr } from '../lib/i18n';
-import type { TimeSkipRun } from '../lib/time-skip';
+import { isForkJob, type ForkLane, type TimeSkipJob, type TimeSkipRun } from '../lib/time-skip';
import { activityWords, phaseFraction } from '../lib/time-skip-activity';
import { stopTimeSkip } from '../lib/store';
import { Btn } from './ui';
@@ -16,16 +16,56 @@ export function TimeSkipWorking({ run, sessionId }: { run: TimeSkipRun; sessionI
const [stopping, setStopping] = useState(false);
useEffect(() => { const t = setInterval(() => setNow(Date.now()), 1000); return () => clearInterval(t); }, []);
const fraction = phaseFraction(run.job?.phase);
+ const fork = isForkJob(run.job);
return <section className="tsw" aria-label={tr("Time-skip is working")}>
<div className="tsw__stage" aria-hidden="true">
<div className="tsw__ver"><span>A · {tr("Original")}</span><i style={{ width: '92%' }}/><i style={{ width: '100%' }}/><i style={{ width: '78%' }}/><i style={{ width: '96%' }}/></div>
<div className="tsw__flow"><i/><i/><i/></div>
<div className="tsw__ver tsw__ver--b"><span>B · {tr("Revising")}</span><i style={{ width: '70%' }}/><i style={{ width: '88%' }}/><i style={{ width: '55%' }}/></div>
</div>
+ {fork ? <ForkProgress job={run.job!}/> : null}
<div className="tsw__bar">
<div className="tsw__step" role="status"><strong>{activityWords(run.job)}</strong><span className="small muted">{clock(now - run.startedAt)}</span>
- <div className="tsw__prog" role="progressbar" aria-valuemin={0} aria-valuemax={100} aria-valuenow={Math.round(fraction * 100)}><i style={{ width: `${Math.round(fraction * 100)}%` }}/></div></div>
+ {fork ? null : <div className="tsw__prog" role="progressbar" aria-valuemin={0} aria-valuemax={100} aria-valuenow={Math.round(fraction * 100)}><i style={{ width: `${Math.round(fraction * 100)}%` }}/></div>}</div>
<Btn size="sm" icon="stop" disabled={stopping || !run.job?.id} onClick={() => { setStopping(true); void stopTimeSkip(sessionId, run.id).finally(() => setStopping(false)); }}>{tr("Stop")}</Btn>
</div>
</section>;
}
+
+const laneFraction = (l: ForkLane | null | undefined) => (l && l.total > 0 ? Math.min(1, (l.state === 'done' ? l.total : Math.max(0, l.step - 1)) / l.total) : 0);
+
+function Lane({ name, lane, waitingText }: { name: string; lane: ForkLane | null | undefined; waitingText: string }) {
+ const pct = Math.round(laneFraction(lane) * 100);
+ const words = !lane ? waitingText : lane.waiting ? waitingText : lane.line || (lane.text ? tr('Step {0} of {1}: {2}', [lane.step, lane.total, lane.text]) : tr('Starting…'));
+ return <div className="tsf__lane" data-state={lane?.state ?? 'waiting'}>
+ <span className="tsf__name">{name}</span>
+ <div className="tsf__prog" role="progressbar" aria-label={tr('Progress of {0}', [name])} aria-valuemin={0} aria-valuemax={100} aria-valuenow={pct}><i style={{ width: `${pct}%` }}/></div>
+ <span className="tsf__words">{words}</span>
+ </div>;
+}
+
+/**
+ * The fork design (notes-split-agent8.md, item 11): the plan as a list, the one step the assistant chose to check and branch at (with its one-line
+ * why), and the two agents' progress. B starts at that step from A's work so far.
+ */
+export function ForkProgress({ job }: { job: TimeSkipJob }) {
+ const steps = job.plan?.steps ?? [], lever = job.lever;
+ const reachedA = job.a?.step ?? 0;
+ const short = !lever && steps.length > 0 && steps.length < 3;
+ return <div className="tsf">
+ {steps.length ? <ol className="tsf__plan" aria-label={tr("The plan")}>
+ {steps.map((s, i) => {
+ const n = i + 1, state = job.a && job.a.state === 'done' || n < reachedA ? 'done' : n === reachedA ? 'running' : 'pending';
+ return <li key={s.id} data-state={state} data-lever={lever?.step === n || undefined}>
+ <span className="tsf__no" aria-hidden="true">{state === 'done' ? '✓' : n}</span>
+ <span>{s.text}{lever?.step === n ? <small className="tsf__why"><strong>{tr("Checking here matters most")}</strong>{lever.why ? ' · ' + lever.why : ''}{lever.defaulted ? ' · ' + tr('chosen by default') : ''}</small> : null}</span>
+ </li>;
+ })}
+ </ol> : null}
+ {short ? <p className="small muted tsf__note">{tr("This is a short job, so there is one version. Nothing is worth branching.")}</p> : null}
+ <div className="tsf__lanes">
+ <Lane name="A" lane={job.a} waitingText={tr('Waiting to start')}/>
+ {short ? null : <Lane name="B" lane={job.b} waitingText={lever ? tr('Starts when A reaches step {0}', [lever.step]) : tr('Waiting for the plan')}/>}
+ </div>
+ </div>;
+}
diff --git a/apps/host/src/lib/chat-folder.ts b/apps/host/src/lib/chat-folder.ts
new file mode 100644
index 000000000..7b3df605d
--- /dev/null
+++ b/apps/host/src/lib/chat-folder.ts
@@ -0,0 +1,48 @@
+import { useEffect, useSyncExternalStore } from 'react';
+import { api } from './client';
+
+/** A chat's project folder (notes-split-agent8.md, item 4): the assistant works inside it and can only touch files in it. */
+export interface ChatFolder { path: string; name: string; exists: boolean }
+const folders = new Map<string, ChatFolder | null>();
+const listeners = new Set<() => void>();
+const subscribe = (fn: () => void) => { listeners.add(fn); return () => { listeners.delete(fn); }; };
+const emit = () => listeners.forEach(fn => fn());
+
+export function readFolder(raw: unknown): ChatFolder | null {
+ if (!raw || typeof raw !== 'object') return null;
+ const f = raw as Record<string, unknown>;
+ if (typeof f.path !== 'string' || !f.path) return null;
+ return { path: f.path, name: typeof f.name === 'string' && f.name ? f.name : f.path.split(/[\/]/).filter(Boolean).at(-1) ?? f.path, exists: f.exists !== false };
+}
+
+function put(chatId: string, folder: ChatFolder | null) {
+ if (JSON.stringify(folders.get(chatId) ?? null) === JSON.stringify(folder) && folders.has(chatId)) return;
+ folders.set(chatId, folder); emit();
+}
+
+export const folderOf = (chatId: string | null | undefined) => (chatId ? folders.get(chatId) ?? null : null);
+
+export function useChatFolder(chatId: string | null | undefined): ChatFolder | null {
+ const value = useSyncExternalStore(subscribe, () => folderOf(chatId), () => null);
+ useEffect(() => { if (chatId) void loadFolder(chatId); }, [chatId]);
+ return value;
+}
+
+export async function loadFolder(chatId: string) {
+ try { put(chatId, readFolder((await api.get<{ folder: unknown }>(`/api/chat/folder?sessionId=${encodeURIComponent(chatId)}`)).folder)); }
+ catch { /* an older host has no folder route: no chip */ }
+}
+
+/** Ask the system for a folder (null when the person closes the dialog), then make it this chat's. */
+export async function chooseChatFolder(chatId: string): Promise<'chosen' | 'cancelled'> {
+ const picked = await api.post<{ path?: string; cancelled?: boolean }>('/api/workspaces/pick', {});
+ if (!picked.path) return 'cancelled';
+ await setChatFolder(chatId, picked.path);
+ return 'chosen';
+}
+
+/** `null` goes back to the default workspace. The host answers a plain sentence when the folder is not allowed (409 while the chat runs). */
+export async function setChatFolder(chatId: string, path: string | null) {
+ const result = await api.post<{ folder: unknown }>('/api/chat/folder', { sessionId: chatId, path });
+ put(chatId, readFolder(result.folder));
+}
diff --git a/apps/host/src/lib/store.ts b/apps/host/src/lib/store.ts
index 61ff5a01e..8e5bf27bf 100644
--- a/apps/host/src/lib/store.ts
+++ b/apps/host/src/lib/store.ts
@@ -6,7 +6,7 @@ import { applyStatusFrame, clearStatus } from './live-status';
import { applyGoalFrame } from './goal';
import { appendText, mergeDeliverable, readDeliverable, readGroup, upsertGroup } from './deliverables';
import { applyPlanFrame, applyQueueFrame, planApprove, queueMessage } from './plan';
-import { TIME_SKIP_DURATION, timeSkipPrompt, timeSkipTabId, withTimeSkipResult, type TimeSkipFile, type TimeSkipJob, type TimeSkipRun, type TimeSkipVersion } from './time-skip';
+import { forkFields, isForkJob, TIME_SKIP_DURATION, timeSkipPrompt, timeSkipTabId, withTimeSkipResult, type TimeSkipFile, type TimeSkipJob, type TimeSkipRun, type TimeSkipVersion } from './time-skip';
import { PREVIEW_EXAMPLES, type PreviewArtifact } from './artifacts';
import { lifecyclePolicy } from './lifecycle';
import { newestServingState } from './serving-state';
@@ -1180,7 +1180,7 @@ function applyTimeSkipEvent(data: Record<string, unknown>) {
for (const session of state.sessions) {
const run = session.timeSkips?.find(r => r.job?.id === id);
if (!run || run.completedAt) continue;
- patchRun(session.id, run.id, r => ({ ...r, job: { ...r.job!, ...(typeof data.phase === 'string' ? { phase: data.phase as TimeSkipJob['phase'] } : {}), activity: data.activity as TimeSkipJob['activity'] } }));
+ patchRun(session.id, run.id, r => ({ ...r, job: { ...r.job!, ...(typeof data.phase === 'string' ? { phase: data.phase as TimeSkipJob['phase'] } : {}), activity: data.activity as TimeSkipJob['activity'], ...forkFields(data) } }));
}
}
@@ -1188,7 +1188,7 @@ function timeSkipEnding(job: TimeSkipJob, files: TimeSkipFile[]): string {
if (job.phase === 'failed') return tr('Time-skip stopped. {0} Your files were not changed.', [plainTimeSkipError(job.error)]);
if (job.phase === 'cancelled' || job.phase === 'interrupted') return tr('Time-skip was stopped before it finished. Your files were not changed.');
if (!files.length) return tr('The assistant did not change anything, so there is nothing to compare. Your files were not changed.');
- return TS_READY();
+ return isForkJob(job) ? tr('Both versions are ready. Compare A and B, then keep one.') : TS_READY();
}
async function startTimeSkipReal(prompt: string) {
@@ -1243,14 +1243,14 @@ export async function followTimeSkip(sessionId: string, runId: string) {
break;
} catch { await new Promise(r => setTimeout(r, 700 * (tryNo + 1))); }
}
- const finished = job;
+ const finished = { ...job, ...forkFields(job as unknown as Record<string, unknown>) };
patchRun(sessionId, runId, r => ({ ...r, completedAt: Date.now(), job: { ...r.job!, ...finished, ...extra } }), timeSkipEnding(finished, files));
// A run that changed files opens the comparison; one that changed nothing, failed or was stopped has no sidebar tab.
if (files.length > 0 && !['failed', 'cancelled', 'interrupted'].includes(finished.phase)) patchSession(sessionId, s => ({ ...s, previewOpen: timeSkipTabId(runId) }));
markTurn(sessionId, null);
return;
}
- if (job) { const live = job; patchRun(sessionId, runId, r => ({ ...r, job: { ...r.job!, ...live } })); }
+ if (job) { const live = { ...job, ...forkFields(job as unknown as Record<string, unknown>) }; patchRun(sessionId, runId, r => ({ ...r, job: { ...r.job!, ...live } })); }
if (misses >= 6) {
patchRun(sessionId, runId, r => ({ ...r, completedAt: Date.now(), job: { ...r.job!, phase: 'interrupted' } }), tr('Time-skip lost contact with the app and stopped. Your files were not changed.'));
markTurn(sessionId, null);
@@ -1272,9 +1272,10 @@ export async function keepTimeSkip(sessionId: string, runId: string, version: Ti
const run = state.sessions.find(s => s.id === sessionId)?.timeSkips?.find(r => r.id === runId);
const job = run?.job;
if (!run || !job?.id || !job.phase || !TS_TERMINAL.includes(job.phase)) return;
- if ((run.retainedVersion ?? 'original') === version) { patchRun(sessionId, runId, r => ({ ...r, retainedVersion: version })); return; }
+ if ((run.retainedVersion ?? 'original') === version && !(isForkJob(job) && run.retainedVersion === undefined)) { patchRun(sessionId, runId, r => ({ ...r, retainedVersion: version })); return; }
try {
- if (version === 'updated') await api.post('/api/timeskip/apply', { id: job.id, attempt: job.applyAttempt ?? null });
+ if (isForkJob(job)) await api.post('/api/timeskip/apply', { id: job.id, which: version === 'original' ? 'a' : 'b' });
+ else if (version === 'updated') await api.post('/api/timeskip/apply', { id: job.id, attempt: job.applyAttempt ?? null });
else await api.post('/api/timeskip/apply', { id: job.id, restore: true });
patchRun(sessionId, runId, r => ({ ...r, retainedVersion: version }));
pushToast('success', version === 'updated' ? tr('The update is now in your files') : tr('Your original files are back'));
@@ -1518,7 +1519,8 @@ export async function sendMessage(text: string, options: { fromLoop?: boolean; g
if (loopCommand) { await runLoopCommand(loopCommand); return; }
const demoPrompt = resume || planStart ? null : timeSkipPrompt(text.trim());
if (demoPrompt !== null) {
- if (demoPrompt && (state.remoteModel || nativeState()?.instances.some(i => i.status === 'ready'))) void startTimeSkipReal(demoPrompt); else startTimeSkipDemo(demoPrompt);
+ if (demoPrompt && (state.remoteModel || nativeState()?.instances.some(i => i.status === 'ready'))) void startTimeSkipReal(demoPrompt); else if (state.connection === 'live' && demoPrompt) pushToast('info', 'Load a model first', 'Time-skip works on a loaded model. Choose one on the Models tab, then try again.');
+ else startTimeSkipDemo(demoPrompt);
return;
}
const imageTarget=nativeState()?.instances.find(i=>i.id===nativeState()?.defaultId);const canSendPictures=!state.remoteModel&&imageTarget?.status==='ready'&&imageTarget.vision;
diff --git a/apps/host/src/lib/time-skip-activity.ts b/apps/host/src/lib/time-skip-activity.ts
index 19c4e1fa0..1bec06cd1 100644
--- a/apps/host/src/lib/time-skip-activity.ts
+++ b/apps/host/src/lib/time-skip-activity.ts
@@ -4,6 +4,7 @@ import type { TimeSkipJob } from './time-skip';
/** What the working view says it is doing: the host's own words (activity.code / text / args.step, notes-split-agent3.md), else from the phase. */
export function activityWords(job: Pick<TimeSkipJob, 'phase' | 'activity'> | undefined): string {
const a = job?.activity;
+ if (a?.code === 'line' && a.text) return a.text;
if (a?.code === 'trying-version') {
const step = typeof a.args?.step === 'string' && a.args.step ? String(a.args.step) : '';
return step || tr('Trying an improved version…');
diff --git a/apps/host/src/lib/time-skip.ts b/apps/host/src/lib/time-skip.ts
index ffdba6c57..48d328a8b 100644
--- a/apps/host/src/lib/time-skip.ts
+++ b/apps/host/src/lib/time-skip.ts
@@ -22,7 +22,7 @@ export interface TimeSkipRun {
/** What the App Host reports about a real run. Field names mirror the job's durable record. */
export interface TimeSkipJob {
id: string;
- phase: 'queued' | 'checkpointing' | 'generating' | 'checking' | 'decision' | 'completed'
+ phase: 'planning' | 'choosing' | 'running' | 'comparing' | 'queued' | 'checkpointing' | 'generating' | 'checking' | 'decision' | 'completed'
| 'cancelled' | 'failed' | 'interrupted' | 'needs_user_review';
attempts: { index: number; decision: string | null; reason: string;
checks: { id: string; outcome: string; kind: string }[] }[];
@@ -36,6 +36,11 @@ export interface TimeSkipJob {
activity?: { code: string; text: string; args?: Record<string, unknown> } | null;
error: string | null;
finishedAt?: number | null;
+ /** The fork design (notes-split-agent8.md, item 11): the plan, the one step where checking matters most, and the two agents' progress. */
+ plan?: { steps: { id: string; text: string }[] } | null;
+ lever?: ForkLever | null;
+ a?: ForkLane | null;
+ b?: ForkLane | null;
/** The files the run changed (saved original against the revision), read from the job's own folders. */
files?: TimeSkipFile[];
/** More changed files than are listed. */
@@ -44,6 +49,36 @@ export interface TimeSkipJob {
applyAttempt?: number | null;
}
+export interface ForkLever { step: number; total: number; text: string; why: string; defaulted: boolean }
+export interface ForkLane { state: string; step: number; total: number; text: string; line: string; waiting: boolean }
+
+const lane = (raw: unknown): ForkLane | null => {
+ if (!raw || typeof raw !== 'object') return null;
+ const l = raw as Record<string, unknown>;
+ return { state: typeof l.state === 'string' ? l.state : 'waiting', step: Number(l.step) || 0, total: Number(l.total) || 0, text: typeof l.text === 'string' ? l.text : '', line: typeof l.line === 'string' ? l.line : '', waiting: l.waiting === true };
+};
+
+/**
+ * What an event or a status answer adds to a job under the fork design: the plan, the lever with its why, both lanes, and the activity as one
+ * friendly line (a string there; the older host sends an object, which is left as it is).
+ */
+export function forkFields(data: Record<string, unknown>): Partial<TimeSkipJob> {
+ const out: Partial<TimeSkipJob> = {};
+ const plan = data.plan as { steps?: unknown } | null | undefined;
+ if (plan && Array.isArray(plan.steps)) out.plan = { steps: plan.steps.flatMap((s, i) => (s && typeof s === 'object' && typeof (s as { text?: unknown }).text === 'string' ? [{ id: String((s as { id?: unknown }).id ?? i + 1), text: (s as { text: string }).text }] : [])) };
+ const lv = data.lever as Record<string, unknown> | null | undefined;
+ if (lv && typeof lv === 'object' && Number(lv.step) > 0) out.lever = { step: Number(lv.step), total: Number(lv.total) || 0, text: typeof lv.text === 'string' ? lv.text : '', why: typeof lv.why === 'string' ? lv.why : '', defaulted: lv.defaulted === true };
+ else if (lv === null) out.lever = null;
+ if ('a' in data) out.a = lane(data.a);
+ if ('b' in data) out.b = lane(data.b);
+ if (typeof data.activity === 'string' && data.activity) out.activity = { code: 'line', text: data.activity };
+ else if (data.activity && typeof data.activity === 'object') out.activity = data.activity as TimeSkipJob['activity'];
+ return out;
+}
+
+/** A job that runs as two agents (A, and B forked at the lever step) rather than one revision. */
+export const isForkJob = (job: Pick<TimeSkipJob, 'plan' | 'lever' | 'a' | 'b'> | undefined | null): boolean => !!job && !!(job.plan || job.lever || job.a || job.b);
+
export interface TimeSkipFile {
path: string;
status: 'added' | 'changed' | 'removed';
diff --git a/apps/host/src/locales/de.json b/apps/host/src/locales/de.json
index 38d71892e..47bc0ada8 100644
--- a/apps/host/src/locales/de.json
+++ b/apps/host/src/locales/de.json
@@ -3100,9 +3100,26 @@
"s3104": "Der Ordner wurde nicht geöffnet",
"s3105": "Der Pfad wurde nicht kopiert",
"s3106": "Die Datei wurde nicht angehängt",
- "s3107": "{0} Zeilen hinzugefügt, {1} entfernt",
- "s3108": "{0} Dateien bearbeitet",
- "s3109": "Alle anzeigen",
- "s3110": "Dateien hier ablegen, um sie hinzuzufügen",
- "s3111": "Bilder und Textdateien"
+ "s3107": "Ordner auswählen",
+ "s3108": "Den Ordner wählen, in dem dieser Chat arbeitet",
+ "s3109": "Projektordner: {0}. Ändern.",
+ "s3110": "Standardordner verwenden",
+ "s3111": "Der Ordner wurde nicht geändert",
+ "s3112": "Der Plan",
+ "s3113": "Hier zu prüfen ist am wichtigsten",
+ "s3114": "standardmäßig gewählt",
+ "s3115": "Das ist eine kurze Aufgabe, daher gibt es eine Version. Eine Verzweigung lohnt sich nicht.",
+ "s3116": "Schritt {0} von {1}: {2}",
+ "s3117": "Startet, wenn A Schritt {0} erreicht",
+ "s3118": "Wartet auf den Start",
+ "s3119": "Wartet auf den Plan",
+ "s3120": "Fortschritt von {0}",
+ "s3121": "Eine Version behalten",
+ "s3122": "Version A ist in Ihren Dateien.",
+ "s3123": "Version B ist in Ihren Dateien.",
+ "s3124": "Version A behalten",
+ "s3125": "Version B behalten",
+ "s3126": "Zwei Versionen zum Vergleichen",
+ "s3127": "A und B sind jeweils vollständig durchgelaufen. Behalten Sie die, die Ihnen gefällt.",
+ "s3128": "Time-skip funktioniert mit einem geladenen Modell. Wählen Sie eines im Tab „Modelle“ und versuchen Sie es erneut."
}
diff --git a/apps/host/src/locales/en.json b/apps/host/src/locales/en.json
index 03ce6e513..2654c4349 100644
--- a/apps/host/src/locales/en.json
+++ b/apps/host/src/locales/en.json
@@ -3100,9 +3100,26 @@
"s3104": "The folder was not opened",
"s3105": "The path was not copied",
"s3106": "The file was not attached",
- "s3107": "{0} lines added, {1} removed",
- "s3108": "Edited {0} files",
- "s3109": "See all",
- "s3110": "Drop files to add them",
- "s3111": "Pictures and text files"
+ "s3107": "Select a folder",
+ "s3108": "Choose the folder this chat works in",
+ "s3109": "Project folder: {0}. Change it.",
+ "s3110": "Use the default folder",
+ "s3111": "The folder was not changed",
+ "s3112": "The plan",
+ "s3113": "Checking here matters most",
+ "s3114": "chosen by default",
+ "s3115": "This is a short job, so there is one version. Nothing is worth branching.",
+ "s3116": "Step {0} of {1}: {2}",
+ "s3117": "Starts when A reaches step {0}",
+ "s3118": "Waiting to start",
+ "s3119": "Waiting for the plan",
+ "s3120": "Progress of {0}",
+ "s3121": "Keep a version",
+ "s3122": "Version A is in your files.",
+ "s3123": "Version B is in your files.",
+ "s3124": "Version A kept",
+ "s3125": "Version B kept",
+ "s3126": "Two versions to compare",
+ "s3127": "A and B each went all the way through. Keep the one you like.",
+ "s3128": "Time-skip works on a loaded model. Choose one on the Models tab, then try again."
}
diff --git a/apps/host/src/locales/es.json b/apps/host/src/locales/es.json
index 54b73e525..9f3d8bf84 100644
--- a/apps/host/src/locales/es.json
+++ b/apps/host/src/locales/es.json
@@ -3100,9 +3100,26 @@
"s3104": "No se abrió la carpeta",
"s3105": "No se copió la ruta",
"s3106": "No se adjuntó el archivo",
- "s3107": "{0} líneas añadidas, {1} eliminadas",
- "s3108": "{0} archivos editados",
- "s3109": "Ver todo",
- "s3110": "Suelta archivos para añadirlos",
- "s3111": "Imágenes y archivos de texto"
+ "s3107": "Elegir una carpeta",
+ "s3108": "Elige la carpeta en la que trabaja este chat",
+ "s3109": "Carpeta del proyecto: {0}. Cámbiala.",
+ "s3110": "Usar la carpeta predeterminada",
+ "s3111": "No se cambió la carpeta",
+ "s3112": "El plan",
+ "s3113": "Revisar aquí es lo más importante",
+ "s3114": "elegido por defecto",
+ "s3115": "Es una tarea corta, así que hay una sola versión. No merece la pena bifurcar.",
+ "s3116": "Paso {0} de {1}: {2}",
+ "s3117": "Empieza cuando A llegue al paso {0}",
+ "s3118": "Esperando para empezar",
+ "s3119": "Esperando el plan",
+ "s3120": "Progreso de {0}",
+ "s3121": "Conservar una versión",
+ "s3122": "La versión A está en tus archivos.",
+ "s3123": "La versión B está en tus archivos.",
+ "s3124": "Versión A conservada",
+ "s3125": "Versión B conservada",
+ "s3126": "Dos versiones para comparar",
+ "s3127": "A y B llegaron hasta el final. Conserva la que prefieras.",
+ "s3128": "Time-skip funciona con un modelo cargado. Elige uno en la pestaña Modelos y vuelve a intentarlo."
}
diff --git a/apps/host/src/locales/ja.json b/apps/host/src/locales/ja.json
index d23a4fb08..207539995 100644
--- a/apps/host/src/locales/ja.json
+++ b/apps/host/src/locales/ja.json
@@ -3100,9 +3100,26 @@
"s3104": "フォルダーを開けませんでした",
"s3105": "パスをコピーできませんでした",
"s3106": "ファイルを添付できませんでした",
- "s3107": "{0} 行追加、{1} 行削除",
- "s3108": "{0} 個のファイルを編集",
- "s3109": "すべて表示",
- "s3110": "ファイルをドロップして追加",
- "s3111": "画像とテキストファイル"
+ "s3107": "フォルダーを選択",
+ "s3108": "このチャットで作業するフォルダーを選択",
+ "s3109": "プロジェクトフォルダー:{0}。変更します。",
+ "s3110": "既定のフォルダーを使う",
+ "s3111": "フォルダーは変更されませんでした",
+ "s3112": "プラン",
+ "s3113": "ここでの確認が最も重要です",
+ "s3114": "既定で選択",
+ "s3115": "短い作業なので、バージョンは1つです。分岐する価値はありません。",
+ "s3116": "ステップ {0}/{1}:{2}",
+ "s3117": "A がステップ {0} に達したら開始",
+ "s3118": "開始待ち",
+ "s3119": "プランを待っています",
+ "s3120": "{0} の進捗",
+ "s3121": "バージョンを残す",
+ "s3122": "バージョン A がファイルに反映されています。",
+ "s3123": "バージョン B がファイルに反映されています。",
+ "s3124": "バージョン A を残しました",
+ "s3125": "バージョン B を残しました",
+ "s3126": "比べる 2 つのバージョン",
+ "s3127": "A も B も最後まで完了しました。気に入った方を残してください。",
+ "s3128": "Time-skip は読み込み済みのモデルで動作します。モデルタブで選んでから、もう一度お試しください。"
}
diff --git a/apps/host/src/locales/ko.json b/apps/host/src/locales/ko.json
index 28973cd0c..13fc315b4 100644
--- a/apps/host/src/locales/ko.json
+++ b/apps/host/src/locales/ko.json
@@ -3100,9 +3100,26 @@
"s3104": "폴더를 열지 못했습니다",
"s3105": "경로를 복사하지 못했습니다",
"s3106": "파일을 첨부하지 못했습니다",
- "s3107": "{0}줄 추가, {1}줄 삭제",
- "s3108": "파일 {0}개 편집됨",
- "s3109": "모두 보기",
- "s3110": "파일을 놓아 추가하세요",
- "s3111": "사진 및 텍스트 파일"
+ "s3107": "폴더 선택",
+ "s3108": "이 대화가 작업할 폴더를 선택하세요",
+ "s3109": "프로젝트 폴더: {0}. 변경합니다.",
+ "s3110": "기본 폴더 사용",
+ "s3111": "폴더가 변경되지 않았습니다",
+ "s3112": "계획",
+ "s3113": "여기서 확인하는 것이 가장 중요합니다",
+ "s3114": "기본값으로 선택됨",
+ "s3115": "짧은 작업이라 버전은 하나입니다. 나눌 필요가 없습니다.",
+ "s3116": "{1}단계 중 {0}단계: {2}",
+ "s3117": "A가 {0}단계에 도달하면 시작합니다",
+ "s3118": "시작 대기 중",
+ "s3119": "계획을 기다리는 중",
+ "s3120": "{0}의 진행 상황",
+ "s3121": "버전 유지",
+ "s3122": "버전 A가 파일에 적용되었습니다.",
+ "s3123": "버전 B가 파일에 적용되었습니다.",
+ "s3124": "버전 A 유지됨",
+ "s3125": "버전 B 유지됨",
+ "s3126": "비교할 두 버전",
+ "s3127": "A와 B 모두 끝까지 진행되었습니다. 마음에 드는 쪽을 유지하세요.",
+ "s3128": "Time-skip은 불러온 모델에서 작동합니다. 모델 탭에서 하나를 고른 뒤 다시 시도하세요."
}
diff --git a/apps/host/src/locales/pt.json b/apps/host/src/locales/pt.json
index e2ed45a6c..40b52384e 100644
--- a/apps/host/src/locales/pt.json
+++ b/apps/host/src/locales/pt.json
@@ -3100,9 +3100,26 @@
"s3104": "A pasta não foi aberta",
"s3105": "O caminho não foi copiado",
"s3106": "O arquivo não foi anexado",
- "s3107": "{0} linhas adicionadas, {1} removidas",
- "s3108": "{0} arquivos editados",
- "s3109": "Ver tudo",
- "s3110": "Solte arquivos para adicioná-los",
- "s3111": "Imagens e arquivos de texto"
+ "s3107": "Escolher uma pasta",
+ "s3108": "Escolha a pasta em que este chat trabalha",
+ "s3109": "Pasta do projeto: {0}. Alterar.",
+ "s3110": "Usar a pasta padrão",
+ "s3111": "A pasta não foi alterada",
+ "s3112": "O plano",
+ "s3113": "Verificar aqui é o mais importante",
+ "s3114": "escolhido por padrão",
+ "s3115": "É uma tarefa curta, então há uma só versão. Não vale a pena ramificar.",
+ "s3116": "Passo {0} de {1}: {2}",
+ "s3117": "Começa quando A chegar ao passo {0}",
+ "s3118": "Aguardando para começar",
+ "s3119": "Aguardando o plano",
+ "s3120": "Progresso de {0}",
+ "s3121": "Manter uma versão",
+ "s3122": "A versão A está nos seus arquivos.",
+ "s3123": "A versão B está nos seus arquivos.",
+ "s3124": "Versão A mantida",
+ "s3125": "Versão B mantida",
+ "s3126": "Duas versões para comparar",
+ "s3127": "A e B foram até o fim. Mantenha a que preferir.",
+ "s3128": "O Time-skip funciona com um modelo carregado. Escolha um na aba Modelos e tente de novo."
}
diff --git a/apps/host/src/locales/ru.json b/apps/host/src/locales/ru.json
index 7f8b08edf..aec071e3d 100644
--- a/apps/host/src/locales/ru.json
+++ b/apps/host/src/locales/ru.json
@@ -3100,9 +3100,26 @@
"s3104": "Папку не удалось открыть",
"s3105": "Путь не удалось скопировать",
"s3106": "Файл не удалось прикрепить",
- "s3107": "Добавлено строк: {0}, удалено: {1}",
- "s3108": "Изменено файлов: {0}",
- "s3109": "Показать все",
- "s3110": "Перетащите файлы, чтобы добавить их",
- "s3111": "Изображения и текстовые файлы"
+ "s3107": "Выбрать папку",
+ "s3108": "Выберите папку, в которой работает этот чат",
+ "s3109": "Папка проекта: {0}. Изменить.",
+ "s3110": "Использовать папку по умолчанию",
+ "s3111": "Папка не была изменена",
+ "s3112": "План",
+ "s3113": "Проверка здесь важнее всего",
+ "s3114": "выбрано по умолчанию",
+ "s3115": "Это короткая задача, поэтому версия одна. Ветвление не нужно.",
+ "s3116": "Шаг {0} из {1}: {2}",
+ "s3117": "Начнётся, когда A дойдёт до шага {0}",
+ "s3118": "Ожидает запуска",
+ "s3119": "Ожидает план",
+ "s3120": "Прогресс {0}",
+ "s3121": "Оставить версию",
+ "s3122": "Версия A в ваших файлах.",
+ "s3123": "Версия B в ваших файлах.",
+ "s3124": "Версия A оставлена",
+ "s3125": "Версия B оставлена",
+ "s3126": "Две версии для сравнения",
+ "s3127": "И A, и B дошли до конца. Оставьте ту, что нравится.",
+ "s3128": "Time-skip работает с загруженной моделью. Выберите её на вкладке «Модели» и повторите."
}
diff --git a/apps/host/src/locales/zh.json b/apps/host/src/locales/zh.json
index b3b67f16b..b027671ef 100644
--- a/apps/host/src/locales/zh.json
+++ b/apps/host/src/locales/zh.json
@@ -3100,9 +3100,26 @@
"s3104": "文件夹未能打开",
"s3105": "路径未能复制",
"s3106": "文件未能附加",
- "s3107": "新增 {0} 行,删除 {1} 行",
- "s3108": "已编辑 {0} 个文件",
- "s3109": "查看全部",
- "s3110": "拖放文件即可添加",
- "s3111": "图片和文本文件"
+ "s3107": "选择文件夹",
+ "s3108": "选择此对话使用的文件夹",
+ "s3109": "项目文件夹:{0}。点击更改。",
+ "s3110": "使用默认文件夹",
+ "s3111": "文件夹未更改",
+ "s3112": "计划",
+ "s3113": "在此处检查最关键",
+ "s3114": "默认选择",
+ "s3115": "这是一个很短的任务,所以只有一个版本,无需分支。",
+ "s3116": "第 {0}/{1} 步:{2}",
+ "s3117": "A 到达第 {0} 步时开始",
+ "s3118": "等待开始",
+ "s3119": "等待计划",
+ "s3120": "{0} 的进度",
+ "s3121": "保留一个版本",
+ "s3122": "版本 A 已在你的文件中。",
+ "s3123": "版本 B 已在你的文件中。",
+ "s3124": "已保留版本 A",
+ "s3125": "已保留版本 B",
+ "s3126": "两个版本待比较",
+ "s3127": "A 和 B 都已完整完成。保留你喜欢的那个。",
+ "s3128": "Time-skip 需要已加载的模型。请在“模型”标签页选择一个,然后重试。"
}
diff --git a/apps/host/src/screens/Chat.tsx b/apps/host/src/screens/Chat.tsx
index 8b17cb244..f23cf3053 100644
--- a/apps/host/src/screens/Chat.tsx
+++ b/apps/host/src/screens/Chat.tsx
@@ -21,6 +21,7 @@ import { ReasoningBlock } from '../components/ReasoningBlock';
import { StatusLine } from '../components/StatusLine';
import { GoalBar } from '../components/GoalBar';
import { PlanCard, PlanPanel, QueuedMessages } from '../components/PlanCard';
+import { FolderChip } from '../components/FolderChip';
import { DropZone } from '../components/DropZone';
import { ActivityLine, EditedFiles, FileCard } from '../components/Deliverables';
import { queueMessage, usePlan, usePlanQuiet } from '../lib/plan';
@@ -118,6 +119,8 @@ export function ChatScreen() {
const planShown = planTab.length > 0 && selectedPreview === planTabId;
const planRunId = plan?.state === 'running' ? plan.id : '';
useEffect(() => { if (planRunId && planTabId && !session?.closedPreviews?.includes(planTabId)) setSelectedPreview(planTabId); }, [planRunId]);
+ // The chat shows every run of this chat (a running one has no files yet, so no tab); the sidebar tabs only those with something to compare.
+ const allTimeSkipRuns = session?.timeSkips ?? [];
const extraTabs = [...runTabs, ...planTab];
const selectedRun = timeSkipRuns.find(run => timeSkipTabId(run.id) === selectedPreview);
const inlinePreview = splitWidth >= (selectedRun || planShown ? 760 : 1120);
@@ -398,7 +401,7 @@ export function ChatScreen() {
<div className="chat__inner">
{tr(session.messages.length === 0 ? (session.statsAvailable === false ? <p className="small muted">{tr("Editing from an earlier message. Update the prompt below.")}</p> :
- <UsageDashboard loaded={!!loaded}/>) : (session.messages.map((m, i) => (<Message key={m.id} message={m} isLast={i === session.messages.length - 1} onEditPrompt={editPrompt} onPreview={openPreview} onOpenTimeSkip={openTimeSkip} timeSkipDone={!!timeSkipRuns.find(r => r.id === m.timeSkipId)?.completedAt} timeSkipReal={!!timeSkipRuns.find(r => r.id === m.timeSkipId)?.job} timeSkipRun={timeSkipRuns.find(r => r.id === m.timeSkipId)} onOpenLink={openLink}/>))))}
+ <UsageDashboard loaded={!!loaded}/>) : (session.messages.map((m, i) => (<Message key={m.id} message={m} isLast={i === session.messages.length - 1} onEditPrompt={editPrompt} onPreview={openPreview} onOpenTimeSkip={openTimeSkip} timeSkipDone={!!allTimeSkipRuns.find(r => r.id === m.timeSkipId)?.completedAt} timeSkipReal={!!allTimeSkipRuns.find(r => r.id === m.timeSkipId)?.job} timeSkipRun={allTimeSkipRuns.find(r => r.id === m.timeSkipId)} onOpenLink={openLink}/>))))}
<QueuedMessages chatId={session.id}/>
</div>
</div>
@@ -498,6 +501,7 @@ function Composer({ draft, setDraft, loaded, streaming, onSubmit, onKey, session
<div className="composer">
<div className="composer__inner">
{tr(fileError ? <ErrorNotice message={fileError} action={tr("Dismiss")} onRetry={() => setFileError('')}/> : null)}
+ <FolderChip chatId={session?.id} disabled={streaming}/>
<GoalBar chatId={session?.id}/>
<div className="st-composer" style={{ boxShadow: 'var(--st-sh-bar)' }}>
{tr(photos.length ? <ChatPhotos photos={photos} onRemove={id => removeChatPhoto(id, session?.id)}/> : null)}
diff --git a/apps/host/src/styles/app.css b/apps/host/src/styles/app.css
index ac655fdc5..76edb7e3a 100644
--- a/apps/host/src/styles/app.css
+++ b/apps/host/src/styles/app.css
@@ -7441,3 +7441,36 @@ textarea {
.chatcol { position: relative; }
.dropzone { position: absolute; inset: 8px; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 2px dashed var(--st-accent); border-radius: var(--st-r-lg); background: color-mix(in srgb, var(--st-surface) 88%, var(--st-accent) 12%); color: var(--st-ink); pointer-events: none; }
.dropzone span { color: var(--st-ink-muted); font-size: var(--st-fs-sm); }
+
+/* The chat's project folder, above the message box (round 8, item 4) */
+.folderchip { display: inline-flex; align-items: center; align-self: flex-start; max-width: 100%; margin: 0 0 6px 6px; border-radius: 8px; color: var(--st-ink-muted); font-size: var(--st-fs-sm); }
+.folderchip__pick { display: inline-flex; align-items: center; gap: 6px; min-width: 0; height: 28px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: inherit; font: 600 var(--st-fs-sm) var(--st-font); cursor: pointer; }
+.folderchip__pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 28ch; }
+.folderchip__pick:hover:not(:disabled), .folderchip__x:hover:not(:disabled) { background: var(--st-surface-2); color: var(--st-ink); }
+.folderchip[data-set="true"] .folderchip__pick { color: var(--st-ink-soft); }
+.folderchip[data-missing="true"] .folderchip__pick { color: var(--st-danger, #b42318); }
+.folderchip__x { width: 22px; height: 22px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--st-icon); cursor: pointer; opacity: 0; }
+.folderchip:hover .folderchip__x, .folderchip:focus-within .folderchip__x { opacity: 1; }
+.folderchip button:disabled { opacity: .55; cursor: default; }
+
+/* Time-skip as two agents: the plan, the lever and its why, and A / B progress (round 8, item 11) */
+.tsf { padding: 4px 18px 14px; display: flex; flex-direction: column; gap: 14px; }
+.tsf__plan { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
+.tsf__plan li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 6px 0; font-size: var(--st-fs-sm); line-height: 1.4; color: var(--st-ink); }
+.tsf__plan li[data-state="done"] { color: var(--st-ink-muted); }
+.tsf__plan li[data-state="running"] { font-weight: 700; }
+.tsf__no { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--st-line); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--st-ink-muted); font-variant-numeric: tabular-nums; }
+.tsf__plan li[data-state="done"] .tsf__no { background: var(--st-accent); border-color: transparent; color: var(--st-accent-ink); }
+.tsf__plan li[data-lever] { margin: 2px -10px; padding: 8px 10px; border-radius: 10px; background: var(--st-surface-2); }
+.tsf__why { display: block; margin-top: 3px; font-weight: 400; color: var(--st-ink-soft); font-size: var(--st-fs-xs); }
+.tsf__why strong { color: var(--st-accent-text); font-weight: 700; }
+.tsf__note { margin: 0; }
+.tsf__lanes { display: flex; flex-direction: column; gap: 10px; }
+.tsf__lane { display: grid; grid-template-columns: 22px 1fr; column-gap: 10px; row-gap: 4px; align-items: center; }
+.tsf__name { grid-row: span 2; width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--st-line); display: grid; place-items: center; font-size: 11px; font-weight: 800; color: var(--st-ink-soft); }
+.tsf__prog { height: 6px; border-radius: 999px; background: var(--st-surface-2); overflow: hidden; }
+.tsf__prog i { display: block; height: 100%; background: var(--st-accent); border-radius: inherit; transition: width .4s ease; }
+.tsf__words { grid-column: 2; font-size: var(--st-fs-xs); color: var(--st-ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+.tsf__lane[data-state="waiting"] .tsf__name, .tsf__lane[data-state="pending"] .tsf__name { opacity: .6; }
+@media (prefers-reduced-motion: reduce) { .tsf__prog i { transition: none; } }
+.ts-keep__buttons { display: inline-flex; gap: 8px; }
diff --git a/apps/host/tests/ui6-fork.test.mjs b/apps/host/tests/ui6-fork.test.mjs
new file mode 100644
index 000000000..864744f39
--- /dev/null
+++ b/apps/host/tests/ui6-fork.test.mjs
@@ -0,0 +1,39 @@
+/** Round 8, item 11: the fork design's events (notes-split-agent8.md) are read into the job; the folder chip reads the host's answer. */
+import test from 'node:test';
+import assert from 'node:assert/strict';
+import { build } from 'esbuild';
+import { fileURLToPath } from 'node:url';
+
+const src = f => fileURLToPath(new URL(`../src/${f}`, import.meta.url));
+const stub = fileURLToPath(new URL('./helpers/react-stub.mjs', import.meta.url));
+globalThis.window ??= globalThis; globalThis.localStorage ??= { getItem: () => null, setItem: () => {} }; globalThis.navigator ??= { language: 'en' };
+async function load(file) {
+ const r = await build({ entryPoints: [src(file)], bundle: true, format: 'esm', platform: 'node', write: false, alias: { react: stub }, logLevel: 'silent' });
+ return import(`data:text/javascript;base64,${Buffer.from(r.outputFiles[0].text).toString('base64')}`);
+}
+const T = await load('lib/time-skip.ts');
+const F = await load('lib/chat-folder.ts');
+
+test('an event carries the plan, the lever with its why, both lanes and one friendly line', () => {
+ const f = T.forkFields({ phase: 'running', activity: 'Step 2 of 5 in A: Draw the layout', plan: { steps: [{ id: 's1', text: 'Look' }, { text: 'Draw' }, 5] }, lever: { step: 3, total: 5, text: 'Styles', why: 'The layout decides everything after it.', defaulted: false }, a: { state: 'running', step: 2, total: 5, text: 'Draw', line: 'Step 2 of 5', waiting: false }, b: { state: 'waiting', waiting: true } });
+ assert.deepEqual(f.plan.steps.map(s => s.id), ['s1', '2']);
+ assert.equal(f.lever.why, 'The layout decides everything after it.');
+ assert.equal(f.a.step, 2); assert.equal(f.b.waiting, true);
+ assert.deepEqual(f.activity, { code: 'line', text: 'Step 2 of 5 in A: Draw the layout' });
+ assert.equal(T.isForkJob(f), true);
+ assert.equal(T.isForkJob({}), false);
+});
+
+test('an older job (an activity object, no plan) is not a fork job and keeps its activity', () => {
+ const f = T.forkFields({ phase: 'generating', activity: { code: 'reading-files', text: 'Reading' } });
+ assert.deepEqual(f.activity, { code: 'reading-files', text: 'Reading' });
+ assert.equal(T.isForkJob(f), false);
+ assert.equal(T.forkFields({ lever: null }).lever, null);
+});
+
+test('the folder answer: a path gives a name; nothing gives no folder', () => {
+ assert.deepEqual(F.readFolder({ path: 'C:\Users\me\pagoda-site', name: 'pagoda-site', exists: true }), { path: 'C:\Users\me\pagoda-site', name: 'pagoda-site', exists: true });
+ assert.equal(F.readFolder({ path: '/home/me/site' }).name, 'site');
+ assert.equal(F.readFolder(null), null);
+ assert.equal(F.readFolder({ path: '' }), null);
+});