browser-assistant 2.9.36 → 2.9.38
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/coding-batch.js +41 -2
- package/extension/content.js +4 -1
- package/extension/detached-panel.js +1 -1
- package/extension/journal-automation.js +5 -5
- package/extension/manifest.json +1 -1
- package/extension/popup.html +1 -1
- 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 **⌥A** (Alt + A) on the webpage to start automation, then press it again to pause or resume. The previous **⌥⇧A** (Alt + Shift + A) shortcut also works, including with the code editor focused, and opens QA Control. Journal automation uses the same toggle; its
|
|
13
|
+
- Press **⌥A** (Alt + A) on the webpage to start automation, then press it again to pause or resume. The previous **⌥⇧A** (Alt + Shift + A) shortcut also works, including with the code editor focused, and opens QA Control. Journal automation uses the same toggle; its dedicated shortcut is **⌥J** (Alt + J). Panel chords are **⌃⇧O** (open), **⌃⇧X** (close), **⌃⇧S** (vision scan) and **⌃⇧M** (minimal mode).
|
|
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
|
|
|
@@ -3,6 +3,45 @@
|
|
|
3
3
|
const visible = node => node.getClientRects().length && !node.closest('#assistant-root');
|
|
4
4
|
const text = node => (node.innerText || node.textContent || '').replace(/\s+/g, ' ').trim();
|
|
5
5
|
const statusPattern = /^(not attempted|in progress|solved)$/i;
|
|
6
|
+
function openControl(row) {
|
|
7
|
+
const enabled = node => visible(node) && !node.closest('[disabled],[aria-disabled="true"]');
|
|
8
|
+
const label = node => [node.getAttribute('aria-label'), node.getAttribute('title'),
|
|
9
|
+
node.getAttribute('data-testid'), text(node)].filter(Boolean).join(' ');
|
|
10
|
+
const bookmark = node => /bookmark|save|favourite|favorite/i.test(label(node));
|
|
11
|
+
const links = [...row.querySelectorAll('a[href*="/question/"]')].filter(enabled);
|
|
12
|
+
if (links.length === 1)
|
|
13
|
+
return links[0];
|
|
14
|
+
const controls = [...row.querySelectorAll('a[href],button,[role="button"]')].filter(enabled).filter(node => !bookmark(node));
|
|
15
|
+
const named = controls.filter(node => /\b(open|view|start|go to)\b|arrow.*right|right.*arrow/i.test(label(node)));
|
|
16
|
+
if (named.length === 1)
|
|
17
|
+
return named[0];
|
|
18
|
+
// CCBP can put the navigation handler on an unlabelled SVG or its
|
|
19
|
+
// wrapper. Clicking the row itself does not reach that child handler.
|
|
20
|
+
const icons = [...row.querySelectorAll('svg,img')].filter(enabled).filter(node => {
|
|
21
|
+
for (let parent = node; parent && parent !== row; parent = parent.parentElement) {
|
|
22
|
+
if (bookmark(parent))
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
return true;
|
|
26
|
+
});
|
|
27
|
+
const arrows = icons.filter(node => /arrow.*right|right.*arrow|\b(open|view)\b/i.test(label(node)));
|
|
28
|
+
if (arrows.length === 1)
|
|
29
|
+
return arrows[0];
|
|
30
|
+
if (row.matches('[data-testid="question-list-question"]') && icons.length)
|
|
31
|
+
return icons[icons.length - 1];
|
|
32
|
+
if (controls.length === 1)
|
|
33
|
+
return controls[0];
|
|
34
|
+
if (icons.length === 1)
|
|
35
|
+
return icons[0];
|
|
36
|
+
return row;
|
|
37
|
+
}
|
|
38
|
+
function openQuestion(selected) {
|
|
39
|
+
const action = selected.action;
|
|
40
|
+
if (typeof action.click === 'function')
|
|
41
|
+
action.click();
|
|
42
|
+
else
|
|
43
|
+
action.dispatchEvent(new MouseEvent('click', { bubbles: true, cancelable: true, view: window }));
|
|
44
|
+
}
|
|
6
45
|
function courseFilterStep(doc) {
|
|
7
46
|
const courses = /^(programming foundations|data structures\s*(?:&|and)\s*algorithms|build your own static website|build your own responsive website|modern responsive web design|build your own dynamic web application)$/i;
|
|
8
47
|
const choices = [];
|
|
@@ -52,7 +91,7 @@
|
|
|
52
91
|
const title = portalTitle?.trim() || text(copy);
|
|
53
92
|
const actions = [...row.querySelectorAll('a[href],button,[role="button"]')].filter(visible);
|
|
54
93
|
if (title && (actions.length || row.querySelector('svg') || row.matches('[role="row"],tr'))) {
|
|
55
|
-
const action =
|
|
94
|
+
const action = openControl(row);
|
|
56
95
|
const link = row.querySelector('a[href*="/question/"]');
|
|
57
96
|
found.push({ title, action, href: link?.getAttribute('href') || null });
|
|
58
97
|
break;
|
|
@@ -183,5 +222,5 @@
|
|
|
183
222
|
copy.querySelector('#assistant-root')?.remove();
|
|
184
223
|
return text(copy);
|
|
185
224
|
}
|
|
186
|
-
window.BrowserAssistantCodingBatch = { rows, nextPage, pageKey, pageRange, getBackControl, getSaveBeforeLeaving, matchesQuestion, courseFilterStep };
|
|
225
|
+
window.BrowserAssistantCodingBatch = { rows, openQuestion, nextPage, pageKey, pageRange, getBackControl, getSaveBeforeLeaving, matchesQuestion, courseFilterStep };
|
|
187
226
|
})();
|
package/extension/content.js
CHANGED
|
@@ -1347,7 +1347,10 @@ function mountJournalCountdown(signal) {
|
|
|
1347
1347
|
automation.state = 'OPENING_QUESTION';
|
|
1348
1348
|
automation.pendingNavigation = true;
|
|
1349
1349
|
updateAutomationUI();
|
|
1350
|
-
|
|
1350
|
+
if (window.BrowserAssistantCodingBatch.openQuestion)
|
|
1351
|
+
window.BrowserAssistantCodingBatch.openQuestion(next);
|
|
1352
|
+
else
|
|
1353
|
+
next.action.click();
|
|
1351
1354
|
continue;
|
|
1352
1355
|
}
|
|
1353
1356
|
const key = window.BrowserAssistantCodingBatch.pageKey(document);
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
event.preventDefault();
|
|
158
158
|
void send('automation');
|
|
159
159
|
}
|
|
160
|
-
else if (event.shiftKey && (key === 'j' || event.code === 'KeyJ')) {
|
|
160
|
+
else if (!event.shiftKey && (key === 'j' || event.code === 'KeyJ')) {
|
|
161
161
|
event.preventDefault();
|
|
162
162
|
void send('journal');
|
|
163
163
|
}
|
|
@@ -228,13 +228,13 @@ function browserAssistantJournal(global) {
|
|
|
228
228
|
publishedDeadline = undefined;
|
|
229
229
|
}
|
|
230
230
|
}
|
|
231
|
-
button.title = 'Fill & Submit Journal (Alt +
|
|
232
|
-
button.setAttribute('aria-keyshortcuts', 'Alt+
|
|
231
|
+
button.title = 'Fill & Submit Journal (Alt + J)';
|
|
232
|
+
button.setAttribute('aria-keyshortcuts', 'Alt+J');
|
|
233
233
|
const shortcutHint = document.createElement('p');
|
|
234
|
-
shortcutHint.textContent = 'Shortcut: Alt +
|
|
234
|
+
shortcutHint.textContent = 'Shortcut: Alt + J';
|
|
235
235
|
panel.insertBefore(shortcutHint, status);
|
|
236
236
|
const shortcutListener = event => {
|
|
237
|
-
if (!event.altKey ||
|
|
237
|
+
if (!event.altKey || event.shiftKey || event.ctrlKey || event.metaKey || event.repeat || event.isComposing)
|
|
238
238
|
return;
|
|
239
239
|
if (event.code !== 'KeyJ' && String(event.key).toLowerCase() !== 'j')
|
|
240
240
|
return;
|
|
@@ -637,7 +637,7 @@ if (typeof window !== 'undefined' && isSidusJournalOrigin(location.origin)) {
|
|
|
637
637
|
if (!window.BrowserAssistantJournalListShortcut) {
|
|
638
638
|
window.BrowserAssistantJournalListShortcut = true;
|
|
639
639
|
document.addEventListener('keydown', event => {
|
|
640
|
-
if (!/^\/modules\/assessments\/assessments\/?$/.test(location.pathname) || !event.altKey ||
|
|
640
|
+
if (!/^\/modules\/assessments\/assessments\/?$/.test(location.pathname) || !event.altKey || event.shiftKey || event.ctrlKey || event.metaKey || event.repeat || event.isComposing)
|
|
641
641
|
return;
|
|
642
642
|
if (event.code !== 'KeyJ' && String(event.key).toLowerCase() !== 'j')
|
|
643
643
|
return;
|
package/extension/manifest.json
CHANGED
package/extension/popup.html
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
<div class="shortcut-row"><span>Close panel</span> <span><kbd>]</kbd> <kbd>⌃⇧X</kbd></span></div>
|
|
25
25
|
<div class="shortcut-row"><span>Vision scan</span> <span><kbd>\</kbd> <kbd>⌃⇧S</kbd></span></div>
|
|
26
26
|
<div class="shortcut-row"><span>Minimal mode</span> <span><kbd>[</kbd> <kbd>⌃⇧M</kbd></span></div>
|
|
27
|
-
<div class="shortcut-row"><span>Fill and submit journal</span> <kbd
|
|
27
|
+
<div class="shortcut-row"><span>Fill and submit journal</span> <kbd>⌥J</kbd></div>
|
|
28
28
|
<div class="shortcut-row"><span>Start, pause or resume</span> <kbd>⌥A</kbd></div>
|
|
29
29
|
</section>
|
|
30
30
|
</main>
|
package/package.json
CHANGED
package/server/main.py
CHANGED
|
@@ -195,7 +195,7 @@ async def lifespan(_app: FastAPI):
|
|
|
195
195
|
client.close()
|
|
196
196
|
|
|
197
197
|
|
|
198
|
-
app = FastAPI(title="Browser Assistant API", version="2.9.
|
|
198
|
+
app = FastAPI(title="Browser Assistant API", version="2.9.38", lifespan=lifespan)
|
|
199
199
|
install_local_guards(app)
|
|
200
200
|
|
|
201
201
|
@app.exception_handler(HTTPException)
|