@wenathlan/extension 1.1.42 → 1.1.44
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/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1451 -14
- package/dist/index.js.map +4 -4
- package/dist/memory.d.ts +76 -5
- package/dist/memory.d.ts.map +1 -1
- package/dist/netauth.d.ts +46 -0
- package/dist/netauth.d.ts.map +1 -0
- package/dist/netcontrol.d.ts +96 -0
- package/dist/netcontrol.d.ts.map +1 -0
- package/dist/netwatch.d.ts +92 -0
- package/dist/netwatch.d.ts.map +1 -0
- package/dist/policy.d.ts +31 -0
- package/dist/policy.d.ts.map +1 -1
- package/dist/protocol.d.ts +59 -3
- package/dist/protocol.d.ts.map +1 -1
- package/dist/socketbus.d.ts +134 -0
- package/dist/socketbus.d.ts.map +1 -0
- package/dist/types.d.ts +338 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/extension/dist/background.js +2890 -630
- package/extension/dist/background.js.map +4 -4
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/pagebridge.js +41 -4
- package/extension/dist/pagebridge.js.map +2 -2
- package/extension/dist/popup.html +1 -1
- package/extension/dist/popup.js +20 -3
- package/extension/dist/popup.js.map +2 -2
- package/extension/dist/sidepanel.html +1 -1
- package/extension/dist/sidepanel.js +212 -3
- package/extension/dist/sidepanel.js.map +2 -2
- package/extension/dist/style.css +1 -0
- 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>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>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"]);
|
|
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"]);
|
|
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"]);
|
|
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"]);
|
|
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"]);
|
|
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"]);
|
|
5
5
|
var allowedactions = /* @__PURE__ */ new Set([...sensitiveactions, ...interactionactions, ...readactions]);
|
|
6
6
|
|
|
7
7
|
// extension/tabscommand.ts
|
|
@@ -66,6 +66,8 @@ var filesroot = document.querySelector("#files");
|
|
|
66
66
|
var capturesroot = document.querySelector("#captures");
|
|
67
67
|
var mediaroot = document.querySelector("#media");
|
|
68
68
|
var callsroot = document.querySelector("#calls");
|
|
69
|
+
var trafficroot = document.querySelector("#traffic");
|
|
70
|
+
var netviewroot = document.querySelector("#netview");
|
|
69
71
|
var statusnode = document.querySelector("#status");
|
|
70
72
|
var progressnode = document.querySelector("#planprogress");
|
|
71
73
|
var capabilitiestext = document.querySelector("#capabilitiestext");
|
|
@@ -1688,6 +1690,82 @@ function rendercaptures(context) {
|
|
|
1688
1690
|
capturesroot.append(card);
|
|
1689
1691
|
}
|
|
1690
1692
|
}
|
|
1693
|
+
function rendertraffic(context) {
|
|
1694
|
+
if (!trafficroot) return;
|
|
1695
|
+
trafficroot.replaceChildren();
|
|
1696
|
+
const head = document.createElement("p");
|
|
1697
|
+
head.textContent = `active traffic rules: ${context.activerules ?? 0} (every rule reverts at run end)`;
|
|
1698
|
+
trafficroot.append(head);
|
|
1699
|
+
const traffic = context.traffic;
|
|
1700
|
+
if (traffic === void 0) return;
|
|
1701
|
+
if (traffic.blocks.length === 0 && traffic.mocks.length === 0 && traffic.rewrites.length === 0 && traffic.cookies.length === 0 && traffic.proxies.length === 0 && traffic.ratelimits.length === 0) {
|
|
1702
|
+
trafficroot.append(Object.assign(document.createElement("p"), { className: "muted", textContent: "No traffic rule has been applied yet; blockrequest, mockresponse, rewriteheaders, setcookies, clearcookies, routeproxy, postform and postfiles steps land here." }));
|
|
1703
|
+
}
|
|
1704
|
+
for (const rule of traffic.blocks) {
|
|
1705
|
+
const row = document.createElement("p");
|
|
1706
|
+
row.textContent = `block ${rule.urlpattern} \xB7 ${rule.hits} blocked \xB7 ${rule.revertedat !== void 0 ? "reverted" : "active"} \xB7 step ${rule.stepid}`;
|
|
1707
|
+
trafficroot.append(row);
|
|
1708
|
+
}
|
|
1709
|
+
for (const spec of traffic.mocks) {
|
|
1710
|
+
const row = document.createElement("p");
|
|
1711
|
+
row.textContent = `mock ${spec.urlpattern} \u2192 ${spec.status} \xB7 ${spec.hits} served \xB7 ${spec.revertedat !== void 0 ? "reverted" : "active"}`;
|
|
1712
|
+
trafficroot.append(row);
|
|
1713
|
+
}
|
|
1714
|
+
for (const rule of traffic.rewrites) {
|
|
1715
|
+
const row = document.createElement("p");
|
|
1716
|
+
row.textContent = `rewrite ${rule.operation} ${rule.name} on ${rule.urlpattern} \xB7 ${rule.hits} applied \xB7 ${rule.revertedat !== void 0 ? "reverted" : "active"}`;
|
|
1717
|
+
trafficroot.append(row);
|
|
1718
|
+
}
|
|
1719
|
+
for (const route of traffic.proxies) {
|
|
1720
|
+
const row = document.createElement("p");
|
|
1721
|
+
row.textContent = `proxy ${route.scheme}://${route.host}:${route.port} \xB7 bypass ${route.bypass.join(", ")} \xB7 ${route.revertedat !== void 0 ? "reverted" : "active"}`;
|
|
1722
|
+
trafficroot.append(row);
|
|
1723
|
+
if (route.revertedat === void 0) {
|
|
1724
|
+
const actions = document.createElement("div");
|
|
1725
|
+
actions.className = "actions";
|
|
1726
|
+
actions.append(button("Revert proxy route", () => request({ kind: "revertproxyroute", id: route.id }).then(() => status(`Proxy route ${route.id} reverted; the previous routing state is restored.`)).then(refresh)));
|
|
1727
|
+
trafficroot.append(actions);
|
|
1728
|
+
}
|
|
1729
|
+
}
|
|
1730
|
+
for (const read of traffic.ratelimits) {
|
|
1731
|
+
const row = document.createElement("p");
|
|
1732
|
+
row.textContent = `rate limit ${read.origin} \xB7 ${read.remaining ?? "?"} of ${read.limit ?? "?"} remaining \xB7 resets ${new Date(read.resetat).toLocaleTimeString()}`;
|
|
1733
|
+
trafficroot.append(row);
|
|
1734
|
+
}
|
|
1735
|
+
for (const flow of context.authflows ?? []) {
|
|
1736
|
+
const row = document.createElement("p");
|
|
1737
|
+
row.textContent = `oauth ${flow.provider} \xB7 scopes ${flow.scopes.join(", ")} \xB7 redirect ${flow.redirectorigin} \xB7 ${flow.stage} in tab ${flow.tabid}`;
|
|
1738
|
+
trafficroot.append(row);
|
|
1739
|
+
}
|
|
1740
|
+
for (const token of context.tokens?.tokens ?? []) {
|
|
1741
|
+
const row = document.createElement("p");
|
|
1742
|
+
row.textContent = `token ${token.provider} \xB7 scopes ${token.scopes.join(", ")} \xB7 ${token.revokedat !== void 0 ? "revoked" : `expires ${new Date(token.expiresat).toLocaleTimeString()}`}${token.refreshedat !== void 0 ? " \xB7 refreshed" : ""}`;
|
|
1743
|
+
trafficroot.append(row);
|
|
1744
|
+
if (token.revokedat === void 0) {
|
|
1745
|
+
const actions = document.createElement("div");
|
|
1746
|
+
actions.className = "actions";
|
|
1747
|
+
actions.append(button("Revoke token", () => request({ kind: "revoketokens", tokenids: [token.id], reason: "review panel demand" }).then(() => status(`Token ${token.id} of ${token.provider} revoked.`)).then(refresh)));
|
|
1748
|
+
trafficroot.append(actions);
|
|
1749
|
+
}
|
|
1750
|
+
}
|
|
1751
|
+
for (const op of traffic.cookies.slice(0, 8)) {
|
|
1752
|
+
const row = document.createElement("p");
|
|
1753
|
+
row.textContent = `cookie ${op.kind} \xB7 ${op.domain} \xB7 ${op.names.length === 0 ? "all cookies" : op.names.join(", ")} \xB7 ${new Date(op.at).toLocaleTimeString()} (values never stored)`;
|
|
1754
|
+
trafficroot.append(row);
|
|
1755
|
+
}
|
|
1756
|
+
for (const ref of context.apikeys ?? []) {
|
|
1757
|
+
const row = document.createElement("p");
|
|
1758
|
+
row.textContent = `api key ${ref.name} \xB7 header ${ref.header} \xB7 scoped to ${ref.origins.join(", ")}${ref.lastuse !== void 0 ? ` \xB7 last use ${new Date(ref.lastuse).toLocaleTimeString()}` : " \xB7 unused"}`;
|
|
1759
|
+
trafficroot.append(row);
|
|
1760
|
+
}
|
|
1761
|
+
const uploads = (context.progress?.outcomes ?? []).filter((outcome) => outcome.details?.upload !== void 0).slice(-4);
|
|
1762
|
+
for (const outcome of uploads) {
|
|
1763
|
+
const entry = outcome.details?.upload;
|
|
1764
|
+
const row = document.createElement("p");
|
|
1765
|
+
row.textContent = `upload chunk ${entry.chunk} of ${entry.chunks} \xB7 ${entry.uploaded} of ${entry.bytes} bytes`;
|
|
1766
|
+
trafficroot.append(row);
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1691
1769
|
function rendercalls(context) {
|
|
1692
1770
|
if (!callsroot) return;
|
|
1693
1771
|
callsroot.replaceChildren();
|
|
@@ -1833,6 +1911,135 @@ function rendercalls(context) {
|
|
|
1833
1911
|
}
|
|
1834
1912
|
callsroot.append(actions);
|
|
1835
1913
|
}
|
|
1914
|
+
function rendernetview(context) {
|
|
1915
|
+
if (!netviewroot) return;
|
|
1916
|
+
netviewroot.replaceChildren();
|
|
1917
|
+
const active = context.session && !context.session.stoppedat && context.session.expiresat > Date.now();
|
|
1918
|
+
const grantcard = document.createElement("div");
|
|
1919
|
+
grantcard.className = "panel";
|
|
1920
|
+
const grantrow = document.createElement("p");
|
|
1921
|
+
grantrow.textContent = `request watching: ${context.webrequestgrant === true ? "granted" : "not granted"} \u2014 the observation derives from the page timing buffers and adds no manifest permission.`;
|
|
1922
|
+
grantcard.append(grantrow);
|
|
1923
|
+
if (active) {
|
|
1924
|
+
const grantactions = document.createElement("div");
|
|
1925
|
+
grantactions.className = "actions";
|
|
1926
|
+
grantactions.append(button(context.webrequestgrant === true ? "Revoke request watching" : "Grant request watching", () => request({ kind: "setwebrequestgrant", granted: context.webrequestgrant !== true }).then(() => status(context.webrequestgrant === true ? "Request watching revoked." : "Request watching granted; watchrequests steps can run now.")).then(refresh)));
|
|
1927
|
+
grantcard.append(grantactions);
|
|
1928
|
+
}
|
|
1929
|
+
netviewroot.append(grantcard);
|
|
1930
|
+
const channels = context.channels ?? [];
|
|
1931
|
+
const subscriptions = context.subscriptions ?? [];
|
|
1932
|
+
if (channels.length > 0 || subscriptions.length > 0 || (context.socketsactive ?? 0) > 0) {
|
|
1933
|
+
const card = document.createElement("div");
|
|
1934
|
+
card.className = "panel";
|
|
1935
|
+
const head = document.createElement("p");
|
|
1936
|
+
head.textContent = `live channels: ${channels.length} websocket channel${channels.length === 1 ? "" : "s"} \xB7 ${subscriptions.length} event stream${subscriptions.length === 1 ? "" : "s"}`;
|
|
1937
|
+
card.append(head);
|
|
1938
|
+
for (const channel of channels) {
|
|
1939
|
+
const row = document.createElement("p");
|
|
1940
|
+
row.textContent = `${channel.kind} ${channel.state} \xB7 ${channel.origin} \xB7 ${channel.sent} sent \xB7 ${channel.received} received \xB7 ${channel.reconnects} reconnect${channel.reconnects === 1 ? "" : "s"}${channel.lasteventid !== void 0 ? ` \xB7 last event ${channel.lasteventid}` : ""}`;
|
|
1941
|
+
card.append(row);
|
|
1942
|
+
if (channel.state === "open" || channel.state === "connecting") {
|
|
1943
|
+
const actions2 = document.createElement("div");
|
|
1944
|
+
actions2.className = "actions";
|
|
1945
|
+
actions2.append(button(`Close ${channel.id}`, () => request({ kind: "closesocket", id: channel.id }).then(() => status(`Channel ${channel.id} closed cleanly.`)).then(refresh)));
|
|
1946
|
+
card.append(actions2);
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
for (const subscription of subscriptions) {
|
|
1950
|
+
const row = document.createElement("p");
|
|
1951
|
+
row.textContent = `sse ${subscription.state} \xB7 ${subscription.origin} \xB7 ${subscription.events} event${subscription.events === 1 ? "" : "s"}${subscription.names.length > 0 ? ` (${subscription.names.slice(0, 4).join(", ")}${subscription.names.length > 4 ? "\u2026" : ""})` : ""}${subscription.lasteventid !== void 0 ? ` \xB7 resume at ${subscription.lasteventid}` : ""} \xB7 cancel on ${subscription.cancel.kind}`;
|
|
1952
|
+
card.append(row);
|
|
1953
|
+
}
|
|
1954
|
+
netviewroot.append(card);
|
|
1955
|
+
}
|
|
1956
|
+
const pollevidence = (context.progress?.outcomes ?? []).filter((outcome) => outcome.details?.poll !== void 0).map((outcome) => outcome.details?.poll);
|
|
1957
|
+
if (pollevidence.length > 0) {
|
|
1958
|
+
const card = document.createElement("div");
|
|
1959
|
+
card.className = "panel";
|
|
1960
|
+
const head = document.createElement("p");
|
|
1961
|
+
head.textContent = `poll loops: ${pollevidence.length} iteration${pollevidence.length === 1 ? "" : "s"}`;
|
|
1962
|
+
card.append(head);
|
|
1963
|
+
for (const poll of pollevidence.slice(0, 8)) {
|
|
1964
|
+
const row = document.createElement("p");
|
|
1965
|
+
row.textContent = `poll ${poll.poll} \xB7 status ${poll.status}${poll.cursor !== void 0 ? ` \xB7 cursor ${poll.cursor}` : ""} \xB7 ${poll.stopped ? `stopped: ${poll.reason}` : "continuing"}`;
|
|
1966
|
+
card.append(row);
|
|
1967
|
+
}
|
|
1968
|
+
card.append(document.createRange().createContextualFragment(""));
|
|
1969
|
+
netviewroot.append(card);
|
|
1970
|
+
}
|
|
1971
|
+
const exchanges = context.exchanges ?? [];
|
|
1972
|
+
const list = document.createElement("div");
|
|
1973
|
+
if (exchanges.length === 0) {
|
|
1974
|
+
list.textContent = "No request of the run has been observed yet; grant request watching and run a watchrequests step.";
|
|
1975
|
+
}
|
|
1976
|
+
for (const exchange of exchanges) {
|
|
1977
|
+
const card = document.createElement("details");
|
|
1978
|
+
card.className = "panel callcard";
|
|
1979
|
+
const summary = document.createElement("summary");
|
|
1980
|
+
summary.textContent = `${exchange.method} ${exchange.status} ${exchange.statusclass} \xB7 ${new URL(exchange.url).host} \xB7 ${exchange.bytes} bytes \xB7 ${exchange.timing} ms \xB7 correlation ${exchange.correlationid} \xB7 ${exchange.source === "page" ? "derived" : "captured"}`;
|
|
1981
|
+
if (exchange.errorclass !== void 0) {
|
|
1982
|
+
const badge = document.createElement("span");
|
|
1983
|
+
badge.className = "credentialbadge";
|
|
1984
|
+
badge.textContent = ` ${exchange.errorclass} `;
|
|
1985
|
+
summary.append(badge);
|
|
1986
|
+
}
|
|
1987
|
+
card.append(summary);
|
|
1988
|
+
const urlrow = document.createElement("p");
|
|
1989
|
+
urlrow.textContent = `url: ${exchange.url}${exchange.mime !== void 0 ? ` \xB7 ${exchange.mime}` : ""}${exchange.bodyref !== void 0 ? ` \xB7 body ${exchange.bodyref}` : ""}${exchange.bodyexpired === true ? " \xB7 body expired from retention" : ""}`;
|
|
1990
|
+
card.append(urlrow);
|
|
1991
|
+
const requestheadernames = Object.keys(exchange.requestheaders ?? {});
|
|
1992
|
+
if (requestheadernames.length > 0 || Object.keys(exchange.responseheaders ?? {}).length > 0) {
|
|
1993
|
+
const headersrow = document.createElement("p");
|
|
1994
|
+
headersrow.textContent = `stored headers (redacted on the redaction list): request ${requestheadernames.length > 0 ? requestheadernames.join(", ") : "none"} \xB7 response ${Object.keys(exchange.responseheaders ?? {}).join(", ") || "none"}`;
|
|
1995
|
+
card.append(headersrow);
|
|
1996
|
+
} else {
|
|
1997
|
+
const headersrow = document.createElement("p");
|
|
1998
|
+
headersrow.className = "muted";
|
|
1999
|
+
headersrow.textContent = "no captured headers: derived page exchanges expose no header names through the timing buffers.";
|
|
2000
|
+
card.append(headersrow);
|
|
2001
|
+
}
|
|
2002
|
+
if (exchange.bodyref !== void 0 && exchange.bodyexpired !== true) {
|
|
2003
|
+
const bodyrow = document.createElement("p");
|
|
2004
|
+
bodyrow.textContent = `captured body ${exchange.bodyref}`;
|
|
2005
|
+
card.append(bodyrow);
|
|
2006
|
+
const actions2 = document.createElement("div");
|
|
2007
|
+
actions2.className = "actions";
|
|
2008
|
+
actions2.append(button(`Preview body ${exchange.bodyref}`, () => request({ kind: "exchangebody", ref: exchange.bodyref }).then((value) => {
|
|
2009
|
+
const record = value;
|
|
2010
|
+
bodyrow.textContent = `captured body ${exchange.bodyref} of ${record.mime} and ${record.bytes} bytes: ${record.body.slice(0, 400)}${record.body.length > 400 ? "\u2026 (display preview truncates; the stored body keeps every byte)" : ""}`;
|
|
2011
|
+
}).catch((error) => status(error instanceof Error ? error.message : String(error), true))));
|
|
2012
|
+
card.append(actions2);
|
|
2013
|
+
}
|
|
2014
|
+
list.append(card);
|
|
2015
|
+
}
|
|
2016
|
+
netviewroot.append(list);
|
|
2017
|
+
const apimap = context.apimap ?? [];
|
|
2018
|
+
if (apimap.length > 0) {
|
|
2019
|
+
const card = document.createElement("div");
|
|
2020
|
+
card.className = "panel";
|
|
2021
|
+
const head = document.createElement("p");
|
|
2022
|
+
head.textContent = `page api map: ${apimap.length} ranked endpoint${apimap.length === 1 ? "" : "s"}`;
|
|
2023
|
+
card.append(head);
|
|
2024
|
+
for (const entry of apimap.slice(0, 10)) {
|
|
2025
|
+
const row = document.createElement("p");
|
|
2026
|
+
row.textContent = `${entry.method} ${entry.endpoint} \xB7 ${entry.frequency} call${entry.frequency === 1 ? "" : "s"} \xB7 json ${Math.round(entry.jsonshare * 100)}% \xB7 stable ${Math.round(entry.stability * 100)}%${entry.payloadshape.length > 0 ? ` \xB7 ${entry.payloadshape.slice(0, 5).join(", ")}` : ""}`;
|
|
2027
|
+
card.append(row);
|
|
2028
|
+
}
|
|
2029
|
+
netviewroot.append(card);
|
|
2030
|
+
}
|
|
2031
|
+
const actions = document.createElement("div");
|
|
2032
|
+
actions.className = "actions";
|
|
2033
|
+
actions.append(button(`Export netlog (${exchanges.length} exchange${exchanges.length === 1 ? "" : "s"})`, () => request({ kind: "exportnetlog" }).then(() => status("Exported the captured run log through the reviewed download flow.")).catch((error) => status(error instanceof Error ? error.message : String(error), true))));
|
|
2034
|
+
if (active) {
|
|
2035
|
+
const retentioninput = document.createElement("input");
|
|
2036
|
+
retentioninput.placeholder = "captured body retention (records)";
|
|
2037
|
+
retentioninput.value = context.bodyretention !== void 0 ? String(context.bodyretention) : "";
|
|
2038
|
+
retentioninput.setAttribute("aria-label", "captured body retention window");
|
|
2039
|
+
actions.append(retentioninput, button("Save body retention", () => request({ kind: "setbodyretention", retention: retentioninput.value === "" ? void 0 : Number(retentioninput.value) }).then(() => status(`Captured body retention saved as ${retentioninput.value === "" ? "keep every body" : retentioninput.value} records; exchange metadata always survives.`)).then(refresh)));
|
|
2040
|
+
}
|
|
2041
|
+
netviewroot.append(actions);
|
|
2042
|
+
}
|
|
1836
2043
|
function rendercapabilities(report) {
|
|
1837
2044
|
if (!capabilitiestext) return;
|
|
1838
2045
|
if (!report) {
|
|
@@ -1885,6 +2092,8 @@ async function refresh() {
|
|
|
1885
2092
|
rendercaptures(context);
|
|
1886
2093
|
rendermedia(context);
|
|
1887
2094
|
rendercalls(context);
|
|
2095
|
+
rendernetview(context);
|
|
2096
|
+
rendertraffic(context);
|
|
1888
2097
|
renderaudit(context.audit);
|
|
1889
2098
|
rendercapabilities(context.capabilities);
|
|
1890
2099
|
if (context.session?.pausedat) status("Session paused. Reviewed actions are blocked until resume.");
|