@wenathlan/extension 1.1.50 → 1.1.52
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 +7 -6
- package/dist/controlflow.d.ts +220 -0
- package/dist/controlflow.d.ts.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3698 -2221
- package/dist/index.js.map +4 -4
- package/dist/memory.d.ts +44 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/policy.d.ts +14 -1
- package/dist/policy.d.ts.map +1 -1
- package/dist/protocol.d.ts +83 -5
- package/dist/protocol.d.ts.map +1 -1
- package/dist/trigger.d.ts +151 -0
- package/dist/trigger.d.ts.map +1 -0
- package/dist/types.d.ts +250 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/workflow.d.ts +12 -3
- package/dist/workflow.d.ts.map +1 -1
- package/extension/dist/background.js +2029 -40
- package/extension/dist/background.js.map +4 -4
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/pagebridge.js +9 -4
- package/extension/dist/pagebridge.js.map +2 -2
- package/extension/dist/popup.html +1 -1
- package/extension/dist/popup.js +30 -6
- package/extension/dist/popup.js.map +2 -2
- package/extension/dist/sidepanel.html +1 -1
- package/extension/dist/sidepanel.js +269 -4
- package/extension/dist/sidepanel.js.map +2 -2
- 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</title><link rel="stylesheet" href="style.css"></head>
|
|
4
|
-
<body><main><header><p class="eyebrow">DEVTHINK 1.1.
|
|
4
|
+
<body><main><header><p class="eyebrow">DEVTHINK 1.1.52</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><p id="sessionstate" role="status" class="muted">Sessions: none saved yet.</p><p id="workflowstate" role="status" class="muted">Workflows: none running.</p><p id="triggerstate" role="status" class="muted">Triggers: none armed.</p><div id="workflowcontrols" class="actions"></div><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>
|
package/extension/dist/popup.js
CHANGED
|
@@ -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", "heapshot", "profilecpu", "capturesourcemaps", "emulatedevice", "emulatenetwork", "emulatelocate", "setuseragent", "overridepermission", "restoresession", "exportsessions", "importsessions", "runworkflow"]);
|
|
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", "measureflow", "trackmemory", "watchshifts", "traceload", "annotatetrace", "replaytrace", "blackboxscripts", "persiststate", "capturesession", "namedsessions", "diffsessions", "searchsessions", "composeworkflow", "savetemplate", "dryrun", "delay", "waitelement", "compute", "extractvars"]);
|
|
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", "restoresession", "exportsessions", "importsessions", "runworkflow", "visitrule", "urlrule", "menurule", "keyrule", "buttonrule", "cronrule", "intervalrule", "urllistrule", "webhookrule", "eventrule"]);
|
|
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", "loop", "repeatuntil", "whileloop", "foreach", "parallel", "trycatch"]);
|
|
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", "persiststate", "capturesession", "namedsessions", "diffsessions", "searchsessions", "composeworkflow", "savetemplate", "dryrun", "delay", "waitelement", "compute", "extractvars", "condition", "branch"]);
|
|
5
5
|
var allowedactions = /* @__PURE__ */ new Set([...sensitiveactions, ...interactionactions, ...readactions]);
|
|
6
6
|
function normalizeendpoint(value) {
|
|
7
7
|
const endpoint = new URL(value.trim());
|
|
@@ -35,6 +35,7 @@ var debugstatenode = document.querySelector("#debugstate");
|
|
|
35
35
|
var emulationstatenode = document.querySelector("#emulationstate");
|
|
36
36
|
var sessionstatenode = document.querySelector("#sessionstate");
|
|
37
37
|
var workflowstatenode = document.querySelector("#workflowstate");
|
|
38
|
+
var triggerstatenode = document.querySelector("#triggerstate");
|
|
38
39
|
var workflowcontrols = document.querySelector("#workflowcontrols");
|
|
39
40
|
var windowcontrols = document.querySelector("#windowcontrols");
|
|
40
41
|
var connectbutton = document.querySelector("#connect");
|
|
@@ -213,12 +214,13 @@ function rendersessionstate(memory, auto) {
|
|
|
213
214
|
if (interval !== void 0) sessionstatenode.dataset.auto = "active";
|
|
214
215
|
else delete sessionstatenode.dataset.auto;
|
|
215
216
|
}
|
|
216
|
-
function renderworkflowstate(runs) {
|
|
217
|
+
function renderworkflowstate(runs, control) {
|
|
217
218
|
if (!workflowstatenode) return;
|
|
218
219
|
const all = runs ?? [];
|
|
219
220
|
const running = all.filter((run) => run.state === "running");
|
|
220
221
|
const paused = all.filter((run) => run.state === "paused");
|
|
221
|
-
|
|
222
|
+
const iterations = (control ?? []).filter((decision) => decision.kind === "loop" && running.some((run) => run.id === decision.runid)).reduce((total, decision) => total + (decision.loops?.length ?? 0), 0);
|
|
223
|
+
workflowstatenode.textContent = `Workflows: ${running.length} running in the background${paused.length > 0 ? ` \xB7 ${paused.length} paused` : ""}${running.length > 0 && iterations > 0 ? ` \xB7 loop iteration ${iterations}` : ""}${all.length > 0 ? ` \xB7 latest ${all[0]?.state ?? ""}` : " \xB7 none composed yet"}.`;
|
|
222
224
|
if (running.length > 0) workflowstatenode.dataset.state = "active";
|
|
223
225
|
else delete workflowstatenode.dataset.state;
|
|
224
226
|
if (!workflowcontrols) return;
|
|
@@ -254,6 +256,16 @@ function renderworkflowstate(runs) {
|
|
|
254
256
|
workflowcontrols.append(controls);
|
|
255
257
|
}
|
|
256
258
|
}
|
|
259
|
+
function rendertriggerstate(rules, queued, paused, buttonfired) {
|
|
260
|
+
if (!triggerstatenode) return;
|
|
261
|
+
const armed = rules ?? [];
|
|
262
|
+
const enabled = armed.filter((rule) => rule.enabled && rule.paused !== true);
|
|
263
|
+
const scheduled = enabled.filter((rule) => rule.nextfireat !== void 0);
|
|
264
|
+
const buttons = enabled.filter((rule) => rule.kind === "button");
|
|
265
|
+
triggerstatenode.textContent = `Triggers: ${armed.length} armed rule${armed.length === 1 ? "" : "s"}${enabled.length !== armed.length ? ` \xB7 ${enabled.length} enabled` : ""}${scheduled.length > 0 ? ` \xB7 ${scheduled.length} scheduled` : ""}${(queued ?? 0) > 0 ? ` \xB7 ${queued} fire${queued === 1 ? "" : "s"} ${paused ? "held while the session is paused" : "queued"}` : ""}${buttons.length > 0 ? ` \xB7 toolbar button ${buttonfired ? "fired" : "ready"}` : ""}.`;
|
|
266
|
+
if (enabled.length > 0) triggerstatenode.dataset.state = "active";
|
|
267
|
+
else delete triggerstatenode.dataset.state;
|
|
268
|
+
}
|
|
257
269
|
async function restore() {
|
|
258
270
|
const context = await request({ kind: "context" });
|
|
259
271
|
if (endpointinput && context.config) endpointinput.value = context.config.endpoint;
|
|
@@ -272,7 +284,8 @@ async function restore() {
|
|
|
272
284
|
renderdebugstate(context.timeline, context.consoleconsents, context.debuggergrants, context.cdpattached, context.profileactive, context.profile?.consents);
|
|
273
285
|
renderemulationstate(context.emulatedlayers, context.emulation?.consents);
|
|
274
286
|
rendersessionstate(context.sessionmemory, context.autosnapshotstate);
|
|
275
|
-
renderworkflowstate(context.workflow?.runs);
|
|
287
|
+
renderworkflowstate(context.workflow?.runs, context.workflow?.control);
|
|
288
|
+
rendertriggerstate(context.trigger?.rules, context.trigger?.queued, context.session?.pausedat !== void 0, triggerbuttonfired);
|
|
276
289
|
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));
|
|
277
290
|
const active = context.session && !context.session.stoppedat && context.session.expiresat > Date.now();
|
|
278
291
|
if (pausebutton) {
|
|
@@ -282,6 +295,17 @@ async function restore() {
|
|
|
282
295
|
if (active && context.session?.pausedat) status("Session paused. Reviewed actions are blocked until resume.");
|
|
283
296
|
else status(active ? "Session active. Review the plan in the side panel." : "No active browser session.");
|
|
284
297
|
}
|
|
298
|
+
var triggerbuttonfired = false;
|
|
299
|
+
void (async () => {
|
|
300
|
+
try {
|
|
301
|
+
const result = await request({ kind: "buttontrigger" });
|
|
302
|
+
if (result.fired) {
|
|
303
|
+
triggerbuttonfired = true;
|
|
304
|
+
status("The toolbar button rule fired behind the consent gates.");
|
|
305
|
+
}
|
|
306
|
+
} catch {
|
|
307
|
+
}
|
|
308
|
+
})();
|
|
285
309
|
connectbutton?.addEventListener("click", async () => {
|
|
286
310
|
try {
|
|
287
311
|
const config = normalizeendpoint(endpointinput?.value ?? "");
|