feat: add advanced context actions and optional translation

This commit is contained in:
golem
2026-10-05 15:38:16 -06:00
parent 33c4dad00f
commit 5308932bf1
34 changed files with 1579 additions and 159 deletions
+14
View File
@@ -0,0 +1,14 @@
import test from 'node:test';
import assert from 'node:assert/strict';
const { openChat } = await import('../background/open-chat.js').catch(()=>({}));
test('window failure falls back to tab, background mode stays inactive, final failure rejects', async()=>{
assert.equal(typeof openChat,'function');
const opened=[];
const browser={windows:{create:async()=>{throw Error('window failed');}},tabs:{create:async v=>opened.push(v)}};
await openChat(browser,'https://chatgpt.com/','new-window');
assert.deepEqual(opened,[{url:'https://chatgpt.com/',active:true}]);
await openChat(browser,'https://chatgpt.com/','background-tab');
assert.equal(opened[1].active,false);
browser.tabs.create=async()=>{throw Error('tab failed');};
await assert.rejects(openChat(browser,'https://chatgpt.com/','new-window'));
});