@wenathlan/extension 1.1.38 → 1.1.39

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
- 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"]);
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"]);
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"]);
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"]);
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"]);
5
5
  var allowedactions = /* @__PURE__ */ new Set([...sensitiveactions, ...interactionactions, ...readactions]);
6
6
 
7
7
  // extension/tabscommand.ts
@@ -62,6 +62,7 @@ var navigationroot = document.querySelector("#navigation");
62
62
  var tabswindowsroot = document.querySelector("#tabswindows");
63
63
  var formsroot = document.querySelector("#forms");
64
64
  var datasetsroot = document.querySelector("#datasets");
65
+ var filesroot = document.querySelector("#files");
65
66
  var statusnode = document.querySelector("#status");
66
67
  var progressnode = document.querySelector("#planprogress");
67
68
  var capabilitiestext = document.querySelector("#capabilitiestext");
@@ -1135,6 +1136,171 @@ function renderdatasets(context) {
1135
1136
  datasetsroot.append(importer);
1136
1137
  }
1137
1138
  }
1139
+ function renderfiles(context) {
1140
+ if (!filesroot) return;
1141
+ filesroot.replaceChildren();
1142
+ const active = context.session && !context.session.stoppedat && context.session.expiresat > Date.now();
1143
+ const downloads = context.downloads ?? [];
1144
+ if (downloads.length > 0) {
1145
+ const card = document.createElement("div");
1146
+ card.className = "panel";
1147
+ const head = document.createElement("p");
1148
+ const states = ["queued", "running", "paused", "complete", "failed"];
1149
+ head.textContent = `batch download queue: ${downloads.length} file${downloads.length === 1 ? "" : "s"} (${states.map((state) => `${downloads.filter((item) => item.state === state).length} ${state}`).filter((part) => !part.startsWith("0 ")).join(" \xB7 ") || "none"})`;
1150
+ card.append(head);
1151
+ const list = document.createElement("ul");
1152
+ for (const record of downloads.slice(0, 6)) {
1153
+ const item = document.createElement("li");
1154
+ item.textContent = `${record.filename} \xB7 ${record.state}${record.bytes !== void 0 ? ` \xB7 ${record.bytes} bytes` : ""}${record.checksum !== void 0 ? ` \xB7 checksum ${record.checksum}` : ""}${record.path !== void 0 ? ` \xB7 ${record.path}` : ""}`;
1155
+ if (active) {
1156
+ item.append(" ", button("Pause", () => request({ kind: "downloadaction", id: record.id, action: "pause" }).then(() => refresh()).then(() => status(`Paused the download of ${record.filename}.`)), record.state !== "running"));
1157
+ item.append(" ", button("Resume", () => request({ kind: "downloadaction", id: record.id, action: "resume" }).then(() => refresh()).then(() => status(`Resumed the download of ${record.filename}.`)), record.state !== "paused"));
1158
+ item.append(" ", button("Verify", () => request({ kind: "downloadaction", id: record.id, action: "verify" }).then((value) => {
1159
+ const output = value;
1160
+ status(output.summary);
1161
+ return refresh();
1162
+ })));
1163
+ }
1164
+ list.append(item);
1165
+ }
1166
+ card.append(list);
1167
+ filesroot.append(card);
1168
+ }
1169
+ const filters = context.mimefilters ?? [];
1170
+ if (filters.length > 0) {
1171
+ const filter = filters[0];
1172
+ const card = document.createElement("p");
1173
+ card.textContent = `mime interception: include ${filter.include.join(", ")} \xB7 exclude ${filter.exclude.join(", ") || "none"} \xB7 ${filter.default} default for unlisted mime types${context.session?.origin ? ` \xB7 armed inside the ${context.session.origin} origin grants` : ""}`;
1174
+ filesroot.append(card);
1175
+ }
1176
+ const consents = (context.clipconsents ?? []).filter((record) => record.approved === void 0);
1177
+ for (const consent of consents.slice(0, 4)) {
1178
+ const card = document.createElement("div");
1179
+ card.className = "bannercard";
1180
+ card.textContent = `Clipboard read consent ${consent.id} waits for your approval: step ${consent.stepid} on ${consent.origin} asked to read the clipboard \u2014 "${consent.prompt}".`;
1181
+ if (active) {
1182
+ card.append(" ", button("Approve read", async () => {
1183
+ await request({ kind: "approveclipconsent", id: consent.id, approved: true });
1184
+ status(`Clipboard read consent ${consent.id} approved; run the step again to read once.`);
1185
+ await refresh();
1186
+ }));
1187
+ card.append(" ", button("Decline", async () => {
1188
+ await request({ kind: "approveclipconsent", id: consent.id, approved: false });
1189
+ status(`Clipboard read consent ${consent.id} declined.`);
1190
+ await refresh();
1191
+ }));
1192
+ }
1193
+ filesroot.append(card);
1194
+ }
1195
+ const netlogs = context.netlogs ?? [];
1196
+ if (netlogs.length > 0) {
1197
+ const card = document.createElement("div");
1198
+ card.className = "panel";
1199
+ const head = document.createElement("p");
1200
+ const steps = [...new Set(netlogs.map((record) => record.stepid))];
1201
+ head.textContent = `network log: ${netlogs.length} record${netlogs.length === 1 ? "" : "s"} correlated with ${steps.length} step${steps.length === 1 ? "" : "s"} (${steps.slice(0, 4).join(", ")}${steps.length > 4 ? "\u2026" : ""})`;
1202
+ card.append(head);
1203
+ const list = document.createElement("ul");
1204
+ for (const record of netlogs.slice(0, 6)) {
1205
+ const item = document.createElement("li");
1206
+ item.textContent = `${record.method} ${record.url} \xB7 ${record.status} \xB7 ${record.timing}ms \xB7 request ${record.requestid ?? "?"} \xB7 step ${record.stepid}`;
1207
+ list.append(item);
1208
+ }
1209
+ card.append(list);
1210
+ if (active) card.append(button("Export netlog (header values redacted)", async () => {
1211
+ const exported = await request({ kind: "exportnetlog" });
1212
+ status(`Exported ${exported.records.length} netlog records; ${exported.redaction}.`);
1213
+ }));
1214
+ filesroot.append(card);
1215
+ }
1216
+ const quarantines = context.quarantines ?? [];
1217
+ if (quarantines.length > 0) {
1218
+ const card = document.createElement("div");
1219
+ card.className = "panel";
1220
+ const head = document.createElement("p");
1221
+ head.textContent = `quarantine: ${quarantines.length} file${quarantines.length === 1 ? "" : "s"} outside the downloads folder (${quarantines.filter((entry) => entry.scan === "pending").length} awaiting scan verdicts)`;
1222
+ card.append(head);
1223
+ const list = document.createElement("ul");
1224
+ for (const entry of quarantines.slice(0, 6)) {
1225
+ const item = document.createElement("li");
1226
+ item.textContent = `${entry.path} \xB7 scan ${entry.scan}${entry.release !== void 0 ? ` \xB7 released under ${entry.release}` : ""} \xB7 ${entry.reason}`;
1227
+ if (active && entry.release === void 0 && entry.scan === "clean") item.append(" ", button("Release", async () => {
1228
+ await request({ kind: "releasequarantine", id: entry.id });
1229
+ status(`Released ${entry.path} from quarantine under the clean scan verdict.`);
1230
+ await refresh();
1231
+ }));
1232
+ list.append(item);
1233
+ }
1234
+ card.append(list);
1235
+ filesroot.append(card);
1236
+ }
1237
+ const planid = context.plan?.id;
1238
+ const counters = (context.capturecounters ?? []).find((item) => item.taskid === planid);
1239
+ if (counters) {
1240
+ const card = document.createElement("p");
1241
+ card.textContent = `capture naming for task ${counters.taskid}: ${Object.entries(counters.counters).map(([step, sequence]) => `${step} \u2192 ${counters.taskid}-${step}-${sequence}`).join(" \xB7 ")}`;
1242
+ filesroot.append(card);
1243
+ }
1244
+ const rules = context.cleanuprules ?? [];
1245
+ const rulecard = document.createElement("div");
1246
+ rulecard.className = "panel";
1247
+ const rulehead = document.createElement("p");
1248
+ rulehead.textContent = `cleanup policy: ${rules.length > 0 ? rules.map((rule) => `older than ${rule.age}ms of kind ${rule.kind} keep ${rule.keep}`).join(" \xB7 ") : "no rule set stored yet"}`;
1249
+ rulecard.append(rulehead);
1250
+ const runs = context.cleanupruns ?? [];
1251
+ if (runs.length > 0) {
1252
+ const lastrun = runs[0];
1253
+ const runline = document.createElement("p");
1254
+ runline.textContent = `last sweep: removed ${lastrun.removed}, kept ${lastrun.kept} under ${lastrun.rules} rule${lastrun.rules === 1 ? "" : "s"}`;
1255
+ rulecard.append(runline);
1256
+ }
1257
+ if (active) {
1258
+ const ageinput = document.createElement("input");
1259
+ ageinput.placeholder = "age window in ms";
1260
+ const kindinput = document.createElement("input");
1261
+ kindinput.placeholder = "artifact kind (any matches all)";
1262
+ const keepinput = document.createElement("input");
1263
+ keepinput.placeholder = "keep policy: none, latest or all";
1264
+ rulecard.append(ageinput, kindinput, keepinput, " ", button("Add cleanup rule", async () => {
1265
+ const age = Number(ageinput.value);
1266
+ const rule = { age, kind: kindinput.value.trim() || "any", keep: keepinput.value.trim() || "none" };
1267
+ const stored = await request({ kind: "setcleanuprules", rules: [...rules, rule] });
1268
+ status(`Stored ${stored.rules} reviewed cleanup rule${stored.rules === 1 ? "" : "s"}; ages stay your choice with no code ceiling.`);
1269
+ await refresh();
1270
+ }));
1271
+ }
1272
+ filesroot.append(rulecard);
1273
+ const inventory = context.inventory ?? [];
1274
+ if (inventory.length > 0) {
1275
+ const card = document.createElement("p");
1276
+ card.textContent = `artifact inventory: ${inventory.slice(0, 5).map((entry) => `${entry.name} (${entry.kind}, ${entry.size} characters, ${Math.max(0, Math.round((Date.now() - entry.at) / 6e4))} minute${Math.round((Date.now() - entry.at) / 6e4) === 1 ? "" : "s"} old)`).join(" \xB7 ")}${inventory.length > 5 ? ` and ${inventory.length - 5} more` : ""}`;
1277
+ filesroot.append(card);
1278
+ }
1279
+ const screens = (context.clips ?? []).filter((entry) => entry.kind === "screen").slice(0, 2);
1280
+ for (const screen of screens) {
1281
+ const card = document.createElement("p");
1282
+ card.textContent = `copyscreen result: ${screen.length} characters of png data with payload hash ${screen.hash} routed to the clipboard destination.`;
1283
+ filesroot.append(card);
1284
+ }
1285
+ const hooks = context.scanhooks ?? [];
1286
+ if (active) {
1287
+ const hookcard = document.createElement("div");
1288
+ hookcard.className = "panel";
1289
+ const hookhead = document.createElement("p");
1290
+ hookhead.textContent = hooks.length > 0 ? `scan hooks: ${hooks.map((hook) => `${hook.scanner} at ${hook.origin} ${hook.granted ? "granted" : "not granted"}`).join(" \xB7 ")}` : "scan hooks: none configured; scan verdicts stay pending without one.";
1291
+ hookcard.append(hookhead);
1292
+ const scannerinput = document.createElement("input");
1293
+ scannerinput.placeholder = "scanner name";
1294
+ const endpointinput = document.createElement("input");
1295
+ endpointinput.placeholder = "https://scanner.example/verdict";
1296
+ hookcard.append(scannerinput, endpointinput, " ", button("Configure scan hook", async () => {
1297
+ await request({ kind: "configurescanhook", scanner: scannerinput.value, endpoint: endpointinput.value });
1298
+ status(`Scan hook ${scannerinput.value} configured; hook failures stay pending verdicts.`);
1299
+ await refresh();
1300
+ }));
1301
+ filesroot.append(hookcard);
1302
+ }
1303
+ }
1138
1304
  function rendercapabilities(report) {
1139
1305
  if (!capabilitiestext) return;
1140
1306
  if (!report) {
@@ -1183,6 +1349,7 @@ async function refresh() {
1183
1349
  rendertabswindows(context);
1184
1350
  renderforms(context);
1185
1351
  renderdatasets(context);
1352
+ renderfiles(context);
1186
1353
  renderaudit(context.audit);
1187
1354
  rendercapabilities(context.capabilities);
1188
1355
  if (context.session?.pausedat) status("Session paused. Reviewed actions are blocked until resume.");