@@ -107,6 +107,7 @@ test('harness bridge caps voice shell chaining', () => {
|
||||
assert.match(bridge.options.system, /You are Jarvis/);
|
||||
assert.match(bridge.options.system, /SOUL\.md/);
|
||||
assert.match(bridge.options.system, /PERSONA\.md/);
|
||||
assert.match(bridge.options.system, /It is /);
|
||||
assert.doesNotMatch(bridge.options.system, /User personality notes/);
|
||||
assert.deepEqual(bridge.options.builtinTools, [
|
||||
'read_file',
|
||||
@@ -130,6 +131,28 @@ test('harness bridge caps voice shell chaining', () => {
|
||||
'memory_write',
|
||||
]);
|
||||
assert.equal(bridge.options.webFetch, true);
|
||||
assert.ok(bridge.options.tools.some((tool) => tool.name === 'browser'));
|
||||
assert.equal(bridge.options.tools.find((tool) => tool.name === 'browser').permission, 'read');
|
||||
assert.ok(bridge.options.tools.some((tool) => tool.name === 'webcam'));
|
||||
assert.equal(bridge.options.tools.find((tool) => tool.name === 'webcam').permission, 'read');
|
||||
assert.ok(bridge.options.tools.length <= 32, 'custom tools exceed harness cap: ' + bridge.options.tools.length);
|
||||
});
|
||||
|
||||
test('ask rebuilds the system prompt instead of keeping a stale clock', async () => {
|
||||
const bridge = new HarnessBridge({ fsAccess: 'workspace' });
|
||||
bridge.options.system = 'stale';
|
||||
bridge.session = {
|
||||
async prompt() { return { ok: true, text: 'Hello there.' }; },
|
||||
on() { return () => {}; },
|
||||
};
|
||||
try {
|
||||
await bridge.ask('hi');
|
||||
assert.match(bridge.options.system, /You are Jarvis/);
|
||||
assert.match(bridge.options.system, /It is /);
|
||||
assert.doesNotMatch(bridge.options.system, /^stale$/);
|
||||
} finally {
|
||||
await bridge.close();
|
||||
}
|
||||
});
|
||||
|
||||
test('harness bridge recovers streamed text when final envelope is empty after a tool call', async () => {
|
||||
@@ -247,6 +270,39 @@ test('Grant desktop revokes any previous portal session before asking GNOME agai
|
||||
} finally { await daemon.close(); }
|
||||
});
|
||||
|
||||
test('camera Allow now starts a grant even when Camera access is off', async () => {
|
||||
const daemon = new JarvisDaemon();
|
||||
const order = [];
|
||||
try {
|
||||
assert.equal(daemon.settings.webcamEnabled, false);
|
||||
daemon.webcam = {
|
||||
access: (opts) => { order.push(['access', opts]); return Promise.resolve({ ok: true, via: 'grant' }); },
|
||||
};
|
||||
daemon.webcamGrant();
|
||||
await Promise.resolve();
|
||||
assert.equal(daemon.camera.status().active, true);
|
||||
assert.equal(daemon.camera.status().enabled, true);
|
||||
assert.equal(daemon.camera.status().backend, 'grant');
|
||||
assert.deepEqual(order[0], ['access', { device: '' }]);
|
||||
const status = JSON.parse(daemon.runtimeStatus());
|
||||
assert.equal(status.camera.active, true);
|
||||
daemon.webcamRevoke();
|
||||
assert.equal(daemon.camera.status().active, false);
|
||||
assert.equal(daemon.camera.status().enabled, false);
|
||||
} finally { await daemon.close(); }
|
||||
});
|
||||
|
||||
test('a failed camera portal does not revoke an Allow now grant', async () => {
|
||||
const daemon = new JarvisDaemon();
|
||||
try {
|
||||
daemon.webcam = { access: async () => { throw new Error('Camera portal Access response 2'); } };
|
||||
daemon.webcamGrant();
|
||||
await Promise.resolve();
|
||||
await Promise.resolve();
|
||||
assert.equal(daemon.camera.status().active, true);
|
||||
} finally { await daemon.close(); }
|
||||
});
|
||||
|
||||
test('cancel suppresses a late reply and revokes portal input', async () => {
|
||||
const daemon = new JarvisDaemon(); let resolve; let revoked = false;
|
||||
daemon.input = { revoke: () => { revoked = true; } };
|
||||
|
||||
Reference in New Issue
Block a user