Skip to content

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

C++

Folder chooser fallback in the app: plain message and a field for the path

Niko1221447b99ba3820
diff --git a/apps/host/server/folder-dialog.mjs b/apps/host/server/folder-dialog.mjs
index ea81f95a0..bb2a9d365 100644
--- a/apps/host/server/folder-dialog.mjs
+++ b/apps/host/server/folder-dialog.mjs
@@ -104,7 +104,7 @@ async function chooseLinuxFolder(prompt, { run, portal }) {
return {
unavailable: true, failed: failures.length > 0, ...(failures.length ? { detail: failures.join('; ') } : {}),
reason: failures.length
- ? `The folder chooser could not open (${failures[0]}). Install zenity or kdialog to pick a folder, or type the path.`
+ ? 'The folder chooser could not open. Install zenity or kdialog to pick a folder, or type the path.'
: 'No folder chooser was found. Install zenity or kdialog to pick a folder, or type the path.',
};
}
@@ -152,7 +152,7 @@ export const TYPE_A_PATH = 'No folder chooser is available on this system, so ty
/** The host's answer when no chooser works: a plain sentence and a code the app turns into a field for typing the path. */
export function chooserUnavailable(picked) {
- return { message: picked.failed ? picked.reason : `${TYPE_A_PATH} ${picked.reason}`, code: 'folder-chooser-unavailable', details: picked.detail };
+ return { message: picked.reason, code: 'folder-chooser-unavailable', details: picked.detail };
}
/** A typed path stands in for the dialog: it must be an absolute directory that exists. */
diff --git a/apps/host/src/app/App.tsx b/apps/host/src/app/App.tsx
index 92e065363..7604306c9 100644
--- a/apps/host/src/app/App.tsx
+++ b/apps/host/src/app/App.tsx
@@ -8,6 +8,7 @@ import { bootOnce, bootstrap, setNavOpen, setFocus, useStore, } from '../lib/sto
import { Sidebar } from './Sidebar';
import { CommandPalette } from './CommandPalette';
import { ShortcutsDialog } from './Shortcuts';
+import { FolderPathDialog } from '../components/FolderPathDialog';
import { handleAppShortcut, runCommand } from '../lib/commands';
import { useMedia } from '../lib/responsive';
import { Btn, Dialog, IconBtn, Toasts } from '../components/ui';
@@ -66,6 +67,7 @@ function AppShell() {
<CommandPalette open={paletteOpen}/>
<Dialog open={location.query.get('settings') === '1'} title={tr("Settings")} className="settings-dialog" onClose={closeSettings}><SettingsScreen /></Dialog>
<ShortcutsDialog />
+ <FolderPathDialog />
{tr(setupOpen ? (<div className="setupmodal" role="dialog" aria-modal="true" aria-label={tr("Set up Strata")}>
<div className="scrim" data-open="true" aria-hidden="true"/>
<div className="setupmodal__surface" ref={setupRef}>
diff --git a/apps/host/src/components/FolderPathDialog.tsx b/apps/host/src/components/FolderPathDialog.tsx
new file mode 100644
index 000000000..4c456cdf2
--- /dev/null
+++ b/apps/host/src/components/FolderPathDialog.tsx
@@ -0,0 +1,21 @@
+import { useEffect, useState } from 'react';
+import { tr } from '../lib/i18n';
+import { useFolderPrompt } from '../lib/folder-pick';
+import { Btn, Dialog } from './ui';
+
+/** The fallback for a system without a folder chooser: say so in plain words and take the folder's path as text. */
+export function FolderPathDialog() {
+ const prompt = useFolderPrompt();
+ const [path, setPath] = useState('');
+ useEffect(() => { if (prompt) setPath(''); }, [prompt]);
+ const submit = () => { const text = path.trim(); if (text) prompt?.resolve(text); };
+ return <Dialog open={!!prompt} compact title={tr("Type the folder path")} onClose={() => prompt?.resolve(null)}
+ actions={<><Btn onClick={() => prompt?.resolve(null)}>{tr("Cancel")}</Btn><Btn variant="primary" disabled={!path.trim()} onClick={submit}>{tr("Use this folder")}</Btn></>}>
+ <form className="stack" onSubmit={event => { event.preventDefault(); submit(); }}>
+ <p className="small" role="status">{tr(prompt?.message ?? '')}</p>
+ <label className="input-field"><span>{tr("Folder path")}</span>
+ <input className="st-input" autoFocus value={path} onChange={event => setPath(event.target.value)} placeholder={tr("/home/you/Documents")} spellCheck={false} aria-label={tr("Folder path")}/>
+ </label>
+ </form>
+ </Dialog>;
+}
diff --git a/apps/host/src/lib/chat-folder.ts b/apps/host/src/lib/chat-folder.ts
index 7b3df605d..c829bceb6 100644
--- a/apps/host/src/lib/chat-folder.ts
+++ b/apps/host/src/lib/chat-folder.ts
@@ -1,5 +1,6 @@
import { useEffect, useSyncExternalStore } from 'react';
import { api } from './client';
+import { postWithFolderFallback } from './folder-pick';
/** A chat's project folder (notes-split-agent8.md, item 4): the assistant works inside it and can only touch files in it. */
export interface ChatFolder { path: string; name: string; exists: boolean }
@@ -35,7 +36,7 @@ export async function loadFolder(chatId: string) {
/** Ask the system for a folder (null when the person closes the dialog), then make it this chat's. */
export async function chooseChatFolder(chatId: string): Promise<'chosen' | 'cancelled'> {
- const picked = await api.post<{ path?: string; cancelled?: boolean }>('/api/workspaces/pick', {});
+ const picked = await postWithFolderFallback<{ path?: string; cancelled?: boolean }>('/api/workspaces/pick') as { path?: string };
if (!picked.path) return 'cancelled';
await setChatFolder(chatId, picked.path);
return 'chosen';
diff --git a/apps/host/src/lib/folder-pick.ts b/apps/host/src/lib/folder-pick.ts
new file mode 100644
index 000000000..81bef53e8
--- /dev/null
+++ b/apps/host/src/lib/folder-pick.ts
@@ -0,0 +1,45 @@
+import { useSyncExternalStore } from 'react';
+import { ApiError, api } from './client';
+
+/**
+ * Picking a folder when the system has no working chooser (Linux without zenity, kdialog or a desktop portal, or one that fails).
+ * The host answers 501 with code `folder-chooser-unavailable` and a plain sentence; the app then asks for the path in a small dialog
+ * and sends it back as `{ path }`, which the host checks the same way as a picked folder. Closing the dialog is a cancel.
+ */
+export interface FolderPrompt { message: string; resolve: (path: string | null) => void }
+
+let current: FolderPrompt | null = null;
+const listeners = new Set<() => void>();
+const subscribe = (fn: () => void) => { listeners.add(fn); return () => { listeners.delete(fn); }; };
+const emit = () => listeners.forEach(fn => fn());
+
+export function useFolderPrompt() { return useSyncExternalStore(subscribe, () => current, () => null); }
+
+/** Ask for a folder path in words; resolves with the typed text, or null when the person cancels. */
+export function askForFolderPath(message: string): Promise<string | null> {
+ return new Promise(resolve => {
+ current?.resolve(null);
+ current = { message, resolve: path => { current = null; emit(); resolve(path); } };
+ emit();
+ });
+}
+
+export const isChooserUnavailable = (e: unknown) => e instanceof ApiError && (e.body as { code?: string } | undefined)?.code === 'folder-chooser-unavailable';
+
+/** POST to a host route that opens the system folder chooser; if there is none, ask for the path and POST it instead. */
+export async function postWithFolderFallback<T>(url: string): Promise<T | { cancelled: true }> {
+ try { return await api.post<T>(url, {}); }
+ catch (e) {
+ if (!isChooserUnavailable(e)) throw e;
+ for (;;) {
+ const typed = await askForFolderPath((e as ApiError).message);
+ if (!typed) return { cancelled: true };
+ try { return await api.post<T>(url, { path: typed }); }
+ catch (again) {
+ // A path the host refuses ("That folder does not exist.") is shown and asked for again; anything else is a real failure.
+ if (!(again instanceof ApiError) || again.status !== 400) throw again;
+ e = Object.assign(new ApiError(again.message, 501, { code: 'folder-chooser-unavailable' }));
+ }
+ }
+ }
+}
diff --git a/apps/host/src/lib/store.ts b/apps/host/src/lib/store.ts
index ebddeb544..a0b322241 100644
--- a/apps/host/src/lib/store.ts
+++ b/apps/host/src/lib/store.ts
@@ -12,6 +12,7 @@ import { lifecyclePolicy } from './lifecycle';
import { newestServingState } from './serving-state';
import { photoData, uploadChatPhotos, photoHistorySlots, pendingChatPhotos, takeChatPhotos } from './chat-photos';
import { nativeState } from './native';
+import { postWithFolderFallback } from './folder-pick';
import { setTranslationLanguage, tr, validLanguage, type Language } from './i18n';
/**
* Strata app store.
@@ -548,7 +549,7 @@ export const CONTENT_FONT_RANGE = { min: CONTENT_FS_MIN, max: CONTENT_FS_MAX };
/** Opens the system folder chooser. Returns null when it is dismissed. */
export async function pickWorkspace(): Promise<string | null> {
- const res = await api.post<{ path?: string; cancelled?: boolean }>('/api/workspaces/pick', {});
+ const res = await postWithFolderFallback<{ path?: string; cancelled?: boolean }>('/api/workspaces/pick') as { path?: string };
return res.path ?? null;
}
diff --git a/apps/host/src/locales/de.json b/apps/host/src/locales/de.json
index c1e525bb6..1c7b0f4f1 100644
--- a/apps/host/src/locales/de.json
+++ b/apps/host/src/locales/de.json
@@ -3138,5 +3138,10 @@
"s3142": "Erlaube Strata in deiner Sicherheitssoftware und versuche es dann erneut.",
"s3143": "Strata hat eine Datei nicht gefunden, die zum Starten der Engine nötig ist.",
"s3144": "Installiere Strata neu oder drücke auf Reparieren.",
- "s3145": "Das Modell wurde beim Starten angehalten."
+ "s3145": "Das Modell wurde beim Starten angehalten.",
+ "s3146": "Es wurde kein Ordner-Auswahldialog gefunden. Installiere zenity oder kdialog, um einen Ordner auszuwählen, oder gib den Pfad ein.",
+ "s3147": "Der Ordner-Auswahldialog konnte nicht geöffnet werden. Installiere zenity oder kdialog, um einen Ordner auszuwählen, oder gib den Pfad ein.",
+ "s3148": "Ordnerpfad eingeben",
+ "s3149": "Ordnerpfad",
+ "s3150": "/home/du/Dokumente"
}
diff --git a/apps/host/src/locales/en.json b/apps/host/src/locales/en.json
index 33a2d9c57..cd59f4623 100644
--- a/apps/host/src/locales/en.json
+++ b/apps/host/src/locales/en.json
@@ -3138,5 +3138,10 @@
"s3142": "Allow Strata in your security software, then try again.",
"s3143": "Strata could not find a file it needs to start the engine.",
"s3144": "Reinstall Strata or press Repair.",
- "s3145": "The model stopped while starting."
+ "s3145": "The model stopped while starting.",
+ "s3146": "No folder chooser was found. Install zenity or kdialog to pick a folder, or type the path.",
+ "s3147": "The folder chooser could not open. Install zenity or kdialog to pick a folder, or type the path.",
+ "s3148": "Type the folder path",
+ "s3149": "Folder path",
+ "s3150": "/home/you/Documents"
}
diff --git a/apps/host/src/locales/es.json b/apps/host/src/locales/es.json
index 78cd50927..eb20f8e20 100644
--- a/apps/host/src/locales/es.json
+++ b/apps/host/src/locales/es.json
@@ -3138,5 +3138,10 @@
"s3142": "Permite Strata en tu software de seguridad y vuelve a intentarlo.",
"s3143": "Strata no encontró un archivo que necesita para iniciar el motor.",
"s3144": "Reinstala Strata o pulsa Reparar.",
- "s3145": "El modelo se detuvo al iniciarse."
+ "s3145": "El modelo se detuvo al iniciarse.",
+ "s3146": "No se encontró ningún selector de carpetas. Instala zenity o kdialog para elegir una carpeta, o escribe la ruta.",
+ "s3147": "No se pudo abrir el selector de carpetas. Instala zenity o kdialog para elegir una carpeta, o escribe la ruta.",
+ "s3148": "Escribe la ruta de la carpeta",
+ "s3149": "Ruta de la carpeta",
+ "s3150": "/home/tu/Documentos"
}
diff --git a/apps/host/src/locales/ja.json b/apps/host/src/locales/ja.json
index fa3a3d147..2bf26ac03 100644
--- a/apps/host/src/locales/ja.json
+++ b/apps/host/src/locales/ja.json
@@ -3138,5 +3138,10 @@
"s3142": "セキュリティソフトで Strata を許可してから、もう一度お試しください。",
"s3143": "エンジンの起動に必要なファイルが Strata に見つかりませんでした。",
"s3144": "Strata を再インストールするか「修復」を押してください。",
- "s3145": "モデルの起動中に停止しました。"
+ "s3145": "モデルの起動中に停止しました。",
+ "s3146": "フォルダー選択ツールが見つかりません。zenity か kdialog をインストールしてフォルダーを選ぶか、パスを入力してください。",
+ "s3147": "フォルダー選択ツールを開けませんでした。zenity か kdialog をインストールしてフォルダーを選ぶか、パスを入力してください。",
+ "s3148": "フォルダーのパスを入力",
+ "s3149": "フォルダーのパス",
+ "s3150": "/home/you/Documents"
}
diff --git a/apps/host/src/locales/ko.json b/apps/host/src/locales/ko.json
index 649138834..846164050 100644
--- a/apps/host/src/locales/ko.json
+++ b/apps/host/src/locales/ko.json
@@ -3138,5 +3138,10 @@
"s3142": "보안 소프트웨어에서 Strata를 허용한 뒤 다시 시도하세요.",
"s3143": "엔진을 시작하는 데 필요한 파일을 Strata가 찾지 못했습니다.",
"s3144": "Strata를 다시 설치하거나 '복구'를 누르세요.",
- "s3145": "모델이 시작하는 중에 멈췄습니다."
+ "s3145": "모델이 시작하는 중에 멈췄습니다.",
+ "s3146": "폴더 선택 도구를 찾지 못했습니다. zenity 또는 kdialog를 설치해 폴더를 고르거나, 경로를 직접 입력하세요.",
+ "s3147": "폴더 선택 도구를 열지 못했습니다. zenity 또는 kdialog를 설치해 폴더를 고르거나, 경로를 직접 입력하세요.",
+ "s3148": "폴더 경로 입력",
+ "s3149": "폴더 경로",
+ "s3150": "/home/you/Documents"
}
diff --git a/apps/host/src/locales/pt.json b/apps/host/src/locales/pt.json
index d088dd87f..a561ec0d2 100644
--- a/apps/host/src/locales/pt.json
+++ b/apps/host/src/locales/pt.json
@@ -3138,5 +3138,10 @@
"s3142": "Permita o Strata no seu software de segurança e tente de novo.",
"s3143": "O Strata não encontrou um arquivo de que precisa para iniciar o motor.",
"s3144": "Reinstale o Strata ou clique em Reparar.",
- "s3145": "O modelo parou ao iniciar."
+ "s3145": "O modelo parou ao iniciar.",
+ "s3146": "Nenhum seletor de pastas foi encontrado. Instale o zenity ou o kdialog para escolher uma pasta, ou digite o caminho.",
+ "s3147": "Não foi possível abrir o seletor de pastas. Instale o zenity ou o kdialog para escolher uma pasta, ou digite o caminho.",
+ "s3148": "Digite o caminho da pasta",
+ "s3149": "Caminho da pasta",
+ "s3150": "/home/voce/Documentos"
}
diff --git a/apps/host/src/locales/ru.json b/apps/host/src/locales/ru.json
index 7659e6cd1..887efcf20 100644
--- a/apps/host/src/locales/ru.json
+++ b/apps/host/src/locales/ru.json
@@ -3138,5 +3138,10 @@
"s3142": "Разрешите Strata в защитной программе и попробуйте снова.",
"s3143": "Strata не нашла файл, нужный для запуска движка.",
"s3144": "Переустановите Strata или нажмите «Восстановить».",
- "s3145": "Модель остановилась при запуске."
+ "s3145": "Модель остановилась при запуске.",
+ "s3146": "Окно выбора папки не найдено. Установите zenity или kdialog, чтобы выбрать папку, или введите путь.",
+ "s3147": "Не удалось открыть окно выбора папки. Установите zenity или kdialog, чтобы выбрать папку, или введите путь.",
+ "s3148": "Введите путь к папке",
+ "s3149": "Путь к папке",
+ "s3150": "/home/you/Documents"
}
diff --git a/apps/host/src/locales/zh.json b/apps/host/src/locales/zh.json
index 48007894d..b49b384b3 100644
--- a/apps/host/src/locales/zh.json
+++ b/apps/host/src/locales/zh.json
@@ -3138,5 +3138,10 @@
"s3142": "请在安全软件中允许 Strata,然后重试。",
"s3143": "Strata 找不到启动引擎所需的文件。",
"s3144": "请重新安装 Strata 或点击“修复”。",
- "s3145": "模型在启动时停止了。"
+ "s3145": "模型在启动时停止了。",
+ "s3146": "没有找到文件夹选择器。请安装 zenity 或 kdialog 来选择文件夹,或直接输入路径。",
+ "s3147": "无法打开文件夹选择器。请安装 zenity 或 kdialog 来选择文件夹,或直接输入路径。",
+ "s3148": "输入文件夹路径",
+ "s3149": "文件夹路径",
+ "s3150": "/home/you/Documents"
}
diff --git a/apps/host/src/screens/Skills.tsx b/apps/host/src/screens/Skills.tsx
index 7ad8efd16..bd192a5cc 100644
--- a/apps/host/src/screens/Skills.tsx
+++ b/apps/host/src/screens/Skills.tsx
@@ -4,6 +4,7 @@ import { useState } from 'react';
import { Btn, Dialog, Empty, Icon, IconBtn, Select, ErrorNotice } from '../components/ui';
import { Screen } from '../components/layout';
import { api } from '../lib/client';
+import { postWithFolderFallback } from '../lib/folder-pick';
import { editSkill, loadSkills, toggleSkill, useStore } from '../lib/store';
import type { Skill } from '../lib/types';
export function SkillsScreen() {
@@ -31,10 +32,13 @@ export function SkillsScreen() {
}
}
async function add() {
- const result = await api.post<{
+ const result = await postWithFolderFallback<{
cancelled?: boolean;
added?: string;
- }>('/api/skills/add');
+ }>('/api/skills/add') as {
+ cancelled?: boolean;
+ added?: string;
+ };
if (!result.cancelled)
await loadSkills();
}