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++
Task handover: markdown bubble, clean chat title, long step lists capped
Niko12214eeccd9c0069
diff --git a/apps/host/src/lib/store.ts b/apps/host/src/lib/store.tsindex 303d0a452..9899b80c9 100644--- a/apps/host/src/lib/store.ts+++ b/apps/host/src/lib/store.ts@@ -1071,9 +1071,8 @@ export function createPreviewExamples() {/** "Continue in a new chat" on a task: a new chat whose first message is the task's findings, what it did and its files (src/lib/task-handover.ts). */export function continueTaskInNewChat(task: Task) {const session = newSession();- patchSession(session.id, s => ({ ...s, title: taskHandoverTitle(task), defaultTitle: false }));go('chat', session.id);- void sendMessage(taskHandoverMessage(task));+ void sendMessage(taskHandoverMessage(task), { title: taskHandoverTitle(task), markdown: true });}export function selectSession(id: string) {@@ -1515,7 +1514,7 @@ export async function approvePlan(sessionId: string, planId: string) {/** "Start as goal" (and Resume on a paused plan): the host streams the run like any chat turn. */export async function startPlanGoal(planId: string) { await sendMessage('', { planId }); }-export async function sendMessage(text: string, options: { fromLoop?: boolean; goalAction?: 'resume'; planId?: string; shown?: string } = {}) {+export async function sendMessage(text: string, options: { fromLoop?: boolean; goalAction?: 'resume'; planId?: string; shown?: string; title?: string; markdown?: boolean } = {}) {if (state.streaming) {// Typed while the assistant works: behind a running goal it waits in the queue; otherwise there is nothing to do but wait.const waiting = state.activeSession, line = text.trim();@@ -1545,7 +1544,7 @@ export async function sendMessage(text: string, options: { fromLoop?: boolean; glet sessionId = state.activeSession;if (!sessionId) sessionId = newSession().id;- const userMsg: ChatMessage = { id: uid('m'), role: 'user', content: options.shown ?? body, at: new Date().toISOString(),...(pictures.length?{photos:pictures}:{}) };+ const userMsg: ChatMessage = { id: uid('m'), role: 'user', content: options.shown ?? body, at: new Date().toISOString(),...(pictures.length?{photos:pictures}:{}),...(options.markdown?{markdown:true}:{}) };let assistantId = uid('m');const assistantMsg: ChatMessage = {id: assistantId,@@ -1577,7 +1576,7 @@ export async function sendMessage(text: string, options: { fromLoop?: boolean; gpatchSession(sessionId, (s) => ({...s,defaultTitle: false,- title: s.messages.length === 0 && !resume && !planStart ? (body.length>48?body.slice(0,47).trimEnd()+'…':body) : s.title,+ title: s.messages.length === 0 && !resume && !planStart ? (options.title ?? (body.length>48?body.slice(0,47).trimEnd()+'…':body)) : s.title,updatedAt: new Date().toISOString(),messages: [...s.messages, ...(resume || planStart ? [] : [userMsg]), assistantMsg],}));diff --git a/apps/host/src/lib/task-handover.ts b/apps/host/src/lib/task-handover.tsindex d2b23e9bd..ff3d5d5dd 100644--- a/apps/host/src/lib/task-handover.ts+++ b/apps/host/src/lib/task-handover.ts@@ -18,6 +18,8 @@ export function splitTaskOutput(output: string): { found: string; did: string[];return { found: (cut ? text.slice(0, cut.index) : text).trim(), did, attention };}+const MAX_STEPS = 10, MAX_STEP = 160;+export const taskHandoverTitle = (task: Task) => tr('Continuing from the task “{0}”', [task.title]);export function taskHandoverMessage(task: Task): string {@@ -29,7 +31,12 @@ export function taskHandoverMessage(task: Task): string {const { found, did, attention } = splitTaskOutput(task.output ?? '');if (found) parts.push(`**${tr('What it found')}**\n\n${found}`);if (attention) parts.push(`**${tr('Needs your attention')}**\n\n${attention}`);- if (did.length) parts.push(`**${tr('What it did')}**\n\n${did.map(l => `- ${l}`).join('\n')}`);+ if (did.length) {+ // the steps of a long run are many and long: the first ones, shortened+ const shown = did.slice(0, MAX_STEPS).map(l => `- ${l.length > MAX_STEP ? `${l.slice(0, MAX_STEP - 1)}…` : l}`);+ if (did.length > MAX_STEPS) shown.push(`- ${tr('…and {0} more steps', [did.length - MAX_STEPS])}`);+ parts.push(`**${tr('What it did')}**\n\n${shown.join('\n')}`);+ }const files = (task.files ?? []).filter(f => f && typeof f.path === 'string' && f.path);if (files.length) parts.push(`**${tr('Files')}**\n\n${files.map(f => `- ${f.path}`).join('\n')}`);parts.push(tr('Please help me take it from here.'));diff --git a/apps/host/src/lib/types.ts b/apps/host/src/lib/types.tsindex c0c7ee2d4..70a7f9e42 100644--- a/apps/host/src/lib/types.ts+++ b/apps/host/src/lib/types.ts@@ -314,6 +314,8 @@ export interface MonitorState {}export interface ChatMessage {+ /** The person's message is written with Markdown (a task handover: bold headings and lists), so the bubble draws it as such. */+ markdown?: boolean;photos?:import('./chat-photos').ChatPhoto[];/** Reply came from a saved API connection, rather than the local engine. */remoteModel?: boolean;diff --git a/apps/host/src/locales/de.json b/apps/host/src/locales/de.jsonindex c0d69575d..2cd813348 100644--- a/apps/host/src/locales/de.json+++ b/apps/host/src/locales/de.json@@ -3173,5 +3173,6 @@"s3177": "Braucht deine Aufmerksamkeit","s3178": "Was sie getan hat","s3179": "Dateien",- "s3180": "Bitte hilf mir, von hier aus weiterzumachen."+ "s3180": "Bitte hilf mir, von hier aus weiterzumachen.",+ "s3181": "…und {0} weitere Schritte"}diff --git a/apps/host/src/locales/en.json b/apps/host/src/locales/en.jsonindex e48e52a79..2e2901549 100644--- a/apps/host/src/locales/en.json+++ b/apps/host/src/locales/en.json@@ -3173,5 +3173,6 @@"s3177": "Needs your attention","s3178": "What it did","s3179": "Files",- "s3180": "Please help me take it from here."+ "s3180": "Please help me take it from here.",+ "s3181": "…and {0} more steps"}diff --git a/apps/host/src/locales/es.json b/apps/host/src/locales/es.jsonindex 2412d64e4..c5aa28990 100644--- a/apps/host/src/locales/es.json+++ b/apps/host/src/locales/es.json@@ -3173,5 +3173,6 @@"s3177": "Necesita tu atención","s3178": "Qué hizo","s3179": "Archivos",- "s3180": "Ayúdame a continuar desde aquí."+ "s3180": "Ayúdame a continuar desde aquí.",+ "s3181": "…y {0} pasos más"}diff --git a/apps/host/src/locales/ja.json b/apps/host/src/locales/ja.jsonindex b0dbb42a4..2607224a0 100644--- a/apps/host/src/locales/ja.json+++ b/apps/host/src/locales/ja.json@@ -3173,5 +3173,6 @@"s3177": "確認が必要なこと","s3178": "実行した内容","s3179": "ファイル",- "s3180": "ここから先を手伝ってください。"+ "s3180": "ここから先を手伝ってください。",+ "s3181": "…ほか {0} 件の手順"}diff --git a/apps/host/src/locales/ko.json b/apps/host/src/locales/ko.jsonindex 4a0e1927e..8a0a41a95 100644--- a/apps/host/src/locales/ko.json+++ b/apps/host/src/locales/ko.json@@ -3173,5 +3173,6 @@"s3177": "확인이 필요한 내용","s3178": "수행한 내용","s3179": "파일",- "s3180": "여기서부터 이어서 도와주세요."+ "s3180": "여기서부터 이어서 도와주세요.",+ "s3181": "…외 {0}단계"}diff --git a/apps/host/src/locales/pt.json b/apps/host/src/locales/pt.jsonindex 20ac1d2b6..1bca02fc7 100644--- a/apps/host/src/locales/pt.json+++ b/apps/host/src/locales/pt.json@@ -3173,5 +3173,6 @@"s3177": "Precisa da sua atenção","s3178": "O que fez","s3179": "Arquivos",- "s3180": "Por favor, ajude-me a continuar daqui."+ "s3180": "Por favor, ajude-me a continuar daqui.",+ "s3181": "…e mais {0} etapas"}diff --git a/apps/host/src/locales/ru.json b/apps/host/src/locales/ru.jsonindex 29281f94b..ddd59f2dd 100644--- a/apps/host/src/locales/ru.json+++ b/apps/host/src/locales/ru.json@@ -3173,5 +3173,6 @@"s3177": "Требует вашего внимания","s3178": "Что она сделала","s3179": "Файлы",- "s3180": "Помогите мне продолжить отсюда."+ "s3180": "Помогите мне продолжить отсюда.",+ "s3181": "…и ещё шагов: {0}"}diff --git a/apps/host/src/locales/zh.json b/apps/host/src/locales/zh.jsonindex a7a4d09de..4978dc627 100644--- a/apps/host/src/locales/zh.json+++ b/apps/host/src/locales/zh.json@@ -3173,5 +3173,6 @@"s3177": "需要你关注","s3178": "它做了什么","s3179": "文件",- "s3180": "请帮我从这里继续。"+ "s3180": "请帮我从这里继续。",+ "s3181": "……以及另外 {0} 个步骤"}diff --git a/apps/host/src/screens/Chat.tsx b/apps/host/src/screens/Chat.tsxindex f7e06c0b2..e152ec737 100644--- a/apps/host/src/screens/Chat.tsx+++ b/apps/host/src/screens/Chat.tsx@@ -590,7 +590,7 @@ function Message({ message: m, isLast, onEditPrompt, onPreview, onOpenLink, onOpconst [sentTime, setSentTime] = useState(() => relTime(m.at));if (m.role === 'user') {return (<div className="st-msg st-msg--user" onMouseEnter={() => setSentTime(relTime(m.at))} onFocus={() => setSentTime(relTime(m.at))}>- <div className="st-bubble">{tr(m.photos?.length ? <ChatPhotos photos={m.photos}/> : null)}{m.content}</div>+ <div className="st-bubble">{tr(m.photos?.length ? <ChatPhotos photos={m.photos}/> : null)}{m.markdown ? <Markdown text={m.content} onOpenLink={onOpenLink}/> : m.content}</div><div className="st-msg__meta"><time dateTime={m.at} title={tr(new Date(m.at).toLocaleString(localeTag()))}>{tr(sentTime)}</time><span className="st-msg__actions">diff --git a/apps/host/tests/task-handover.test.mjs b/apps/host/tests/task-handover.test.mjsindex 74c5918ac..39364b658 100644--- a/apps/host/tests/task-handover.test.mjs+++ b/apps/host/tests/task-handover.test.mjs@@ -57,3 +57,12 @@ test('a scheduled run keeps the files the agent made, and a later failed run doeawait service.execute(saved.id);assert.equal(service.list()[0].status, 'error'); assert.deepEqual(service.list()[0].files, []);});++test('a long run keeps the first steps, shortened, and says how many more', () => {+ setTranslationLanguage('en');+ const steps = Array.from({ length: 14 }, (_, i) => `Step ${i + 1} ${'x'.repeat(300)}`);+ const text = taskHandoverMessage({ ...task, output: `Done.\n\n---\n\n**What it did**\n\n${steps.map(s => `- ${s}`).join('\n')}`, files: [] });+ const lines = text.split('\n').filter(l => l.startsWith('- '));+ assert.equal(lines.length, 11); assert.ok(lines.slice(0, 10).every(l => l.length <= 162 && l.endsWith('…')));+ assert.equal(lines[10], '- …and 4 more steps');+});