scripted worker: multi script ends with its own text

This commit is contained in:
Niko1221 committed 2026-10-18 13:41:41 +02:00
1 parent b533ae5246
commit e2d03ac4fa
1 file changed
+5
@@ -127,6 +127,11 @@ export async function startScriptedWorker({ port = 0, chunkDelayMs = 40, model =
}
if (directive?.[1] === 'planslow') return say(['## Slow plan\n\n', '1. First thing SCRIPT:goalstep\n', '2. A step that never finishes SCRIPT:slow 4000\n', '3. Third thing SCRIPT:goalstep\n']);
if (directive?.[1] === 'planreply') return say(['I looked around the folder first.\n\n## The pagoda plan\n\n', '1. First thing SCRIPT:goalstep\n', '2. Second thing SCRIPT:goalstep\n', '3. Third thing SCRIPT:goalstep\n']);
if (directive?.[1] === 'multi' && last.role === 'tool') {
let cfg = {};
try { cfg = JSON.parse((directive[2] ?? '').trim()); } catch { /* a test bug */ }
return say([String(cfg.say ?? 'Done.')]);
}
if (last.role === 'tool') {
const result = text(last).replace(/\s+/g, ' ').slice(0, 120);
return say(['Tool finished. ', `Result: ${result}`]);