@wenathlan/extension 1.1.53 → 1.1.54

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 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>Profiling</h2><div id="profiling" class="panel"></div></section><section><h2>Emulation</h2><div id="emulation" class="panel"></div></section><section><h2>Sessions</h2><div id="sessions" class="panel"></div></section><section><h2>Workflows</h2><div id="workflows" class="panel"></div></section><section><h2>Workflow editor</h2><div id="workfloweditor" class="panel"></div></section><section><h2>Triggers</h2><div id="triggers" 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>Sessions</h2><div id="sessions" class="panel"></div></section><section><h2>Workflows</h2><div id="workflows" class="panel"></div></section><section><h2>Workflow editor</h2><div id="workfloweditor" class="panel"></div></section><section><h2>Triggers</h2><div id="triggers" class="panel"></div></section><section><h2>Agent protocol</h2><div id="agentprotocol" 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>
@@ -74,7 +74,7 @@ function regexruleof(value) {
74
74
  // policy.ts
75
75
  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", "restoresession", "exportsessions", "importsessions", "runworkflow", "visitrule", "urlrule", "menurule", "keyrule", "buttonrule", "cronrule", "intervalrule", "urllistrule", "webhookrule", "eventrule"]);
76
76
  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", "loop", "repeatuntil", "whileloop", "foreach", "parallel", "trycatch"]);
77
- 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", "persiststate", "capturesession", "namedsessions", "diffsessions", "searchsessions", "composeworkflow", "savetemplate", "dryrun", "delay", "waitelement", "compute", "extractvars", "condition", "branch"]);
77
+ 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", "persiststate", "capturesession", "namedsessions", "diffsessions", "searchsessions", "composeworkflow", "savetemplate", "dryrun", "delay", "waitelement", "compute", "extractvars", "listruns", "condition", "branch"]);
78
78
  var allowedactions = /* @__PURE__ */ new Set([...sensitiveactions, ...interactionactions, ...readactions]);
79
79
 
80
80
  // workfloweditor.ts
@@ -392,6 +392,7 @@ var sessionsroot = document.querySelector("#sessions");
392
392
  var workflowsroot = document.querySelector("#workflows");
393
393
  var workfloweditorroot = document.querySelector("#workfloweditor");
394
394
  var triggersroot = document.querySelector("#triggers");
395
+ var agentprotocolroot = document.querySelector("#agentprotocol");
395
396
  var triggerview = { manual: void 0, history: void 0 };
396
397
  var sessionsview = { term: "", window: "all", diffselection: [], restorereview: void 0, importreview: void 0 };
397
398
  var workflowview = { review: void 0, selected: "" };
@@ -2874,6 +2875,7 @@ async function refresh() {
2874
2875
  renderworkflows(context);
2875
2876
  renderworkfloweditor(context);
2876
2877
  rendertriggers(context);
2878
+ renderagentprotocol(context);
2877
2879
  renderconsolediff();
2878
2880
  renderaudit(context.audit);
2879
2881
  rendercapabilities(context.capabilities);
@@ -4640,4 +4642,137 @@ function rendertriggers(context) {
4640
4642
  settings.append(retentionactions);
4641
4643
  triggersroot.append(settings);
4642
4644
  }
4645
+ function renderagentprotocol(context) {
4646
+ if (!agentprotocolroot) return;
4647
+ agentprotocolroot.replaceChildren();
4648
+ const mcp = context.mcp;
4649
+ if (!mcp) {
4650
+ const empty = document.createElement("p");
4651
+ empty.textContent = "The agent protocol state is unknown.";
4652
+ agentprotocolroot.append(empty);
4653
+ return;
4654
+ }
4655
+ const running = mcp.state === "running";
4656
+ const head = document.createElement("p");
4657
+ head.textContent = `Server ${mcp.state} \xB7 ${mcp.bind}:${mcp.port}${mcp.localhost ? " (localhost bind)" : " (remote bind behind the explicit review)"} \xB7 transports ${mcp.config.transports.join(" and ")} \xB7 ${mcp.catalog.tools.length} tools \xB7 ${mcp.clients.length} connected client${mcp.clients.length === 1 ? "" : "s"}.`;
4658
+ agentprotocolroot.append(head);
4659
+ const controls = document.createElement("div");
4660
+ controls.className = "actions";
4661
+ controls.append(button(running ? "Stop server" : "Start server", async () => {
4662
+ await request({ kind: running ? "mcpserverstop" : "mcpserverstart" });
4663
+ status(running ? "The mcp server stopped; no tool call passes the gates." : "The mcp server started on the localhost bind; every client waits for the pairing approval.");
4664
+ await refresh();
4665
+ }));
4666
+ const bindinput = document.createElement("input");
4667
+ bindinput.placeholder = "bind address (empty keeps localhost)";
4668
+ bindinput.value = mcp.config.bind ?? "";
4669
+ const portinput = document.createElement("input");
4670
+ portinput.placeholder = "port";
4671
+ portinput.value = String(mcp.config.port);
4672
+ controls.append(" ", bindinput, " ", portinput, " ", button("Save config", async () => {
4673
+ await request({ kind: "mcpserverconfig", bind: bindinput.value, port: Number(portinput.value), ...bindinput.value.trim() !== "" && bindinput.value.trim() !== "127.0.0.1" && bindinput.value.trim() !== "localhost" && bindinput.value.trim() !== "::1" ? { remote: true } : {} });
4674
+ status(`Saved the mcp server config for ${bindinput.value.trim() === "" ? "127.0.0.1" : bindinput.value.trim()}:${portinput.value}.`);
4675
+ await refresh();
4676
+ }));
4677
+ agentprotocolroot.append(controls);
4678
+ if (mcp.bridge !== void 0) {
4679
+ const bridge = document.createElement("p");
4680
+ bridge.textContent = `Stdio bridge ${mcp.bridge.connected ? "connected" : "disconnected"} on the ${mcp.bridge.host} host \xB7 ${mcp.bridge.restarts} restart${mcp.bridge.restarts === 1 ? "" : "s"} \xB7 ${mcp.bridge.received} inbound and ${mcp.bridge.sent} outbound frame${mcp.bridge.sent === 1 ? "" : "s"}${mcp.launches.length > 0 ? ` \xB7 last launch pid ${mcp.launches[0]?.pid ?? "unknown"}` : " \xB7 no host launch reported yet"}.`;
4681
+ agentprotocolroot.append(bridge);
4682
+ const bridgeactions = document.createElement("div");
4683
+ bridgeactions.className = "actions";
4684
+ bridgeactions.append(button("Restart bridge", async () => {
4685
+ await request({ kind: "mcpbridge", action: "restart" });
4686
+ status("The stdio bridge restart ran; the browser exposes the native messaging host only under a native messaging permission.");
4687
+ await refresh();
4688
+ }));
4689
+ agentprotocolroot.append(bridgeactions);
4690
+ }
4691
+ const clientsbox = document.createElement("details");
4692
+ clientsbox.className = "sessiongroup";
4693
+ clientsbox.open = true;
4694
+ const clientsummary = document.createElement("summary");
4695
+ clientsummary.textContent = `Connected clients (${mcp.clients.length})`;
4696
+ clientsbox.append(clientsummary);
4697
+ for (const client of mcp.clients) {
4698
+ const row = document.createElement("div");
4699
+ row.className = "sessionrow";
4700
+ const headline = document.createElement("p");
4701
+ const badge = document.createElement("span");
4702
+ badge.className = "sessionbadge";
4703
+ badge.dataset.restored = "false";
4704
+ badge.textContent = client.paired ? "paired" : "waiting for approval";
4705
+ headline.append(`${client.id} \xB7 ${client.transport}${client.capabilities !== void 0 ? ` \xB7 protocol ${client.capabilities.protocolversion} \xB7 tool floor ${client.capabilities.toolversion} \xB7 ${client.capabilities.tools} tools` : " \xB7 not negotiated yet"}`, badge);
4706
+ row.append(headline);
4707
+ const actions = document.createElement("div");
4708
+ actions.className = "actions";
4709
+ if (!client.paired) {
4710
+ actions.append(button("Approve pairing", async () => {
4711
+ await request({ kind: "mcpclientdecision", clientid: client.id, approved: true });
4712
+ status(`Approved the pairing of the client ${client.id}; its tool calls now pass the same consent gates.`);
4713
+ await refresh();
4714
+ }));
4715
+ actions.append(" ", button("Refuse pairing", async () => {
4716
+ await request({ kind: "mcpclientdecision", clientid: client.id, approved: false });
4717
+ status(`Refused and disconnected the client ${client.id}.`);
4718
+ await refresh();
4719
+ }));
4720
+ }
4721
+ actions.append(button("Disconnect", async () => {
4722
+ await request({ kind: "mcpclientdisconnect", clientid: client.id });
4723
+ status(`Disconnected the client ${client.id}; its record stays for the audit trail.`);
4724
+ await refresh();
4725
+ }));
4726
+ row.append(actions);
4727
+ clientsbox.append(row);
4728
+ }
4729
+ if (mcp.clients.length === 0) {
4730
+ const empty = document.createElement("p");
4731
+ empty.textContent = "No connected client yet; a paired client speaks json rpc frames over the stdio bridge or an http post envelope.";
4732
+ clientsbox.append(empty);
4733
+ }
4734
+ agentprotocolroot.append(clientsbox);
4735
+ const catalogbox = document.createElement("details");
4736
+ catalogbox.className = "sessiongroup";
4737
+ const catalogsummary = document.createElement("summary");
4738
+ catalogsummary.textContent = `Tool catalog (${mcp.catalog.tools.length} tools by namespace)`;
4739
+ catalogbox.append(catalogsummary);
4740
+ const bynamespace = /* @__PURE__ */ new Map();
4741
+ for (const tool of mcp.catalog.tools) {
4742
+ const namespace = tool.name.split(".")[0] ?? "browser";
4743
+ const group = bynamespace.get(namespace) ?? [];
4744
+ group.push(tool);
4745
+ bynamespace.set(namespace, group);
4746
+ }
4747
+ for (const [namespace, tools] of bynamespace) {
4748
+ const domain = document.createElement("details");
4749
+ domain.className = "sessiongroup";
4750
+ const domainsummary = document.createElement("summary");
4751
+ domainsummary.textContent = `${namespace} (${tools.length} tools)`;
4752
+ domain.append(domainsummary);
4753
+ for (const tool of tools) {
4754
+ const line = document.createElement("p");
4755
+ line.textContent = `${tool.name} v${tool.version} \xB7 ${tool.risk} \xB7 ${tool.description.split(".")[0] ?? tool.description}${tool.consentmeta !== void 0 ? ` \xB7 review: ${tool.consentmeta}` : ""}`;
4756
+ domain.append(line);
4757
+ }
4758
+ catalogbox.append(domain);
4759
+ }
4760
+ agentprotocolroot.append(catalogbox);
4761
+ const callsbox = document.createElement("details");
4762
+ callsbox.className = "sessiongroup";
4763
+ const callssummary = document.createElement("summary");
4764
+ callssummary.textContent = `Recent tool calls (${mcp.calls.length})`;
4765
+ callsbox.append(callssummary);
4766
+ for (const call of mcp.calls.slice(0, 25)) {
4767
+ const line = document.createElement("p");
4768
+ line.textContent = `${new Date(call.at).toISOString()} \xB7 ${call.clientid} \xB7 ${call.tool} \xB7 ${call.origin} \xB7 ${call.ok ? "ran behind the gates" : `refused${call.code !== void 0 ? ` (${call.code})` : ""}`}`;
4769
+ callsbox.append(line);
4770
+ }
4771
+ if (mcp.calls.length === 0) {
4772
+ const empty = document.createElement("p");
4773
+ empty.textContent = "No tool call yet; every call records the client, tool and outcome without payloads.";
4774
+ callsbox.append(empty);
4775
+ }
4776
+ agentprotocolroot.append(callsbox);
4777
+ }
4643
4778
  //# sourceMappingURL=sidepanel.js.map