import test from 'node:test'; import assert from 'node:assert/strict'; import { createRuntimeTools } from '../skills/runtime-tools.js'; import { assertSdkVersion } from '../daemon/qvac-master.js'; import { parseHudSidecar } from '../skills/voice-prompt.js'; import { createPhase2Tools } from '../skills/phase2-tools.js'; import { createQvacTools } from '../skills/qvac-tools.js'; import { profile } from '../daemon/model-profiles.js'; test('runtime tools expose local QVAC and computer-use status', () => { const computer = { status: () => ({ active: true, steps_used: 2, backend: 'portal-ei' }) }; const tools = createRuntimeTools({ computer }); const status = tools.find((tool) => tool.name === 'jarvis_status').execute({}); assert.equal(status.local, true); assert.equal(status.computer_use.active, true); assert.equal(tools.find((tool) => tool.name === 'cu_status').execute({}).backend, 'portal-ei'); }); test('the copied harness uses the pinned QVAC 0.19.x SDK', () => { assert.match(assertSdkVersion(), /^0\.19\./); }); test('voice sidecars are removed from speech and retained for the HUD', () => { const parsed = parseHudSidecar('Done. {"title":"Done","chips":[]}'); assert.equal(parsed.spoken, 'Done.'); assert.equal(parsed.hud.title, 'Done'); }); test('phase 2 registers safe local tools with permission metadata', async () => { const tools = createPhase2Tools({ cwd: process.cwd() }); assert.deepEqual(tools.map((tool) => tool.name), ['app_list', 'fs_search', 'fs_read', 'fs_write', 'memory_recall', 'memory_remember', 'rag_workspaces', 'capability_status']); assert.equal(tools.find((tool) => tool.name === 'fs_search').permission, 'read'); assert.ok((await tools.find((tool) => tool.name === 'fs_search').execute({ query: 'ROADMAP' })).some((x) => x.endsWith('ROADMAP.md'))); assert.deepEqual(await tools.find((tool) => tool.name === 'fs_write').execute({ file: 'nope.txt', contents: 'x', confirmed: false }), { confirmation_required: true, action: 'write', file: 'nope.txt' }); }); test('QVAC utility tools are exposed only through the master adapter', () => { assert.deepEqual(createQvacTools().map((tool) => tool.name), ['qvac_runtime_state', 'qvac_system_resources', 'qvac_assess_model_fit']); }); test('model profiles select one master model without creating another runtime', () => { assert.equal(profile('desktop-gpu').model, 'qwen3.5-9b'); assert.throws(() => profile('missing'), /unknown Jarvis model profile/); });