From 85098708494643ae5daefd872d3caceff52e43b7 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Fri, 16 Oct 2026 22:25:56 +0200 Subject: [PATCH 1/4] Round 8: compact segmented Computer use, version chevron and panel gap, download details only when useful, immediate download progress, Models screens no longer follow every monitor tick --- apps/host/server/engine-step.mjs | 2 +- apps/host/src/components/ChatModelPicker.tsx | 4 ++-- apps/host/src/components/FloatingMenu.tsx | 2 +- apps/host/src/components/LifecycleNotice.tsx | 4 ++-- apps/host/src/components/ManagedModelLibrary.tsx | 4 ++-- apps/host/src/components/NativeModels.tsx | 2 +- apps/host/src/components/VersionPicker.tsx | 2 +- apps/host/src/lib/native.ts | 10 ++++++++-- apps/host/src/lib/store.ts | 8 ++++++++ apps/host/src/screens/ModelRun.tsx | 4 ++-- apps/host/src/screens/Models.tsx | 4 ++-- apps/host/src/screens/Tuning.tsx | 4 ++-- apps/host/src/styles/app.css | 13 +++++++++++++ 13 files changed, 45 insertions(+), 18 deletions(-) diff --git a/apps/host/server/engine-step.mjs b/apps/host/server/engine-step.mjs index fa40d0e6..da774247 100644 --- a/apps/host/server/engine-step.mjs +++ b/apps/host/server/engine-step.mjs @@ -32,7 +32,7 @@ export function createEngineStep({ control, signal = null, onChange = () => {} } try { report = await control.updateCheck(); } catch (error) { - if (usable) { set({ state: 'skipped', message: 'The engine for this PC is installed.', details: 'The update server could not be reached, so a newer engine was not looked for.' }); return { ...part }; } + if (usable) { set({ state: 'skipped', message: 'The engine for this PC is installed.' }); return { ...part }; } throw error; } const engine = report.engine ?? {}; diff --git a/apps/host/src/components/ChatModelPicker.tsx b/apps/host/src/components/ChatModelPicker.tsx index eb0eeb4b..bc759c03 100644 --- a/apps/host/src/components/ChatModelPicker.tsx +++ b/apps/host/src/components/ChatModelPicker.tsx @@ -3,7 +3,7 @@ import { modelFamilyIcon } from '../lib/model-icons'; import { useId, useRef, useState } from 'react'; import { FloatingMenu } from './FloatingMenu'; import { Bar, Btn, Dialog, ErrorNotice, Icon } from './ui'; -import { go, lifecycleStatus, loadVariant, selectRemoteModel, setSettingsSection, useStore } from '../lib/store'; +import { go, useLifecycle, loadVariant, selectRemoteModel, setSettingsSection, useStore } from '../lib/store'; import { pickerGroups, pickerVersionState } from '../lib/model-picker'; import { versionFit } from '../lib/model-versions'; import type { ModelVariant } from '../lib/types'; @@ -28,7 +28,7 @@ function LegacyChatModelPicker() { const providers = useStore(s => s.providers), remote = useStore(s => s.remoteModel), streaming = useStore(s => s.streaming); const connection = providers?.connections.find(c => c.id === remote?.connectionId); const apiModel = connection?.models.find(m => m.id === remote?.modelId); - const lifecycle = lifecycleStatus(useStore(s => s)); + const lifecycle = useLifecycle(); const [open, setOpen] = useState(false), [selected, setSelected] = useState(null); const [pending, setPending] = useState(false), [error, setError] = useState(''); const [expanded, setExpanded] = useState([]); diff --git a/apps/host/src/components/FloatingMenu.tsx b/apps/host/src/components/FloatingMenu.tsx index ac6fcb3f..ab903435 100644 --- a/apps/host/src/components/FloatingMenu.tsx +++ b/apps/host/src/components/FloatingMenu.tsx @@ -14,7 +14,7 @@ export function FloatingMenu({ anchor, title, onClose, children, width = 232 }: const rect = anchor?.getBoundingClientRect(); const height = ref.current?.getBoundingClientRect().height ?? 200; const left = Math.max(12, Math.min(rect?.left ?? 12, window.innerWidth - Math.min(width, window.innerWidth - 24) - 12)); - const below = rect?.bottom ?? 12; + const below = (rect?.bottom ?? 12) + 8; // a little air between the button and its panel const top = below + height + 12 <= window.innerHeight ? below : Math.max(12, (rect?.top ?? window.innerHeight) - height - 6); setPlaced({ left, top }); ref.current?.querySelector('[role="menuitem"]:not(:disabled), [role="menuitemradio"]:not(:disabled)')?.focus(); diff --git a/apps/host/src/components/LifecycleNotice.tsx b/apps/host/src/components/LifecycleNotice.tsx index aa4cdcd1..30bd19c2 100644 --- a/apps/host/src/components/LifecycleNotice.tsx +++ b/apps/host/src/components/LifecycleNotice.tsx @@ -1,10 +1,10 @@ import { tr } from '../lib/i18n'; -import { go, lifecycleStatus, useStore } from '../lib/store'; +import { go, useLifecycle } from '../lib/store'; import { Btn } from './ui'; export function LifecycleNotice({ showScope = true }: { showScope?: boolean; }) { - const status = lifecycleStatus(useStore(s => s)); + const status = useLifecycle(); if (!showScope && status.allowed) return null; return
{tr(showScope ? {tr("Global \u00B7 all chats")} : null)}{tr(!status.allowed ? <>{tr(status.reason)} go('serving')}>{tr("View requests")} : null)}
; diff --git a/apps/host/src/components/ManagedModelLibrary.tsx b/apps/host/src/components/ManagedModelLibrary.tsx index ecedf0b2..5f69013d 100644 --- a/apps/host/src/components/ManagedModelLibrary.tsx +++ b/apps/host/src/components/ManagedModelLibrary.tsx @@ -10,7 +10,7 @@ import { familyVersion, modelFamilies, modelVersions, versionFit } from '../lib/ import { contextTokens, estimate, execution } from '../lib/experience'; import { planMemory } from '../lib/run-memory'; import type { ModelVariant } from '../lib/types'; -import { cancelInstall, installVariant, lifecycleStatus, loadVariant, removeVariant, runtimeModelAction, useStore } from '../lib/store'; +import { cancelInstall, installVariant, useLifecycle, loadVariant, removeVariant, runtimeModelAction, useStore } from '../lib/store'; export function ManagedModelLibrary({ contextOverride, familyOverride, selectedVariant, onChoose }: { contextOverride?: number; familyOverride?: string; @@ -19,7 +19,7 @@ export function ManagedModelLibrary({ contextOverride, familyOverride, selectedV }) { const library = useStore(s => s.library), hardware = useStore(s => s.hardware), engine = useStore(s => s.engine); const runtime = useStore(s => s.runtime), serving = useStore(s => s.serving); - const lifecycle = lifecycleStatus(useStore(s => s)); + const lifecycle = useLifecycle(); const [selected, setSelected] = useState(selectedVariant ?? ''); const [familyChoice, setFamilyChoice] = useState(familyOverride ?? ''); const [pending, setPending] = useState(false), [error, setError] = useState(''); diff --git a/apps/host/src/components/NativeModels.tsx b/apps/host/src/components/NativeModels.tsx index daddadb0..a8d6c9a1 100644 --- a/apps/host/src/components/NativeModels.tsx +++ b/apps/host/src/components/NativeModels.tsx @@ -171,4 +171,4 @@ catch (e) { } finally { setStopping(false); -} } return

{tr(job.kind === 'install' ? 'Preparing your model' : job.kind === 'load' ? 'Loading model' : job.kind === 'autotune' || job.kind === 'recheck' ? 'Tuning your model' : 'Engine operation')}

{tr(job.kind === 'install' || job.kind === 'load' || job.kind === 'autotune' || job.kind === 'recheck' ?
{tr(eta ? {eta} : null)} void stop()}>{tr(stopping ? 'Stopping…' : 'Stop')}
: null)}

{tr(job.kind === 'install' ? installStepLabel(job.result?.install?.step) : job.summary)}

{tr(download ? <>

{tr(download.file === 'model files' ? 'Model files' : download.file)} · {tr(download.percent ?? 0)}%{tr(Number.isFinite(download.done_gb) && Number.isFinite(download.total_gb) ? ` · ${download.done_gb!.toFixed(1)} / ${download.total_gb!.toFixed(1)} GB` : '')}

: null)}
{tr("Details")}

{tr("Completed files are retained. Downloading, packing and loading are separate stages; readiness is confirmed by the engine.")}

{tr(detailsText ?
{detailsText}
: null)}
{tr(error ? : null)}
; } +} } return

