@wenathlan/extension 1.1.51 → 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 +6 -5
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +657 -3
- package/dist/index.js.map +4 -4
- package/dist/memory.d.ts +38 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/policy.d.ts +13 -0
- package/dist/policy.d.ts.map +1 -1
- package/dist/protocol.d.ts +62 -1
- 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 +98 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/extension/dist/background.js +1068 -5
- package/extension/dist/background.js.map +4 -4
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/pagebridge.js +1 -1
- package/extension/dist/pagebridge.js.map +2 -2
- package/extension/dist/popup.html +1 -1
- package/extension/dist/popup.js +24 -1
- package/extension/dist/popup.js.map +2 -2
- package/extension/dist/sidepanel.html +1 -1
- package/extension/dist/sidepanel.js +159 -1
- 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 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>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>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>
|
|
5
5
|
</html>
|
|
@@ -1,5 +1,5 @@
|
|
|
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"]);
|
|
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
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
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]);
|
|
@@ -75,6 +75,8 @@ var emulationroot = document.querySelector("#emulation");
|
|
|
75
75
|
var netviewroot = document.querySelector("#netview");
|
|
76
76
|
var sessionsroot = document.querySelector("#sessions");
|
|
77
77
|
var workflowsroot = document.querySelector("#workflows");
|
|
78
|
+
var triggersroot = document.querySelector("#triggers");
|
|
79
|
+
var triggerview = { manual: void 0, history: void 0 };
|
|
78
80
|
var sessionsview = { term: "", window: "all", diffselection: [], restorereview: void 0, importreview: void 0 };
|
|
79
81
|
var workflowview = { review: void 0, selected: "" };
|
|
80
82
|
var statusnode = document.querySelector("#status");
|
|
@@ -2539,6 +2541,7 @@ async function refresh() {
|
|
|
2539
2541
|
renderemulation(context);
|
|
2540
2542
|
rendersessions(context);
|
|
2541
2543
|
renderworkflows(context);
|
|
2544
|
+
rendertriggers(context);
|
|
2542
2545
|
renderconsolediff();
|
|
2543
2546
|
renderaudit(context.audit);
|
|
2544
2547
|
rendercapabilities(context.capabilities);
|
|
@@ -3199,4 +3202,159 @@ function renderworkflows(context) {
|
|
|
3199
3202
|
}
|
|
3200
3203
|
}
|
|
3201
3204
|
}
|
|
3205
|
+
function rendertriggers(context) {
|
|
3206
|
+
if (!triggersroot) return;
|
|
3207
|
+
triggersroot.replaceChildren();
|
|
3208
|
+
const rules = context.trigger?.rules ?? [];
|
|
3209
|
+
const queued = context.trigger?.queued ?? 0;
|
|
3210
|
+
const workflows = context.workflow?.workflows ?? [];
|
|
3211
|
+
const title = document.createElement("p");
|
|
3212
|
+
title.textContent = `${rules.length} armed rule${rules.length === 1 ? "" : "s"} across ${new Set(rules.map((rule) => rule.workflowid)).size} workflow${new Set(rules.map((rule) => rule.workflowid)).size === 1 ? "" : "s"} \xB7 ${queued} queued fire${queued === 1 ? "" : "s"}${context.session?.pausedat !== void 0 ? " held while the session is paused" : ""}.`;
|
|
3213
|
+
triggersroot.append(title);
|
|
3214
|
+
const byworkflow = /* @__PURE__ */ new Map();
|
|
3215
|
+
for (const rule of rules) {
|
|
3216
|
+
const group = byworkflow.get(rule.workflowid) ?? [];
|
|
3217
|
+
group.push(rule);
|
|
3218
|
+
byworkflow.set(rule.workflowid, group);
|
|
3219
|
+
}
|
|
3220
|
+
for (const [workflowid, group] of byworkflow) {
|
|
3221
|
+
const workflowname = group[0]?.workflowname ?? workflowid;
|
|
3222
|
+
const box = document.createElement("details");
|
|
3223
|
+
box.className = "sessiongroup";
|
|
3224
|
+
box.open = true;
|
|
3225
|
+
const summary = document.createElement("summary");
|
|
3226
|
+
summary.textContent = `${workflowname} \xB7 ${group.length} rule${group.length === 1 ? "" : "s"}`;
|
|
3227
|
+
box.append(summary);
|
|
3228
|
+
for (const rule of group) {
|
|
3229
|
+
const row = document.createElement("div");
|
|
3230
|
+
row.className = "sessionrow";
|
|
3231
|
+
const headline = document.createElement("p");
|
|
3232
|
+
const badge = document.createElement("span");
|
|
3233
|
+
badge.className = "sessionbadge";
|
|
3234
|
+
badge.dataset.restored = "false";
|
|
3235
|
+
badge.textContent = rule.enabled ? rule.paused === true ? "paused" : "enabled" : "disabled";
|
|
3236
|
+
const match = rule.summary.pattern !== void 0 ? String(rule.summary.pattern) : rule.summary.origins !== void 0 ? rule.summary.origins.join(", ") : rule.summary.cron !== void 0 ? `${String(rule.summary.cron)}${rule.summary.timezone !== void 0 ? ` (${String(rule.summary.timezone)})` : ""}` : rule.summary.period !== void 0 ? `every ${String(rule.summary.period)} ms${rule.summary.jitter !== void 0 ? ` \xB1 ${String(rule.summary.jitter)} ms` : ""}` : rule.summary.title !== void 0 ? String(rule.summary.title) : rule.summary.command !== void 0 ? String(rule.summary.command) : rule.summary.events !== void 0 ? rule.summary.events.join(", ") : rule.kind === "urllist" ? `${rule.summary.urls?.length ?? 0} urls` : rule.kind === "webhook" ? `webhook with ${String(rule.summary.fields ?? 0)} schema fields` : "toolbar button";
|
|
3237
|
+
headline.append(`${rule.label} \xB7 ${rule.kind} \xB7 ${match} \xB7 cooldown ${rule.cooldown} ms \xB7 ${rule.fires} fire${rule.fires === 1 ? "" : "s"}, ${rule.launches} launch${rule.launches === 1 ? "" : "es"}, ${rule.suppressions} suppressed${rule.nextfireat !== void 0 ? ` \xB7 next fire ${new Date(rule.nextfireat).toISOString()}` : ""}`, badge);
|
|
3238
|
+
row.append(headline);
|
|
3239
|
+
const actions = document.createElement("div");
|
|
3240
|
+
actions.className = "actions";
|
|
3241
|
+
actions.append(button(rule.enabled ? "Disable" : "Enable", async () => {
|
|
3242
|
+
await request({ kind: "toggletrigger", ruleid: rule.id, enabled: !rule.enabled });
|
|
3243
|
+
status(`The ${rule.kind} rule is now ${rule.enabled ? "disabled" : "enabled"}.`);
|
|
3244
|
+
await refresh();
|
|
3245
|
+
}));
|
|
3246
|
+
actions.append(" ", button("Fire history", async () => {
|
|
3247
|
+
const result = await request({ kind: "triggerhistory", ruleid: rule.id });
|
|
3248
|
+
triggerview.history = result.fires;
|
|
3249
|
+
status(`Fire history: ${result.fires.length} fire record${result.fires.length === 1 ? "" : "s"} of the ${rule.kind} rule.`);
|
|
3250
|
+
await refresh();
|
|
3251
|
+
}));
|
|
3252
|
+
actions.append(" ", button("Fire manually", async () => {
|
|
3253
|
+
const result = await request({ kind: "firetrigger", ruleid: rule.id });
|
|
3254
|
+
status(result.fired ? `The ${rule.kind} rule fired${result.queued === true ? " and queued for the busy run" : ""}.` : `The ${rule.kind} rule suppressed the fire: ${result.suppressed ?? "review gate"}.`);
|
|
3255
|
+
await refresh();
|
|
3256
|
+
}));
|
|
3257
|
+
if (rule.kind === "webhook") actions.append(" ", button("Rotate secret", async () => {
|
|
3258
|
+
const result = await request({ kind: "rotatetriggersecret", ruleid: rule.id });
|
|
3259
|
+
status(`The webhook secret rotated to ${result.secret}; it was shown once and never leaves the store.`);
|
|
3260
|
+
await refresh();
|
|
3261
|
+
}));
|
|
3262
|
+
if (workflows.length > 1) actions.append(" ", button("Duplicate to second workflow", async () => {
|
|
3263
|
+
const target = workflows.find((record) => record.id !== rule.workflowid);
|
|
3264
|
+
if (!target) {
|
|
3265
|
+
status("No second composed workflow exists to duplicate the rule to.", true);
|
|
3266
|
+
return;
|
|
3267
|
+
}
|
|
3268
|
+
await request({ kind: "duplicatetrigger", ruleid: rule.id, workflowid: target.id });
|
|
3269
|
+
status(`Duplicated the ${rule.kind} rule to ${target.name}.`);
|
|
3270
|
+
await refresh();
|
|
3271
|
+
}));
|
|
3272
|
+
row.append(actions);
|
|
3273
|
+
box.append(row);
|
|
3274
|
+
}
|
|
3275
|
+
const workflowactions = document.createElement("div");
|
|
3276
|
+
workflowactions.className = "actions";
|
|
3277
|
+
workflowactions.append(button("Create visit rule from current page", async () => {
|
|
3278
|
+
await request({ kind: "createvisitrule", workflowid });
|
|
3279
|
+
status(`Armed a visit rule of the current page origin for ${workflowname}.`);
|
|
3280
|
+
await refresh();
|
|
3281
|
+
}));
|
|
3282
|
+
workflowactions.append(" ", button("Manual run preview", async () => {
|
|
3283
|
+
const result = await request({ kind: "manualrun", workflowid });
|
|
3284
|
+
triggerview.manual = { ...result.manualrun, at: Date.now() };
|
|
3285
|
+
status(`Manual run preview: ${result.manualrun.preview.length} steps of ${workflowname}; nothing runs before the confirmation.`);
|
|
3286
|
+
await refresh();
|
|
3287
|
+
}));
|
|
3288
|
+
box.append(workflowactions);
|
|
3289
|
+
triggersroot.append(box);
|
|
3290
|
+
}
|
|
3291
|
+
if (rules.length === 0) {
|
|
3292
|
+
const empty = document.createElement("p");
|
|
3293
|
+
empty.textContent = "No armed trigger rule yet; arm a reviewed rule of any family or create a visit rule from the current page.";
|
|
3294
|
+
triggersroot.append(empty);
|
|
3295
|
+
}
|
|
3296
|
+
if (triggerview.history !== void 0) {
|
|
3297
|
+
const history = document.createElement("details");
|
|
3298
|
+
history.className = "sessiongroup";
|
|
3299
|
+
const summary = document.createElement("summary");
|
|
3300
|
+
summary.textContent = `Fire history (${triggerview.history.length} records)`;
|
|
3301
|
+
history.append(summary);
|
|
3302
|
+
for (const fire of triggerview.history.slice(0, 25)) {
|
|
3303
|
+
const line = document.createElement("p");
|
|
3304
|
+
line.textContent = `${new Date(fire.at).toISOString()} \xB7 ${fire.cause}${fire.url !== void 0 ? ` \xB7 ${fire.url}` : ""}${fire.title !== void 0 ? ` \xB7 ${fire.title}` : ""}`;
|
|
3305
|
+
history.append(line);
|
|
3306
|
+
}
|
|
3307
|
+
triggersroot.append(history);
|
|
3308
|
+
}
|
|
3309
|
+
if (triggerview.manual !== void 0) {
|
|
3310
|
+
const preview = document.createElement("div");
|
|
3311
|
+
preview.className = "sessionrow";
|
|
3312
|
+
const headline = document.createElement("p");
|
|
3313
|
+
headline.textContent = `Manual run step preview: ${triggerview.manual.preview.length} expanded step${triggerview.manual.preview.length === 1 ? "" : "s"}; approve or cancel before anything runs.`;
|
|
3314
|
+
preview.append(headline);
|
|
3315
|
+
for (const step of triggerview.manual.preview) {
|
|
3316
|
+
const line = document.createElement("p");
|
|
3317
|
+
line.textContent = `${step.stepid} \xB7 ${step.kind} \xB7 ${step.label}${step.block !== void 0 ? ` \xB7 block ${step.block}` : ""}${step.control !== void 0 ? ` \xB7 ${Object.entries(step.control).map(([key, value]) => `${key}: ${Array.isArray(value) ? value.join(", ") : String(value)}`).join(" \xB7 ")}` : ""}`;
|
|
3318
|
+
preview.append(line);
|
|
3319
|
+
}
|
|
3320
|
+
const actions = document.createElement("div");
|
|
3321
|
+
actions.className = "actions";
|
|
3322
|
+
actions.append(button("Approve manual run", async () => {
|
|
3323
|
+
const result = await request({ kind: "confirmmanualrun", previewid: triggerview.manual?.id, confirmed: true });
|
|
3324
|
+
status(`Manual run approved and launched${result.runid !== void 0 ? ` as run ${result.runid}` : ""}; the run ended ${result.state ?? "running"}.`);
|
|
3325
|
+
triggerview.manual = void 0;
|
|
3326
|
+
await refresh();
|
|
3327
|
+
}));
|
|
3328
|
+
actions.append(" ", button("Cancel manual run", async () => {
|
|
3329
|
+
await request({ kind: "confirmmanualrun", previewid: triggerview.manual?.id, confirmed: false });
|
|
3330
|
+
status("Manual run cancelled after the step preview; nothing ran.");
|
|
3331
|
+
triggerview.manual = void 0;
|
|
3332
|
+
await refresh();
|
|
3333
|
+
}));
|
|
3334
|
+
preview.append(actions);
|
|
3335
|
+
triggersroot.append(preview);
|
|
3336
|
+
}
|
|
3337
|
+
const settings = document.createElement("details");
|
|
3338
|
+
settings.className = "sessiongroup";
|
|
3339
|
+
const settingsummary = document.createElement("summary");
|
|
3340
|
+
settingsummary.textContent = "Trigger settings";
|
|
3341
|
+
settings.append(settingsummary);
|
|
3342
|
+
const retention = document.createElement("p");
|
|
3343
|
+
retention.textContent = `Fire record retention: ${context.triggerretention === void 0 ? "keep every fire record" : `${context.triggerretention} record${context.triggerretention === 1 ? "" : "s"}`}; the rule counters always survive and no code ceiling applies.`;
|
|
3344
|
+
settings.append(retention);
|
|
3345
|
+
const retentionactions = document.createElement("div");
|
|
3346
|
+
retentionactions.className = "actions";
|
|
3347
|
+
retentionactions.append(button("Keep every fire record", async () => {
|
|
3348
|
+
await request({ kind: "settriggerretention" });
|
|
3349
|
+
status("Trigger fire retention keeps every record.");
|
|
3350
|
+
await refresh();
|
|
3351
|
+
}));
|
|
3352
|
+
retentionactions.append(" ", button("Keep last 100 fire records", async () => {
|
|
3353
|
+
await request({ kind: "settriggerretention", retention: 100 });
|
|
3354
|
+
status("Trigger fire retention keeps the last 100 records.");
|
|
3355
|
+
await refresh();
|
|
3356
|
+
}));
|
|
3357
|
+
settings.append(retentionactions);
|
|
3358
|
+
triggersroot.append(settings);
|
|
3359
|
+
}
|
|
3202
3360
|
//# sourceMappingURL=sidepanel.js.map
|