Documented tree replacement (the history has no git-subtree metadata): 3-way merge of the old subtree (570201a:engine/strata) against upstream 41cf05a06a25dd29103b7b27a2279a3f60c21876 (2026-10-25), merge base = the old pin d9ab8435 (tree-identical to upstream 5b734e42; d9ab8435 is not an ancestor of upstream main). Local patches re-applied by hand where they conflicted (15 files): STRATA_CUDA_STATIC profile, experimental KAR experts and KAR PLE arms, keyless V-only arm (now beside upstream's K8V4 hybrid KV and fused norm+rope). Details, conflict table and left-out files are in docs/upstream.md. Left out (weights, captures, logs, media): new bench/results (2022 files), binary media and app assets (61), docs/work/evidence (24), *.bin / *.gguf data files, and the 7 files the first import already left out. scripts/build-cpu.sh: build the 11 CPU tests upstream registered since the old pin (they ran as "Not Run"). Checked: build-cpu.sh 16/16 ctest in WSL; sm_86 CUDA objects of the patched files compile, also with the KAR macros on. No GPU run, no quality gate. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
54 lines
3.8 KiB
JavaScript
54 lines
3.8 KiB
JavaScript
/** Item 2: an approval card asks in plain words; the exact command stays in the card's Details. */
|
|
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { askFor } from '../server/agent/ask.mjs';
|
|
import { TurnProjector } from '../server/agent/events.mjs';
|
|
|
|
const sh = command => askFor('pwsh', { command });
|
|
const ev = (type, data, seq = 1, time = 1000) => ({ type: 'event', event: { type, seq, time, data } });
|
|
|
|
test('opening a folder is asked as opening that folder, with the common ones by name', () => {
|
|
assert.deepEqual(sh('Start-Process explorer.exe -ArgumentList "C:\\Users\\Ana\\Documents"').id, 'open-known-folder');
|
|
assert.deepEqual(sh('Start-Process explorer.exe -ArgumentList "C:\\Users\\Ana\\Documents"').params, ['Documents']);
|
|
assert.deepEqual(sh('explorer.exe C:\\Users\\Ana\\Downloads').params, ['Downloads']);
|
|
assert.deepEqual(sh('Start-Process explorer.exe C:\\work\\Reports'), { id: 'open-folder', params: ['Reports'], why: 'opens-window', detail: 'C:\\work\\Reports' });
|
|
assert.equal(sh('Invoke-Item C:\\work\\plan.pdf').id, 'open-file');
|
|
assert.equal(sh('explorer.exe').id, 'open-explorer');
|
|
});
|
|
|
|
test('running a program, deleting, creating and copying are named for what they are', () => {
|
|
assert.deepEqual(sh('Start-Process "C:\\Users\\Ana\\Downloads\\setup.exe" -ArgumentList /S').params, ['setup.exe']);
|
|
assert.equal(sh('Start-Process "C:\\Users\\Ana\\Downloads\\setup.exe" -ArgumentList /S').id, 'run-program');
|
|
assert.deepEqual(sh('Remove-Item C:\\tmp\\old.txt -Force'), { id: 'delete', params: ['old.txt'], why: 'delete-why', detail: 'C:\\tmp\\old.txt' });
|
|
assert.equal(sh('rm -rf build').id, 'delete');
|
|
assert.equal(sh('New-Item -ItemType File -Path C:\\Users\\Ana\\Desktop\\notes.txt').id, 'create-file');
|
|
assert.equal(sh('mkdir C:\\work\\out').id, 'create-folder');
|
|
assert.equal(sh('Copy-Item a.txt b.txt').id, 'copy');
|
|
assert.equal(sh('Get-Date | Out-File C:\\x\\a.txt').id, 'write-file');
|
|
assert.equal(sh('echo hi > notes.txt').params[0], 'notes.txt');
|
|
assert.deepEqual(sh('git push origin main'), { id: 'git', params: ['push'], why: 'changes-repo' });
|
|
assert.equal(sh('npm install left-pad').id, 'install');
|
|
assert.equal(sh('python build.py').id, 'run-script');
|
|
});
|
|
|
|
test('files the agent writes or edits, and the tools that are not commands', () => {
|
|
assert.deepEqual(askFor('write', { file_path: 'C:/Users/Ana/Desktop/notes.txt' }), { id: 'create-file', params: ['notes.txt'], why: 'replaces-if-exists', detail: 'C:/Users/Ana/Desktop/notes.txt' });
|
|
assert.equal(askFor('edit', { file_path: 'C:/a/b.md' }).id, 'change-file');
|
|
assert.equal(askFor('job_kill', {}).id, 'stop-task');
|
|
assert.deepEqual(askFor('web_fetch', { url: 'https://example.com/a?b=1' }).params, ['example.com']);
|
|
assert.deepEqual(askFor('mcp__github__create_issue', {}).params, ['github / create_issue']);
|
|
});
|
|
|
|
test('what it cannot read it does not pretend to: a generic question, with the model\'s own description when there is one', () => {
|
|
assert.deepEqual(sh('foo --bar'), { id: 'run-command', params: [], why: 'run-command-why' });
|
|
assert.equal(askFor('pwsh', { command: 'foo --bar' }, 'Rebuild the index').detail, 'Rebuild the index');
|
|
assert.equal(sh('Get-Date; Remove-Item x.txt').id, 'run-steps', 'two different steps are said to be steps');
|
|
});
|
|
|
|
test('the card carries the question, and the exact command stays in its arguments for Details', () => {
|
|
const p = new TurnProjector({ startedAt: 0 });
|
|
const card = p.consume(ev('tool/call', { callId: 'a1', name: 'pwsh', arguments: JSON.stringify({ command: 'Start-Process explorer.exe -ArgumentList "C:\\Users\\Ana\\Documents"', description: 'Open Documents' }) }))[0].tool;
|
|
assert.equal(card.ask.id, 'open-known-folder'); assert.deepEqual(card.ask.params, ['Documents']);
|
|
assert.match(card.preview, /Start-Process explorer\.exe/, 'the command is still sent for the Details disclosure');
|
|
});
|