browser-assistant 2.8.23 → 2.8.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/extension/background.js +16 -58
- package/extension/content.js +4 -4
- package/extension/manifest.json +1 -1
- package/extension/popup.html +1 -16
- package/extension/popup.js +0 -45
- package/package.json +1 -1
- package/server/main.py +1 -1
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ A Chrome Manifest V3 extension with a local Python backend for exploring multipl
|
|
|
10
10
|
- Displays results in an in-page panel, offers code copying, and saves successful scans in local SQLite history.
|
|
11
11
|
- Includes a local practice page and automation for selecting answers, filling editors, and submitting supported forms after starting a run.
|
|
12
12
|
- Resumes CCBP practice from an already submitted answer through its submitted-question Next control, without generating or submitting that answer again. Delayed Submit controls are awaited for up to 15 seconds while the question and selected answer remain unchanged.
|
|
13
|
-
- Press **Alt +
|
|
13
|
+
- Press **Alt + A** on the webpage to start automation, then press it again to pause or resume. The previous **Alt + Shift + A** shortcut also works. It also works with the code editor focused and opens QA Control. Journal automation uses the same toggle; its existing **Alt + Shift + J** shortcut remains available.
|
|
14
14
|
|
|
15
15
|
AI answers can be wrong. Automation can change or submit page content: use it only where authorized, review results, and avoid restricted assessments. Site detection is heuristic; custom controls, frames, editors, and navigation can fail. The policy includes a general HTTP/HTTPS fallback, so it is not a strict site allowlist.
|
|
16
16
|
|
package/extension/background.js
CHANGED
|
@@ -65,10 +65,24 @@ chrome.alarms.onAlarm.addListener(alarm => {
|
|
|
65
65
|
if (alarm.name !== 'assistant-workspace-update')
|
|
66
66
|
return;
|
|
67
67
|
void checkWorkspaceUpdate();
|
|
68
|
-
void checkJournalReminder();
|
|
69
68
|
void updateJournalBadge();
|
|
70
69
|
});
|
|
71
|
-
chrome.runtime.onInstalled.addListener(
|
|
70
|
+
chrome.runtime.onInstalled.addListener(details => {
|
|
71
|
+
void attachUpdatedPanels();
|
|
72
|
+
if (details.reason === 'update')
|
|
73
|
+
void clearRetiredReminderSettings();
|
|
74
|
+
});
|
|
75
|
+
async function clearRetiredReminderSettings() {
|
|
76
|
+
try {
|
|
77
|
+
const storage = chrome.storage.local;
|
|
78
|
+
const keys = Object.keys(await storage.get()).filter(key => key === 'assistantJournalReminderConfig' || key.startsWith('assistantJournalReminder:'));
|
|
79
|
+
if (keys.length)
|
|
80
|
+
await storage.remove(keys);
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
console.warn('Could not remove retired journal reminder settings.', error);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
72
86
|
let journalBadgeRevision = 0;
|
|
73
87
|
function activeJournalTimers(data, now = Date.now()) {
|
|
74
88
|
const prefix = 'assistantJournalTimer:';
|
|
@@ -111,62 +125,6 @@ chrome.storage?.local.onChanged?.addListener(changes => {
|
|
|
111
125
|
}
|
|
112
126
|
});
|
|
113
127
|
void updateJournalBadge();
|
|
114
|
-
let checkingJournalReminder = false;
|
|
115
|
-
async function checkJournalReminder() {
|
|
116
|
-
if (checkingJournalReminder)
|
|
117
|
-
return;
|
|
118
|
-
checkingJournalReminder = true;
|
|
119
|
-
try {
|
|
120
|
-
const storage = chrome.storage.local;
|
|
121
|
-
const data = await storage.get();
|
|
122
|
-
const config = data.assistantJournalReminderConfig;
|
|
123
|
-
if (!config?.url || !config?.token)
|
|
124
|
-
return;
|
|
125
|
-
await Promise.all(activeJournalTimers(data).map(timer => sendJournalReminder(timer, config)));
|
|
126
|
-
}
|
|
127
|
-
catch { /* The minute alarm keeps timer checks independent of workspace updates. */ }
|
|
128
|
-
finally {
|
|
129
|
-
checkingJournalReminder = false;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
async function sendJournalReminder(timer, config) {
|
|
133
|
-
try {
|
|
134
|
-
const storage = chrome.storage.local;
|
|
135
|
-
const remaining = timer.deadline - Date.now();
|
|
136
|
-
// Give the portal time to confirm an existing submission at 30:00.
|
|
137
|
-
if (remaining > (30 * 60 - 45) * 1000 || remaining <= 0)
|
|
138
|
-
return;
|
|
139
|
-
const stateKey = `assistantJournalReminder:${timer.path}`;
|
|
140
|
-
const confirmationKey = `assistantJournalConfirmed:${timer.path}`;
|
|
141
|
-
const previous = await storage.get([stateKey, confirmationKey]);
|
|
142
|
-
if (previous[stateKey] || previous[confirmationKey])
|
|
143
|
-
return;
|
|
144
|
-
// Reserve the one attempt before the network call. A timed-out webhook
|
|
145
|
-
// can still have sent a message, so replay would risk a duplicate.
|
|
146
|
-
await storage.set({ [stateKey]: 'sending' });
|
|
147
|
-
const latest = await storage.get();
|
|
148
|
-
const current = activeJournalTimers(latest).find(candidate => candidate.path === timer.path);
|
|
149
|
-
if (!current || Math.abs(current.deadline - timer.deadline) > 2000 ||
|
|
150
|
-
latest.assistantJournalReminderConfig?.url !== config.url || latest.assistantJournalReminderConfig.token !== config.token) {
|
|
151
|
-
await storage.remove(stateKey);
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
let result = 'failed';
|
|
155
|
-
try {
|
|
156
|
-
const response = await fetch(config.url, {
|
|
157
|
-
method: 'POST', credentials: 'omit', redirect: 'error', signal: AbortSignal.timeout(15000),
|
|
158
|
-
headers: { 'Content-Type': 'application/json', 'X-Journal-Reminder-Token': config.token },
|
|
159
|
-
body: JSON.stringify({ event: 'journal_submission_unconfirmed' }),
|
|
160
|
-
});
|
|
161
|
-
if (response.ok)
|
|
162
|
-
result = 'sent';
|
|
163
|
-
}
|
|
164
|
-
finally {
|
|
165
|
-
await storage.set({ [stateKey]: result });
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
catch { /* One failed request does not interrupt the other journals. */ }
|
|
169
|
-
}
|
|
170
128
|
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
|
|
171
129
|
if (!request || typeof request.action !== 'string') {
|
|
172
130
|
sendResponse({ error: 'Invalid extension message' });
|
package/extension/content.js
CHANGED
|
@@ -2058,7 +2058,7 @@ function mountJournalCountdown(signal) {
|
|
|
2058
2058
|
root.style.display = 'none';
|
|
2059
2059
|
}
|
|
2060
2060
|
function handleAutomationShortcut(e) {
|
|
2061
|
-
if (e.repeat || e.isComposing || e.defaultPrevented || !e.altKey ||
|
|
2061
|
+
if (e.repeat || e.isComposing || e.defaultPrevented || !e.altKey || e.ctrlKey || e.metaKey
|
|
2062
2062
|
|| (e.code !== 'KeyA' && String(e.key).toLowerCase() !== 'a'))
|
|
2063
2063
|
return false;
|
|
2064
2064
|
e.preventDefault();
|
|
@@ -2583,11 +2583,11 @@ function mountJournalCountdown(signal) {
|
|
|
2583
2583
|
<div class="assistant-qa-latest" id="assistant-automation-latest" aria-live="polite"></div>
|
|
2584
2584
|
<div id="assistant-journal-slot"></div>
|
|
2585
2585
|
<div class="assistant-automation-actions assistant-qa-actions">
|
|
2586
|
-
<button class="assistant-auto-btn start" id="assistant-auto-start-btn" aria-keyshortcuts="Alt+Shift+A" title="Start automation (Alt +
|
|
2587
|
-
<button class="assistant-auto-btn" id="assistant-auto-pause-btn" aria-keyshortcuts="Alt+Shift+A" title="Pause or resume (Alt +
|
|
2586
|
+
<button class="assistant-auto-btn start" id="assistant-auto-start-btn" aria-keyshortcuts="Alt+A Alt+Shift+A" title="Start automation (Alt + A)">▶ Start automation</button>
|
|
2587
|
+
<button class="assistant-auto-btn" id="assistant-auto-pause-btn" aria-keyshortcuts="Alt+A Alt+Shift+A" title="Pause or resume (Alt + A)" disabled>Pause</button>
|
|
2588
2588
|
<button class="assistant-auto-btn stop" id="assistant-auto-stop-btn" disabled>■ Stop</button>
|
|
2589
2589
|
</div>
|
|
2590
|
-
<p class="assistant-automation-status">Alt +
|
|
2590
|
+
<p class="assistant-automation-status">Alt + A: Start / Pause / Resume</p>
|
|
2591
2591
|
<button class="assistant-auto-btn" id="assistant-export-question-btn">Export question details</button>
|
|
2592
2592
|
</section>
|
|
2593
2593
|
`;
|
package/extension/manifest.json
CHANGED
package/extension/popup.html
CHANGED
|
@@ -39,11 +39,6 @@
|
|
|
39
39
|
#server-status { color: #f59e0b; }
|
|
40
40
|
#server-status.online { color: #10b981; }
|
|
41
41
|
#server-status.offline { color: #ef4444; }
|
|
42
|
-
#journal-reminder { margin: 10px 0; font-size: 11px; }
|
|
43
|
-
#journal-reminder summary { cursor: pointer; }
|
|
44
|
-
#journal-reminder label { display: block; margin: 7px 0; }
|
|
45
|
-
#journal-reminder input { box-sizing: border-box; width: 100%; }
|
|
46
|
-
#journal-reminder-status { margin-top: 6px; }
|
|
47
42
|
</style>
|
|
48
43
|
</head>
|
|
49
44
|
<body>
|
|
@@ -54,23 +49,13 @@
|
|
|
54
49
|
<p>Extension active. The floating panel appears on every page.</p>
|
|
55
50
|
<div class="status">Server: <span id="server-status">checking...</span></div>
|
|
56
51
|
<p id="journal-countdown" hidden></p>
|
|
57
|
-
<details id="journal-reminder">
|
|
58
|
-
<summary>WhatsApp journal reminder</summary>
|
|
59
|
-
<form id="journal-reminder-form">
|
|
60
|
-
<label>n8n production webhook URL<input id="journal-webhook-url" type="url" required></label>
|
|
61
|
-
<label>Webhook token<input id="journal-webhook-token" type="password" required autocomplete="off"></label>
|
|
62
|
-
<button type="submit">Enable</button>
|
|
63
|
-
<button type="button" id="journal-reminder-disable">Disable</button>
|
|
64
|
-
</form>
|
|
65
|
-
<p id="journal-reminder-status" role="status">Checking settings…</p>
|
|
66
|
-
</details>
|
|
67
52
|
<div class="shortcuts">
|
|
68
53
|
<div class="shortcut-row"><span>Open panel</span> <kbd>`</kbd></div>
|
|
69
54
|
<div class="shortcut-row"><span>Close panel</span> <kbd>]</kbd></div>
|
|
70
55
|
<div class="shortcut-row"><span>Vision scan</span> <kbd>\</kbd></div>
|
|
71
56
|
<div class="shortcut-row"><span>Minimal mode</span> <kbd>[</kbd></div>
|
|
72
57
|
<div class="shortcut-row"><span>Journal fill & submit</span> <kbd>Alt+Shift+J</kbd></div>
|
|
73
|
-
<div class="shortcut-row"><span>Automation start / pause / resume</span> <kbd>Alt+
|
|
58
|
+
<div class="shortcut-row"><span>Automation start / pause / resume</span> <kbd>Alt+A</kbd></div>
|
|
74
59
|
</div>
|
|
75
60
|
<script src="popup.js"></script>
|
|
76
61
|
</body>
|
package/extension/popup.js
CHANGED
|
@@ -48,48 +48,3 @@ journalTimerStorage.onChanged.addListener(changes => {
|
|
|
48
48
|
});
|
|
49
49
|
void refreshPopupJournalTimers();
|
|
50
50
|
setInterval(showJournalCountdown, 1000);
|
|
51
|
-
const reminderForm = document.querySelector('#journal-reminder-form');
|
|
52
|
-
if (reminderForm) {
|
|
53
|
-
const key = 'assistantJournalReminderConfig';
|
|
54
|
-
const urlInput = document.querySelector('#journal-webhook-url');
|
|
55
|
-
const tokenInput = document.querySelector('#journal-webhook-token');
|
|
56
|
-
const status = document.getElementById('journal-reminder-status');
|
|
57
|
-
const disable = document.querySelector('#journal-reminder-disable');
|
|
58
|
-
void journalTimerStorage.get(key).then(data => {
|
|
59
|
-
const config = data[key];
|
|
60
|
-
if (config)
|
|
61
|
-
urlInput.value = config.url;
|
|
62
|
-
status.textContent = config ? 'Reminder enabled.' : 'Reminder disabled.';
|
|
63
|
-
}).catch(() => { status.textContent = 'Could not load reminder settings.'; });
|
|
64
|
-
reminderForm.addEventListener('submit', async (event) => {
|
|
65
|
-
event.preventDefault();
|
|
66
|
-
try {
|
|
67
|
-
const url = new URL(urlInput.value);
|
|
68
|
-
const local = ['localhost', '127.0.0.1', '[::1]'].includes(url.hostname);
|
|
69
|
-
if (!(url.protocol === 'https:' || (local && url.protocol === 'http:')) || url.username || url.password ||
|
|
70
|
-
url.search || url.hash || !url.pathname.includes('/webhook/')) {
|
|
71
|
-
throw Error('Enter the n8n production webhook URL. Use HTTPS for remote n8n.');
|
|
72
|
-
}
|
|
73
|
-
const token = tokenInput.value.trim();
|
|
74
|
-
if (!/^[\x21-\x7e]{20,256}$/.test(token))
|
|
75
|
-
throw Error('Use a webhook token of at least 20 characters, with no spaces.');
|
|
76
|
-
await journalTimerStorage.set({ [key]: { url: url.href, token } });
|
|
77
|
-
tokenInput.value = '';
|
|
78
|
-
status.textContent = 'Reminder enabled.';
|
|
79
|
-
}
|
|
80
|
-
catch (error) {
|
|
81
|
-
status.textContent = error.message;
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
disable.addEventListener('click', async () => {
|
|
85
|
-
try {
|
|
86
|
-
await journalTimerStorage.remove(key);
|
|
87
|
-
urlInput.value = '';
|
|
88
|
-
tokenInput.value = '';
|
|
89
|
-
status.textContent = 'Reminder disabled.';
|
|
90
|
-
}
|
|
91
|
-
catch {
|
|
92
|
-
status.textContent = 'Could not disable reminder.';
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
package/package.json
CHANGED
package/server/main.py
CHANGED
|
@@ -191,7 +191,7 @@ async def lifespan(_app: FastAPI):
|
|
|
191
191
|
client.close()
|
|
192
192
|
|
|
193
193
|
|
|
194
|
-
app = FastAPI(title="Browser Assistant API", version="2.8.
|
|
194
|
+
app = FastAPI(title="Browser Assistant API", version="2.8.26", lifespan=lifespan)
|
|
195
195
|
install_local_guards(app)
|
|
196
196
|
|
|
197
197
|
@app.exception_handler(HTTPException)
|