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++
Time-skip refuses the app's own folder and a folder too big to copy, in plain words in all 8 languages
Niko122170f8268dab67
diff --git a/apps/host/scripts/agent2-tools-flow.mjs b/apps/host/scripts/agent2-tools-flow.mjsnew file mode 100644index 000000000..bfab6cf8d--- /dev/null+++ b/apps/host/scripts/agent2-tools-flow.mjs@@ -0,0 +1,192 @@+/**+ * Settings -> Tools and what it gives the assistant, through the real app on a real model, with screenshots (playwright-core + Chrome).+ *+ * STRATA_URL=http://127.0.0.1:8899 SHOTS=./shots MODEL='Qwen test' node scripts/agent2-tools-flow.mjs+ *+ * The host must run with STRATA_BROWSER_HEADLESS=1 (the browser step must not open a window on the person's desktop) and a scratch+ * STRATA_HOME / STRATA_TIMESKIP_DIR. Steps (each prints ok/FAIL):+ * 1. Settings -> Tools shows the groups; two tools of my own are added through the dialog (instructions, command);+ * 2. web search with no key: "Searched the web" card, real DuckDuckGo results in the answer;+ * 3. the instruction tool is used without asking and shapes the answer; the command tool asks first in Manual, runs after Approve;+ * 4. Search the web switched off: the assistant has no search tool any more;+ * 5. the browser switched on: Manual asks before opening https://example.com, the answer names the page's heading.+ */+import { chromium } from 'playwright-core';+import { existsSync, mkdirSync } from 'node:fs';+import { join, resolve } from 'node:path';++const BASE = process.env.STRATA_URL;+if (!BASE) { console.error('STRATA_URL is required'); process.exit(2); }+const SHOTS = resolve(process.env.SHOTS ?? 'agent2-tools-shots');+mkdirSync(SHOTS, { recursive: true });+const MODEL = process.env.MODEL ?? 'Qwen test';+const SKIP = new Set((process.env.SKIP ?? '').split(',').filter(Boolean));+const CHROME = process.env.CHROME ?? ['C:/Program Files/Google/Chrome/Application/chrome.exe', '/usr/bin/google-chrome'].find(existsSync);++let failed = false;+const check = (ok, label) => { console.log(`${ok ? 'ok ' : 'FAIL'} ${label}`); if (!ok) failed = true; };+const browser = await chromium.launch({ executablePath: CHROME, headless: true });+const page = await browser.newPage({ viewport: { width: 1360, height: 980 } });+const problems = [];+page.on('pageerror', e => problems.push(`pageerror: ${e.message}`));+page.on('console', m => { if (m.type() === 'error') problems.push(`console: ${m.text().slice(0, 200)}`); });+const shot = async name => { await page.waitForTimeout(500); await page.screenshot({ path: join(SHOTS, `${name}.png`) }); console.log(`shot ${name}.png`); };+const send = async text => { await page.locator('textarea').first().fill(text); await page.getByRole('button', { name: 'Send' }).click(); };+const idle = async (ms = 900000) => page.waitForFunction(() => document.documentElement.dataset.streaming !== 'true', null, { timeout: ms });+const started = async () => page.waitForFunction(() => document.documentElement.dataset.streaming === 'true', null, { timeout: 30000 });+const chatText = () => page.evaluate(() => document.querySelector('.chat')?.innerText ?? document.body.innerText);++async function approveUntilIdle(label) {+ let asked = 0; const seen = new Set(); const reasons = [];+ for (;;) {+ const streaming = await page.evaluate(() => document.documentElement.dataset.streaming === 'true');+ const cards = page.locator('.toolcard[data-state="proposed"]');+ const n = await cards.count();+ for (let i = 0; i < n; i++) {+ const card = cards.nth(i);+ const key = (await card.innerText()).slice(0, 200);+ if (!seen.has(key)) { seen.add(key); asked++; reasons.push(key.replace(/\s+/g, ' ')); await shot(`${label}-approve-${asked}`); }+ await card.getByRole('button', { name: 'Approve' }).click().catch(() => {});+ }+ if (!streaming && n === 0) break;+ await page.waitForTimeout(400);+ }+ return { asked, reasons };+}+async function openTools() {+ await page.goto(`${BASE}/#/settings`);+ await page.waitForSelector('#settings-tab-Tools', { timeout: 20000 });+ await page.locator('#settings-tab-Tools').evaluate(el => el.click());+ await page.waitForSelector('.settings-tools', { timeout: 10000 });+ await page.waitForSelector('.settings-tools [role="switch"]', { timeout: 10000 });+}+async function newChat() {+ await page.goto(`${BASE}/#/chat`);+ await page.waitForTimeout(1200);+ await page.getByRole('button', { name: 'New chat' }).first().click();+ await page.waitForTimeout(600);+ await page.getByRole('button', { name: /Choose model/ }).first().click();+ await page.waitForTimeout(300);+ await page.getByRole('menuitemradio', { name: new RegExp(MODEL) }).first().click();+ await page.waitForTimeout(300);+}++try {+ await page.goto(`${BASE}/`);+ const skip = page.getByText('Go straight to the app');+ await skip.waitFor({ timeout: 8000 }).then(() => skip.click()).catch(() => {});++ // 1. the screen, and two tools of my own+ if (!SKIP.has('own')) {+ await openTools();+ await shot('01-tools');+ const names = await page.locator('.settings-tools .field__label, .settings-tools [class*="field__label"]').allInnerTexts();+ check(['Run commands', 'Search the web', 'Open web pages', 'Goals'].every(n => names.some(x => x.includes(n))), 'the groups are listed in plain words');+ await page.getByRole('button', { name: 'Add a tool' }).click();+ await page.getByRole('dialog').getByLabel('Name').fill('House style');+ await page.getByRole('dialog').getByLabel('What it does').fill('Our house style for every answer.');+ await page.getByRole('dialog').getByLabel('Instructions').fill('End your answer with the single word FINISHED on a line of its own.');+ await shot('02-add-instructions');+ await page.getByRole('button', { name: 'Save tool' }).click();+ await page.waitForTimeout(800);+ await page.getByRole('button', { name: 'Add a tool' }).click();+ await page.getByRole('dialog').getByLabel('Name').fill('Say hello');+ await page.getByRole('dialog').getByLabel('What it does').fill('Prints a greeting from this computer.');+ await page.getByRole('dialog').getByLabel('How it works').click();+ await page.getByRole('option', { name: 'Run a command' }).click();+ await page.getByRole('dialog').getByLabel('Command to run').fill('echo hello from my own tool');+ await shot('03-add-command');+ await page.getByRole('button', { name: 'Save tool' }).click();+ await page.waitForTimeout(800);+ await page.getByRole('heading', { name: 'Your own tools' }).evaluate(el => el.scrollIntoView({ block: 'start' }));+ await shot('04-own-tools');+ const own = await page.locator('.settings-tools').innerText();+ check(/House style/.test(own) && /Say hello/.test(own), 'both tools of my own are listed');+ }++ // 2. web search with no key+ if (!SKIP.has('search')) {+ await newChat();+ await send('Use the web_search tool to find the GitHub page of the Strata local LLM engine by Niko1221. Tell me its address.');+ await started().catch(() => {});+ const r = await approveUntilIdle('05');+ await idle();+ await shot('05-search');+ const body = await chatText();+ check(/Searched the web/.test(body), 'a "Searched the web" card appeared');+ check(r.asked === 0, 'searching asked nothing (it only reads)');+ check(/github\.com\/Niko1221\/Strata/i.test(body), 'the answer names the real GitHub address from the results');+ }++ // 3. my own tools+ if (!SKIP.has('use')) {+ await newChat();+ await send('Use my House style tool, then tell me what 2 plus 2 is.');+ await started().catch(() => {});+ const a = await approveUntilIdle('06');+ await idle();+ await shot('06-house-style');+ const body = await chatText();+ check(/Read your instructions/.test(body), 'a "Read your instructions" card appeared');+ check(a.asked === 0, 'an instruction tool asked nothing');+ check(/FINISHED\s*$/m.test(body.trim().split('\n').filter(l => !/tok\/s|total tokens|of context/.test(l)).join('\n')), 'the answer follows the instructions (ends with FINISHED)');+ await send('Now use my Say hello tool and tell me what it printed.');+ await started().catch(() => {});+ const b = await approveUntilIdle('07');+ await idle();+ await shot('07-say-hello');+ const after = await chatText();+ check(b.asked >= 1 && b.reasons.some(x => /Run your tool .say hello./i.test(x)), `Manual asked first, in plain words (${b.reasons[0] ?? 'no card'})`);+ check(/hello from my own tool/i.test(after), 'after Approve the command ran and the answer has its output');+ }++ // 4. Search the web switched off+ if (!SKIP.has('off')) {+ await openTools();+ await page.getByRole('switch', { name: 'Search the web' }).click();+ await page.waitForTimeout(800);+ await shot('08-search-off');+ check((await page.getByRole('switch', { name: 'Search the web' }).getAttribute('aria-checked')) === 'false', 'the switch is off');+ await newChat();+ await send('Use the web_search tool to search for the word Strata. If you have no such tool, say exactly: NO SEARCH TOOL.');+ await started().catch(() => {});+ await approveUntilIdle('08');+ await idle();+ await shot('09-no-search');+ const body = await chatText();+ check(!/Searched the web|Searching the web/.test(body), 'no search card: the assistant has no search tool now');+ await openTools();+ await page.getByRole('switch', { name: 'Search the web' }).click();+ await page.waitForTimeout(500);+ }++ // 5. the browser+ if (!SKIP.has('browser')) {+ await openTools();+ await page.getByRole('heading', { name: 'Web browser' }).evaluate(el => el.scrollIntoView({ block: 'start' }));+ const sw = page.getByRole('switch', { name: 'Use a web browser' });+ check(await sw.isEnabled(), 'the browser switch is available (Chrome or Edge and the tool server were found)');+ await sw.click();+ await page.waitForTimeout(800);+ await shot('10-browser-on');+ await newChat();+ await send('Open https://example.com in the browser and tell me the big heading on that page.');+ await started().catch(() => {});+ const r = await approveUntilIdle('11');+ await idle();+ await shot('11-browser');+ const body = await chatText();+ check(r.asked >= 1 && r.reasons.some(x => /Open the web page https:\/\/example\.com/i.test(x)), `Manual asked before opening the page (${r.reasons[0] ?? 'no card'})`);+ check(/Opened a page in the browser/.test(body), 'a plain "Opened a page in the browser" card appeared');+ check(/Example Domain/.test(body), 'the answer names the page heading');+ }+} catch (e) {+ console.log('ERROR', e.message);+ await shot('zz-error').catch(() => {});+ failed = true;+} finally {+ const text = problems.filter(p => !/Failed to load resource|ERR_|favicon/.test(p));+ console.log(`page problems: ${text.length}`); text.slice(0, 8).forEach(p => console.log(' ' + p));+ await browser.close();+}+process.exit(failed ? 1 : 0);diff --git a/apps/host/server/index.mjs b/apps/host/server/index.mjsindex 053903bac..51976008b 100644--- a/apps/host/server/index.mjs+++ b/apps/host/server/index.mjs@@ -927,6 +927,8 @@ async function api(req, res, path, method, url) {const workspace = String(body.workspace ?? '').trim() || ((workspaceId ? workspaces.find(w => w.id === workspaceId)?.path : null) ?? WORKSPACE);const prompt = String(body.prompt ?? '').trim().slice(0, 4000);const reviseCommand = body.useAgent === false ? null : TIMESKIP_REVISE;+ // The folder of the app itself is never a person's work: "Keep the update" would write into the installation.+ if (resolve(workspace) === resolve(ROOT) || resolve(workspace).startsWith(resolve(ROOT) + sep)) return error(res, 400, 'Time-skip works on a folder of your own. Choose a workspace folder for this chat, then try again.');// A trial copies the folder (twice), so a huge folder is refused in plain words instead of filling the disk.if (existsSync(workspace)) {const size = measureFolder(workspace);diff --git a/apps/host/src/lib/store.ts b/apps/host/src/lib/store.tsindex 21d9629ae..eb0c34f75 100644--- a/apps/host/src/lib/store.ts+++ b/apps/host/src/lib/store.ts@@ -1130,7 +1130,8 @@ export function plainTimeSkipError(raw: string | null | undefined): string {const afterExit = /\(exit \d+\):\s*([\s\S]*)$/.exec(text);const body = (afterExit?.[1] ?? text).replace(/^\w*Error:\s*/, '').trim();if (/destination changed|refusing to overwrite/i.test(body)) return tr('Your files changed after this trial started, so nothing was overwritten. Run Time-skip again.');- if (/too big/i.test(body)) return body;+ if (/too big/i.test(body)) return tr('This folder is too big to try a change on a copy. Open a smaller folder for this chat, then try again.');+ if (/folder of your own/i.test(body)) return tr('Time-skip works on a folder of your own. Choose a workspace folder for this chat, then try again.');if (/Load a model|model first/i.test(body)) return tr('Load a model first, then try Time-skip again.');if (/needs the Strata app|could not be reached/i.test(body)) return tr('The assistant could not be reached. Try again.');return body.length > 300 ? body.slice(0, 299) + '…' : body;diff --git a/apps/host/src/locales/de.json b/apps/host/src/locales/de.jsonindex c953491d2..78a15457c 100644--- a/apps/host/src/locales/de.json+++ b/apps/host/src/locales/de.json@@ -2826,5 +2826,7 @@"s2828": "Deine Anweisungen ließen sich nicht lesen","s2829": "Dein Werkzeug läuft","s2830": "Dein Werkzeug ausgeführt",- "s2831": "Dein Werkzeug ist fehlgeschlagen"+ "s2831": "Dein Werkzeug ist fehlgeschlagen",+ "s2832": "Dieser Ordner ist zu groß, um eine Änderung an einer Kopie auszuprobieren. Öffne für diesen Chat einen kleineren Ordner und versuche es erneut.",+ "s2833": "Time-skip arbeitet an einem eigenen Ordner von dir. Wähle für diesen Chat einen Arbeitsordner und versuche es erneut."}diff --git a/apps/host/src/locales/en.json b/apps/host/src/locales/en.jsonindex 5bb94693c..e63d42147 100644--- a/apps/host/src/locales/en.json+++ b/apps/host/src/locales/en.json@@ -2826,5 +2826,7 @@"s2828": "Couldn't read your instructions","s2829": "Running your tool","s2830": "Ran your tool",- "s2831": "Your tool failed"+ "s2831": "Your tool failed",+ "s2832": "This folder is too big to try a change on a copy. Open a smaller folder for this chat, then try again.",+ "s2833": "Time-skip works on a folder of your own. Choose a workspace folder for this chat, then try again."}diff --git a/apps/host/src/locales/es.json b/apps/host/src/locales/es.jsonindex 5616bd586..46cdae52c 100644--- a/apps/host/src/locales/es.json+++ b/apps/host/src/locales/es.json@@ -2826,5 +2826,7 @@"s2828": "No se pudieron leer tus instrucciones","s2829": "Ejecutando tu herramienta","s2830": "Ejecutó tu herramienta",- "s2831": "Tu herramienta falló"+ "s2831": "Tu herramienta falló",+ "s2832": "Esta carpeta es demasiado grande para probar un cambio en una copia. Abre una carpeta más pequeña para este chat e inténtalo de nuevo.",+ "s2833": "Time-skip trabaja sobre una carpeta tuya. Elige una carpeta de trabajo para este chat e inténtalo de nuevo."}diff --git a/apps/host/src/locales/ja.json b/apps/host/src/locales/ja.jsonindex ab6439406..ef044f2e7 100644--- a/apps/host/src/locales/ja.json+++ b/apps/host/src/locales/ja.json@@ -2826,5 +2826,7 @@"s2828": "あなたの指示を読めませんでした","s2829": "あなたのツールを実行しています","s2830": "あなたのツールを実行しました",- "s2831": "あなたのツールは失敗しました"+ "s2831": "あなたのツールは失敗しました",+ "s2832": "このフォルダーは大きすぎて、コピーで変更を試せません。このチャットでは小さいフォルダーを開いてから、もう一度お試しください。",+ "s2833": "Time-skip はあなた自身のフォルダーで動作します。このチャットの作業フォルダーを選んでから、もう一度お試しください。"}diff --git a/apps/host/src/locales/ko.json b/apps/host/src/locales/ko.jsonindex e096fbab5..7b96f2b91 100644--- a/apps/host/src/locales/ko.json+++ b/apps/host/src/locales/ko.json@@ -2826,5 +2826,7 @@"s2828": "내 지침을 읽을 수 없었습니다","s2829": "내 도구를 실행하는 중","s2830": "내 도구를 실행했습니다",- "s2831": "내 도구가 실패했습니다"+ "s2831": "내 도구가 실패했습니다",+ "s2832": "이 폴더는 너무 커서 복사본에서 변경을 시도할 수 없습니다. 이 채팅에 더 작은 폴더를 연 뒤 다시 시도하세요.",+ "s2833": "Time-skip은 내 폴더에서 작동합니다. 이 채팅의 작업 폴더를 선택한 뒤 다시 시도하세요."}diff --git a/apps/host/src/locales/pt.json b/apps/host/src/locales/pt.jsonindex 3647ea9d6..8a129b3d7 100644--- a/apps/host/src/locales/pt.json+++ b/apps/host/src/locales/pt.json@@ -2826,5 +2826,7 @@"s2828": "Não foi possível ler as suas instruções","s2829": "Executando a sua ferramenta","s2830": "Executou a sua ferramenta",- "s2831": "A sua ferramenta falhou"+ "s2831": "A sua ferramenta falhou",+ "s2832": "Esta pasta é grande demais para testar uma mudança numa cópia. Abra uma pasta menor para este chat e tente novamente.",+ "s2833": "O Time-skip funciona numa pasta sua. Escolha uma pasta de trabalho para este chat e tente novamente."}diff --git a/apps/host/src/locales/ru.json b/apps/host/src/locales/ru.jsonindex 093af3228..9752befed 100644--- a/apps/host/src/locales/ru.json+++ b/apps/host/src/locales/ru.json@@ -2826,5 +2826,7 @@"s2828": "Не удалось прочитать ваши инструкции","s2829": "Запускается ваш инструмент","s2830": "Ваш инструмент выполнен",- "s2831": "Ваш инструмент завершился с ошибкой"+ "s2831": "Ваш инструмент завершился с ошибкой",+ "s2832": "Эта папка слишком большая, чтобы пробовать изменение на копии. Откройте для этого чата папку поменьше и повторите попытку.",+ "s2833": "Time-skip работает с вашей собственной папкой. Выберите рабочую папку для этого чата и повторите попытку."}diff --git a/apps/host/src/locales/zh.json b/apps/host/src/locales/zh.jsonindex 0262f7744..e563fb3e9 100644--- a/apps/host/src/locales/zh.json+++ b/apps/host/src/locales/zh.json@@ -2826,5 +2826,7 @@"s2828": "无法读取你的说明","s2829": "正在运行你的工具","s2830": "已运行你的工具",- "s2831": "你的工具运行失败"+ "s2831": "你的工具运行失败",+ "s2832": "此文件夹太大,无法在副本上尝试修改。请为此聊天打开一个更小的文件夹,然后重试。",+ "s2833": "Time-skip 需要在你自己的文件夹中运行。请为此聊天选择一个工作区文件夹,然后重试。"}