skopix 2.0.99 → 2.0.101
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/cli/commands/agent.js +1 -1
- package/core/recorder.js +30 -1
- package/package.json +1 -1
package/cli/commands/agent.js
CHANGED
|
@@ -436,7 +436,7 @@ export async function agentCommand(options) {
|
|
|
436
436
|
session.emit = (obj) => {
|
|
437
437
|
sendRec(obj);
|
|
438
438
|
if (obj.type === 'step') process.stdout.write(chalk.cyan(' ⏺ ') + (obj.step?.action || '') + '\n');
|
|
439
|
-
if (obj.type === 'done') {
|
|
439
|
+
if (obj.type === 'done' || obj.type === 'stopped') {
|
|
440
440
|
console.log(chalk.green(' ✔ Debug recording done — ' + (obj.steps?.length || 0) + ' new steps'));
|
|
441
441
|
browser.close().catch(() => {});
|
|
442
442
|
ws.send(JSON.stringify({ type: 'jobDone', runId }));
|
package/core/recorder.js
CHANGED
|
@@ -744,7 +744,36 @@ export class RecordingSession {
|
|
|
744
744
|
});
|
|
745
745
|
|
|
746
746
|
// Re-evaluate init script on the current page (since addInitScript only runs on navigation)
|
|
747
|
-
|
|
747
|
+
// Use evaluate to inject directly into the live page without reloading
|
|
748
|
+
try {
|
|
749
|
+
await this.page.evaluate(() => {
|
|
750
|
+
if (window.__skopixRecording) return;
|
|
751
|
+
window.__skopixRecording = true;
|
|
752
|
+
// Toolbar will be injected via addInitScript on next navigation,
|
|
753
|
+
// but we need it now — dispatch a custom event to trigger creation
|
|
754
|
+
const event = new CustomEvent('__skopix_attach');
|
|
755
|
+
document.dispatchEvent(event);
|
|
756
|
+
});
|
|
757
|
+
} catch {}
|
|
758
|
+
|
|
759
|
+
// Directly inject the toolbar into the current live page
|
|
760
|
+
try {
|
|
761
|
+
await this.page.evaluate(() => {
|
|
762
|
+
if (document.getElementById('__skopix_toolbar')) return;
|
|
763
|
+
const toolbar = document.createElement('div');
|
|
764
|
+
toolbar.id = '__skopix_toolbar';
|
|
765
|
+
toolbar.style.cssText = 'position:fixed;bottom:20px;right:20px;z-index:2147483647;display:flex;align-items:center;gap:8px;background:#0d0d1a;border:1px solid rgba(0,212,255,0.3);border-radius:10px;padding:10px 14px;font-family:monospace;font-size:12px;box-shadow:0 4px 24px rgba(0,0,0,0.5);user-select:none;';
|
|
766
|
+
toolbar.innerHTML = '<span style="color:#00d4ff;font-weight:600;letter-spacing:0.08em">SKOPIX</span><span id="__skopix_step_count" style="color:#5a6180;font-size:11px">0 steps</span><button id="__skopix_assert_btn" style="background:#1a1d2e;border:1px solid rgba(0,212,255,0.2);color:#00d4ff;border-radius:6px;padding:5px 10px;cursor:pointer;font-family:monospace;font-size:11px">+ Assert</button><button id="__skopix_stop_btn" style="background:#1a1d2e;border:1px solid rgba(239,68,68,0.3);color:#ef4444;border-radius:6px;padding:5px 10px;cursor:pointer;font-family:monospace;font-size:11px">■ Stop</button>';
|
|
767
|
+
document.body.appendChild(toolbar);
|
|
768
|
+
document.getElementById('__skopix_stop_btn').addEventListener('click', function() {
|
|
769
|
+
if (window.__skopixCapture) window.__skopixCapture({ action: 'stop' });
|
|
770
|
+
});
|
|
771
|
+
document.getElementById('__skopix_assert_btn').addEventListener('click', function() {
|
|
772
|
+
window.__skopixPickMode = true;
|
|
773
|
+
document.body.style.cursor = 'crosshair';
|
|
774
|
+
});
|
|
775
|
+
});
|
|
776
|
+
} catch {}
|
|
748
777
|
|
|
749
778
|
this.page.on('framenavigated', async (frame) => {
|
|
750
779
|
if (frame !== this.page.mainFrame()) return;
|
package/package.json
CHANGED