From d146b0da299bcd90e8ed86d875e6770777cfc3f4 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Fri, 16 Oct 2026 11:01:55 +0200 Subject: [PATCH] plain browser card sentences (waiting, scripts, tabs, back, close), no empty braces on cards; tools flow script for the real model --- apps/host/scripts/agent2-tools-flow.mjs | 4 ++-- apps/host/server/agent/events.mjs | 8 +++++++- apps/host/src/locales/de.json | 17 ++++++++++++++++- apps/host/src/locales/en.json | 17 ++++++++++++++++- apps/host/src/locales/es.json | 17 ++++++++++++++++- apps/host/src/locales/ja.json | 17 ++++++++++++++++- apps/host/src/locales/ko.json | 17 ++++++++++++++++- apps/host/src/locales/pt.json | 17 ++++++++++++++++- apps/host/src/locales/ru.json | 17 ++++++++++++++++- apps/host/src/locales/zh.json | 17 ++++++++++++++++- apps/host/tests/agent-events.test.mjs | 7 +++++++ 11 files changed, 144 insertions(+), 11 deletions(-) diff --git a/apps/host/scripts/agent2-tools-flow.mjs b/apps/host/scripts/agent2-tools-flow.mjs index bfab6cf8..29468cf4 100644 --- a/apps/host/scripts/agent2-tools-flow.mjs +++ b/apps/host/scripts/agent2-tools-flow.mjs @@ -136,7 +136,7 @@ try { 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(b.asked >= 1 && b.reasons.some(x => /Running 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'); } @@ -176,7 +176,7 @@ try { 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(r.asked >= 1 && r.reasons.some(x => /Opening a page in the browser.*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'); } diff --git a/apps/host/server/agent/events.mjs b/apps/host/server/agent/events.mjs index f8d0d658..204d768c 100644 --- a/apps/host/server/agent/events.mjs +++ b/apps/host/server/agent/events.mjs @@ -92,6 +92,12 @@ const BROWSER_VERBS = { browser_press_key: ['Typing on the page', 'Typed on the page', "Couldn't type on the page"], browser_snapshot: ['Looking at the page', 'Looked at the page', "Couldn't look at the page"], browser_take_screenshot: ['Looking at the page', 'Looked at the page', "Couldn't look at the page"], + browser_evaluate: ['Running a small program on the page', 'Ran a small program on the page', "Couldn't run the program on the page"], + browser_run_code: ['Running a small program on the page', 'Ran a small program on the page', "Couldn't run the program on the page"], + browser_wait_for: ['Waiting for the page', 'Waited for the page', "Couldn't wait for the page"], + browser_navigate_back: ['Going back a page', 'Went back a page', "Couldn't go back"], + browser_tabs: ['Managing browser tabs', 'Managed browser tabs', "Couldn't manage the browser tabs"], + browser_close: ['Closing the browser page', 'Closed the browser page', "Couldn't close the browser page"], }; const BROWSER_GENERIC = ['Using the browser', 'Used the browser', 'The browser step failed']; const BROWSER_PREFIX = 'mcp__browser__', INSTRUCTIONS_PREFIX = 'mcp__strata-instructions__', COMMANDS_PREFIX = 'mcp__strata-commands__'; @@ -117,7 +123,7 @@ export function presentTool({ callId, name, args, reason = null }) { const words = WORDS[name]?.(args); const preview = scope === 'shell' && !words ? args.command ?? '' : scope === 'write' ? args.file_path ?? args.path ?? args.filePath ?? '' - : words ? words[1] ?? '' : name.startsWith(INSTRUCTIONS_PREFIX) || name.startsWith(COMMANDS_PREFIX) ? ownToolName(name) : args.file_path ?? args.path ?? args.pattern ?? args.url ?? args.element ?? args.query ?? JSON.stringify(args); + : words ? words[1] ?? '' : name.startsWith(INSTRUCTIONS_PREFIX) || name.startsWith(COMMANDS_PREFIX) ? ownToolName(name) : /^mcp__browser__browser_(evaluate|run_code)$/.test(name) ? '' : args.file_path ?? args.path ?? args.pattern ?? args.url ?? args.element ?? args.query ?? args.text ?? args.action ?? (Object.keys(args).length ? JSON.stringify(args) : ''); const effect = reason ?? (words ? words[0] : scope === 'shell' ? (args.description ?? 'Runs a command in the workspace.') : scope === 'write' ? 'Changes a file in the workspace.' : scope === 'read' ? 'Reads from the workspace.' : 'Uses a connected tool.'); diff --git a/apps/host/src/locales/de.json b/apps/host/src/locales/de.json index 78a15457..6acb6f6b 100644 --- a/apps/host/src/locales/de.json +++ b/apps/host/src/locales/de.json @@ -2828,5 +2828,20 @@ "s2830": "Dein Werkzeug ausgeführt", "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." + "s2833": "Time-skip arbeitet an einem eigenen Ordner von dir. Wähle für diesen Chat einen Arbeitsordner und versuche es erneut.", + "s2834": "Ein kleines Programm auf der Seite läuft", + "s2835": "Ein kleines Programm auf der Seite ausgeführt", + "s2836": "Das Programm ließ sich auf der Seite nicht ausführen", + "s2837": "Es wird auf die Seite gewartet", + "s2838": "Auf die Seite gewartet", + "s2839": "Das Warten auf die Seite ging nicht", + "s2840": "Eine Seite zurück", + "s2841": "Eine Seite zurückgegangen", + "s2842": "Zurückgehen ging nicht", + "s2843": "Browser-Tabs werden verwaltet", + "s2844": "Browser-Tabs verwaltet", + "s2845": "Die Browser-Tabs ließen sich nicht verwalten", + "s2846": "Die Browser-Seite wird geschlossen", + "s2847": "Die Browser-Seite geschlossen", + "s2848": "Die Browser-Seite ließ sich nicht schließen" } diff --git a/apps/host/src/locales/en.json b/apps/host/src/locales/en.json index e63d4214..ac23f58b 100644 --- a/apps/host/src/locales/en.json +++ b/apps/host/src/locales/en.json @@ -2828,5 +2828,20 @@ "s2830": "Ran your tool", "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." + "s2833": "Time-skip works on a folder of your own. Choose a workspace folder for this chat, then try again.", + "s2834": "Running a small program on the page", + "s2835": "Ran a small program on the page", + "s2836": "Couldn't run the program on the page", + "s2837": "Waiting for the page", + "s2838": "Waited for the page", + "s2839": "Couldn't wait for the page", + "s2840": "Going back a page", + "s2841": "Went back a page", + "s2842": "Couldn't go back", + "s2843": "Managing browser tabs", + "s2844": "Managed browser tabs", + "s2845": "Couldn't manage the browser tabs", + "s2846": "Closing the browser page", + "s2847": "Closed the browser page", + "s2848": "Couldn't close the browser page" } diff --git a/apps/host/src/locales/es.json b/apps/host/src/locales/es.json index 46cdae52..35e96261 100644 --- a/apps/host/src/locales/es.json +++ b/apps/host/src/locales/es.json @@ -2828,5 +2828,20 @@ "s2830": "Ejecutó tu herramienta", "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." + "s2833": "Time-skip trabaja sobre una carpeta tuya. Elige una carpeta de trabajo para este chat e inténtalo de nuevo.", + "s2834": "Ejecutando un pequeño programa en la página", + "s2835": "Ejecutó un pequeño programa en la página", + "s2836": "No se pudo ejecutar el programa en la página", + "s2837": "Esperando a la página", + "s2838": "Esperó a la página", + "s2839": "No se pudo esperar a la página", + "s2840": "Volviendo a la página anterior", + "s2841": "Volvió a la página anterior", + "s2842": "No se pudo volver atrás", + "s2843": "Gestionando las pestañas del navegador", + "s2844": "Gestionó las pestañas del navegador", + "s2845": "No se pudieron gestionar las pestañas del navegador", + "s2846": "Cerrando la página del navegador", + "s2847": "Cerró la página del navegador", + "s2848": "No se pudo cerrar la página del navegador" } diff --git a/apps/host/src/locales/ja.json b/apps/host/src/locales/ja.json index ef044f2e..6b002e7f 100644 --- a/apps/host/src/locales/ja.json +++ b/apps/host/src/locales/ja.json @@ -2828,5 +2828,20 @@ "s2830": "あなたのツールを実行しました", "s2831": "あなたのツールは失敗しました", "s2832": "このフォルダーは大きすぎて、コピーで変更を試せません。このチャットでは小さいフォルダーを開いてから、もう一度お試しください。", - "s2833": "Time-skip はあなた自身のフォルダーで動作します。このチャットの作業フォルダーを選んでから、もう一度お試しください。" + "s2833": "Time-skip はあなた自身のフォルダーで動作します。このチャットの作業フォルダーを選んでから、もう一度お試しください。", + "s2834": "ページ上で小さなプログラムを実行しています", + "s2835": "ページ上で小さなプログラムを実行しました", + "s2836": "ページ上でプログラムを実行できませんでした", + "s2837": "ページを待っています", + "s2838": "ページを待ちました", + "s2839": "ページを待てませんでした", + "s2840": "前のページに戻っています", + "s2841": "前のページに戻りました", + "s2842": "戻れませんでした", + "s2843": "ブラウザーのタブを操作しています", + "s2844": "ブラウザーのタブを操作しました", + "s2845": "ブラウザーのタブを操作できませんでした", + "s2846": "ブラウザーのページを閉じています", + "s2847": "ブラウザーのページを閉じました", + "s2848": "ブラウザーのページを閉じられませんでした" } diff --git a/apps/host/src/locales/ko.json b/apps/host/src/locales/ko.json index 7b96f2b9..2ce05406 100644 --- a/apps/host/src/locales/ko.json +++ b/apps/host/src/locales/ko.json @@ -2828,5 +2828,20 @@ "s2830": "내 도구를 실행했습니다", "s2831": "내 도구가 실패했습니다", "s2832": "이 폴더는 너무 커서 복사본에서 변경을 시도할 수 없습니다. 이 채팅에 더 작은 폴더를 연 뒤 다시 시도하세요.", - "s2833": "Time-skip은 내 폴더에서 작동합니다. 이 채팅의 작업 폴더를 선택한 뒤 다시 시도하세요." + "s2833": "Time-skip은 내 폴더에서 작동합니다. 이 채팅의 작업 폴더를 선택한 뒤 다시 시도하세요.", + "s2834": "페이지에서 작은 프로그램을 실행하는 중", + "s2835": "페이지에서 작은 프로그램을 실행했습니다", + "s2836": "페이지에서 프로그램을 실행할 수 없었습니다", + "s2837": "페이지를 기다리는 중", + "s2838": "페이지를 기다렸습니다", + "s2839": "페이지를 기다릴 수 없었습니다", + "s2840": "이전 페이지로 돌아가는 중", + "s2841": "이전 페이지로 돌아갔습니다", + "s2842": "돌아갈 수 없었습니다", + "s2843": "브라우저 탭을 관리하는 중", + "s2844": "브라우저 탭을 관리했습니다", + "s2845": "브라우저 탭을 관리할 수 없었습니다", + "s2846": "브라우저 페이지를 닫는 중", + "s2847": "브라우저 페이지를 닫았습니다", + "s2848": "브라우저 페이지를 닫을 수 없었습니다" } diff --git a/apps/host/src/locales/pt.json b/apps/host/src/locales/pt.json index 8a129b3d..d8621fd1 100644 --- a/apps/host/src/locales/pt.json +++ b/apps/host/src/locales/pt.json @@ -2828,5 +2828,20 @@ "s2830": "Executou a sua ferramenta", "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." + "s2833": "O Time-skip funciona numa pasta sua. Escolha uma pasta de trabalho para este chat e tente novamente.", + "s2834": "Executando um pequeno programa na página", + "s2835": "Executou um pequeno programa na página", + "s2836": "Não foi possível executar o programa na página", + "s2837": "Aguardando a página", + "s2838": "Aguardou a página", + "s2839": "Não foi possível aguardar a página", + "s2840": "Voltando uma página", + "s2841": "Voltou uma página", + "s2842": "Não foi possível voltar", + "s2843": "Gerenciando as abas do navegador", + "s2844": "Gerenciou as abas do navegador", + "s2845": "Não foi possível gerenciar as abas do navegador", + "s2846": "Fechando a página do navegador", + "s2847": "Fechou a página do navegador", + "s2848": "Não foi possível fechar a página do navegador" } diff --git a/apps/host/src/locales/ru.json b/apps/host/src/locales/ru.json index 9752befe..7e032aa3 100644 --- a/apps/host/src/locales/ru.json +++ b/apps/host/src/locales/ru.json @@ -2828,5 +2828,20 @@ "s2830": "Ваш инструмент выполнен", "s2831": "Ваш инструмент завершился с ошибкой", "s2832": "Эта папка слишком большая, чтобы пробовать изменение на копии. Откройте для этого чата папку поменьше и повторите попытку.", - "s2833": "Time-skip работает с вашей собственной папкой. Выберите рабочую папку для этого чата и повторите попытку." + "s2833": "Time-skip работает с вашей собственной папкой. Выберите рабочую папку для этого чата и повторите попытку.", + "s2834": "На странице выполняется небольшая программа", + "s2835": "На странице выполнена небольшая программа", + "s2836": "Не удалось выполнить программу на странице", + "s2837": "Ожидание страницы", + "s2838": "Ожидание страницы завершено", + "s2839": "Не удалось дождаться страницы", + "s2840": "Переход на предыдущую страницу", + "s2841": "Выполнен переход на предыдущую страницу", + "s2842": "Не удалось вернуться", + "s2843": "Управление вкладками браузера", + "s2844": "Вкладки браузера обработаны", + "s2845": "Не удалось управлять вкладками браузера", + "s2846": "Закрытие страницы браузера", + "s2847": "Страница браузера закрыта", + "s2848": "Не удалось закрыть страницу браузера" } diff --git a/apps/host/src/locales/zh.json b/apps/host/src/locales/zh.json index e563fb3e..a99632e8 100644 --- a/apps/host/src/locales/zh.json +++ b/apps/host/src/locales/zh.json @@ -2828,5 +2828,20 @@ "s2830": "已运行你的工具", "s2831": "你的工具运行失败", "s2832": "此文件夹太大,无法在副本上尝试修改。请为此聊天打开一个更小的文件夹,然后重试。", - "s2833": "Time-skip 需要在你自己的文件夹中运行。请为此聊天选择一个工作区文件夹,然后重试。" + "s2833": "Time-skip 需要在你自己的文件夹中运行。请为此聊天选择一个工作区文件夹,然后重试。", + "s2834": "正在页面上运行一个小程序", + "s2835": "已在页面上运行一个小程序", + "s2836": "无法在页面上运行该程序", + "s2837": "正在等待页面", + "s2838": "已等待页面", + "s2839": "无法等待页面", + "s2840": "正在返回上一页", + "s2841": "已返回上一页", + "s2842": "无法返回", + "s2843": "正在管理浏览器标签页", + "s2844": "已管理浏览器标签页", + "s2845": "无法管理浏览器标签页", + "s2846": "正在关闭浏览器页面", + "s2847": "已关闭浏览器页面", + "s2848": "无法关闭浏览器页面" } diff --git a/apps/host/tests/agent-events.test.mjs b/apps/host/tests/agent-events.test.mjs index ee982b6e..68a293ab 100644 --- a/apps/host/tests/agent-events.test.mjs +++ b/apps/host/tests/agent-events.test.mjs @@ -139,6 +139,11 @@ test('the browser and the person\'s own tools have plain sentences, translated i ['mcp__browser__browser_click', 'Clicking on the page', 'Clicked on the page', "Couldn't click on the page"], ['mcp__browser__browser_type', 'Typing on the page', 'Typed on the page', "Couldn't type on the page"], ['mcp__browser__browser_snapshot', 'Looking at the page', 'Looked at the page', "Couldn't look at the page"], + ['mcp__browser__browser_evaluate', 'Running a small program on the page', 'Ran a small program on the page', "Couldn't run the program on the page"], + ['mcp__browser__browser_wait_for', 'Waiting for the page', 'Waited for the page', "Couldn't wait for the page"], + ['mcp__browser__browser_navigate_back', 'Going back a page', 'Went back a page', "Couldn't go back"], + ['mcp__browser__browser_tabs', 'Managing browser tabs', 'Managed browser tabs', "Couldn't manage the browser tabs"], + ['mcp__browser__browser_close', 'Closing the browser page', 'Closed the browser page', "Couldn't close the browser page"], ['mcp__browser__browser_something_new', 'Using the browser', 'Used the browser', 'The browser step failed'], ['mcp__strata-instructions__house_style', 'Reading your instructions', 'Read your instructions', "Couldn't read your instructions"], ['mcp__strata-commands__check_site', 'Running your tool', 'Ran your tool', 'Your tool failed'], @@ -153,4 +158,6 @@ test('the browser and the person\'s own tools have plain sentences, translated i const own = presentTool({ callId: 'c2', name: 'mcp__strata-commands__check_site', args: {} }); assert.equal(own.target, 'check site'); assert.equal(presentTool({ callId: 'c3', name: 'mcp__github__create_issue', args: {} }).target, 'mcp__github__create_issue', 'an unknown connected tool keeps its name'); + assert.equal(presentTool({ callId: 'c4', name: 'mcp__browser__browser_snapshot', args: {} }).preview, '', 'no empty braces on a card'); + assert.equal(presentTool({ callId: 'c5', name: 'mcp__browser__browser_evaluate', args: { function: '() => document.title' } }).preview, '', 'a script in the page is not shown as code on the card'); });