{tr(job.kind === 'install' ? 'Preparing your model' : job.kind === 'load' ? 'Loading model' : job.kind === 'autotune' || job.kind === 'recheck' ? 'Tuning your model' : 'Engine operation')}

{tr(job.kind === 'install' || job.kind === 'load' || job.kind === 'autotune' || job.kind === 'recheck' ?
{tr(eta ? {eta} : null)} void stop()}>{tr(stopping ? 'Stopping…' : 'Stop')}
: null)}

{tr(job.kind === 'install' ? installStepLabel(job.result?.install?.step) : job.summary)}

{tr(download ? <>

{tr(download.file === 'model files' ? 'Model files' : download.file)} · {tr(download.percent ?? 0)}%{tr(Number.isFinite(download.done_gb) && Number.isFinite(download.total_gb) ? ` · ${download.done_gb!.toFixed(1)} / ${download.total_gb!.toFixed(1)} GB` : '')}

: null)}{tr(detailsText ?
{tr("Details")}
{detailsText}
: null)}{tr(error ? : null)}
; } diff --git a/apps/host/src/components/VersionPicker.tsx b/apps/host/src/components/VersionPicker.tsx index 03939dc8..b173a737 100644 --- a/apps/host/src/components/VersionPicker.tsx +++ b/apps/host/src/components/VersionPicker.tsx @@ -55,7 +55,7 @@ export function VersionPicker({ versions, selectedId, hardware, onSelect, onOwnG {tr(open ? setOpen(false)}>
diff --git a/apps/host/src/lib/native.ts b/apps/host/src/lib/native.ts index 521c68f7..fdff0c0e 100644 --- a/apps/host/src/lib/native.ts +++ b/apps/host/src/lib/native.ts @@ -9,7 +9,9 @@ export interface NativeInstance {id:string;apiModelId:string;model:string;label: export interface NativeState {available:boolean;repo:string;downloadDirectory?:string;version?:string|null;summary:string;error:string|null;catalog:{families:NativeFamily[];contexts:number[];recommendation:{family:string|null;model:string|null;context?:number;why?:string};context_note:string}|null;installed:{models:{model:string;config:string;model_name:string;ready:boolean;context?:number;kv?:string;images?:string;visionEnabled?:boolean;visionDevice?:string;lowRamMode?:string;resourceProfile?:'work'|'performance';dataFolder?:string;diskGb?:number;diskBytes?:number;missing_files?:string[]}[];data_folder:string;engine:{version:string|null}}|null;hardware:{ram_gb:number;gpus:{index:number;name:string;vram_gb:number;usable:boolean}[]}|null;fields:NativeField[];instances:NativeInstance[];defaultId:string|null;jobs:NativeJob[];capabilities:{responses?:boolean;updates:boolean;rollback:boolean;calibration:boolean;componentUpdates?:boolean}} let state:NativeState|null=null,timer:ReturnType|null=null,reading:Promise|null=null; const listeners=new Set<()=>void>(); -export function refreshNative(force=false){if(reading)return reading;reading=api.get(`/api/native${force?'?refresh=1':''}`).then(value=>{state=value;listeners.forEach(fn=>fn());}).catch(error=>{if(state){state={...state,error:error.message,instances:state.instances.map(i=>({...i,metrics:null,phase:'unavailable'}))};listeners.forEach(fn=>fn());}}).finally(()=>{reading=null;});return reading;} +let again=false; +/** A forced refresh (after an action) never joins a read that began before the action: that read cannot know about the new job. It waits for it, then reads again. */ +export function refreshNative(force=false):Promise{if(reading){if(!force)return reading;if(again)return reading;again=true;return reading.then(()=>{again=false;return refreshNative(true);});}reading=api.get(`/api/native${force?'?refresh=1':''}`).then(value=>{if(state&&JSON.stringify(state)===JSON.stringify(value))return;state=value;listeners.forEach(fn=>fn());}).catch(error=>{if(state){state={...state,error:error.message,instances:state.instances.map(i=>({...i,metrics:null,phase:'unavailable'}))};listeners.forEach(fn=>fn());}}).finally(()=>{reading=null;});return reading;} export function useNative(){const value=useSyncExternalStore(fn=>{listeners.add(fn);return()=>listeners.delete(fn);},()=>state);useEffect(()=>{void refreshNative();if(!timer)timer=setInterval(()=>void refreshNative(),2500);return()=>{if(!listeners.size&&timer){clearInterval(timer);timer=null;}};},[]);return value;} export const nativeState=()=>state; /** Connection-list projection only; memory reservations are not inferred. */ @@ -17,6 +19,10 @@ export function nativeRouting(native:NativeState|null,hardware:Hardware|null):Ru if(!native?.instances.length)return null; return {revision:Date.now(),mode:'real',capabilities:{multipleModels:true,deviceAssignment:true},defaultId:native.defaultId,instances:native.instances.filter(i=>i.status==='ready').map(i=>({id:i.id,apiModelId:i.apiModelId,variantId:i.model,family:i.label,name:i.model,quant:i.model,loadedAt:i.loadedAt,status:'ready',phase:i.phase as RuntimeModels['instances'][number]['phase'],active:i.metrics?.live?.running??0,queued:i.metrics?.live?.queued??0,prompt:{done:0,total:0,pct:0},outputTps:i.metrics?.live?.tok_s??0,promptTps:i.metrics?.live?.prefill_tok_s_mean??0,context:{usedTokens:0,maxTokens:i.metrics?.engine?.max_context??i.context??0,pct:0},gpuIds:i.gpus.map(index=>{const g=hardware?.gpus.find(g=>g.index===index);return g?.id??`${g?.vendor??'native'}:${index}`;}),memory:{context:i.metrics?.engine?.max_context??i.context??0,ramGb:0,gpuGb:0,spillGb:0,reserveGb:0,totalGb:0,devices:[]}})),memory:{ramGb:0,budgetGb:0,reserveGb:0,totalGb:0,fits:true,devices:[]}}; } -export async function nativeAction(path:string,body:unknown={}){const result=await api.post(`/api/native/${path}`,body);await refreshNative(true);return result;} +export async function nativeAction(path:string,body:unknown={}){const result=await api.post(`/api/native/${path}`,body); + // A started operation is a job: show it at once instead of waiting for the next read (the owner saw download progress only after switching tabs). + const job=result as unknown as NativeJob|undefined; + if(state&&job&&typeof job.id==='string'&&path==='operations'&&!state.jobs.some(j=>j.id===job.id)){state={...state,jobs:[...state.jobs,job]};listeners.forEach(fn=>fn());} + await refreshNative(true);return result;} export {nativeVersionLabel} from './native-catalog'; diff --git a/apps/host/src/lib/store.ts b/apps/host/src/lib/store.ts index afec584a..aa089593 100644 --- a/apps/host/src/lib/store.ts +++ b/apps/host/src/lib/store.ts @@ -324,6 +324,14 @@ function libraryResponse(data: ModelLibrary): ModelLibrary { export function lifecycleStatus(s = state) { return lifecyclePolicy({ connected: s.connection === 'live', streaming: !!s.streaming || s.liveChats > 0, stats: s.serving?.stats, busy: s.busy }); } +/** The lifecycle status without subscribing to the whole store: a screen that only needs this must not redraw on every monitor tick (round 8, item 13). */ +export function useLifecycle() { + const connected = useStore(s => s.connection === 'live'); + const streaming = useStore(s => !!s.streaming || s.liveChats > 0); + const stats = useStore(s => s.serving?.stats); + const busy = useStore(s => s.busy); + return lifecyclePolicy({ connected, streaming, stats, busy }); +} export function lifecycleAvailable(): boolean { const result = lifecycleStatus(); if (!result.allowed) pushToast('warn', 'Model change unavailable', result.reason); diff --git a/apps/host/src/screens/ModelRun.tsx b/apps/host/src/screens/ModelRun.tsx index 904196ec..a4d8bc31 100644 --- a/apps/host/src/screens/ModelRun.tsx +++ b/apps/host/src/screens/ModelRun.tsx @@ -19,7 +19,7 @@ import { computerIdentity, configIdentity, defaultProfileKey, emptyProfiles, rea import { modelFamilyIcon } from '../lib/model-icons'; import { familyVersion, modelFamilies } from '../lib/model-versions'; import { sizeGb } from '../lib/format'; -import { applyImageModel, getState, lifecycleStatus, loadRuntimeModel, loadVariant, pushToast, restartEngine, saveEngine, selectImageModel, setConfigDraft, useStore, validateEngine } from '../lib/store'; +import { applyImageModel, getState, useLifecycle, loadRuntimeModel, loadVariant, pushToast, restartEngine, saveEngine, selectImageModel, setConfigDraft, useStore, validateEngine } from '../lib/store'; import type { ImageModelChoice, RuntimeModels, RuntimeModel } from '../lib/types'; import { useNative } from '../lib/native'; import { NativeModels } from '../components/NativeModels'; @@ -55,7 +55,7 @@ function LegacyModelRunScreen({ importFirst = false, initialVariant }: { const imageNeedsDownload = imageChoice !== 'off' && imageVersion?.state !== 'installed'; const imageUnavailable = imageChoice !== 'off' && !imageModels?.generationAvailable; const rawDraft = useStore(s => s.configDraft), connected = useStore(s => s.connection === 'live'); - const lifecycle = lifecycleStatus(useStore(s => s)); + const lifecycle = useLifecycle(); const [selected, setSelected] = useState(() => { if (initialVariant) return initialVariant; diff --git a/apps/host/src/screens/Models.tsx b/apps/host/src/screens/Models.tsx index 87573dfe..fc4669f9 100644 --- a/apps/host/src/screens/Models.tsx +++ b/apps/host/src/screens/Models.tsx @@ -11,7 +11,7 @@ import { contextTokens, estimate, execution } from '../lib/experience'; import { planMemory } from '../lib/run-memory'; import { useMedia } from '../lib/responsive'; import { formatModelName, sizeGb } from '../lib/format'; -import { cancelInstall, go, installVariant, loadVariant, removeVariant, unloadModel, useStore, lifecycleStatus } from '../lib/store'; +import { cancelInstall, go, installVariant, loadVariant, removeVariant, unloadModel, useStore, useLifecycle } from '../lib/store'; export function ModelsScreen({ embedded = false, ...props }: { embedded?: boolean; contextOverride?: number; @@ -28,7 +28,7 @@ function ModelLibraryScreen({ embedded = false, contextOverride, onChoose }: { } = {}) { const inlineDetails = useMedia('(max-width: 850px)'); const library = useStore(s => s.library), hardware = useStore(s => s.hardware), engine = useStore(s => s.engine); - const lifecycle = lifecycleStatus(useStore(s => s)); + const lifecycle = useLifecycle(); const [selected, setSelected] = useState(''), [selectedFamily, setSelectedFamily] = useState(''), [confirm, setConfirm] = useState<'switch' | 'delete' | null>(null), [pending, setPending] = useState(false), [error, setError] = useState(''); if (!library) return

{tr("Loading model versions\u2026")}

; diff --git a/apps/host/src/screens/Tuning.tsx b/apps/host/src/screens/Tuning.tsx index fb984f01..f76cba86 100644 --- a/apps/host/src/screens/Tuning.tsx +++ b/apps/host/src/screens/Tuning.tsx @@ -10,7 +10,7 @@ import type { Workload } from '../lib/experience'; import { ActionError, Btn, Dialog, ErrorNotice, Icon, Select } from '../components/ui'; import { Screen, SectionHead } from '../components/layout'; import { configDocument, configPatch, draftParams, readConfig, type ConfigDocument } from '../lib/config'; -import { useStore, setConfigDraft, saveEngine, restartEngine, validateEngine, pushToast, lifecycleAvailable, lifecycleStatus } from '../lib/store'; +import { useStore, setConfigDraft, saveEngine, restartEngine, validateEngine, pushToast, lifecycleAvailable, useLifecycle } from '../lib/store'; import type { BeginnerConfig, EngineConfig, ExpertParam } from '../lib/types'; type Issue = { level: 'warn' | 'error'; @@ -35,7 +35,7 @@ export function TuningScreen() { const [changedOnly, setChangedOnly] = useState(false); const [descriptions, setDescriptions] = useState(false); const [moreOpen, setMoreOpen] = useState(false); - const lifecycle = lifecycleStatus(useStore(s => s)); + const lifecycle = useLifecycle(); const [issues, setIssues] = useState([]); const [preview, setPreview] = useState(null); const [pending, setPending] = useState(false); diff --git a/apps/host/src/styles/app.css b/apps/host/src/styles/app.css index c7952d36..1fb56acf 100644 --- a/apps/host/src/styles/app.css +++ b/apps/host/src/styles/app.css @@ -7374,3 +7374,16 @@ textarea { .privacy-notes { padding: 2px 4px; } .plan__step[data-state="skipped"] { color: var(--st-ink-muted); text-decoration: line-through; } .plan__step[data-state="skipped"] .plan__text small { text-decoration: none; } + +/* Computer use: one compact segmented control on a single line (round 8, item 2) */ +.native-choice__col .native-resource-choice { display: inline-flex; align-self: flex-start; gap: 2px; padding: 3px; border: 1px solid var(--st-line); border-radius: 10px; background: var(--st-surface-2); max-width: 100%; } +.native-choice__col .native-resource-choice button { min-height: 0; height: 30px; padding: 0 14px; border: 0; border-radius: 8px; background: transparent; box-shadow: none; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; font-size: var(--st-fs-sm); color: var(--st-ink-soft); } +.native-choice__col .native-resource-choice button strong { font-weight: 600; font-size: inherit; } +.native-choice__col .native-resource-choice button > svg, .native-choice__col .native-resource-choice button > span + svg { display: none; } +.native-choice__col .native-resource-choice button[data-selected="true"] { background: var(--st-surface); color: var(--st-ink); box-shadow: var(--st-sh-card); } +.native-choice__col .native-resource-choice button:focus-visible { outline: 2px solid var(--st-accent); outline-offset: 1px; } + +/* the version dropdown's chevron turns when it opens (round 8, item 7) */ +.version-trigger__chev { transform: rotate(90deg); transition: transform var(--st-t-local, 160ms) var(--st-ease-in-out, ease); } +.version-trigger[aria-expanded="true"] .version-trigger__chev { transform: rotate(-90deg); } +@media (prefers-reduced-motion: reduce) { .version-trigger__chev { transition: none; } } From 9e2d698c9e6e9df4a7bca26b22ebd00cb55d2b2a Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Fri, 16 Oct 2026 22:35:54 +0200 Subject: [PATCH 2/4] Round 8: Models navbar family dropdown, deliverable cards with Open menu, Edited summary, grouped activity lines, text in order, drop zone, image generation hidden --- apps/host/src/components/ComposerControls.tsx | 6 +- apps/host/src/components/Deliverables.tsx | 73 ++++++++++++++ apps/host/src/components/DropZone.tsx | 21 ++++ apps/host/src/components/FamilySwitch.tsx | 30 ++++-- apps/host/src/components/NativeModels.tsx | 3 +- apps/host/src/lib/deliverables.ts | 96 +++++++++++++++++++ apps/host/src/lib/features.ts | 3 +- apps/host/src/lib/store.ts | 9 +- apps/host/src/lib/types.ts | 4 + apps/host/src/locales/de.json | 23 ++++- apps/host/src/locales/en.json | 23 ++++- apps/host/src/locales/es.json | 23 ++++- apps/host/src/locales/ja.json | 23 ++++- apps/host/src/locales/ko.json | 23 ++++- apps/host/src/locales/pt.json | 23 ++++- apps/host/src/locales/ru.json | 23 ++++- apps/host/src/locales/zh.json | 23 ++++- apps/host/src/screens/Chat.tsx | 18 ++-- apps/host/src/screens/ModelRun.tsx | 3 +- apps/host/src/styles/app.css | 68 +++++++++++-- apps/host/tests/engine-step.test.mjs | 2 +- apps/host/tests/ui6-deliverables.test.mjs | 36 +++++++ 22 files changed, 491 insertions(+), 65 deletions(-) create mode 100644 apps/host/src/components/Deliverables.tsx create mode 100644 apps/host/src/components/DropZone.tsx create mode 100644 apps/host/src/lib/deliverables.ts create mode 100644 apps/host/tests/ui6-deliverables.test.mjs diff --git a/apps/host/src/components/ComposerControls.tsx b/apps/host/src/components/ComposerControls.tsx index 485cfe97..fd680d8e 100644 --- a/apps/host/src/components/ComposerControls.tsx +++ b/apps/host/src/components/ComposerControls.tsx @@ -48,6 +48,7 @@ export function ComposerControls({ session, onPreview, onAttach, onError, onSlas const trigger = useRef(null), modeTrigger = useRef(null), thinkingTrigger = useRef(null); const attachLatest = useRef(onAttach); attachLatest.current = onAttach; + const addFilesLatest = useRef<(files: File[]) => Promise>(async () => { }); const mode = modes.find(m => m.value === session?.preferences?.mode) ?? modes[0]; const effort = efforts.includes(session?.preferences?.thinking ?? '') ? session!.preferences!.thinking! : 'Medium'; const budget = session?.preferences?.thinkingBudget ?? 0; @@ -117,6 +118,7 @@ export function ComposerControls({ session, onPreview, onAttach, onError, onSlas setReading(false); } } + addFilesLatest.current = files => addFiles(files); useEffect(() => { folder.current?.setAttribute('webkitdirectory', ''); const key = (e: KeyboardEvent) => { @@ -127,10 +129,12 @@ export function ComposerControls({ session, onPreview, onAttach, onError, onSlas }; const website = () => { setUrlOpen(true); setError(''); }; const preview = () => previewFile.current?.click(); + const dropped = (e: Event) => { if (!streaming && !reading) void addFilesLatest.current((e as CustomEvent).detail ?? []); }; + window.addEventListener('strata:drop-files', dropped); window.addEventListener('keydown', key); window.addEventListener('strata:open-website', website); window.addEventListener('strata:open-preview', preview); - return () => { window.removeEventListener('keydown', key); window.removeEventListener('strata:open-website', website); window.removeEventListener('strata:open-preview', preview); }; + return () => { window.removeEventListener('strata:drop-files', dropped); window.removeEventListener('keydown', key); window.removeEventListener('strata:open-website', website); window.removeEventListener('strata:open-preview', preview); }; }, [streaming, reading]); useEffect(() => { if (preferences !== 'mode') diff --git a/apps/host/src/components/Deliverables.tsx b/apps/host/src/components/Deliverables.tsx new file mode 100644 index 00000000..48b850a0 --- /dev/null +++ b/apps/host/src/components/Deliverables.tsx @@ -0,0 +1,73 @@ +import { useRef, useState } from 'react'; +import { tr } from '../lib/i18n'; +import { fileAction, fileSize, fileTypeLabel, previewOf, rawUrlOf, type ActivityGroup, type Deliverable } from '../lib/deliverables'; +import type { PreviewArtifact } from '../lib/artifacts'; +import { pushToast } from '../lib/store'; +import { plainFailureText } from '../lib/plain-errors'; +import { FloatingMenu } from './FloatingMenu'; +import { Icon } from './ui'; + +const problem = (title: string, e: unknown) => pushToast('error', tr(title), plainFailureText(e instanceof Error ? e.message : String(e)).message); + +/** A line's numbers ("+225 −0") shown as a pair of small figures; the sentence itself stays plain grey. */ +export function Plusminus({ added, removed }: { added: number; removed: number }) { + return +{added}−{removed}; +} + +const showOf = (file: { path: string; name: string }, sessionId: string, onPreview: (a: PreviewArtifact) => void, kind?: string) => + previewOf(sessionId, file).then(onPreview, e => { + // A file with no preview opens in its own app instead. + if (kind === 'other') return fileAction.open(sessionId, file.path, 'app').catch(err => problem('The file was not opened', err)); + return problem('The file has no preview', e); + }); + +/** One file the assistant made or changed: its type, name and size, and Open (in the sidebar) with a menu for the other things to do with it. */ +export function FileCard({ file, sessionId, onPreview }: { file: Deliverable; sessionId: string; onPreview: (a: PreviewArtifact) => void }) { + const more = useRef(null); + const [menu, setMenu] = useState(false), [busy, setBusy] = useState(false); + const run = async (fn: () => Promise, failed: string) => { setMenu(false); try { await fn(); } catch (e) { problem(failed, e); } }; + return
+ {fileTypeLabel(file)} + {file.name}{fileSize(file.size)} + + + + + {tr(menu ? setMenu(false)}> + + + + : null)} +
; +} + +/** "Edited N files": each with its lines added and removed, and the total under See all. */ +export function EditedFiles({ files, sessionId, onPreview }: { files: Deliverable[]; sessionId: string; onPreview: (a: PreviewArtifact) => void }) { + const [all, setAll] = useState(false); + const textual = files.filter(f => f.lines !== null); + if (textual.length < 2) return null; + const shown = all ? textual : textual.slice(0, 3); + const added = textual.reduce((n, f) => n + f.added, 0), removed = textual.reduce((n, f) => n + f.removed, 0); + return
+
{tr('Edited {0} files', [textual.length])}
+ {shown.map(f => )} + +
; +} + +/** 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); + const picture = group.files.find(f => f.kind === 'image'); + // The host's sentence may end with the numbers ("… +225 −0"): they are drawn as figures instead. + const sentence = group.line.replace(/\s*\+\d+\s*[−-]\s*\d+\s*$/, ''); + return
+ + {picture ? void showOf(picture, sessionId, onPreview)}/> : null} + {open ?
    {group.files.map(f =>
  • )}
: null} +
; +} diff --git a/apps/host/src/components/DropZone.tsx b/apps/host/src/components/DropZone.tsx new file mode 100644 index 00000000..44c935a6 --- /dev/null +++ b/apps/host/src/components/DropZone.tsx @@ -0,0 +1,21 @@ +import { useRef, useState, type ReactNode } from 'react'; +import { tr } from '../lib/i18n'; +import { Icon } from './ui'; + +/** Files dropped on the chat go where the attach button would put them: the composer reads the 'strata:drop-files' event. */ +export const DROP_EVENT = 'strata:drop-files'; +const hasFiles = (e: React.DragEvent) => Array.from(e.dataTransfer?.types ?? []).includes('Files'); + +/** The conversation column, with a calm highlight while something is dragged over it. */ +export function DropZone({ children, className }: { children: ReactNode; className?: string }) { + const [over, setOver] = useState(false); + const depth = useRef(0); + return
{ if (!hasFiles(e)) return; e.preventDefault(); depth.current++; setOver(true); }} + onDragOver={e => { if (!hasFiles(e)) return; e.preventDefault(); e.dataTransfer.dropEffect = 'copy'; }} + onDragLeave={e => { if (!hasFiles(e)) return; depth.current = Math.max(0, depth.current - 1); if (!depth.current) setOver(false); }} + onDrop={e => { if (!hasFiles(e)) return; e.preventDefault(); depth.current = 0; setOver(false); const files = Array.from(e.dataTransfer.files); if (files.length) window.dispatchEvent(new CustomEvent(DROP_EVENT, { detail: files })); }}> + {children} + {over ? : null} +
; +} diff --git a/apps/host/src/components/FamilySwitch.tsx b/apps/host/src/components/FamilySwitch.tsx index 27d55f59..7b7c2a4b 100644 --- a/apps/host/src/components/FamilySwitch.tsx +++ b/apps/host/src/components/FamilySwitch.tsx @@ -1,12 +1,30 @@ +import { useRef, useState } from 'react'; import { tr } from '../lib/i18n'; import type { CatalogModel } from '../lib/native-catalog'; +import { FloatingMenu } from './FloatingMenu'; +import { Icon } from './ui'; -/** The model families of the catalog as a switch in the navbar (Qwen3.8-Flash-Next, Qwen3.6-35B-A3B). A single family is just its name. */ +/** + * The model family in the Models navbar: its icon, its name and a chevron. Opening it lists the families of the catalog (Qwen3.8-Flash-Next, + * Qwen3.6-35B-A3B, and future ones) to switch between. One family still shows as the same control, so the page looks the same as families arrive. + */ export function FamilySwitch({ families, selected, onPick }: { families: CatalogModel[]; selected?: string; onPick: (family: CatalogModel) => void }) { const shown = families.filter(f => f.sizes.length); - if (shown.length < 2) return shown[0] ? {tr(shown[0].title)} : null; - return
- {shown.map(f => )} -
; + const trigger = useRef(null); + const [open, setOpen] = useState(false); + if (!shown.length) return null; + const current = shown.find(f => f.family === selected) ?? shown[0]; + return <> + + {tr(open ? setOpen(false)}> +
+ {shown.map(f => )} +
+
: null)} + ; } diff --git a/apps/host/src/components/NativeModels.tsx b/apps/host/src/components/NativeModels.tsx index a8d6c9a1..1cf8d3d4 100644 --- a/apps/host/src/components/NativeModels.tsx +++ b/apps/host/src/components/NativeModels.tsx @@ -17,6 +17,7 @@ import { tuneEffective } from '../lib/native-tune'; import { tunedFields } from '../lib/tune-values'; import { NativeSettings } from './NativeSettings'; import { RunImageModel } from './RunImageModel'; +import { IMAGE_GENERATION_VISIBLE } from '../lib/features'; import { useStore } from '../lib/store'; import { NativePresets } from './NativePresets'; import { NativeTune } from './NativeTune'; @@ -135,7 +136,7 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine {selectedSize && installed?.ready ? : null}
{tr(loadedSelected ? <> void perform(() => nativeAction(`instances/${loadedSelected.id}/unload`))}>{tr("Unload")}{tr(onReady ? {tr("Start chatting")} : {tr("Ready")})} : onReady && native?.instances.some(i => i.status === 'ready') ? {tr("Start chatting")} : <> setTuneOpen(true)}>{tr("Tune model")} void load()}>{tr(pending ? 'Checking…' : installed?.ready ? 'Load model' : 'Download & load')})}
- {tr(expert ? <>
{tr("Image generation ")}{tr("Optional")} { }}/>
: null)} + {tr(expert && IMAGE_GENERATION_VISIBLE ? <>
{tr("Image generation ")}{tr("Optional")} { }}/>
: null)} {tr(expert ?

{tr("Expert settings")}

{tr(tunedNow ?

{tr("Showing the values of your tuning '{0}'.", [tunedNow.name])}

: null)}
: null)}{tr(gpus.length > 1 ? : null)}
{tr(installed ? :

{tr("More engine parameters become available after preparing this version.")}

)} : null)} diff --git a/apps/host/src/lib/deliverables.ts b/apps/host/src/lib/deliverables.ts new file mode 100644 index 00000000..0b597000 --- /dev/null +++ b/apps/host/src/lib/deliverables.ts @@ -0,0 +1,96 @@ +import { api } from './client'; +import type { PreviewArtifact } from './artifacts'; + +/** + * Deliverables and grouped activity (notes-split-agent8.md, item 12). The host sends `deliverable` frames for every file the assistant wrote or + * changed and `activity-group` frames for runs of tool use between two pieces of text. A reply keeps them in the order they came, so the text + * that arrives between activities reads as one continuous piece. + */ +export type DeliverableKind = 'html' | 'markdown' | 'pdf' | 'csv' | 'image' | 'code' | 'text' | 'other'; +export interface Deliverable { path: string; abs: string; name: string; kind: DeliverableKind; status: 'created' | 'changed'; size: number; lines: number | null; added: number; removed: number } +export interface GroupFile { path: string; name: string; kind: DeliverableKind; status: string; added: number; removed: number } +export interface ActivityGroup { id: string; closed: boolean; line: string; added: number; removed: number; files: GroupFile[] } +export type MessageBlock = { kind: 'text'; text: string } | ({ kind: 'group' } & ActivityGroup); + +const KINDS = ['html', 'markdown', 'pdf', 'csv', 'image', 'code', 'text', 'other']; +const num = (v: unknown) => (Number.isFinite(Number(v)) ? Number(v) : 0); + +export function readDeliverable(raw: unknown): Deliverable | null { + if (!raw || typeof raw !== 'object') return null; + const f = raw as Record; + if (typeof f.path !== 'string' || !f.path) return null; + const name = typeof f.name === 'string' && f.name ? f.name : f.path.split(/[\\/]/).at(-1) ?? f.path; + return { + path: f.path, abs: typeof f.abs === 'string' ? f.abs : f.path, name, kind: KINDS.includes(String(f.kind)) ? f.kind as DeliverableKind : 'other', + status: f.status === 'changed' ? 'changed' : 'created', size: num(f.size), lines: f.lines === null || f.lines === undefined ? null : num(f.lines), added: num(f.added), removed: num(f.removed), + }; +} + +export function readGroup(raw: unknown): ActivityGroup | null { + if (!raw || typeof raw !== 'object') return null; + const g = raw as Record; + if (typeof g.id !== 'string' || !g.id) return null; + const files = Array.isArray(g.files) ? g.files.flatMap((x): GroupFile[] => { + const d = readDeliverable(x); + return d ? [{ path: d.path, name: d.name, kind: d.kind, status: d.status, added: d.added, removed: d.removed }] : []; + }) : []; + return { id: g.id, closed: g.closed === true, line: typeof g.line === 'string' ? g.line : '', added: num(g.added), removed: num(g.removed), files }; +} + +/** 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); + if (last?.kind === 'text') return [...list.slice(0, -1), { kind: 'text', text: last.text + text }]; + return [...list, { kind: 'text', text }]; +} + +/** A group frame is re-sent while it grows: the same id replaces its line; a new id goes after what came before. */ +export function upsertGroup(blocks: MessageBlock[] | undefined, group: ActivityGroup): MessageBlock[] { + const list = blocks ?? [], at = list.findIndex(b => b.kind === 'group' && b.id === group.id); + const next: MessageBlock = { kind: 'group', ...group }; + return at >= 0 ? list.map((b, i) => (i === at ? next : b)) : [...list, next]; +} + +/** The same file may be written more than once in a run: one card per path, with its latest numbers. */ +export function mergeDeliverable(list: Deliverable[] | undefined, file: Deliverable): Deliverable[] { + const have = list ?? [], at = have.findIndex(f => f.path === file.path); + if (at < 0) return [...have, file]; + const old = have[at]; + return have.map((f, i) => (i === at ? { ...file, status: old.status === 'created' ? 'created' : file.status, added: old.added + file.added, removed: old.removed + file.removed } : f)); +} + +export const fileTypeLabel = (d: { kind: DeliverableKind; name: string }) => { + const ext = d.name.includes('.') ? d.name.split('.').at(-1)!.toUpperCase() : ''; + return d.kind === 'markdown' ? 'MD' : d.kind === 'html' ? 'HTML' : d.kind === 'csv' ? 'CSV' : d.kind === 'pdf' ? 'PDF' : ext && ext.length <= 10 ? ext : d.kind.toUpperCase(); +}; + +export function fileSize(bytes: number): string { + if (bytes < 1024) return `${bytes} B`; + if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(bytes < 10240 ? 1 : 0)} KB`; + return `${(bytes / 1024 / 1024).toFixed(1)} MB`; +} + +const csvText = (rows: string[][]) => rows.map(r => r.map(c => (/[",\n]/.test(c) ? `"${c.replace(/"/g, '""')}"` : c)).join(',')).join('\n'); + +interface PreviewAnswer { kind: DeliverableKind; name: string; path: string; size: number; url?: string; text?: string; rows?: string[][]; rawUrl?: string; note?: string } + +/** The sidebar preview of a file: the host reads it (only inside the chat's folder) and the page draws it as a website, markdown, table, picture, PDF or code. */ +export async function previewOf(sessionId: string, file: { path: string; name: string }): Promise { + const a = await api.get(`/api/files/preview?sessionId=${encodeURIComponent(sessionId)}&path=${encodeURIComponent(file.path)}`); + const id = `file:${a.path}`, title = a.name || file.name; + if (a.kind === 'image' && a.rawUrl) return { id, kind: 'image', title, url: a.rawUrl }; + if (a.kind === 'pdf' && a.rawUrl) return { id, kind: 'pdf', title, url: a.rawUrl }; + if (a.kind === 'html' && a.text !== undefined) return { id, kind: 'website', title, content: a.text }; + if (a.kind === 'markdown' && a.text !== undefined) return { id, kind: 'markdown', title, content: a.text }; + if (a.kind === 'csv' && a.rows) return { id, kind: 'table', title, content: csvText(a.rows) }; + if (a.text !== undefined) return { id, kind: 'code', title, content: a.text }; + throw new Error(a.note || 'This file has no preview. Open it in its own app.'); +} + +export const fileAction = { + open: (sessionId: string, path: string, how: 'browser' | 'app' | 'folder') => api.post('/api/files/open', { sessionId, path, how }), + fullPath: async (sessionId: string, path: string) => (await api.get<{ path: string }>(`/api/files/path?sessionId=${encodeURIComponent(sessionId)}&path=${encodeURIComponent(path)}`)).path, + attach: (sessionId: string, path: string) => api.post('/api/chat/attachments', { sessionId, path }), +}; + +export const rawUrlOf = (sessionId: string, path: string) => `/api/files/raw?sessionId=${encodeURIComponent(sessionId)}&path=${encodeURIComponent(path)}`; diff --git a/apps/host/src/lib/features.ts b/apps/host/src/lib/features.ts index 86ba6efd..39b5f125 100644 --- a/apps/host/src/lib/features.ts +++ b/apps/host/src/lib/features.ts @@ -1 +1,2 @@ -export const features = { toolAccess: false, thinkingLevels: false, sessionLog: true, demosInComposer: false } as const; +/** Image generation is hidden everywhere in the interface for this version (round 8, item 8). The pieces stay in the code; flip this to bring them back. */ +export const IMAGE_GENERATION_VISIBLE = false; diff --git a/apps/host/src/lib/store.ts b/apps/host/src/lib/store.ts index aa089593..61ff5a01 100644 --- a/apps/host/src/lib/store.ts +++ b/apps/host/src/lib/store.ts @@ -4,6 +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 { 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 { PREVIEW_EXAMPLES, type PreviewArtifact } from './artifacts'; @@ -1650,7 +1651,13 @@ export async function sendMessage(text: string, options: { fromLoop?: boolean; g } else if (type === 'agent') { patchSession(sessionId, s => ({ ...s, agents: updateAgent(s.agents ?? [], frame.agent) })); } else if (type === 'delta') { - patchAssistant((m) => { const content=m.content+String(frame.text??''); if (m.reasoningStartedAt && m.reasoningMs === undefined) m = { ...m, reasoningMs: Date.now() - m.reasoningStartedAt }; const count=Math.max(1,Math.ceil((content.length+(m.reasoning?.length??0))/4)); return {...m,content,tokens:m.usageSource==='estimated'&&m.tps?m.tokens:count,inputTokens:m.inputTokens??Math.ceil((body.length+prior.reduce((n,p)=>n+p.content.length,0))/4),usageSource:'estimated'}; }); + patchAssistant((m) => { const content=m.content+String(frame.text??''); if (m.reasoningStartedAt && m.reasoningMs === undefined) m = { ...m, reasoningMs: Date.now() - m.reasoningStartedAt }; const count=Math.max(1,Math.ceil((content.length+(m.reasoning?.length??0))/4)); return {...m,content,...(m.blocks?{blocks:appendText(m.blocks,String(frame.text??''))}:{}),tokens:m.usageSource==='estimated'&&m.tps?m.tokens:count,inputTokens:m.inputTokens??Math.ceil((body.length+prior.reduce((n,p)=>n+p.content.length,0))/4),usageSource:'estimated'}; }); + } else if (type === 'deliverable') { + const file = readDeliverable(frame); + if (file) patchAssistant(m => ({ ...m, deliverables: mergeDeliverable(m.deliverables, file) })); + } 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) })); } else if (type === 'artifacts' && Array.isArray(frame.artifacts)) { patchAssistant(m => ({ ...m, artifacts: frame.artifacts as PreviewArtifact[] })); } else if(type==='native-tool'){ diff --git a/apps/host/src/lib/types.ts b/apps/host/src/lib/types.ts index 67ff69d2..bfc8613a 100644 --- a/apps/host/src/lib/types.ts +++ b/apps/host/src/lib/types.ts @@ -320,6 +320,10 @@ export interface ChatMessage { timeSkipId?: string; /** The plan this reply proposed: shown as the plan card in place of the reply text. */ 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[]; + /** 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. */ local?: boolean; ttftMs?: number; diff --git a/apps/host/src/locales/de.json b/apps/host/src/locales/de.json index 1c832e9b..38d71892 100644 --- a/apps/host/src/locales/de.json +++ b/apps/host/src/locales/de.json @@ -3087,9 +3087,22 @@ "s3091": "übersprungen", "s3092": "Pausiert · {0} von {1} erledigt", "s3093": "Plan genehmigt.", - "s3094": "Der Assistent antwortet noch", - "s3095": "Senden Sie Ihre Nachricht, wenn er fertig ist.", - "s3096": "Die Nachricht wurde nicht eingereiht", - "s3097": "In der Warteschlange — wird danach gesendet", - "s3098": "In der Warteschlange — wird gesendet, wenn das Ziel erreicht ist" + "s3094": "Experimentell", + "s3095": "Weitere Möglichkeiten, {0} zu öffnen", + "s3096": "Dateiaktionen", + "s3097": "Im Ordner anzeigen", + "s3098": "Pfad kopieren", + "s3099": "Als Kontext anhängen", + "s3100": "Pfad kopiert", + "s3101": "An Ihre nächste Nachricht angehängt", + "s3102": "Die Datei wurde nicht geöffnet", + "s3103": "Für diese Datei gibt es keine Vorschau", + "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" } diff --git a/apps/host/src/locales/en.json b/apps/host/src/locales/en.json index 2cec82a5..03ce6e51 100644 --- a/apps/host/src/locales/en.json +++ b/apps/host/src/locales/en.json @@ -3087,9 +3087,22 @@ "s3091": "skipped", "s3092": "Paused · {0} of {1} done", "s3093": "Approved the plan.", - "s3094": "The assistant is still answering", - "s3095": "Send your message when it has finished.", - "s3096": "The message was not queued", - "s3097": "Queued — sends after that", - "s3098": "Queued — sends when the goal finishes" + "s3094": "Experimental", + "s3095": "More ways to open {0}", + "s3096": "File actions", + "s3097": "Show in folder", + "s3098": "Copy path", + "s3099": "Attach as context", + "s3100": "Path copied", + "s3101": "Attached to your next message", + "s3102": "The file was not opened", + "s3103": "The file has no preview", + "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" } diff --git a/apps/host/src/locales/es.json b/apps/host/src/locales/es.json index c9395412..54b73e52 100644 --- a/apps/host/src/locales/es.json +++ b/apps/host/src/locales/es.json @@ -3087,9 +3087,22 @@ "s3091": "omitido", "s3092": "En pausa · {0} de {1} hechos", "s3093": "Plan aprobado.", - "s3094": "El asistente aún está respondiendo", - "s3095": "Envía tu mensaje cuando haya terminado.", - "s3096": "No se pudo poner el mensaje en cola", - "s3097": "En cola — se envía después", - "s3098": "En cola — se envía cuando termine el objetivo" + "s3094": "Experimental", + "s3095": "Más formas de abrir {0}", + "s3096": "Acciones del archivo", + "s3097": "Mostrar en la carpeta", + "s3098": "Copiar la ruta", + "s3099": "Adjuntar como contexto", + "s3100": "Ruta copiada", + "s3101": "Adjunto a tu próximo mensaje", + "s3102": "No se abrió el archivo", + "s3103": "Este archivo no tiene vista previa", + "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" } diff --git a/apps/host/src/locales/ja.json b/apps/host/src/locales/ja.json index fbb2cda3..d23a4fb0 100644 --- a/apps/host/src/locales/ja.json +++ b/apps/host/src/locales/ja.json @@ -3087,9 +3087,22 @@ "s3091": "スキップ", "s3092": "一時停止中 · {1} 件中 {0} 件完了", "s3093": "プランを承認しました。", - "s3094": "アシスタントはまだ回答中です", - "s3095": "完了してからメッセージを送ってください。", - "s3096": "メッセージを待機に入れられませんでした", - "s3097": "待機中 — その後に送信", - "s3098": "待機中 — ゴールの完了後に送信" + "s3094": "試験的", + "s3095": "{0} を開くその他の方法", + "s3096": "ファイル操作", + "s3097": "フォルダーで表示", + "s3098": "パスをコピー", + "s3099": "コンテキストとして添付", + "s3100": "パスをコピーしました", + "s3101": "次のメッセージに添付しました", + "s3102": "ファイルを開けませんでした", + "s3103": "このファイルはプレビューできません", + "s3104": "フォルダーを開けませんでした", + "s3105": "パスをコピーできませんでした", + "s3106": "ファイルを添付できませんでした", + "s3107": "{0} 行追加、{1} 行削除", + "s3108": "{0} 個のファイルを編集", + "s3109": "すべて表示", + "s3110": "ファイルをドロップして追加", + "s3111": "画像とテキストファイル" } diff --git a/apps/host/src/locales/ko.json b/apps/host/src/locales/ko.json index e8f77bd1..28973cd0 100644 --- a/apps/host/src/locales/ko.json +++ b/apps/host/src/locales/ko.json @@ -3087,9 +3087,22 @@ "s3091": "건너뜀", "s3092": "일시 중지 · {1}개 중 {0}개 완료", "s3093": "계획을 승인했습니다.", - "s3094": "어시스턴트가 아직 답하는 중입니다", - "s3095": "끝난 뒤에 메시지를 보내 주세요.", - "s3096": "메시지를 대기열에 넣지 못했습니다", - "s3097": "대기 중 — 그 다음에 전송됩니다", - "s3098": "대기 중 — 목표가 끝나면 전송됩니다" + "s3094": "실험적", + "s3095": "{0}을(를) 여는 다른 방법", + "s3096": "파일 작업", + "s3097": "폴더에서 보기", + "s3098": "경로 복사", + "s3099": "컨텍스트로 첨부", + "s3100": "경로를 복사했습니다", + "s3101": "다음 메시지에 첨부했습니다", + "s3102": "파일을 열지 못했습니다", + "s3103": "이 파일은 미리 볼 수 없습니다", + "s3104": "폴더를 열지 못했습니다", + "s3105": "경로를 복사하지 못했습니다", + "s3106": "파일을 첨부하지 못했습니다", + "s3107": "{0}줄 추가, {1}줄 삭제", + "s3108": "파일 {0}개 편집됨", + "s3109": "모두 보기", + "s3110": "파일을 놓아 추가하세요", + "s3111": "사진 및 텍스트 파일" } diff --git a/apps/host/src/locales/pt.json b/apps/host/src/locales/pt.json index 5de3161a..e2ed45a6 100644 --- a/apps/host/src/locales/pt.json +++ b/apps/host/src/locales/pt.json @@ -3087,9 +3087,22 @@ "s3091": "ignorado", "s3092": "Pausado · {0} de {1} concluídos", "s3093": "Plano aprovado.", - "s3094": "O assistente ainda está respondendo", - "s3095": "Envie sua mensagem quando ele terminar.", - "s3096": "A mensagem não foi colocada na fila", - "s3097": "Na fila — enviada depois disso", - "s3098": "Na fila — enviada quando a meta terminar" + "s3094": "Experimental", + "s3095": "Mais formas de abrir {0}", + "s3096": "Ações do arquivo", + "s3097": "Mostrar na pasta", + "s3098": "Copiar o caminho", + "s3099": "Anexar como contexto", + "s3100": "Caminho copiado", + "s3101": "Anexado à sua próxima mensagem", + "s3102": "O arquivo não foi aberto", + "s3103": "Este arquivo não tem pré-visualização", + "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" } diff --git a/apps/host/src/locales/ru.json b/apps/host/src/locales/ru.json index 3b189491..7f8b08ed 100644 --- a/apps/host/src/locales/ru.json +++ b/apps/host/src/locales/ru.json @@ -3087,9 +3087,22 @@ "s3091": "пропущено", "s3092": "Пауза · готово {0} из {1}", "s3093": "План одобрен.", - "s3094": "Ассистент ещё отвечает", - "s3095": "Отправьте сообщение, когда он закончит.", - "s3096": "Сообщение не удалось поставить в очередь", - "s3097": "В очереди — отправится после этого", - "s3098": "В очереди — отправится, когда цель будет достигнута" + "s3094": "Экспериментально", + "s3095": "Другие способы открыть {0}", + "s3096": "Действия с файлом", + "s3097": "Показать в папке", + "s3098": "Копировать путь", + "s3099": "Прикрепить как контекст", + "s3100": "Путь скопирован", + "s3101": "Прикреплено к вашему следующему сообщению", + "s3102": "Файл не удалось открыть", + "s3103": "У этого файла нет предпросмотра", + "s3104": "Папку не удалось открыть", + "s3105": "Путь не удалось скопировать", + "s3106": "Файл не удалось прикрепить", + "s3107": "Добавлено строк: {0}, удалено: {1}", + "s3108": "Изменено файлов: {0}", + "s3109": "Показать все", + "s3110": "Перетащите файлы, чтобы добавить их", + "s3111": "Изображения и текстовые файлы" } diff --git a/apps/host/src/locales/zh.json b/apps/host/src/locales/zh.json index 795518a1..b3b67f16 100644 --- a/apps/host/src/locales/zh.json +++ b/apps/host/src/locales/zh.json @@ -3087,9 +3087,22 @@ "s3091": "已跳过", "s3092": "已暂停 · 已完成 {0}/{1}", "s3093": "已批准计划。", - "s3094": "助手仍在回答", - "s3095": "等它完成后再发送你的消息。", - "s3096": "消息未能排队", - "s3097": "已排队 — 在此之后发送", - "s3098": "已排队 — 目标完成后发送" + "s3094": "实验性", + "s3095": "打开 {0} 的更多方式", + "s3096": "文件操作", + "s3097": "在文件夹中显示", + "s3098": "复制路径", + "s3099": "作为上下文附加", + "s3100": "路径已复制", + "s3101": "已附加到你的下一条消息", + "s3102": "文件未能打开", + "s3103": "此文件无法预览", + "s3104": "文件夹未能打开", + "s3105": "路径未能复制", + "s3106": "文件未能附加", + "s3107": "新增 {0} 行,删除 {1} 行", + "s3108": "已编辑 {0} 个文件", + "s3109": "查看全部", + "s3110": "拖放文件即可添加", + "s3111": "图片和文本文件" } diff --git a/apps/host/src/screens/Chat.tsx b/apps/host/src/screens/Chat.tsx index 1b898ef3..8b17cb24 100644 --- a/apps/host/src/screens/Chat.tsx +++ b/apps/host/src/screens/Chat.tsx @@ -21,6 +21,8 @@ import { ReasoningBlock } from '../components/ReasoningBlock'; import { StatusLine } from '../components/StatusLine'; import { GoalBar } from '../components/GoalBar'; import { PlanCard, PlanPanel, QueuedMessages } from '../components/PlanCard'; +import { DropZone } from '../components/DropZone'; +import { ActivityLine, EditedFiles, FileCard } from '../components/Deliverables'; import { queueMessage, usePlan, usePlanQuiet } from '../lib/plan'; import { plainFailureText } from '../lib/plain-errors'; import { useLiveStatus } from '../lib/live-status'; @@ -358,7 +360,7 @@ export function ChatScreen() { return (<> { setSelectedPreview(null); setExpanded(false); }} inline={inlinePreview} expanded={expanded} onExpand={() => setExpanded(v => !v)}/>
-
+
{tr(awayFromBottom ? () : null)} @@ -367,7 +369,7 @@ export function ChatScreen() {
-
+ setSelectedPreview(null)} inline={inlinePreview}/> {tr(resizeHandle)} @@ -380,7 +382,7 @@ export function ChatScreen() { the context panel open, a full-width composer sat underneath the panel and drifted out of alignment with the transcript it belongs to. */}
-
+
{ const el = e.currentTarget; if (session) @@ -403,7 +405,7 @@ export function ChatScreen() {
{tr(awayFromBottom ? () : null)}
-
+
{tr(!setupVisible && selectedRun && session ? { setSelectedPreview(null); setExpanded(false); }}/> : null)} {tr(!setupVisible && planShown ? : null)} setSelectedPreview(null)} inline={inlinePreview}/> @@ -571,6 +573,8 @@ function Message({ message: m, isLast, onEditPrompt, onPreview, onOpenLink, onOp // A reply that proposed a plan shows the plan card in place of its closing text (which is the plan in prose). const storedPlan = usePlanQuiet(m.planId ? activeSession : null); const planCard = !!m.planId && storedPlan?.id === m.planId; + // A reply with activity lines is drawn piece by piece in the order it came; one without is the plain text it always was. + const grouped = !!m.blocks?.some(b => b.kind === 'group'); const [sentTime, setSentTime] = useState(() => relTime(m.at)); if (m.role === 'user') { return (
setSentTime(relTime(m.at))} onFocus={() => setSentTime(relTime(m.at))}> @@ -593,18 +597,20 @@ function Message({ message: m, isLast, onEditPrompt, onPreview, onOpenLink, onOp {tr(m.reasoning ? : null)} - {tr((m.tools ?? []).map((t) => ()))} + {tr((m.tools ?? []).filter(t => !grouped || t.state !== 'done').map((t) => ()))} {tr(!(m.timeSkipId && timeSkipReal && !timeSkipDone) && (m.content || m.error || !m.streaming || !liveStatus) ?
{tr(planCard ? : null)} {tr(m.error ? () : null)} - {tr(m.content && !planCard ? ( onPreview({ id: m.id + '-html', kind: 'website', title: 'HTML preview', content })}/>) : !m.error && m.streaming && !liveStatus ? ( + {tr(grouped && !planCard && !m.timeSkipId ? m.blocks!.map((b, i) => b.kind === 'group' ? : onPreview({ id: m.id + '-html-' + i, kind: 'website', title: 'HTML preview', content })}/>) : null)} + {tr(m.content && !planCard && !grouped ? ( onPreview({ id: m.id + '-html', kind: 'website', title: 'HTML preview', content })}/>) : !m.error && m.streaming && !liveStatus ? ( ) : null)} {tr(m.streaming && m.content ?
: null)} + {tr(m.deliverables?.length && !m.streaming ?
{m.deliverables.map(f => )}
: null)} {tr(m.streaming && isLast && !m.timeSkipId ? : null)} {tr(m.timeSkipId && timeSkipReal && !timeSkipDone && timeSkipRun ? : m.timeSkipId && (!timeSkipReal || (timeSkipRun?.job?.files?.length ?? 0) > 0) ? : null)} diff --git a/apps/host/src/screens/ModelRun.tsx b/apps/host/src/screens/ModelRun.tsx index a4d8bc31..16ec83e9 100644 --- a/apps/host/src/screens/ModelRun.tsx +++ b/apps/host/src/screens/ModelRun.tsx @@ -10,6 +10,7 @@ import { RunningModels } from '../components/RunningModels'; import { LocalModelImport } from '../components/LocalModelImport'; import { gpuId } from '../lib/monitor-hardware'; import { RunImageModel } from '../components/RunImageModel'; +import { IMAGE_GENERATION_VISIBLE } from '../lib/features'; import { FloatingMenu } from '../components/FloatingMenu'; import { ModelsScreen } from './Models'; import { configDocument, configPatch, readConfig, type ConfigDocument } from '../lib/config'; @@ -424,7 +425,7 @@ function LegacyModelRunScreen({ importFirst = false, initialVariant }: {
{tr("Version")} ({ value: String(n), label: `${n / 1024}K` }))} onChange={n => setContext(Number(n))}/>
{tr("Computer use")}
- {tr(selectedSize?.images ?
{tr(expert && vision !== 'no' ? setVision(e.target.checked ? 'yes' : 'no')}/>{tr("Read pictures ")}{tr("Optional")}{tr("Understand photos, screenshots and charts. Vision files download automatically. Enable them when loading this model.")}{tr(expert && vision !== 'no' ?