@wenathlan/extension 1.1.50 → 1.1.51

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,7 +1,7 @@
1
1
  // policy.ts
2
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"]);
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
 
7
7
  // extension/tabscommand.ts
@@ -2918,6 +2918,90 @@ function renderrestorereview(record) {
2918
2918
  }));
2919
2919
  sessionsroot.append(review);
2920
2920
  }
2921
+ function controlreviewtext(control) {
2922
+ if (control === void 0) return "";
2923
+ if (control.kind === "condition") return ` \xB7 condition ${control.expression ?? "expression"}`;
2924
+ if (control.kind === "branch") return ` \xB7 paths ${(control.paths ?? []).join(", ")} \xB7 else ${control.elsepath ?? "else"} when no path matches`;
2925
+ if (control.kind === "loop") return ` \xB7 loops ${control.list ?? "list"} binding ${control.item ?? "item"} and ${control.index ?? "index"} per iteration \xB7 safety bound ${control.bound ?? 1e3}`;
2926
+ if (control.kind === "repeatuntil") return ` \xB7 repeats until convergence \xB7 safety bound ${control.bound ?? 1e3}`;
2927
+ if (control.kind === "whileloop") return ` \xB7 while the condition holds \xB7 safety bound ${control.bound ?? "reviewed"}`;
2928
+ if (control.kind === "foreach") return ` \xB7 foreach ${control.selector ?? "selector"} binding ${control.item ?? "item"} and ${control.index ?? "index"} per element`;
2929
+ if (control.kind === "parallel") return ` \xB7 branches ${(control.branches ?? []).join(", ")} \xB7 join ${control.strategy ?? "last"} \xB7 on failure ${control.onfail ?? "continue"}`;
2930
+ return ` \xB7 try with catch${control.rerun === true ? " and rerun" : ""}${control.attempts !== void 0 ? ` \xB7 ${control.attempts} attempt${control.attempts === 1 ? "" : "s"} of ${control.backoff ?? "fixed"} backoff` : ""}${control.stepms !== void 0 ? ` \xB7 step budget ${control.stepms} ms` : ""}${control.runms !== void 0 ? ` \xB7 run budget ${control.runms} ms` : ""}`;
2931
+ }
2932
+ function rendercontroldecision(entry) {
2933
+ const block = document.createElement("details");
2934
+ block.className = "sessiongroup";
2935
+ const control = entry.details?.control;
2936
+ const summary = document.createElement("summary");
2937
+ summary.textContent = `control flow \xB7 ${control?.kind ?? "decision"} \xB7 ${entry.summary}`;
2938
+ block.append(summary);
2939
+ if (control?.branch !== void 0) {
2940
+ const line = document.createElement("p");
2941
+ line.textContent = `Chose the path ${control.branch.path}: ${control.branch.reason}`;
2942
+ line.dataset.class = "added";
2943
+ line.dataset.branch = control.branch.path;
2944
+ block.append(line);
2945
+ }
2946
+ if (control?.loops !== void 0 && control.loops.length > 0) {
2947
+ const group = document.createElement("details");
2948
+ group.className = "sessiongroup";
2949
+ const groupsummary = document.createElement("summary");
2950
+ groupsummary.textContent = `Loop iterations (${control.loops.length})`;
2951
+ group.append(groupsummary);
2952
+ for (const counter of control.loops) {
2953
+ const line = document.createElement("p");
2954
+ line.textContent = `${counter.path} \xB7 ${counter.ok ? "completed" : "failed"}`;
2955
+ line.dataset.class = counter.ok ? "added" : "changed";
2956
+ group.append(line);
2957
+ }
2958
+ block.append(group);
2959
+ }
2960
+ if (control?.retries !== void 0 && control.retries.length > 0) {
2961
+ for (const attempt of control.retries) {
2962
+ const line = document.createElement("p");
2963
+ line.textContent = `Retry attempt ${attempt.attempt} after a ${attempt.delay} ms backoff countdown for the ${attempt.errorclass} error class.`;
2964
+ line.dataset.class = "changed";
2965
+ block.append(line);
2966
+ }
2967
+ }
2968
+ if (control?.timeouts !== void 0 && control.timeouts.length > 0) {
2969
+ for (const abort of control.timeouts) {
2970
+ const line = document.createElement("p");
2971
+ line.textContent = `Timeout abort: the ${abort.scope} exceeded its reviewed budget of ${abort.budget} milliseconds.`;
2972
+ line.dataset.class = "changed";
2973
+ line.dataset.timeout = "true";
2974
+ block.append(line);
2975
+ }
2976
+ }
2977
+ if (control?.branches !== void 0 && control.branches.length > 0) {
2978
+ const lanes = document.createElement("details");
2979
+ lanes.className = "sessiongroup";
2980
+ const lannessummary = document.createElement("summary");
2981
+ lannessummary.textContent = `Parallel branch lanes (${control.branches.length})`;
2982
+ lanes.append(lannessummary);
2983
+ for (const outcome of control.branches) {
2984
+ const lane = document.createElement("p");
2985
+ lane.textContent = `lane ${outcome.branchid} \xB7 ${outcome.cancelled === true ? "cancelled" : outcome.ok ? "completed" : "failed"} \xB7 ${outcome.summary}`;
2986
+ lane.dataset.class = outcome.ok && outcome.cancelled !== true ? "added" : "changed";
2987
+ lanes.append(lane);
2988
+ }
2989
+ block.append(lanes);
2990
+ }
2991
+ if (control?.join !== void 0) {
2992
+ const line = document.createElement("p");
2993
+ line.textContent = `Join under the ${control.join.strategy} strategy merged ${control.join.merged.join(", ") || "no variable"}${control.join.conflicts.length > 0 ? ` with the conflicts ${control.join.conflicts.join(", ")}` : " with no conflict"}.`;
2994
+ line.dataset.class = control.join.conflicts.length > 0 ? "changed" : "added";
2995
+ block.append(line);
2996
+ }
2997
+ if (control?.catch !== void 0) {
2998
+ const line = document.createElement("p");
2999
+ line.textContent = `The catch handler ran after the ${control.catch.errorclass} failure${control.catch.rerun ? " and reran the fragile body" : ""}.`;
3000
+ line.dataset.class = "changed";
3001
+ block.append(line);
3002
+ }
3003
+ return block;
3004
+ }
2921
3005
  function renderworkflows(context) {
2922
3006
  if (!workflowsroot) return;
2923
3007
  workflowsroot.replaceChildren();
@@ -2995,8 +3079,30 @@ function renderworkflows(context) {
2995
3079
  const list = document.createElement("ol");
2996
3080
  for (const step of workflowview.review.steps) {
2997
3081
  const line = document.createElement("li");
2998
- line.textContent = `${step.label} (${step.kind}${step.block !== void 0 ? ` \xB7 block ${step.block}` : ""}${step.target !== void 0 ? ` \xB7 ${step.target}` : ""}${step.expression !== void 0 ? ` \xB7 expression ${step.expression.operator} into ${step.expression.result}` : ""}${step.extract !== void 0 && step.extract.groups.length > 0 ? ` \xB7 extracts ${step.extract.groups.join(", ")}` : ""}${Array.isArray(step.bindings) && step.bindings.length > 0 ? ` \xB7 ${step.bindings.length} binding${step.bindings.length === 1 ? "" : "s"}` : ""}`;
3082
+ line.textContent = `${step.label} (${step.kind}${step.block !== void 0 ? ` \xB7 block ${step.block}` : ""}${step.target !== void 0 ? ` \xB7 ${step.target}` : ""}${step.expression !== void 0 ? ` \xB7 expression ${step.expression.operator} into ${step.expression.result}` : ""}${step.extract !== void 0 && step.extract.groups.length > 0 ? ` \xB7 extracts ${step.extract.groups.join(", ")}` : ""}${Array.isArray(step.bindings) && step.bindings.length > 0 ? ` \xB7 ${step.bindings.length} binding${step.bindings.length === 1 ? "" : "s"}` : ""}${controlreviewtext(step.control)}`;
2999
3083
  list.append(line);
3084
+ if (step.control !== void 0 && (step.control.kind === "loop" || step.control.kind === "repeatuntil")) {
3085
+ const boundrow = document.createElement("div");
3086
+ boundrow.className = "actions";
3087
+ const boundlabel = document.createElement("label");
3088
+ boundlabel.textContent = `Safety bound of ${step.label}: `;
3089
+ const boundinput = document.createElement("input");
3090
+ boundinput.type = "number";
3091
+ boundinput.min = "1";
3092
+ boundinput.value = String(step.control.bound ?? 1e3);
3093
+ boundlabel.append(boundinput);
3094
+ boundrow.append(boundlabel, " ", button("Apply bound before a run", async () => {
3095
+ const bound = Number(boundinput.value);
3096
+ if (!Number.isInteger(bound) || bound < 1) {
3097
+ status("The loop safety bound must be a positive integer with no code ceiling.", true);
3098
+ return;
3099
+ }
3100
+ const result = await request({ kind: "setloopbound", workflowid: workflowview.review?.workflowid, stepid: step.id, bound });
3101
+ status(`Loop bound applied: the workflow was recomposed as version ${result.version} and the older version survives for the audit trail.`);
3102
+ await refresh();
3103
+ }));
3104
+ list.append(boundrow);
3105
+ }
3000
3106
  }
3001
3107
  review.append(list);
3002
3108
  review.append(button("Close workflow review", async () => {
@@ -3059,6 +3165,7 @@ function renderworkflows(context) {
3059
3165
  line.textContent = `${entry.state} \xB7 ${entry.label} \xB7 ${entry.duration} ms${entry.produced !== void 0 && entry.produced.length > 0 ? ` \xB7 produced ${entry.produced.join(", ")}` : ""}${entry.consumed !== void 0 && entry.consumed.length > 0 ? ` \xB7 consumed ${entry.consumed.join(", ")}` : ""} \xB7 ${entry.summary}`;
3060
3166
  line.dataset.class = entry.state === "failed" || entry.state === "refused" ? "changed" : "added";
3061
3167
  runlog.append(line);
3168
+ if (entry.details !== void 0 && entry.details.control !== void 0) runlog.append(rendercontroldecision(entry));
3062
3169
  }
3063
3170
  timeline.append(runlog);
3064
3171
  workflowsroot.append(timeline);