@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.
@@ -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</title><link rel="stylesheet" href="style.css"></head>
4
- <body><main><header><p class="eyebrow">DEVTHINK 1.1.46</p><h1>Browser bridge</h1><p>Consent is required before page access or action.</p></header><label for="endpoint">Optional agent endpoint</label><input id="endpoint" type="url" inputmode="url" placeholder="https://agent.example/proposal" autocomplete="off"><button id="connect">Approve endpoint origin</button><div class="actions"><button id="session">Start active tab session</button><button id="pause" class="secondary">Pause session</button><button id="openpanel" class="secondary">Review plans</button><button id="stop" class="danger">Stop</button></div><p id="capabilities" role="status" class="muted">Optional capabilities: loading.</p><p id="livelogic" role="status" class="muted">Held keys: none · Open dialogs answered: none.</p><p id="navstate" role="status" class="muted">Navigation: unknown.</p><p id="windowlayout" role="status" class="muted">Window layout: unknown.</p><p id="captchastate" role="status" class="muted">Captcha handoff: none.</p><p id="datasetstate" role="status" class="muted">Datasets: none collected yet.</p><p id="downloadstate" role="status" class="muted">Downloads: none.</p><p id="clipboardstate" role="status" class="muted">Clipboard consent: none waiting.</p><p id="capturestate" role="status" class="muted">Captures: none.</p><p id="mediastate" role="status" class="muted">Media: none.</p><p id="callstate" role="status" class="muted">Outbound calls: none.</p><p id="netstate" role="status" class="muted">Observed requests: none.</p><p id="rulestate" role="status" class="muted">Traffic rules: none active.</p><p id="debugstate" role="status" class="muted">Timeline: no errors captured.</p><div id="windowcontrols" class="actions"></div><p id="status" role="status">Loading session state.</p></main><script type="module" src="popup.js"></script></body>
4
+ <body><main><header><p class="eyebrow">DEVTHINK 1.1.48</p><h1>Browser bridge</h1><p>Consent is required before page access or action.</p></header><label for="endpoint">Optional agent endpoint</label><input id="endpoint" type="url" inputmode="url" placeholder="https://agent.example/proposal" autocomplete="off"><button id="connect">Approve endpoint origin</button><div class="actions"><button id="session">Start active tab session</button><button id="pause" class="secondary">Pause session</button><button id="openpanel" class="secondary">Review plans</button><button id="stop" class="danger">Stop</button></div><p id="capabilities" role="status" class="muted">Optional capabilities: loading.</p><p id="livelogic" role="status" class="muted">Held keys: none · Open dialogs answered: none.</p><p id="navstate" role="status" class="muted">Navigation: unknown.</p><p id="windowlayout" role="status" class="muted">Window layout: unknown.</p><p id="captchastate" role="status" class="muted">Captcha handoff: none.</p><p id="datasetstate" role="status" class="muted">Datasets: none collected yet.</p><p id="downloadstate" role="status" class="muted">Downloads: none.</p><p id="clipboardstate" role="status" class="muted">Clipboard consent: none waiting.</p><p id="capturestate" role="status" class="muted">Captures: none.</p><p id="mediastate" role="status" class="muted">Media: none.</p><p id="callstate" role="status" class="muted">Outbound calls: none.</p><p id="netstate" role="status" class="muted">Observed requests: none.</p><p id="rulestate" role="status" class="muted">Traffic rules: none active.</p><p id="debugstate" role="status" class="muted">Timeline: no errors captured.</p><p id="emulationstate" role="status" class="muted">Emulation: no active layer.</p><div id="windowcontrols" class="actions"></div><p id="status" role="status">Loading session state.</p></main><script type="module" src="popup.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
  function normalizeendpoint(value) {
7
7
  const endpoint = new URL(value.trim());
@@ -32,6 +32,7 @@ var callstatenode = document.querySelector("#callstate");
32
32
  var rulestatenode = document.querySelector("#rulestate");
33
33
  var netstatenode = document.querySelector("#netstate");
34
34
  var debugstatenode = document.querySelector("#debugstate");
35
+ var emulationstatenode = document.querySelector("#emulationstate");
35
36
  var windowcontrols = document.querySelector("#windowcontrols");
36
37
  var connectbutton = document.querySelector("#connect");
37
38
  var sessionbutton = document.querySelector("#session");
@@ -151,18 +152,22 @@ function rendernetstate(exchanges, channels) {
151
152
  const live = (channels ?? []).filter((channel) => channel.state === "open" || channel.state === "connecting").length;
152
153
  netstatenode.textContent = `Observed requests: ${count} of the run${live > 0 ? ` \xB7 ${live} live channel${live === 1 ? "" : "s"}` : ""}.`;
153
154
  }
154
- function renderdebugstate(timeline, consoleconsents, debuggergrants, cdpattached) {
155
+ function renderdebugstate(timeline, consoleconsents, debuggergrants, cdpattached, profileactive, sourcemapconsents) {
155
156
  if (!debugstatenode) return;
156
157
  const errors = timeline?.errors?.length ?? 0;
157
158
  const rejections = timeline?.rejections?.length ?? 0;
158
159
  const waiting = (consoleconsents ?? []).filter((consent) => consent.approved === void 0).length;
159
160
  const debuggerwaiting = (debuggergrants ?? []).filter((grant) => grant.approved === void 0 && grant.revokedat === void 0).length;
160
161
  const attached = cdpattached ?? 0;
161
- debugstatenode.textContent = errors === 0 && rejections === 0 && waiting === 0 && debuggerwaiting === 0 && attached === 0 ? "Timeline: no errors captured." : `Timeline: ${errors} error${errors === 1 ? "" : "s"}${rejections > 0 ? ` \xB7 ${rejections} rejection${rejections === 1 ? "" : "s"}` : ""} captured in the active run${waiting > 0 ? ` \xB7 ${waiting} console consent prompt${waiting === 1 ? "" : "s"} waiting` : ""}${debuggerwaiting > 0 ? ` \xB7 ${debuggerwaiting} debugger consent prompt${debuggerwaiting === 1 ? "" : "s"} waiting` : ""}${attached > 0 ? ` \xB7 debugger attached on ${attached} session${attached === 1 ? "" : "s"}` : ""}.`;
162
- if (errors > 0 || waiting > 0 || debuggerwaiting > 0) debugstatenode.dataset.state = "error";
162
+ const profiling = profileactive ?? 0;
163
+ const sourcemapwaiting = (sourcemapconsents ?? []).filter((consent) => consent.approved === void 0 && consent.revokedat === void 0).length;
164
+ debugstatenode.textContent = errors === 0 && rejections === 0 && waiting === 0 && debuggerwaiting === 0 && attached === 0 && profiling === 0 && sourcemapwaiting === 0 ? "Timeline: no errors captured." : `Timeline: ${errors} error${errors === 1 ? "" : "s"}${rejections > 0 ? ` \xB7 ${rejections} rejection${rejections === 1 ? "" : "s"}` : ""} captured in the active run${waiting > 0 ? ` \xB7 ${waiting} console consent prompt${waiting === 1 ? "" : "s"} waiting` : ""}${debuggerwaiting > 0 ? ` \xB7 ${debuggerwaiting} debugger consent prompt${debuggerwaiting === 1 ? "" : "s"} waiting` : ""}${attached > 0 ? ` \xB7 debugger attached on ${attached} session${attached === 1 ? "" : "s"}` : ""}${profiling > 0 ? ` \xB7 profiling active on ${profiling} instrument${profiling === 1 ? "" : "s"}` : ""}${sourcemapwaiting > 0 ? ` \xB7 ${sourcemapwaiting} source map prompt${sourcemapwaiting === 1 ? "" : "s"} waiting` : ""}.`;
165
+ if (errors > 0 || waiting > 0 || debuggerwaiting > 0 || sourcemapwaiting > 0) debugstatenode.dataset.state = "error";
163
166
  else delete debugstatenode.dataset.state;
164
167
  if (attached > 0) debugstatenode.dataset.debugger = "attached";
165
168
  else delete debugstatenode.dataset.debugger;
169
+ if (profiling > 0) debugstatenode.dataset.profile = "active";
170
+ else delete debugstatenode.dataset.profile;
166
171
  }
167
172
  function renderrulestate(activerules, blocked, mocked) {
168
173
  if (!rulestatenode) return;
@@ -187,6 +192,16 @@ function rendermediastate(media, recordingactive, recordingconsents) {
187
192
  if (active > 0) mediastatenode.dataset.state = "recording";
188
193
  else delete mediastatenode.dataset.state;
189
194
  }
195
+ function renderemulationstate(layers, locationconsents) {
196
+ if (!emulationstatenode) return;
197
+ const active = layers ?? [];
198
+ const waiting = (locationconsents ?? []).filter((consent) => consent.approved === void 0).length;
199
+ emulationstatenode.textContent = `Emulation: ${active.length > 0 ? `${active.length} active layer${active.length === 1 ? "" : "s"} (${active.join(", ")})` : "no active layer"}${waiting > 0 ? ` \xB7 ${waiting} location consent prompt${waiting === 1 ? "" : "s"} waiting` : ""}.`;
200
+ if (active.length > 0) emulationstatenode.dataset.emulated = "active";
201
+ else delete emulationstatenode.dataset.emulated;
202
+ if (waiting > 0) emulationstatenode.dataset.state = "error";
203
+ else delete emulationstatenode.dataset.state;
204
+ }
190
205
  async function restore() {
191
206
  const context = await request({ kind: "context" });
192
207
  if (endpointinput && context.config) endpointinput.value = context.config.endpoint;
@@ -202,7 +217,8 @@ async function restore() {
202
217
  rendermediastate(context.media, context.recordingactive, context.recordingconsents);
203
218
  rendercallstate(context.calls, context.fetchconsents);
204
219
  rendernetstate(context.exchanges, context.channels);
205
- renderdebugstate(context.timeline, context.consoleconsents, context.debuggergrants, context.cdpattached);
220
+ renderdebugstate(context.timeline, context.consoleconsents, context.debuggergrants, context.cdpattached, context.profileactive, context.profile?.consents);
221
+ renderemulationstate(context.emulatedlayers, context.emulation?.consents);
206
222
  renderrulestate(context.activerules, (context.traffic?.blocks ?? []).filter((rule) => rule.revertedat === void 0).reduce((total, rule) => total + rule.hits, 0), (context.traffic?.mocks ?? []).filter((spec) => spec.revertedat === void 0).reduce((total, spec) => total + spec.hits, 0));
207
223
  const active = context.session && !context.session.stoppedat && context.session.expiresat > Date.now();
208
224
  if (pausebutton) {