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++
Skills used under an answer; Continue in a new chat on a task (owner-approved mockups), 8 languages, tests
Niko1221b533ae524686
diff --git a/apps/host/server/agent/agent-bridge.mjs b/apps/host/server/agent/agent-bridge.mjsindex e3e2c308c..72002eb8b 100644--- a/apps/host/server/agent/agent-bridge.mjs+++ b/apps/host/server/agent/agent-bridge.mjs@@ -25,6 +25,7 @@ import { TurnProjector, parseArguments as parseArgs } from './events.mjs';import { ChildProjector } from './children.mjs';import { nearestBudget } from './llm-shape.mjs';import { DeliverableTracker, ActivityGroups } from './deliverables.mjs';+import { SkillsUsed, skillInfoFrom } from './skills-used.mjs';import { PlanStore, planPrompt, parsePlan, parsePoints, stepObjective, stepLine, firstSentence, stepSummary, planAsPrompt, editedSteps, planView, researchPrompt, researchWritePrompt, RESEARCH_NUDGE, parseSources } from './plan.mjs';/**@@ -298,6 +299,7 @@ export function createAgentBridge({ dataDir, componentsDir = null, bundledDir =const tracker = new DeliverableTracker(workspacePath);try { tracker.snapshot(); } catch { /* a folder that cannot be read has no deliverables */ }const groups = new ActivityGroups({ emit: raw });+ const skills = new SkillsUsed({ emit: raw, info: skillInfoFrom(skillsDir()) });const emit = frame => {if (frame.type === 'delta' && !frame.own) { written.all += frame.text; written.step += frame.text; if (hideDeltas) return; }if (frame.own) { const { own, ...rest } = frame; frame = rest; }@@ -308,6 +310,7 @@ export function createAgentBridge({ dataDir, componentsDir = null, bundledDir =raw(frame);if (made) raw(made);groups.card(frame.tool, made);+ skills.card(frame.tool);return;}raw(frame);diff --git a/apps/host/server/agent/skills-used.mjs b/apps/host/server/agent/skills-used.mjsnew file mode 100644index 000000000..d7da72660--- /dev/null+++ b/apps/host/server/agent/skills-used.mjs@@ -0,0 +1,43 @@+/**+ * Which saved skills an answer used, for the line under the answer ("Used 2 skills: Weekly report, Brand voice").+ *+ * The agent loads a skill with its `skill` tool (the name is the folder name the app wrote, see skill-files.mjs). Each skill that was loaded+ * successfully during the turn is reported once, in a `skills-used` frame that carries the whole list so far (the page replaces its copy), with the+ * name the person gave it and its one-line description from the skill's own file. A skill the app does not know by file (a folder the agent+ * found elsewhere) is named from its folder name. Pure apart from reading `<dir>/<name>/SKILL.md`.+ */+import { readFileSync } from 'node:fs';+import { join } from 'node:path';+import { parseSkillFile } from '../skill-files.mjs';++/** "weekly-report" -> "Weekly report" */+export const skillLabel = slug => {+ const text = String(slug ?? '').replace(/[-_]+/g, ' ').trim();+ return text ? text[0].toUpperCase() + text.slice(1) : '';+};++/** A function from the skill's folder name to `{ name, description }`, read from the app's skills folder. */+export function skillInfoFrom(dir) {+ return slug => {+ const safe = /^[A-Za-z0-9][A-Za-z0-9._-]{0,80}$/.test(String(slug)) ? String(slug) : null;+ let parsed = null;+ if (safe && dir) { try { parsed = parseSkillFile(readFileSync(join(dir, safe, 'SKILL.md'), 'utf8')); } catch { /* not a file of ours */ } }+ const name = (parsed?.title || skillLabel(slug)).slice(0, 80);+ // the app writes "<name>. <description>" into the file so the agent's catalog names the skill: the line shows only the description+ let description = String(parsed?.description ?? '').replace(/\s+/g, ' ').trim();+ if (description.toLowerCase().startsWith(`${name.toLowerCase()}. `)) description = description.slice(name.length + 2);+ return { name, description: description.slice(0, 200) };+ };+}++export class SkillsUsed {+ constructor({ emit, info = slug => ({ name: skillLabel(slug), description: '' }) }) { this.emit = emit; this.info = info; this.used = new Map(); }+ /** A tool card frame (every state change). Counts a `skill` call once, when it has worked. */+ card(tool) {+ if (!tool || tool.name !== 'skill' || tool.state !== 'done') return;+ const slug = String(tool.args?.name ?? tool.args?.skill ?? '').trim();+ if (!slug || this.used.has(slug)) return;+ this.used.set(slug, this.info(slug));+ this.emit({ type: 'skills-used', skills: [...this.used.values()] });+ }+}diff --git a/apps/host/server/agent/task-run.mjs b/apps/host/server/agent/task-run.mjsindex f378bca72..14d0d8d45 100644--- a/apps/host/server/agent/task-run.mjs+++ b/apps/host/server/agent/task-run.mjs@@ -18,6 +18,7 @@ export function createAgentTaskRunner({ agent, choice, workspace }) {const chatId = `task:${task.id}`;const cards = new Map();let text = '', failure = null;+ const files = new Map();const stop = () => void agent.stop(chatId).catch(() => {});signal?.addEventListener('abort', stop, { once: true });try {@@ -26,6 +27,7 @@ export function createAgentTaskRunner({ agent, choice, workspace }) {onFrame: frame => {if (frame.type === 'delta') text += frame.text ?? '';else if (frame.type === 'error') failure = frame.message;+ else if (frame.type === 'deliverable' && frame.abs && files.size < 30) files.set(frame.abs, { name: frame.name ?? frame.path, path: frame.abs });else if (frame.type === 'agent-tool') {cards.set(frame.tool.id, { ...(cards.get(frame.tool.id) ?? {}), ...frame.tool });if (frame.tool.state === 'proposed') void agent.approve({ chatId, callId: frame.tool.id, decision: 'deny' }).catch(() => {});@@ -35,6 +37,6 @@ export function createAgentTaskRunner({ agent, choice, workspace }) {} finally { signal?.removeEventListener('abort', stop); agent.forget(chatId); }signal?.throwIfAborted();if (failure) throw new Error(failure);- return taskReport({ text, cards: [...cards.values()] });+ return { ...taskReport({ text, cards: [...cards.values()] }), files: [...files.values()] };};}diff --git a/apps/host/server/tasks.mjs b/apps/host/server/tasks.mjsindex 1d28f15a7..952c94af5 100644--- a/apps/host/server/tasks.mjs+++ b/apps/host/server/tasks.mjs@@ -59,10 +59,10 @@ export function createTaskService({ read, write, run, notify = () => {}, now = Dconst t = find(id); if (t.status === 'running') return;if (t.archived) throw new Error('Restore this task first.');const controller = new AbortController(); controllers.set(id, controller);- t.status = 'running'; t.lastRunAt = new Date(now()).toISOString(); t.error = null;+ t.status = 'running'; t.lastRunAt = new Date(now()).toISOString(); t.error = null; t.files = [];t.nextRunAt = t.enabled ? nextRun(t, now()) : null; save();const timeout = setTimeout(() => controller.abort(), timeoutMs); timeout.unref?.();- try { const result = await run(t, controller.signal); t.output = result.text.slice(0, 100000); t.demo = result.demo; t.attention = result.attention ?? null; t.status = 'done'; }+ try { const result = await run(t, controller.signal); t.output = result.text.slice(0, 100000); t.demo = result.demo; t.attention = result.attention ?? null; t.files = Array.isArray(result.files) ? result.files.slice(0, 30) : []; t.status = 'done'; }catch (e) { t.status = controller.signal.aborted ? 'cancelled' : 'error'; t.error = controller.signal.aborted ? 'Run stopped.' : String(e.message ?? e); }finally { clearTimeout(timeout); controllers.delete(id); save(); try { notify(t); } catch { /* a notification is a courtesy */ } }}diff --git a/apps/host/src/components/Deliverables.tsx b/apps/host/src/components/Deliverables.tsxindex 48b850a04..cb18f77fd 100644--- a/apps/host/src/components/Deliverables.tsx+++ b/apps/host/src/components/Deliverables.tsx@@ -55,6 +55,23 @@ export function EditedFiles({ files, sessionId, onPreview }: { files: Deliverabl</div>;}+/**+ * The saved skills an answer used, as one quiet line under the answer in the same style as the activity line ("Ran 2 commands, read a file"):+ * "Used 2 skills: Weekly report, Brand voice"; opened, each skill with its one-line description.+ */+export function SkillsUsed({ skills }: { skills: { name: string; description: string }[] }) {+ const [open, setOpen] = useState(false);+ if (!skills.length) return null;+ const names = skills.map(s => s.name).join(', ');+ return <div className="act" data-open={open || undefined}>+ <button type="button" className="act__line" aria-expanded={open} onClick={() => setOpen(v => !v)}>+ <Icon name="skills" size={15}/><span>{skills.length === 1 ? tr('Used 1 skill: {0}', [names]) : tr('Used {0} skills: {1}', [skills.length, names])}</span>+ <Icon name="chevron" size={14} className="act__chev"/>+ </button>+ {open ? <ul className="act__files">{skills.map(s => <li key={s.name}><span className="act__skill"><Icon name="skills" size={14}/>{s.name}{s.description ? <span className="small muted">{s.description}</span> : null}</span></li>)}</ul> : null}+ </div>;+}+/** A run of tool use between two pieces of text, as one quiet line: "Ran 2 commands, read monitor.png", with a thumbnail when it touched a picture. */export function ActivityLine({ group, sessionId, onPreview }: { group: ActivityGroup; sessionId: string; onPreview: (a: PreviewArtifact) => void }) {const [open, setOpen] = useState(false);diff --git a/apps/host/src/lib/deliverables.ts b/apps/host/src/lib/deliverables.tsindex 0b5970006..40295a870 100644--- a/apps/host/src/lib/deliverables.ts+++ b/apps/host/src/lib/deliverables.ts@@ -37,6 +37,16 @@ export function readGroup(raw: unknown): ActivityGroup | null {return { id: g.id, closed: g.closed === true, line: typeof g.line === 'string' ? g.line : '', added: num(g.added), removed: num(g.removed), files };}+/** The `skills-used` frame: the skills this reply used, each with the name the person gave it and a one-line description. */+export function readSkills(raw: unknown): { name: string; description: string }[] {+ const list = (raw as { skills?: unknown } | null)?.skills;+ if (!Array.isArray(list)) return [];+ return list.flatMap(x => {+ const s = x as Record<string, unknown>;+ return typeof s?.name === 'string' && s.name ? [{ name: s.name, description: typeof s.description === 'string' ? s.description : '' }] : [];+ }).slice(0, 20);+}+/** Add streamed text to the reply's ordered pieces: it continues the last text piece, or starts a new one after an activity line. */export function appendText(blocks: MessageBlock[] | undefined, text: string): MessageBlock[] {const list = blocks ?? [], last = list.at(-1);diff --git a/apps/host/src/lib/store.ts b/apps/host/src/lib/store.tsindex 39a5e4182..303d0a452 100644--- a/apps/host/src/lib/store.ts+++ b/apps/host/src/lib/store.ts@@ -4,7 +4,7 @@ import { updateAgent } from './agents';import { LOOP_MAX_RUNS, LOOP_USAGE, loopEvery, parseLoop, type LoopCommand } from './loop';import { applyStatusFrame, clearStatus } from './live-status';import { applyGoalFrame } from './goal';-import { appendText, mergeDeliverable, readDeliverable, readGroup, upsertGroup } from './deliverables';+import { appendText, mergeDeliverable, readDeliverable, readGroup, readSkills, upsertGroup } from './deliverables';import { applyPlanFrame, applyQueueFrame, planApprove, queueMessage } from './plan';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';@@ -13,6 +13,8 @@ import { newestServingState } from './serving-state';import { photoData, uploadChatPhotos, photoHistorySlots, pendingChatPhotos, takeChatPhotos } from './chat-photos';import { nativeState } from './native';import { pictureStatus } from './pictures';+import { taskHandoverMessage, taskHandoverTitle } from './task-handover';+import type { Task } from './tasks';import { postWithFolderFallback } from './folder-pick';import { setTranslationLanguage, tr, validLanguage, type Language } from './i18n';/**@@ -1066,6 +1068,14 @@ export function createPreviewExamples() {go('chat', session.id);}+/** "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));+}+export function selectSession(id: string) {set({ activeSession: id });markRead(id);@@ -1660,6 +1670,9 @@ export async function sendMessage(text: string, options: { fromLoop?: boolean; g} else if (type === 'deliverable') {const file = readDeliverable(frame);if (file) patchAssistant(m => ({ ...m, deliverables: mergeDeliverable(m.deliverables, file) }));+ } else if (type === 'skills-used') {+ const skills = readSkills(frame);+ if (skills.length) patchAssistant(m => ({ ...m, skills }));} else if (type === 'activity-group') {const group = readGroup(frame);if (group) patchAssistant(m => ({ ...m, blocks: upsertGroup(m.blocks ?? (m.content ? appendText(undefined, m.content) : undefined), group) }));diff --git a/apps/host/src/lib/task-handover.ts b/apps/host/src/lib/task-handover.tsnew file mode 100644index 000000000..d2b23e9bd--- /dev/null+++ b/apps/host/src/lib/task-handover.ts@@ -0,0 +1,37 @@+import { tr, localeTag } from './i18n';+import type { Task } from './tasks';++/**+ * "Continue in a new chat" on a task: the first message of the new chat. It carries what the task found, what it did and the files it made, in the+ * words the person reads, so the conversation can go on from the result (a finished task, or one that stopped and needs a person).+ */+const when = (iso?: string) => (iso ? new Date(iso).toLocaleString(localeTag(), { dateStyle: 'medium', timeStyle: 'short' }) : '');++/** The task's saved answer as its parts: the answer, the list of what it did, and the note that something needed a yes ("What it did" is how the host writes it, server/task-report.mjs). */+export function splitTaskOutput(output: string): { found: string; did: string[]; attention: string } {+ let text = String(output ?? '').trim();+ let attention = '';+ const note = /\n\n> ([\s\S]*)$/.exec(text);+ if (note) { attention = note[1].replace(/\n> /g, '\n').trim(); text = text.slice(0, note.index).trim(); }+ const cut = /\n\n---\n\n\*\*What it did\*\*\n\n([\s\S]*)$/.exec(text);+ const did = cut ? cut[1].split('\n').map(l => l.replace(/^-\s*/, '').trim()).filter(Boolean) : [];+ return { found: (cut ? text.slice(0, cut.index) : text).trim(), did, attention };+}++export const taskHandoverTitle = (task: Task) => tr('Continuing from the task “{0}”', [task.title]);++export function taskHandoverMessage(task: Task): string {+ const failed = !!task.error;+ const ran = when(task.lastRunAt);+ const head = `**${taskHandoverTitle(task)}**${ran ? ` ${failed ? tr('(ran {0}, did not finish).', [ran]) : tr('(ran {0}, finished).', [ran])}` : ''}`;+ const parts = [head];+ if (failed) parts.push(`**${tr('What went wrong')}**\n\n${String(task.error).trim()}`);+ 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')}`);+ 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.'));+ return parts.join('\n\n');+}diff --git a/apps/host/src/lib/tasks.ts b/apps/host/src/lib/tasks.tsindex c19e20750..303dca5c1 100644--- a/apps/host/src/lib/tasks.ts+++ b/apps/host/src/lib/tasks.ts@@ -1,2 +1,2 @@-export interface Task { id?: string; title: string; prompt: string; frequency: string; at: string; weekday: number; timeZone: string; mode?: 'plan' | 'manual' | 'bypass'; enabled: boolean; archived?: boolean; nextRunAt?: string; lastRunAt?: string; status?: string; output?: string; demo?: boolean; error?: string; attention?: string | null; }+export interface Task { id?: string; title: string; prompt: string; frequency: string; at: string; weekday: number; timeZone: string; mode?: 'plan' | 'manual' | 'bypass'; enabled: boolean; archived?: boolean; nextRunAt?: string; lastRunAt?: string; status?: string; output?: string; demo?: boolean; error?: string; attention?: string | null; /** The files the last run made or changed (name, full path). */ files?: { name: string; path: string }[]; }export const blankTask = (): Task => ({ title:'', prompt:'', frequency:'daily', at:'09:00', weekday:1, timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone, mode:'bypass', enabled:true });diff --git a/apps/host/src/lib/types.ts b/apps/host/src/lib/types.tsindex fac118a1f..c0c7ee2d4 100644--- a/apps/host/src/lib/types.ts+++ b/apps/host/src/lib/types.ts@@ -322,6 +322,8 @@ export interface ChatMessage {planId?: string;/** The reply in the order it came: text and grouped activity lines (round 8, item 12). Absent on older replies. */blocks?: import('./deliverables').MessageBlock[];+ /** The saved skills this reply used (the line under the answer), in the order they were loaded. */+ skills?: { name: string; description: string }[];/** Files the assistant made or changed in this reply, one card each. */deliverables?: import('./deliverables').Deliverable[];/** A line from the app itself (for example from /loop), never sent to the model. */diff --git a/apps/host/src/locales/de.json b/apps/host/src/locales/de.jsonindex 9961bdfda..c0d69575d 100644--- a/apps/host/src/locales/de.json+++ b/apps/host/src/locales/de.json@@ -3162,5 +3162,16 @@"s3166": "Lade zuerst ein Modell, das Bilder lesen kann, und füge dann das Bild hinzu.","s3167": "Dieses Modell wurde ohne Bilderkennung gestartet. Öffne Modelle, schalte „Bilder lesen“ ein und lade es erneut.","s3168": "Dieses Modell kann keine Bilder lesen. Wähle ein Modell, das Bilder lesen kann, oder entferne das Bild.",- "s3169": "Es ist in der Vorschau geöffnet."+ "s3169": "Es ist in der Vorschau geöffnet.",+ "s3170": "1 Skill verwendet: {0}",+ "s3171": "{0} Skills verwendet: {1}",+ "s3172": "In neuem Chat fortsetzen",+ "s3173": "Weiter mit der Aufgabe „{0}“",+ "s3174": "(lief {0}, abgeschlossen).",+ "s3175": "(lief {0}, nicht abgeschlossen).",+ "s3176": "Was sie gefunden hat",+ "s3177": "Braucht deine Aufmerksamkeit",+ "s3178": "Was sie getan hat",+ "s3179": "Dateien",+ "s3180": "Bitte hilf mir, von hier aus weiterzumachen."}diff --git a/apps/host/src/locales/en.json b/apps/host/src/locales/en.jsonindex ec270e7f2..e48e52a79 100644--- a/apps/host/src/locales/en.json+++ b/apps/host/src/locales/en.json@@ -3162,5 +3162,16 @@"s3166": "Load a model that reads pictures first, then add the picture.","s3167": "This model was started without picture reading. Open Models, turn on Read pictures and load it again.","s3168": "This model cannot read pictures. Choose a model that reads pictures, or remove the picture.",- "s3169": "It is open in preview."+ "s3169": "It is open in preview.",+ "s3170": "Used 1 skill: {0}",+ "s3171": "Used {0} skills: {1}",+ "s3172": "Continue in a new chat",+ "s3173": "Continuing from the task “{0}”",+ "s3174": "(ran {0}, finished).",+ "s3175": "(ran {0}, did not finish).",+ "s3176": "What it found",+ "s3177": "Needs your attention",+ "s3178": "What it did",+ "s3179": "Files",+ "s3180": "Please help me take it from here."}diff --git a/apps/host/src/locales/es.json b/apps/host/src/locales/es.jsonindex 8c301a224..2412d64e4 100644--- a/apps/host/src/locales/es.json+++ b/apps/host/src/locales/es.json@@ -3162,5 +3162,16 @@"s3166": "Primero carga un modelo que lea imágenes y luego añade la imagen.","s3167": "Este modelo se inició sin lectura de imágenes. Abre Modelos, activa «Leer imágenes» y cárgalo de nuevo.","s3168": "Este modelo no puede leer imágenes. Elige un modelo que lea imágenes o quita la imagen.",- "s3169": "Está abierta en la vista previa."+ "s3169": "Está abierta en la vista previa.",+ "s3170": "Se usó 1 habilidad: {0}",+ "s3171": "Se usaron {0} habilidades: {1}",+ "s3172": "Continuar en un chat nuevo",+ "s3173": "Continuando desde la tarea «{0}»",+ "s3174": "(se ejecutó {0}, terminada).",+ "s3175": "(se ejecutó {0}, no terminó).",+ "s3176": "Qué encontró",+ "s3177": "Necesita tu atención",+ "s3178": "Qué hizo",+ "s3179": "Archivos",+ "s3180": "Ayúdame a continuar desde aquí."}diff --git a/apps/host/src/locales/ja.json b/apps/host/src/locales/ja.jsonindex 4c1778524..b0dbb42a4 100644--- a/apps/host/src/locales/ja.json+++ b/apps/host/src/locales/ja.json@@ -3162,5 +3162,16 @@"s3166": "まず画像を読み取れるモデルを読み込んでから、画像を追加してください。","s3167": "このモデルは画像の読み取りなしで起動されました。モデルを開き、「画像を読み取る」をオンにして読み込み直してください。","s3168": "このモデルは画像を読み取れません。画像を読み取れるモデルを選ぶか、画像を取り除いてください。",- "s3169": "画像はプレビューで開いています。"+ "s3169": "画像はプレビューで開いています。",+ "s3170": "スキルを 1 つ使いました:{0}",+ "s3171": "スキルを {0} 個使いました:{1}",+ "s3172": "新しいチャットで続ける",+ "s3173": "タスク「{0}」の続きです",+ "s3174": "({0} に実行、完了)。",+ "s3175": "({0} に実行、完了せず)。",+ "s3176": "分かったこと",+ "s3177": "確認が必要なこと",+ "s3178": "実行した内容",+ "s3179": "ファイル",+ "s3180": "ここから先を手伝ってください。"}diff --git a/apps/host/src/locales/ko.json b/apps/host/src/locales/ko.jsonindex 9255cac48..4a0e1927e 100644--- a/apps/host/src/locales/ko.json+++ b/apps/host/src/locales/ko.json@@ -3162,5 +3162,16 @@"s3166": "먼저 이미지를 읽을 수 있는 모델을 불러온 다음 이미지를 추가하세요.","s3167": "이 모델은 이미지 읽기 없이 시작되었습니다. 모델에서 '이미지 읽기'를 켜고 다시 불러오세요.","s3168": "이 모델은 이미지를 읽을 수 없습니다. 이미지를 읽는 모델을 고르거나 이미지를 제거하세요.",- "s3169": "미리보기에서 열려 있습니다."+ "s3169": "미리보기에서 열려 있습니다.",+ "s3170": "스킬 1개 사용: {0}",+ "s3171": "스킬 {0}개 사용: {1}",+ "s3172": "새 채팅에서 이어가기",+ "s3173": "작업 ‘{0}’에서 이어갑니다",+ "s3174": "({0}에 실행, 완료).",+ "s3175": "({0}에 실행, 끝나지 못함).",+ "s3176": "확인한 내용",+ "s3177": "확인이 필요한 내용",+ "s3178": "수행한 내용",+ "s3179": "파일",+ "s3180": "여기서부터 이어서 도와주세요."}diff --git a/apps/host/src/locales/pt.json b/apps/host/src/locales/pt.jsonindex 4d4e876ad..20ac1d2b6 100644--- a/apps/host/src/locales/pt.json+++ b/apps/host/src/locales/pt.json@@ -3162,5 +3162,16 @@"s3166": "Carregue primeiro um modelo que leia imagens e depois adicione a imagem.","s3167": "Este modelo foi iniciado sem leitura de imagens. Abra Modelos, ative «Ler imagens» e carregue-o novamente.","s3168": "Este modelo não consegue ler imagens. Escolha um modelo que leia imagens ou remova a imagem.",- "s3169": "Ela está aberta na visualização."+ "s3169": "Ela está aberta na visualização.",+ "s3170": "Usou 1 habilidade: {0}",+ "s3171": "Usou {0} habilidades: {1}",+ "s3172": "Continuar em um novo chat",+ "s3173": "Continuando a partir da tarefa “{0}”",+ "s3174": "(executada em {0}, concluída).",+ "s3175": "(executada em {0}, não terminou).",+ "s3176": "O que encontrou",+ "s3177": "Precisa da sua atenção",+ "s3178": "O que fez",+ "s3179": "Arquivos",+ "s3180": "Por favor, ajude-me a continuar daqui."}diff --git a/apps/host/src/locales/ru.json b/apps/host/src/locales/ru.jsonindex 32825beac..29281f94b 100644--- a/apps/host/src/locales/ru.json+++ b/apps/host/src/locales/ru.json@@ -3162,5 +3162,16 @@"s3166": "Сначала загрузите модель, которая читает картинки, затем добавьте картинку.","s3167": "Эта модель была запущена без чтения картинок. Откройте Модели, включите «Читать картинки» и загрузите её снова.","s3168": "Эта модель не умеет читать картинки. Выберите модель, которая их читает, или уберите картинку.",- "s3169": "Она открыта в предпросмотре."+ "s3169": "Она открыта в предпросмотре.",+ "s3170": "Использован 1 навык: {0}",+ "s3171": "Использовано навыков: {0}: {1}",+ "s3172": "Продолжить в новом чате",+ "s3173": "Продолжаем задачу «{0}»",+ "s3174": "(запускалась {0}, завершена).",+ "s3175": "(запускалась {0}, не завершена).",+ "s3176": "Что она нашла",+ "s3177": "Требует вашего внимания",+ "s3178": "Что она сделала",+ "s3179": "Файлы",+ "s3180": "Помогите мне продолжить отсюда."}diff --git a/apps/host/src/locales/zh.json b/apps/host/src/locales/zh.jsonindex 3d596a06b..a7a4d09de 100644--- a/apps/host/src/locales/zh.json+++ b/apps/host/src/locales/zh.json@@ -3162,5 +3162,16 @@"s3166": "请先加载能读取图片的模型,再添加图片。","s3167": "此模型启动时没有开启图片读取。请打开“模型”,开启“读取图片”后重新加载。","s3168": "此模型无法读取图片。请选择能读取图片的模型,或移除图片。",- "s3169": "图片已在预览中打开。"+ "s3169": "图片已在预览中打开。",+ "s3170": "使用了 1 个技能:{0}",+ "s3171": "使用了 {0} 个技能:{1}",+ "s3172": "在新聊天中继续",+ "s3173": "接着任务“{0}”继续",+ "s3174": "({0} 运行,已完成)。",+ "s3175": "({0} 运行,未完成)。",+ "s3176": "它的发现",+ "s3177": "需要你关注",+ "s3178": "它做了什么",+ "s3179": "文件",+ "s3180": "请帮我从这里继续。"}diff --git a/apps/host/src/screens/Chat.tsx b/apps/host/src/screens/Chat.tsxindex 93c40ef8c..f7e06c0b2 100644--- a/apps/host/src/screens/Chat.tsx+++ b/apps/host/src/screens/Chat.tsx@@ -23,7 +23,7 @@ import { GoalBar } from '../components/GoalBar';import { PlanCard, PlanPanel, QueuedMessages } from '../components/PlanCard';import { FolderChip } from '../components/FolderChip';import { DropZone, DROP_EVENT, pastedFiles } from '../components/DropZone';-import { ActivityLine, EditedFiles, FileCard } from '../components/Deliverables';+import { ActivityLine, EditedFiles, FileCard, SkillsUsed } from '../components/Deliverables';import { queueMessage, usePlan, usePlanQuiet } from '../lib/plan';import { plainFailureText } from '../lib/plain-errors';import { useLiveStatus } from '../lib/live-status';@@ -622,6 +622,7 @@ function Message({ message: m, isLast, onEditPrompt, onPreview, onOpenLink, onOp</span>) : null)}{tr(m.streaming && m.content ? <span className="caret" aria-hidden="true"/> : null)}</div> : null)}+ {tr(m.skills?.length && !m.streaming ? <SkillsUsed skills={m.skills}/> : null)}{tr(m.deliverables?.length && !m.streaming ? <div className="deliverables">{m.deliverables.map(f => <FileCard key={f.path} file={f} sessionId={activeSession ?? ''} onPreview={onPreview}/>)}<EditedFiles files={m.deliverables} sessionId={activeSession ?? ''} onPreview={onPreview}/></div> : null)}{tr(m.streaming && isLast && !m.timeSkipId ? <StatusLine sessionId={activeSession} startedAt={Date.parse(m.at) || Date.now()} tokens={m.tokens}/> : null)}diff --git a/apps/host/src/screens/Tasks.tsx b/apps/host/src/screens/Tasks.tsxindex 98082a5ac..971ff0f6b 100644--- a/apps/host/src/screens/Tasks.tsx+++ b/apps/host/src/screens/Tasks.tsx@@ -6,7 +6,7 @@ import { Btn, Dialog, Icon, IconBtn, Select, ErrorNotice } from '../components/uimport { Markdown } from '../components/Markdown';import { Screen } from '../components/layout';import { api } from '../lib/client';-import { pushToast, useStore } from '../lib/store';+import { continueTaskInNewChat, pushToast, useStore } from '../lib/store';import { blankTask as blank, type Task } from '../lib/tasks';import { TaskEditor } from '../components/TaskEditor';import { TaskDetail } from '../components/TaskDetail';@@ -71,6 +71,7 @@ export function TasksScreen() {<IconBtn name={currentTask.enabled ? 'pause' : 'play'} title={tr(currentTask.enabled ? "Pause {0}" : "Resume {0}", [currentTask.title])} disabled={pending || currentTask.status === 'running' || !!currentTask.archived} onClick={() => void action(() => api.patch(`/api/tasks/${currentTask.id}`, { enabled: !currentTask.enabled }))}/><IconBtn name="trash" title={tr("Delete {0}", [currentTask.title])} disabled={pending || !!currentTask.archived} onClick={() => setRemoveTask(true)}/><Btn icon="pencil" disabled={pending || currentTask.status === 'running'} onClick={() => open(currentTask)}>{tr("Edit")}</Btn>+ {tr(currentTask.lastRunAt || currentTask.output || currentTask.error ? <Btn icon="chat" disabled={pending || currentTask.status === 'running'} onClick={() => continueTaskInNewChat(currentTask)}>{tr("Continue in a new chat")}</Btn> : null)}<Btn variant="primary" icon={currentTask.status === 'running' ? 'stop' : 'bolt'} disabled={pending || !loaded && currentTask.status !== 'running'} onClick={() => void action(() => api.post(`/api/tasks/${currentTask.id}/${currentTask.status === 'running' ? 'stop' : 'run'}`))}>{tr(currentTask.status === 'running' ? 'Stop' : 'Run now')}</Btn></div> : null;return <Screen title={currentTask ? <span className="sr-only">{currentTask.title}</span> : "Tasks"} sub={currentTask ? undefined : "Run a prompt on a schedule, or whenever you need it."} actions={currentTask ? taskHeader : <div className="tasks-actions"><input className="st-input tasks-search" type="search" aria-label={tr("Search tasks")} placeholder={tr("Search tasks…")} value={query} onChange={e => setQuery(e.target.value)}/><Select ariaLabel={tr("Sort tasks")} value={sort} options={[{ value: 'next', label: 'Next run' }, { value: 'name', label: 'Name' }]} onChange={setSort}/><IconBtn name="plus" title={tr("New task")} onClick={() => open(blank())}/></div>}>diff --git a/apps/host/src/styles/app.css b/apps/host/src/styles/app.cssindex 30eecbcc0..5c615af72 100644--- a/apps/host/src/styles/app.css+++ b/apps/host/src/styles/app.css@@ -7443,6 +7443,8 @@ textarea {.act__live { width: 6px; height: 6px; border-radius: 50%; background: var(--st-accent); animation: plan-glow 1.8s ease-out infinite; }.act__thumb { width: 44px; height: 30px; object-fit: cover; border-radius: 6px; border: 1px solid var(--st-line); cursor: pointer; }.act__files { flex-basis: 100%; list-style: none; margin: 0; padding: 0 0 0 4px; display: flex; flex-direction: column; }+.act__skill { display: inline-flex; align-items: center; gap: 8px; padding: 4px 0; color: var(--st-ink-soft); }+.act__skill .small { margin-left: 6px; }.act__files button { display: inline-flex; align-items: center; gap: 8px; padding: 4px 0; border: 0; background: transparent; color: var(--st-ink-soft); font: inherit; cursor: pointer; }@media (prefers-reduced-motion: reduce) { .act__live, .fcard__chev, .act__chev { animation: none; transition: none; } }diff --git a/apps/host/tests/helpers/scripted-worker.mjs b/apps/host/tests/helpers/scripted-worker.mjsindex 73c7c5de7..360c6ecd5 100644--- a/apps/host/tests/helpers/scripted-worker.mjs+++ b/apps/host/tests/helpers/scripted-worker.mjs@@ -26,6 +26,7 @@* SCRIPT:goalstep one goal round: get_goal, then update_goal complete, then a short closing text* SCRIPT:planreply a reply ending with a numbered plan of three steps (each step's text carries SCRIPT:goalstep)* SCRIPT:call <tool> <json> one call to any tool with the given JSON arguments+ * SCRIPT:multi <json> {"calls":[[tool,args],...],"say":"final text"}: all the calls in one reply, then the text once their results are in** A request whose last message is a tool result is answered with a text that quotes the result.*/@@ -158,6 +159,15 @@ export async function startScriptedWorker({ port = 0, chunkDelayMs = 40, model =try { callArgs = JSON.parse(at < 0 ? '{}' : args.slice(at + 1).replace(/\s+#\d+.*$/, '')); } catch { /* an unparsable script argument is a test bug; send no arguments */ }return toolCall(at < 0 ? args : args.slice(0, at), callArgs);}+ if (name === 'multi') {+ let cfg = {};+ try { cfg = JSON.parse(args.trim()); } catch { /* a test bug: no calls */ }+ if (toolMessages.length) return say([String(cfg.say ?? 'Done.')]);+ send({ role: 'assistant', content: '', reasoning_content: 'I will use the tools.' });+ await delay(chunkDelayMs);+ (cfg.calls ?? []).forEach(([tool, callArgs], i) => send({ tool_calls: [{ index: i, id: `call_${requests.length}_${i}`, type: 'function', function: { name: tool, arguments: JSON.stringify(callArgs ?? {}) } }] }));+ return finish('tool_calls', 20);+ }if (name === 'spawn') {// A settlement notice (or any later user-role message) after this prompt already got its tool round: just answer.if (messages.slice(promptAt + 1).some(m => m.role === 'assistant') && last.role === 'user') {diff --git a/apps/host/tests/skills-used.test.mjs b/apps/host/tests/skills-used.test.mjsnew file mode 100644index 000000000..66638becd--- /dev/null+++ b/apps/host/tests/skills-used.test.mjs@@ -0,0 +1,85 @@+/** "Used 2 skills: Weekly report, Brand voice" under an answer: the skills a turn loaded, with the name the person gave and a one-line description. */+import test from 'node:test';+import assert from 'node:assert/strict';+import { mkdtempSync, mkdirSync, rmSync } from 'node:fs';+import { tmpdir } from 'node:os';+import { join } from 'node:path';+import { readFile } from 'node:fs/promises';+import { transform } from 'esbuild';+import { startScriptedWorker } from './helpers/scripted-worker.mjs';+import { createAgentBridge } from '../server/agent/agent-bridge.mjs';+import { resolveHarness } from '../server/agent/harness-runtime.mjs';+import { materializeSkills } from '../server/skill-files.mjs';+import { SkillsUsed, skillInfoFrom, skillLabel } from '../server/agent/skills-used.mjs';++const skip = !process.env.STRATA_HARNESS_DIR || !resolveHarness({ env: process.env }).ok ? 'STRATA_HARNESS_DIR is not set to a built Harness' : false;+const cleanup = dir => { try { rmSync(dir, { recursive: true, force: true, maxRetries: 3 }); } catch { /* best effort */ } };++test('a skill is reported once, when it has worked, with the whole list so far', () => {+ const frames = [];+ const used = new SkillsUsed({ emit: f => frames.push(f) });+ used.card({ name: 'skill', state: 'running', args: { name: 'weekly-report' } });+ used.card({ name: 'read', state: 'done', args: { name: 'x' } });+ assert.equal(frames.length, 0, 'not while running, not for another tool');+ used.card({ name: 'skill', state: 'done', args: { name: 'weekly-report' } });+ used.card({ name: 'skill', state: 'done', args: { name: 'weekly-report' } });+ used.card({ name: 'skill', state: 'error', args: { name: 'brand-voice' } });+ used.card({ name: 'skill', state: 'done', args: { name: 'brand-voice' } });+ assert.equal(frames.length, 2);+ assert.deepEqual(frames[1], { type: 'skills-used', skills: [{ name: 'Weekly report', description: '' }, { name: 'Brand voice', description: '' }] });+});++test('the name and description come from the skill file the app wrote; a folder name is made readable', () => {+ const dir = mkdtempSync(join(tmpdir(), 'strata-su-'));+ try {+ materializeSkills(dir, [{ id: 'my-weekly-report', name: 'Weekly report', description: 'Turns notes into a short status update', body: 'Be short.', enabled: true }]);+ const info = skillInfoFrom(dir);+ assert.deepEqual(info('weekly-report'), { name: 'Weekly report', description: 'Turns notes into a short status update' });+ assert.deepEqual(info('brand-voice'), { name: 'Brand voice', description: '' });+ assert.deepEqual(info('../../etc/passwd'), { name: skillLabel('../../etc/passwd'), description: '' }, 'a path is never read');+ } finally { cleanup(dir); }+});++test('the page keeps the list on the reply (readSkills) and tolerates a bad frame', async () => {+ const source = await readFile(new URL('../src/lib/deliverables.ts', import.meta.url), 'utf8');+ const { code } = await transform(source.replace(/^import .*$/gm, ''), { loader: 'ts', format: 'esm' });+ const { readSkills } = await import(`data:text/javascript;base64,${Buffer.from(code).toString('base64')}`);+ assert.deepEqual(readSkills({ skills: [{ name: 'A', description: 'd' }, { name: '' }, null, { name: 'B' }] }), [{ name: 'A', description: 'd' }, { name: 'B', description: '' }]);+ assert.deepEqual(readSkills({}), []); assert.deepEqual(readSkills(null), []);+});++test('real Harness: loading two saved skills in a turn sends one skills-used frame per skill, then both are listed', { skip }, async (t) => {+ const worker = await startScriptedWorker({});+ const dir = mkdtempSync(join(tmpdir(), 'strata-su-run-')); const ws = join(dir, 'ws'); mkdirSync(ws, { recursive: true });+ const live = join(dir, 'skills-live');+ materializeSkills(live, [+ { id: 'my-weekly-report', name: 'Weekly report', description: 'Turns notes into a short status update', body: 'Be short.', enabled: true },+ { id: 'my-brand-voice', name: 'Brand voice', description: 'Plain, friendly, no jargon', body: 'Write plainly.', enabled: true },+ ]);+ const bridge = createAgentBridge({ dataDir: dir, localInstances: () => [{ id: 'i', label: 'Scripted', baseUrl: worker.url, modelId: 'scripted-model', context: 32768, slots: 2 }], connections: () => [], skillsDir: () => live, env: process.env, startTimeoutMs: 90_000 });+ t.after(async () => { await bridge.close(); await worker.close(); cleanup(dir); });+ const turn = async (chatId, args) => { const frames = []; await bridge.runTurn({ chatId, message: `SCRIPT:call skill ${JSON.stringify(args)}`, workspacePath: ws, mode: 'bypass', onFrame: f => frames.push(f) }); return frames.filter(f => f.type === 'skills-used'); };+ const first = await turn('su', { name: 'weekly-report' });+ assert.equal(first.length, 1);+ assert.deepEqual(first[0].skills, [{ name: 'Weekly report', description: 'Turns notes into a short status update' }]);+ const none = await turn('su2', { name: 'does-not-exist' });+ assert.equal(none.length, 0, 'a skill that could not be loaded is not listed');+});++test('real Harness: two skills in one answer are listed together, in the order they were loaded', { skip }, async (t) => {+ const worker = await startScriptedWorker({});+ const dir = mkdtempSync(join(tmpdir(), 'strata-su-two-')); const ws = join(dir, 'ws'); mkdirSync(ws, { recursive: true });+ const live = join(dir, 'skills-live');+ materializeSkills(live, [+ { id: 'my-weekly-report', name: 'Weekly report', description: 'Turns notes into a short status update', body: 'Be short.', enabled: true },+ { id: 'my-brand-voice', name: 'Brand voice', description: 'Plain, friendly, no jargon', body: 'Write plainly.', enabled: true },+ ]);+ const bridge = createAgentBridge({ dataDir: dir, localInstances: () => [{ id: 'i', label: 'Scripted', baseUrl: worker.url, modelId: 'scripted-model', context: 32768, slots: 2 }], connections: () => [], skillsDir: () => live, env: process.env, startTimeoutMs: 90_000 });+ t.after(async () => { await bridge.close(); await worker.close(); cleanup(dir); });+ const frames = [];+ await bridge.runTurn({ chatId: 'two', message: `SCRIPT:multi ${JSON.stringify({ calls: [['skill', { name: 'weekly-report' }], ['skill', { name: 'brand-voice' }]], say: 'Here is the note.' })}`, workspacePath: ws, mode: 'bypass', onFrame: f => frames.push(f) });+ const last = frames.filter(f => f.type === 'skills-used').at(-1);+ assert.deepEqual(last.skills.map(s => s.name).sort(), ['Brand voice', 'Weekly report']);+ assert.match(frames.filter(f => f.type === 'delta').map(f => f.text).join(''), /Here is the note\./);+ assert.ok(frames.findIndex(f => f.type === 'skills-used') < frames.findIndex(f => f.type === 'done'), 'the list arrives before the answer is done');+});diff --git a/apps/host/tests/task-handover.test.mjs b/apps/host/tests/task-handover.test.mjsnew file mode 100644index 000000000..74c5918ac--- /dev/null+++ b/apps/host/tests/task-handover.test.mjs@@ -0,0 +1,59 @@+/** "Continue in a new chat" on a task: the first message of the new chat carries what the task found, did, and the files it made. */+import test from 'node:test';+import assert from 'node:assert/strict';+import { build } from 'esbuild';+import { createAgentTaskRunner } from '../server/agent/task-run.mjs';+import { createTaskService } from '../server/tasks.mjs';++const compiled = await build({ stdin: { contents: "export * from './src/lib/task-handover'; export * from './src/lib/i18n';", resolveDir: process.cwd() }, bundle: true, write: false, format: 'esm', platform: 'node', loader: { '.json': 'json' } });+const { splitTaskOutput, taskHandoverMessage, taskHandoverTitle, setTranslationLanguage } = await import(`data:text/javascript;base64,${Buffer.from(compiled.outputFiles[0].text).toString('base64')}`);++const OUTPUT = 'Two things need your attention.\n\n- Disk space is low.\n- The card ran hot twice.\n\n---\n\n**What it did**\n\n- Read the temperature log\n- Checked free space on C: and D:\n\n> This task wanted to change something and needed a yes. Nothing was changed.';+const task = { id: 't', title: 'Hardware check', prompt: 'Check it', frequency: 'daily', at: '08:00', weekday: 1, timeZone: 'UTC', enabled: true, lastRunAt: '2026-10-18T06:00:00.000Z', output: OUTPUT,+ files: [{ name: 'report.md', path: 'C:\\Users\\you\\Documents\\Strata\\Workspace\\report.md' }] };++test('the saved answer is split into what it found, what it did, and the note that needed a yes', () => {+ const parts = splitTaskOutput(OUTPUT);+ assert.equal(parts.found, 'Two things need your attention.\n\n- Disk space is low.\n- The card ran hot twice.');+ assert.deepEqual(parts.did, ['Read the temperature log', 'Checked free space on C: and D:']);+ assert.match(parts.attention, /needed a yes/);+ assert.deepEqual(splitTaskOutput('Just an answer.'), { found: 'Just an answer.', did: [], attention: '' });+ assert.deepEqual(splitTaskOutput(''), { found: '', did: [], attention: '' });+});++test('the first message names the task and carries the findings, the steps, the files and a next step', () => {+ setTranslationLanguage('en');+ const text = taskHandoverMessage(task);+ assert.match(text, /^\*\*Continuing from the task “Hardware check”\*\* \(ran .*, finished\)\./);+ for (const part of ['**What it found**', 'Disk space is low.', '**Needs your attention**', 'needed a yes', '**What it did**', '- Read the temperature log', '**Files**', '- C:\\Users\\you\\Documents\\Strata\\Workspace\\report.md', 'Please help me take it from here.']) assert.ok(text.includes(part), part);+ assert.ok(text.indexOf('What it found') < text.indexOf('What it did') && text.indexOf('What it did') < text.indexOf('Files'), 'in reading order');+ assert.equal(taskHandoverTitle(task), 'Continuing from the task “Hardware check”');+});++test('a task that did not finish says what went wrong; a task with no files has no Files part', () => {+ setTranslationLanguage('en');+ const failed = taskHandoverMessage({ ...task, error: 'The model is not reachable.', output: '', files: [] });+ assert.match(failed, /did not finish/); assert.match(failed, /\*\*What went wrong\*\*\n\nThe model is not reachable\./);+ assert.ok(!failed.includes('**Files**') && !failed.includes('**What it found**'));+});++test('the labels follow the language of the app', () => {+ setTranslationLanguage('de');+ const text = taskHandoverMessage(task);+ assert.match(text, /Weiter mit der Aufgabe „Hardware check“/); assert.match(text, /\*\*Was sie gefunden hat\*\*/); assert.match(text, /Dateien/);+ setTranslationLanguage('en');+});++test('a scheduled run keeps the files the agent made, and a later failed run does not keep the old ones', async () => {+ const frames = [{ type: 'delta', text: 'Done.' }, { type: 'deliverable', abs: '/w/report.md', name: 'report.md', path: 'report.md' }, { type: 'deliverable', abs: '/w/report.md', name: 'report.md', path: 'report.md' }];+ const agent = { runTurn: async ({ onFrame }) => { for (const f of frames) onFrame(f); }, stop: async () => {}, forget() {}, approve: async () => {} };+ const run = createAgentTaskRunner({ agent, choice: () => ({ instanceId: 'i' }), workspace: '/w' });+ let store = [];+ const service = createTaskService({ read: () => store, write: v => { store = v; }, run });+ const saved = service.put({ title: 'T', prompt: 'p', frequency: 'daily', at: '08:00', timeZone: 'UTC' });+ await service.execute(saved.id);+ assert.deepEqual(service.list()[0].files, [{ name: 'report.md', path: '/w/report.md' }]);+ frames.length = 0; frames.push({ type: 'error', message: 'boom' });+ await service.execute(saved.id);+ assert.equal(service.list()[0].status, 'error'); assert.deepEqual(service.list()[0].files, []);+});