@wenathlan/extension 1.1.46 → 1.1.48
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 +6 -4
- package/dist/emulation.d.ts +89 -0
- package/dist/emulation.d.ts.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +989 -11
- package/dist/index.js.map +4 -4
- package/dist/memory.d.ts +89 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/policy.d.ts +39 -1
- package/dist/policy.d.ts.map +1 -1
- package/dist/profilers.d.ts +167 -0
- package/dist/profilers.d.ts.map +1 -0
- package/dist/protocol.d.ts +68 -2
- package/dist/protocol.d.ts.map +1 -1
- package/dist/types.d.ts +238 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/extension/dist/background.js +1483 -15
- package/extension/dist/background.js.map +4 -4
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/pagebridge.js +430 -6
- package/extension/dist/pagebridge.js.map +4 -4
- package/extension/dist/popup.html +1 -1
- package/extension/dist/popup.js +22 -6
- package/extension/dist/popup.js.map +2 -2
- package/extension/dist/sidepanel.html +1 -1
- package/extension/dist/sidepanel.js +319 -2
- package/extension/dist/sidepanel.js.map +2 -2
- package/extension/dist/style.css +3 -1
- package/extension/manifest.json +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!doctype html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Devthink review</title><link rel="stylesheet" href="style.css"></head>
|
|
4
|
-
<body><main class="wide"><header><p class="eyebrow">REVIEW GATE</p><h1>Plan before action</h1><p>Every browser operation remains blocked until the user reviews and approves it here.</p></header><label for="objective">Objective</label><textarea id="objective" rows="4" placeholder="Describe a browser task to turn into a reviewable plan."></textarea><div class="actions"><button id="localplan">Create local observation plan</button><button id="remoteplan" class="secondary">Ask configured endpoint</button><button id="diagnostic" class="secondary">Capture local diagnostics</button></div><p id="status" role="status">Loading session state.</p><p id="capabilitiestext" role="status" class="muted">Optional capabilities unknown.</p><section><h2>Current plan</h2><progress id="planprogress" max="1" value="0"></progress><div id="plan" class="panel"></div></section><section><h2>Clickable map</h2><ol id="map" class="audit maplist"></ol></section><section><h2>Navigation trail</h2><ol id="trail" class="audit"></ol></section><section><h2>Navigation state</h2><div id="navigation" class="panel"></div></section><section><h2>Tabs and windows</h2><div id="tabswindows" class="panel"></div></section><section><h2>Forms and data</h2><div id="forms" class="panel"></div></section><section><h2>Files and downloads</h2><div id="files" class="panel"></div></section><section><h2>Capture gallery</h2><div id="captures" class="panel"></div></section><section><h2>Media</h2><div id="media" class="panel"></div></section><section><h2>Network calls</h2><div id="calls" class="panel"></div></section><section><h2>Network view</h2><div id="netview" class="panel"></div></section><section><h2>Traffic control</h2><div id="traffic" class="panel"></div></section><section><h2>Run timeline</h2><div id="timeline" class="panel"></div></section><section><h2>Debugger</h2><div id="debugger" class="panel"></div></section><section><h2>Console diff</h2><div id="consolediff" class="panel"></div></section><section><h2>Datasets</h2><div id="datasets" class="panel"></div></section><section><h2>Consent banners</h2><div id="banners" class="panel"></div></section><section><h2>Accessibility tree</h2><div id="a11y" class="panel"></div></section><section><h2>Reader view</h2><div id="reader" class="panel"></div></section><section><h2>Detected shapes</h2><ol id="detections" class="audit maplist"></ol></section><section><h2>Watch stream</h2><ol id="stream" class="audit"></ol></section><section><h2>Snapshot diffs</h2><div id="diffs" class="panel"></div></section><section><h2>Derived selectors</h2><ol id="selectors" class="audit maplist"></ol></section><section><h2>Structured diagnostics</h2><ul id="diagnostics" class="audit"></ul></section><section><h2>Local audit</h2><ol id="audit" class="audit"></ol></section></main><script type="module" src="sidepanel.js"></script></body>
|
|
4
|
+
<body><main class="wide"><header><p class="eyebrow">REVIEW GATE</p><h1>Plan before action</h1><p>Every browser operation remains blocked until the user reviews and approves it here.</p></header><label for="objective">Objective</label><textarea id="objective" rows="4" placeholder="Describe a browser task to turn into a reviewable plan."></textarea><div class="actions"><button id="localplan">Create local observation plan</button><button id="remoteplan" class="secondary">Ask configured endpoint</button><button id="diagnostic" class="secondary">Capture local diagnostics</button></div><p id="status" role="status">Loading session state.</p><p id="capabilitiestext" role="status" class="muted">Optional capabilities unknown.</p><section><h2>Current plan</h2><progress id="planprogress" max="1" value="0"></progress><div id="plan" class="panel"></div></section><section><h2>Clickable map</h2><ol id="map" class="audit maplist"></ol></section><section><h2>Navigation trail</h2><ol id="trail" class="audit"></ol></section><section><h2>Navigation state</h2><div id="navigation" class="panel"></div></section><section><h2>Tabs and windows</h2><div id="tabswindows" class="panel"></div></section><section><h2>Forms and data</h2><div id="forms" class="panel"></div></section><section><h2>Files and downloads</h2><div id="files" class="panel"></div></section><section><h2>Capture gallery</h2><div id="captures" class="panel"></div></section><section><h2>Media</h2><div id="media" class="panel"></div></section><section><h2>Network calls</h2><div id="calls" class="panel"></div></section><section><h2>Network view</h2><div id="netview" class="panel"></div></section><section><h2>Traffic control</h2><div id="traffic" class="panel"></div></section><section><h2>Run timeline</h2><div id="timeline" class="panel"></div></section><section><h2>Debugger</h2><div id="debugger" class="panel"></div></section><section><h2>Profiling</h2><div id="profiling" class="panel"></div></section><section><h2>Emulation</h2><div id="emulation" class="panel"></div></section><section><h2>Console diff</h2><div id="consolediff" class="panel"></div></section><section><h2>Datasets</h2><div id="datasets" class="panel"></div></section><section><h2>Consent banners</h2><div id="banners" class="panel"></div></section><section><h2>Accessibility tree</h2><div id="a11y" class="panel"></div></section><section><h2>Reader view</h2><div id="reader" class="panel"></div></section><section><h2>Detected shapes</h2><ol id="detections" class="audit maplist"></ol></section><section><h2>Watch stream</h2><ol id="stream" class="audit"></ol></section><section><h2>Snapshot diffs</h2><div id="diffs" class="panel"></div></section><section><h2>Derived selectors</h2><ol id="selectors" class="audit maplist"></ol></section><section><h2>Structured diagnostics</h2><ul id="diagnostics" class="audit"></ul></section><section><h2>Local audit</h2><ol id="audit" class="audit"></ol></section></main><script type="module" src="sidepanel.js"></script></body>
|
|
5
5
|
</html>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// policy.ts
|
|
2
|
-
var sensitiveactions = /* @__PURE__ */ new Set(["click", "type", "navigate", "select", "presskey", "drag", "drop", "upload", "clear", "check", "uncheck", "toggle", "submit", "reload", "back", "forward", "writestorage", "setattribute", "removeattribute", "evaluate", "tabcreate", "tabactivate", "tabclose", "tabreload", "windowcreate", "windowclose", "windowresize", "downloadfile", "clickpoint", "shiftclick", "dismissdialog", "enterframe", "typetime", "appendtext", "setvalue", "typeedit", "keyhold", "keyrelease", "submitsearch", "selectmulti", "chooseradio", "setslider", "setdate", "setcolor", "openlink", "openprivate", "reloadcache", "stopnav", "followlink", "spanav", "rewritequery", "setfragment", "navlist", "navprofile", "handleauth", "printpdf", "prefetch", "preconnect", "deeplink", "reopentab", "pausenav", "navrate", "openclipboard", "batchopen", "duplicatetab", "closepattern", "pintab", "mutetab", "movetab", "movetabwindow", "grouptabs", "colorgroup", "collapsegroup", "discardtab", "reloadtabs", "zoomin", "zoomout", "switchtab", "maximizewindow", "minimizewindow", "restorewindow", "focuswindow", "scratchwindow", "incognitowindow", "restoretab", "restorelayout", "reopenrun", "badgetab", "fillform", "filllabel", "fillplaceholder", "submitform", "retryform", "runwizard", "selectchain", "picktypeahead", "pickdate", "attachfile", "fillcard", "fillcode", "consentpassword", "exportcsv", "exportjson", "exportexcel", "copytable", "pushsheets", "streamdisk", "paginateextract", "resumeextract", "batchdownload", "pausedownload", "resumedownload", "interceptmime", "readclipboard", "writeclipboard", "copyscreen", "quarantinedownload", "scanvirus", "cleanupartifacts", "recordscreen", "captureaudio", "downloadimages", "callrest", "callgraphql", "sendmessage", "blockrequest", "mockresponse", "rewriteheaders", "setcookies", "clearcookies", "authflow", "saveapikey", "routeproxy", "postform", "postfiles", "attachcdp", "detachcdp", "cdpcmd", "overridescript"]);
|
|
2
|
+
var sensitiveactions = /* @__PURE__ */ new Set(["click", "type", "navigate", "select", "presskey", "drag", "drop", "upload", "clear", "check", "uncheck", "toggle", "submit", "reload", "back", "forward", "writestorage", "setattribute", "removeattribute", "evaluate", "tabcreate", "tabactivate", "tabclose", "tabreload", "windowcreate", "windowclose", "windowresize", "downloadfile", "clickpoint", "shiftclick", "dismissdialog", "enterframe", "typetime", "appendtext", "setvalue", "typeedit", "keyhold", "keyrelease", "submitsearch", "selectmulti", "chooseradio", "setslider", "setdate", "setcolor", "openlink", "openprivate", "reloadcache", "stopnav", "followlink", "spanav", "rewritequery", "setfragment", "navlist", "navprofile", "handleauth", "printpdf", "prefetch", "preconnect", "deeplink", "reopentab", "pausenav", "navrate", "openclipboard", "batchopen", "duplicatetab", "closepattern", "pintab", "mutetab", "movetab", "movetabwindow", "grouptabs", "colorgroup", "collapsegroup", "discardtab", "reloadtabs", "zoomin", "zoomout", "switchtab", "maximizewindow", "minimizewindow", "restorewindow", "focuswindow", "scratchwindow", "incognitowindow", "restoretab", "restorelayout", "reopenrun", "badgetab", "fillform", "filllabel", "fillplaceholder", "submitform", "retryform", "runwizard", "selectchain", "picktypeahead", "pickdate", "attachfile", "fillcard", "fillcode", "consentpassword", "exportcsv", "exportjson", "exportexcel", "copytable", "pushsheets", "streamdisk", "paginateextract", "resumeextract", "batchdownload", "pausedownload", "resumedownload", "interceptmime", "readclipboard", "writeclipboard", "copyscreen", "quarantinedownload", "scanvirus", "cleanupartifacts", "recordscreen", "captureaudio", "downloadimages", "callrest", "callgraphql", "sendmessage", "blockrequest", "mockresponse", "rewriteheaders", "setcookies", "clearcookies", "authflow", "saveapikey", "routeproxy", "postform", "postfiles", "attachcdp", "detachcdp", "cdpcmd", "overridescript", "heapshot", "profilecpu", "capturesourcemaps", "emulatedevice", "emulatenetwork", "emulatelocate", "setuseragent", "overridepermission"]);
|
|
3
3
|
var interactionactions = /* @__PURE__ */ new Set(["focus", "scroll", "hover", "clickdeep", "rightclick", "doubleclick", "scrollpage", "scrollby", "scrollend", "scrolltop", "fullscreen", "zoomset", "movepointer", "clicktext", "clickaria", "clickname", "expanddetails", "pierceshadow", "retryaction", "capturebodies", "setbreakpoint", "stepcode", "watchexpr"]);
|
|
4
|
-
var readactions = /* @__PURE__ */ new Set(["observe", "inspect", "extract", "wait", "waitfor", "waittext", "readattribute", "readstyle", "readgeometry", "readvalue", "readtext", "readhtml", "countelements", "readtable", "readlinks", "readimages", "readmeta", "readforms", "readstorage", "highlight", "tablist", "windowlist", "tabsnapshot", "mapclicks", "verifyvisible", "verifyenabled", "resolvexpath", "a11ytree", "readvisible", "readertree", "detectlists", "detecttables", "readjson", "watchmutate", "waitquiet", "watchbanner", "detectinfinitescroll", "detectvirtual", "detectlazy", "readscrollpos", "readlang", "readoutline", "countpages", "listshadow", "listframes", "classifypage", "fingerprintsection", "diffsnapshots", "readselection", "watchfocus", "detectsticky", "detectscrolllock", "readopengraph", "detectlanguage", "deriveselector", "waitload", "waiturl", "spawait", "detecthttp", "readredirects", "readfinalurl", "trailaudit", "navintent", "checksafe", "querytabs", "watchtab", "findclones", "searchtabs", "listaudio", "snapshotsession", "savelayout", "attachmeta", "detectfields", "generatevalues", "saveprofiles", "asksubmit", "readerrors", "skiphoneypot", "detectlogin", "detecttemplate", "handoffcaptcha", "scrapetable", "importcsv", "looprows", "transformvalues", "deduperows", "mergepages", "stamplerows", "previewgrid", "logprovenance", "verifydownload", "exportnetlog", "namecaptures", "shotview", "shotfullpage", "shotelement", "shotregion", "contactsheet", "capturepdf", "captureframe", "readmedia", "readassets", "probestream", "timelapse", "shotcanvas", "convertimage", "makethumbs", "fetchurl", "parsejson", "parsehtml", "opensocket", "waitmessage", "watchrequests", "readheaders", "mapapi", "subscribesse", "longpoll", "extractapi", "readcookies", "watchconsole", "watcherrors", "watchtasks", "watchcdp"]);
|
|
4
|
+
var readactions = /* @__PURE__ */ new Set(["observe", "inspect", "extract", "wait", "waitfor", "waittext", "readattribute", "readstyle", "readgeometry", "readvalue", "readtext", "readhtml", "countelements", "readtable", "readlinks", "readimages", "readmeta", "readforms", "readstorage", "highlight", "tablist", "windowlist", "tabsnapshot", "mapclicks", "verifyvisible", "verifyenabled", "resolvexpath", "a11ytree", "readvisible", "readertree", "detectlists", "detecttables", "readjson", "watchmutate", "waitquiet", "watchbanner", "detectinfinitescroll", "detectvirtual", "detectlazy", "readscrollpos", "readlang", "readoutline", "countpages", "listshadow", "listframes", "classifypage", "fingerprintsection", "diffsnapshots", "readselection", "watchfocus", "detectsticky", "detectscrolllock", "readopengraph", "detectlanguage", "deriveselector", "waitload", "waiturl", "spawait", "detecthttp", "readredirects", "readfinalurl", "trailaudit", "navintent", "checksafe", "querytabs", "watchtab", "findclones", "searchtabs", "listaudio", "snapshotsession", "savelayout", "attachmeta", "detectfields", "generatevalues", "saveprofiles", "asksubmit", "readerrors", "skiphoneypot", "detectlogin", "detecttemplate", "handoffcaptcha", "scrapetable", "importcsv", "looprows", "transformvalues", "deduperows", "mergepages", "stamplerows", "previewgrid", "logprovenance", "verifydownload", "exportnetlog", "namecaptures", "shotview", "shotfullpage", "shotelement", "shotregion", "contactsheet", "capturepdf", "captureframe", "readmedia", "readassets", "probestream", "timelapse", "shotcanvas", "convertimage", "makethumbs", "fetchurl", "parsejson", "parsehtml", "opensocket", "waitmessage", "watchrequests", "readheaders", "mapapi", "subscribesse", "longpoll", "extractapi", "readcookies", "watchconsole", "watcherrors", "watchtasks", "watchcdp", "measureflow", "trackmemory", "watchshifts", "traceload", "annotatetrace", "replaytrace", "blackboxscripts"]);
|
|
5
5
|
var allowedactions = /* @__PURE__ */ new Set([...sensitiveactions, ...interactionactions, ...readactions]);
|
|
6
6
|
|
|
7
7
|
// extension/tabscommand.ts
|
|
@@ -70,6 +70,8 @@ var trafficroot = document.querySelector("#traffic");
|
|
|
70
70
|
var timelineroot = document.querySelector("#timeline");
|
|
71
71
|
var consolediffroot = document.querySelector("#consolediff");
|
|
72
72
|
var debuggerroot = document.querySelector("#debugger");
|
|
73
|
+
var profilingroot = document.querySelector("#profiling");
|
|
74
|
+
var emulationroot = document.querySelector("#emulation");
|
|
73
75
|
var netviewroot = document.querySelector("#netview");
|
|
74
76
|
var statusnode = document.querySelector("#status");
|
|
75
77
|
var progressnode = document.querySelector("#planprogress");
|
|
@@ -2346,6 +2348,164 @@ function renderdebugger(context) {
|
|
|
2346
2348
|
ceilinginput.value = context.breakpointceiling !== void 0 ? String(context.breakpointceiling) : "";
|
|
2347
2349
|
debuggerroot.append(settingsline, retentioninput, ceilinginput, button("Save debugger settings", () => Promise.all([request({ kind: "setpauseretention", retention: retentioninput.value === "" ? void 0 : Number(retentioninput.value) }), request({ kind: "setbreakpointceiling", ceiling: ceilinginput.value === "" ? void 0 : Number(ceilinginput.value) })]).then(() => status(`Debugger settings saved: pause retention ${retentioninput.value === "" ? "keeps every capture" : retentioninput.value} and breakpoint ceiling ${ceilinginput.value === "" ? "none" : ceilinginput.value}.`)).then(refresh)));
|
|
2348
2350
|
}
|
|
2351
|
+
function renderemulation(context) {
|
|
2352
|
+
if (!emulationroot) return;
|
|
2353
|
+
emulationroot.replaceChildren();
|
|
2354
|
+
const emulation = context.emulation;
|
|
2355
|
+
if (!emulation) {
|
|
2356
|
+
emulationroot.textContent = "No emulation state is available yet; start a session and review a plan with emulation steps.";
|
|
2357
|
+
return;
|
|
2358
|
+
}
|
|
2359
|
+
const pending = emulation.consents.filter((consent) => consent.approved === void 0 && consent.revokedat === void 0);
|
|
2360
|
+
for (const consent of pending) {
|
|
2361
|
+
const card = document.createElement("div");
|
|
2362
|
+
card.className = "bannercard";
|
|
2363
|
+
const title = document.createElement("p");
|
|
2364
|
+
title.textContent = `Location consent needed on ${consent.origin}`;
|
|
2365
|
+
const coordinates = document.createElement("p");
|
|
2366
|
+
coordinates.textContent = `Reviewed coordinates: ${consent.latitude}, ${consent.longitude}; the override applies through a page-injected geolocation mask and the true browser location stays untouched.`;
|
|
2367
|
+
card.append(title, coordinates, button("Approve location consent", () => request({ kind: "approvelocationconsent", id: consent.id }).then(() => {
|
|
2368
|
+
status(`Approved the location consent for ${consent.latitude}, ${consent.longitude} on ${consent.origin}.`);
|
|
2369
|
+
return refresh();
|
|
2370
|
+
})));
|
|
2371
|
+
emulationroot.append(card);
|
|
2372
|
+
}
|
|
2373
|
+
const active = emulation.layers.filter((layer) => layer.revertedat === void 0);
|
|
2374
|
+
const state = document.createElement("p");
|
|
2375
|
+
state.textContent = `${active.length} active emulation layer${active.length === 1 ? "" : "s"} of run ${active[0]?.runid ?? "none"}${active.length > 1 ? "; the last applied layer wins conflicts" : ""}.`;
|
|
2376
|
+
emulationroot.append(state);
|
|
2377
|
+
if (active.length > 1) {
|
|
2378
|
+
const warn = document.createElement("p");
|
|
2379
|
+
warn.textContent = `Warning: ${active.length} layers stack on one tab (${active.map((layer) => layer.name).join(", ")}); every mask reverts at run end in reverse order.`;
|
|
2380
|
+
warn.className = "muted";
|
|
2381
|
+
emulationroot.append(warn);
|
|
2382
|
+
}
|
|
2383
|
+
const offlinelayer = active.find((layer) => layer.family === "network" && emulation.networks.some((preset) => preset.name === layer.name && preset.offline));
|
|
2384
|
+
if (offlinelayer !== void 0) {
|
|
2385
|
+
const offline = document.createElement("p");
|
|
2386
|
+
offline.textContent = `Offline: the network layer ${offlinelayer.name} cuts the traffic the extension initiates; page traffic stays observed only.`;
|
|
2387
|
+
offline.className = "muted";
|
|
2388
|
+
emulationroot.append(offline);
|
|
2389
|
+
}
|
|
2390
|
+
for (const layer of active) {
|
|
2391
|
+
const row = document.createElement("div");
|
|
2392
|
+
row.className = "emulationrow";
|
|
2393
|
+
row.dataset.stacked = active.length > 1 ? "true" : "false";
|
|
2394
|
+
const line = document.createElement("p");
|
|
2395
|
+
line.textContent = `${layer.family} layer ${layer.name} on ${layer.originscope} applied ${new Date(layer.appliedat).toLocaleTimeString()} with the revert plan ${layer.revertplan.join(", ")}.`;
|
|
2396
|
+
row.append(line, button("Revert now", () => request({ kind: "revertemulation" }).then(() => {
|
|
2397
|
+
status("Reverted every active emulation layer of the run on review panel demand.");
|
|
2398
|
+
return refresh();
|
|
2399
|
+
})));
|
|
2400
|
+
emulationroot.append(row);
|
|
2401
|
+
}
|
|
2402
|
+
if (active.length > 0) {
|
|
2403
|
+
emulationroot.append(button("Restore stored layers after a crash", () => request({ kind: "restoreemulation" }).then(() => {
|
|
2404
|
+
status("Restored the stored emulation layers of the run record.");
|
|
2405
|
+
return refresh();
|
|
2406
|
+
})));
|
|
2407
|
+
}
|
|
2408
|
+
const families = [
|
|
2409
|
+
{ label: "device presets", presets: emulation.devices.map((preset) => ({ label: `${preset.name}: ${preset.width}x${preset.height} @${preset.pixelratio}${preset.mobile ? " mobile" : ""}`, kind: "device" })) },
|
|
2410
|
+
{ label: "network presets", presets: emulation.networks.map((preset) => ({ label: `${preset.name}: ${preset.latency}ms, ${preset.download}/${preset.upload} kbps${preset.offline ? ", offline" : ""}`, kind: "network" })) },
|
|
2411
|
+
{ label: "location presets", presets: emulation.locations.map((preset) => ({ label: `${preset.name}: ${preset.latitude}, ${preset.longitude} \xB1${preset.accuracy}m`, kind: "location" })) },
|
|
2412
|
+
{ label: "agent presets", presets: emulation.agents.map((preset) => ({ label: `${preset.name}: ${preset.platform} with ${preset.brands.length} brands`, kind: "agent" })) }
|
|
2413
|
+
];
|
|
2414
|
+
for (const family of families) {
|
|
2415
|
+
const head = document.createElement("h4");
|
|
2416
|
+
head.textContent = family.label;
|
|
2417
|
+
emulationroot.append(head);
|
|
2418
|
+
if (family.presets.length === 0) {
|
|
2419
|
+
const empty = document.createElement("p");
|
|
2420
|
+
empty.className = "muted";
|
|
2421
|
+
empty.textContent = "No user curated preset yet; the library stays user data instead of a hardcoded list.";
|
|
2422
|
+
emulationroot.append(empty);
|
|
2423
|
+
continue;
|
|
2424
|
+
}
|
|
2425
|
+
for (const preset of family.presets) {
|
|
2426
|
+
const line = document.createElement("p");
|
|
2427
|
+
line.textContent = preset.label;
|
|
2428
|
+
emulationroot.append(line);
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
const editor = document.createElement("details");
|
|
2432
|
+
const summary = document.createElement("summary");
|
|
2433
|
+
summary.textContent = "Preset editor";
|
|
2434
|
+
editor.append(summary);
|
|
2435
|
+
const nameinput = document.createElement("input");
|
|
2436
|
+
nameinput.placeholder = "preset name";
|
|
2437
|
+
const valueinput = document.createElement("input");
|
|
2438
|
+
valueinput.placeholder = 'preset json, for example {"name":"phone","width":390,"height":844,"pixelratio":3,"mobile":true}';
|
|
2439
|
+
const familyselect = document.createElement("select");
|
|
2440
|
+
for (const family of ["device", "network", "location", "agent"]) {
|
|
2441
|
+
const option = document.createElement("option");
|
|
2442
|
+
option.value = family;
|
|
2443
|
+
option.textContent = family;
|
|
2444
|
+
familyselect.append(option);
|
|
2445
|
+
}
|
|
2446
|
+
editor.append(nameinput, valueinput, familyselect, button("Save preset", async () => {
|
|
2447
|
+
let payload;
|
|
2448
|
+
try {
|
|
2449
|
+
payload = JSON.parse(valueinput.value);
|
|
2450
|
+
} catch {
|
|
2451
|
+
throw new Error("The preset payload must be reviewed JSON.");
|
|
2452
|
+
}
|
|
2453
|
+
if (payload && typeof payload === "object" && !Array.isArray(payload) && nameinput.value.trim()) payload = { ...payload, name: nameinput.value.trim() };
|
|
2454
|
+
const kind = familyselect.value === "device" ? "setdevicepreset" : familyselect.value === "network" ? "setnetworkpreset" : familyselect.value === "location" ? "setlocationpreset" : "setagentpreset";
|
|
2455
|
+
const field = familyselect.value;
|
|
2456
|
+
await request({ kind, [field]: payload });
|
|
2457
|
+
status(`Stored the ${familyselect.value} preset in the user curated library.`);
|
|
2458
|
+
await refresh();
|
|
2459
|
+
}));
|
|
2460
|
+
const exportrow = document.createElement("div");
|
|
2461
|
+
exportrow.className = "actions";
|
|
2462
|
+
exportrow.append(button("Export preset file", () => request({ kind: "exportpresets" }).then((value) => {
|
|
2463
|
+
const parsed = value;
|
|
2464
|
+
status(`Exported ${parsed.exported} preset${parsed.exported === 1 ? "" : "s"} through the reviewed download flow.`);
|
|
2465
|
+
return refresh();
|
|
2466
|
+
})));
|
|
2467
|
+
const importinput = document.createElement("input");
|
|
2468
|
+
importinput.type = "file";
|
|
2469
|
+
importinput.accept = "application/json";
|
|
2470
|
+
importinput.addEventListener("change", () => {
|
|
2471
|
+
const file = importinput.files?.[0];
|
|
2472
|
+
if (!file) return;
|
|
2473
|
+
void file.text().then((content) => JSON.parse(content)).then((filevalue) => request({ kind: "importpresets", file: filevalue })).then((value) => {
|
|
2474
|
+
const parsed = value;
|
|
2475
|
+
status(`Imported ${parsed.imported} reviewed preset${parsed.imported === 1 ? "" : "s"} into the library.`);
|
|
2476
|
+
return refresh();
|
|
2477
|
+
}).catch((error) => status(error instanceof Error ? error.message : String(error), true));
|
|
2478
|
+
});
|
|
2479
|
+
exportrow.append(importinput);
|
|
2480
|
+
editor.append(exportrow);
|
|
2481
|
+
emulationroot.append(editor);
|
|
2482
|
+
const blackbox = emulation.blackbox.filter((entry) => entry.rules.length > 0);
|
|
2483
|
+
if (blackbox.length > 0) {
|
|
2484
|
+
const head = document.createElement("h4");
|
|
2485
|
+
head.textContent = "blackboxed patterns of the run";
|
|
2486
|
+
emulationroot.append(head);
|
|
2487
|
+
for (const entry of blackbox) {
|
|
2488
|
+
const line = document.createElement("p");
|
|
2489
|
+
line.textContent = `${entry.origin}: ${entry.rules.flatMap((rule) => rule.urlpatterns).join(", ")} (${entry.rules.map((rule) => rule.tracescope).join(", ")} scope)`;
|
|
2490
|
+
emulationroot.append(line);
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
const restored = emulation.permissions.filter((record) => record.restoredat === void 0);
|
|
2494
|
+
if (restored.length > 0) {
|
|
2495
|
+
const head = document.createElement("h4");
|
|
2496
|
+
head.textContent = "permission overrides pending restore";
|
|
2497
|
+
emulationroot.append(head);
|
|
2498
|
+
for (const record of restored) {
|
|
2499
|
+
const line = document.createElement("p");
|
|
2500
|
+
line.textContent = `${record.name} of ${record.origin} answered ${record.state} for run ${record.runid}; the prior ${record.priorstate} state restores at run end.`;
|
|
2501
|
+
emulationroot.append(line);
|
|
2502
|
+
}
|
|
2503
|
+
}
|
|
2504
|
+
const retentionrow = document.createElement("p");
|
|
2505
|
+
retentionrow.className = "muted";
|
|
2506
|
+
retentionrow.textContent = `Reverted layer state retention: ${context.emulationretention === void 0 ? "keep every prior state" : `${context.emulationretention} layer${context.emulationretention === 1 ? "" : "s"}`}; the layer history itself always survives.`;
|
|
2507
|
+
emulationroot.append(retentionrow);
|
|
2508
|
+
}
|
|
2349
2509
|
async function refresh() {
|
|
2350
2510
|
const context = await request({ kind: "context" });
|
|
2351
2511
|
renderplan(context.plan, context.progress, context.outcomes ?? [], context.retries ?? []);
|
|
@@ -2371,6 +2531,8 @@ async function refresh() {
|
|
|
2371
2531
|
rendertraffic(context);
|
|
2372
2532
|
rendertimeline(context);
|
|
2373
2533
|
renderdebugger(context);
|
|
2534
|
+
renderprofiling(context);
|
|
2535
|
+
renderemulation(context);
|
|
2374
2536
|
renderconsolediff();
|
|
2375
2537
|
renderaudit(context.audit);
|
|
2376
2538
|
rendercapabilities(context.capabilities);
|
|
@@ -2385,4 +2547,159 @@ localbutton?.addEventListener("click", () => create("proposelocal").catch((error
|
|
|
2385
2547
|
remotebutton?.addEventListener("click", () => create("proposeremote").catch((error) => status(error instanceof Error ? error.message : String(error), true)));
|
|
2386
2548
|
diagnosticbutton?.addEventListener("click", () => request({ kind: "diagnostic" }).then(() => refresh()).catch((error) => status(error instanceof Error ? error.message : String(error), true)));
|
|
2387
2549
|
refresh().catch((error) => status(error instanceof Error ? error.message : String(error), true));
|
|
2550
|
+
function renderprofiling(context) {
|
|
2551
|
+
if (!profilingroot) return;
|
|
2552
|
+
profilingroot.replaceChildren();
|
|
2553
|
+
const report = context.profile;
|
|
2554
|
+
const waiting = (report?.consents ?? []).filter((consent) => consent.approved === void 0 && consent.revokedat === void 0);
|
|
2555
|
+
for (const consent of waiting) {
|
|
2556
|
+
const card = document.createElement("div");
|
|
2557
|
+
card.className = "consentcard";
|
|
2558
|
+
const prompt = document.createElement("p");
|
|
2559
|
+
prompt.textContent = `Source map capture on ${consent.origin} waits for your consent; the map files of the loaded same origin scripts are fetched and parsed locally.`;
|
|
2560
|
+
card.append(prompt, button("Approve source map capture", () => request({ kind: "approvesourcemapconsent", id: consent.id }).then(() => status(`Source map capture on ${consent.origin} approved; run the capturesourcemaps step again.`)).then(refresh)));
|
|
2561
|
+
profilingroot.append(card);
|
|
2562
|
+
}
|
|
2563
|
+
const granted = (report?.consents ?? []).filter((consent) => consent.approved === true && consent.revokedat === void 0);
|
|
2564
|
+
if (granted.length > 0) profilingroot.append(button("Revoke source map consent", () => request({ kind: "revokesourcemapconsent" }).then((value) => {
|
|
2565
|
+
const parsed = value;
|
|
2566
|
+
status(`Revoked ${parsed.revoked} source map consent record${parsed.revoked === 1 ? "" : "s"}; the next capture needs a new reviewed prompt.`);
|
|
2567
|
+
return refresh();
|
|
2568
|
+
})));
|
|
2569
|
+
const stateline = document.createElement("p");
|
|
2570
|
+
stateline.className = "muted";
|
|
2571
|
+
stateline.textContent = `${context.profileactive ?? 0} profiling instrument${(context.profileactive ?? 0) === 1 ? "" : "s"} active${(context.profiletargets ?? []).length > 0 ? ` with the targets ${(context.profiletargets ?? []).map((target) => `${target.kind} ${target.url} (${target.sessionid.slice(0, 10)})`).join(", ")} attached through flattened sub sessions` : ""}.`;
|
|
2572
|
+
profilingroot.append(stateline);
|
|
2573
|
+
const flows = report?.flows ?? [];
|
|
2574
|
+
if (flows.length > 0) {
|
|
2575
|
+
const head = document.createElement("h4");
|
|
2576
|
+
head.textContent = "Flow durations per step";
|
|
2577
|
+
profilingroot.append(head);
|
|
2578
|
+
const maxflow = flows.reduce((max, metric) => Math.max(max, metric.duration), 0);
|
|
2579
|
+
for (const metric of flows.slice(0, 12)) {
|
|
2580
|
+
const bar = document.createElement("div");
|
|
2581
|
+
bar.className = "taskbar";
|
|
2582
|
+
const label = document.createElement("p");
|
|
2583
|
+
label.className = "timeline";
|
|
2584
|
+
label.textContent = `${metric.name} \xB7 ${metric.duration} ms \xB7 steps ${metric.steps.join(", ")}`;
|
|
2585
|
+
const gauge = document.createElement("div");
|
|
2586
|
+
gauge.className = "taskgauge";
|
|
2587
|
+
const fill = document.createElement("div");
|
|
2588
|
+
fill.className = "taskfill";
|
|
2589
|
+
fill.style.width = maxflow > 0 ? `${Math.round(metric.duration / maxflow * 100)}%` : "0%";
|
|
2590
|
+
gauge.append(fill);
|
|
2591
|
+
bar.append(label, gauge);
|
|
2592
|
+
profilingroot.append(bar);
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
const heaps = report?.heaps ?? [];
|
|
2596
|
+
const samples = report?.samples ?? [];
|
|
2597
|
+
const trend = (report?.trends ?? [])[0];
|
|
2598
|
+
if (samples.length > 0 || heaps.length > 0) {
|
|
2599
|
+
const head = document.createElement("h4");
|
|
2600
|
+
head.textContent = "Heap samples with the growth trend";
|
|
2601
|
+
profilingroot.append(head);
|
|
2602
|
+
const maxused = samples.reduce((max, sample) => Math.max(max, sample.usedbytes), 1);
|
|
2603
|
+
for (const sample of samples.slice(0, 12)) {
|
|
2604
|
+
const bar = document.createElement("div");
|
|
2605
|
+
bar.className = "taskbar";
|
|
2606
|
+
const label = document.createElement("p");
|
|
2607
|
+
label.className = "timeline";
|
|
2608
|
+
label.textContent = `${sample.usedbytes} of ${sample.limitbytes} bytes \xB7 step ${sample.stepid}`;
|
|
2609
|
+
const gauge = document.createElement("div");
|
|
2610
|
+
gauge.className = "taskgauge";
|
|
2611
|
+
const fill = document.createElement("div");
|
|
2612
|
+
fill.className = "taskfill";
|
|
2613
|
+
fill.style.width = `${Math.round(sample.usedbytes / maxused * 100)}%`;
|
|
2614
|
+
gauge.append(fill);
|
|
2615
|
+
bar.append(label, gauge);
|
|
2616
|
+
profilingroot.append(bar);
|
|
2617
|
+
}
|
|
2618
|
+
const trendline = document.createElement("p");
|
|
2619
|
+
trendline.className = "muted";
|
|
2620
|
+
trendline.textContent = trend !== void 0 ? `Trend slope ${trend.slope.toFixed(2)} bytes per millisecond over ${trend.samples} sample${trend.samples === 1 ? "" : "s"}${trend.flaggedsteps.length > 0 ? `; flagged steps ${trend.flaggedsteps.join(", ")}` : ""}.` : "No growth trend computed yet; trackmemory computes it from the samples beside every step.";
|
|
2621
|
+
profilingroot.append(trendline);
|
|
2622
|
+
if (heaps.length > 0) {
|
|
2623
|
+
const list = document.createElement("ul");
|
|
2624
|
+
list.className = "audit";
|
|
2625
|
+
for (const heap of heaps.slice(0, 6)) {
|
|
2626
|
+
const item = document.createElement("li");
|
|
2627
|
+
item.textContent = `snapshot ${heap.id.slice(0, 8)} \xB7 ${heap.bytesize} bytes \xB7 ${heap.nodecount} dom nodes${heap.bytesexpired === true ? " \xB7 heavy bytes expired" : ""}`;
|
|
2628
|
+
list.append(item);
|
|
2629
|
+
}
|
|
2630
|
+
profilingroot.append(list);
|
|
2631
|
+
}
|
|
2632
|
+
}
|
|
2633
|
+
const cpuprofiles = report?.profiles ?? [];
|
|
2634
|
+
if (cpuprofiles.length > 0) {
|
|
2635
|
+
const head = document.createElement("h4");
|
|
2636
|
+
head.textContent = "Cpu profiles with hot functions";
|
|
2637
|
+
const list = document.createElement("ul");
|
|
2638
|
+
list.className = "audit";
|
|
2639
|
+
for (const profile of cpuprofiles.slice(0, 6)) {
|
|
2640
|
+
const item = document.createElement("li");
|
|
2641
|
+
item.textContent = `profile ${profile.id.slice(0, 8)} \xB7 ${profile.duration} ms \xB7 ${profile.samplecount} sample${profile.samplecount === 1 ? "" : "s"} \xB7 hot ${profile.hotfunctions.slice(0, 4).join(", ") || "none"}${profile.samplesexpired === true ? " \xB7 heavy samples expired" : ""}`;
|
|
2642
|
+
list.append(item);
|
|
2643
|
+
}
|
|
2644
|
+
profilingroot.append(head, list);
|
|
2645
|
+
}
|
|
2646
|
+
const shifts = report?.shifts ?? [];
|
|
2647
|
+
if (shifts.length > 0) {
|
|
2648
|
+
const head = document.createElement("h4");
|
|
2649
|
+
head.textContent = "Layout shifts with scores and selectors";
|
|
2650
|
+
const list = document.createElement("ul");
|
|
2651
|
+
list.className = "audit";
|
|
2652
|
+
for (const shift of shifts.slice(0, 10)) {
|
|
2653
|
+
const item = document.createElement("li");
|
|
2654
|
+
item.textContent = `score ${shift.score.toFixed(4)} at ${Math.round(shift.starttime)} ms${shift.selectors.length > 0 ? ` \xB7 impacted ${shift.selectors.join(", ")}` : ""} \xB7 step ${shift.stepid}`;
|
|
2655
|
+
list.append(item);
|
|
2656
|
+
}
|
|
2657
|
+
profilingroot.append(head, list);
|
|
2658
|
+
}
|
|
2659
|
+
const traces = report?.traces ?? [];
|
|
2660
|
+
if (traces.length > 0) {
|
|
2661
|
+
const head = document.createElement("h4");
|
|
2662
|
+
head.textContent = "Traces with step annotations";
|
|
2663
|
+
profilingroot.append(head);
|
|
2664
|
+
const list = document.createElement("ul");
|
|
2665
|
+
list.className = "audit";
|
|
2666
|
+
for (const trace of traces.slice(0, 8)) {
|
|
2667
|
+
const item = document.createElement("li");
|
|
2668
|
+
item.textContent = `trace ${trace.id.slice(0, 8)} \xB7 ${trace.categories.join(", ")} \xB7 ${trace.events} event${trace.events === 1 ? "" : "s"} \xB7 ${trace.bytesize} bytes \xB7 ${trace.annotations.length} annotation${trace.annotations.length === 1 ? "" : "s"}${trace.bytesexpired === true ? " \xB7 heavy bytes expired" : ""}${trace.exportedat !== void 0 ? " \xB7 exported" : ""}`;
|
|
2669
|
+
item.append(button("Replay trace", () => request({ kind: "tracereplay", traceid: trace.id }).then((value) => {
|
|
2670
|
+
const replay = value;
|
|
2671
|
+
const grouped = Object.entries(replay.categories).map(([category, count]) => `${category} ${count}`).join(", ");
|
|
2672
|
+
const steps = [...new Set(replay.events.map((event) => event.stepid).filter((stepid) => stepid !== void 0))].join(", ");
|
|
2673
|
+
status(`Trace replay of ${trace.id.slice(0, 8)}: ${replay.events.length} event${replay.events.length === 1 ? "" : "s"} grouped by category (${grouped}) and by step (${steps || "none"}) with ${replay.annotations.length} annotation${replay.annotations.length === 1 ? "" : "s"}.`);
|
|
2674
|
+
return refresh();
|
|
2675
|
+
})));
|
|
2676
|
+
if (trace.bytesexpired !== true) item.append(button("Export trace", () => request({ kind: "exporttrace", traceid: trace.id }).then(() => status(`Exported the trace ${trace.id.slice(0, 8)} through the reviewed download flow with its ${trace.annotations.length} step annotation${trace.annotations.length === 1 ? "" : "s"}.`)).then(refresh)));
|
|
2677
|
+
list.append(item);
|
|
2678
|
+
}
|
|
2679
|
+
profilingroot.append(list);
|
|
2680
|
+
}
|
|
2681
|
+
const sourcemaps = report?.sourcemaps ?? [];
|
|
2682
|
+
if (sourcemaps.length > 0) {
|
|
2683
|
+
const head = document.createElement("h4");
|
|
2684
|
+
head.textContent = "Source maps";
|
|
2685
|
+
const list = document.createElement("ul");
|
|
2686
|
+
list.className = "audit";
|
|
2687
|
+
for (const ref of sourcemaps.slice(0, 10)) {
|
|
2688
|
+
const item = document.createElement("li");
|
|
2689
|
+
item.textContent = `${ref.scripturl} \u2192 ${ref.mapurl} \xB7 ${ref.parsed ? "parsed" : "unparsed"}`;
|
|
2690
|
+
list.append(item);
|
|
2691
|
+
}
|
|
2692
|
+
profilingroot.append(head, list);
|
|
2693
|
+
}
|
|
2694
|
+
const settingsline = document.createElement("p");
|
|
2695
|
+
settingsline.className = "muted";
|
|
2696
|
+
settingsline.textContent = `Profile retention ${context.profileretention ?? "keeps every heavy artifact"} \xB7 trace byte ceiling ${context.traceceiling ?? "none"}.`;
|
|
2697
|
+
const retentioninput = document.createElement("input");
|
|
2698
|
+
retentioninput.placeholder = "profile retention ms";
|
|
2699
|
+
retentioninput.value = context.profileretention !== void 0 ? String(context.profileretention) : "";
|
|
2700
|
+
const ceilinginput = document.createElement("input");
|
|
2701
|
+
ceilinginput.placeholder = "trace byte ceiling";
|
|
2702
|
+
ceilinginput.value = context.traceceiling !== void 0 ? String(context.traceceiling) : "";
|
|
2703
|
+
profilingroot.append(settingsline, retentioninput, ceilinginput, button("Save profiling settings", () => Promise.all([request({ kind: "setprofileretention", retention: retentioninput.value === "" ? void 0 : Number(retentioninput.value) }), request({ kind: "settraceceiling", ceiling: ceilinginput.value === "" ? void 0 : Number(ceilinginput.value) })]).then(() => status(`Profiling settings saved: profile retention ${retentioninput.value === "" ? "keeps every heavy artifact" : `${retentioninput.value} milliseconds`} and trace byte ceiling ${ceilinginput.value === "" ? "none" : `${ceilinginput.value} bytes`}.`)).then(refresh)));
|
|
2704
|
+
}
|
|
2388
2705
|
//# sourceMappingURL=sidepanel.js.map
|