@@ -237,6 +237,33 @@ test('Obsidian Apply replaces the tool and memory selection, resets context, and
|
||||
}
|
||||
});
|
||||
|
||||
test('file access applies live without a service restart', async () => {
|
||||
const previous = process.env.XDG_CONFIG_HOME;
|
||||
const dir = await mkdtemp(path.join(tmpdir(), 'jarvis-file-access-'));
|
||||
process.env.XDG_CONFIG_HOME = dir; await mkdir(path.join(dir, 'jarvis'));
|
||||
const daemon = new JarvisDaemon(); let resets = 0;
|
||||
daemon.harness.resetContext = async () => { resets++; };
|
||||
daemon.setState = state => { daemon.state = state; };
|
||||
daemon.startVoice = async () => { daemon.voiceLoop = { stop: async () => {}, status: { errors: {} } }; };
|
||||
daemon.voiceLoop = { stop: async () => {} };
|
||||
try {
|
||||
const config = path.join(dir, 'jarvis/config.json');
|
||||
await writeFile(config, JSON.stringify({ fsAccess: 'filesystem' }));
|
||||
const result = JSON.parse(await daemon.reloadSettings());
|
||||
assert.equal(resets, 1); assert.deepEqual(daemon.harness.options.roots, ['/']);
|
||||
assert.equal(result.restartRequired.includes('fsAccess'), false);
|
||||
const names = daemon.harness.options.tools.map(t => t.name);
|
||||
assert.equal(new Set(names).size, names.length);
|
||||
await writeFile(config, JSON.stringify({ fsAccess: 'workspace' }));
|
||||
await daemon.reloadSettings();
|
||||
assert.equal(resets, 2); assert.deepEqual(daemon.harness.options.roots, []);
|
||||
} finally {
|
||||
clearInterval(daemon._idleTimer); clearInterval(daemon._telemetryTimer);
|
||||
if (previous === undefined) delete process.env.XDG_CONFIG_HOME; else process.env.XDG_CONFIG_HOME = previous;
|
||||
await rm(dir, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
|
||||
test('voice preview uses selected text without changing chat history or the repeat reply', async () => {
|
||||
const daemon = new JarvisDaemon(); const speech = []; const replies = [];
|
||||
daemon.setState = state => { daemon.state = state; };
|
||||
|
||||
Reference in New Issue
Block a user