@wenathlan/extension 1.1.34 → 1.1.36
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 -5
- package/dist/index.js +533 -5
- package/dist/index.js.map +2 -2
- package/dist/memory.d.ts +91 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/policy.d.ts +20 -1
- package/dist/policy.d.ts.map +1 -1
- package/dist/protocol.d.ts +37 -1
- package/dist/protocol.d.ts.map +1 -1
- package/dist/types.d.ts +271 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/extension/dist/background.js +2040 -17
- package/extension/dist/background.js.map +4 -4
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/pagebridge.js +331 -12
- package/extension/dist/pagebridge.js.map +4 -4
- package/extension/dist/popup.html +1 -1
- package/extension/dist/popup.js +33 -2
- package/extension/dist/popup.js.map +2 -2
- package/extension/dist/sidepanel.html +1 -1
- package/extension/dist/sidepanel.js +396 -8
- package/extension/dist/sidepanel.js.map +4 -4
- package/extension/manifest.json +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../sidepanel.ts"],
|
|
4
|
-
"sourcesContent": ["import type { a11ycapture, a11ynode, agentplan, auditevent, bannerreport, capabilityreport, clickablemap, derivedselector, diagnosticreport, focusevent, listpattern, mutationevent, planprogress, readercapture, resolvedtarget, retryoutcome, snapshotdiff, stepoutcome, tableshape, toolstep } from \"../types.js\";\n\nconst objective = document.querySelector<HTMLTextAreaElement>(\"#objective\");\nconst localbutton = document.querySelector<HTMLButtonElement>(\"#localplan\");\nconst remotebutton = document.querySelector<HTMLButtonElement>(\"#remoteplan\");\nconst diagnosticbutton = document.querySelector<HTMLButtonElement>(\"#diagnostic\");\nconst planroot = document.querySelector<HTMLElement>(\"#plan\");\nconst auditroot = document.querySelector<HTMLElement>(\"#audit\");\nconst diagnosticroot = document.querySelector<HTMLElement>(\"#diagnostics\");\nconst maproot = document.querySelector<HTMLElement>(\"#map\");\nconst a11yroot = document.querySelector<HTMLElement>(\"#a11y\");\nconst readerroot = document.querySelector<HTMLElement>(\"#reader\");\nconst detectionsroot = document.querySelector<HTMLElement>(\"#detections\");\nconst streamroot = document.querySelector<HTMLElement>(\"#stream\");\nconst diffsroot = document.querySelector<HTMLElement>(\"#diffs\");\nconst bannersroot = document.querySelector<HTMLElement>(\"#banners\");\nconst selectorsroot = document.querySelector<HTMLElement>(\"#selectors\");\nconst statusnode = document.querySelector<HTMLElement>(\"#status\");\nconst progressnode = document.querySelector<HTMLProgressElement>(\"#planprogress\");\nconst capabilitiestext = document.querySelector<HTMLElement>(\"#capabilitiestext\");\n\ntype previewresult = { ok: boolean; summary: string; resolvedtarget?: resolvedtarget; candidates?: string[] };\nconst previews = new Map<string, previewresult>();\n\n/** Safely reads the reviewed options object of one step. */\nfunction options(step: toolstep): Record<string, unknown> {\n if (!step.options) return {};\n try {\n const parsed = JSON.parse(step.options);\n return parsed && typeof parsed === \"object\" && !Array.isArray(parsed) ? (parsed as Record<string, unknown>) : {};\n } catch { return {}; }\n}\n\nfunction status(message: string, error = false): void { if (statusnode) { statusnode.textContent = message; statusnode.dataset.state = error ? \"error\" : \"ready\"; } }\nasync function request(message: unknown): Promise<unknown> { const response = await chrome.runtime.sendMessage(message) as { ok: boolean; value?: unknown; error?: string }; if (!response.ok) throw new Error(response.error); return response.value; }\nfunction button(label: string, action: () => Promise<void>, disabled = false): HTMLButtonElement { const element = document.createElement(\"button\"); element.type = \"button\"; element.textContent = label; element.disabled = disabled; element.addEventListener(\"click\", () => action().catch(error => status(error instanceof Error ? error.message : String(error), true))); return element; }\n\n/** Kinds addressable by a css target or a reviewed targetref; only these can be previewed. */\nconst previewkinds = [\"focus\", \"inspect\", \"click\", \"type\", \"scroll\", \"select\", \"hover\", \"clickdeep\", \"rightclick\", \"doubleclick\", \"drag\", \"drop\", \"upload\", \"clear\", \"check\", \"uncheck\", \"toggle\", \"submit\", \"readattribute\", \"readstyle\", \"readgeometry\", \"readvalue\", \"readtext\", \"readhtml\", \"countelements\", \"readtable\", \"highlight\", \"setattribute\", \"removeattribute\", \"waitfor\", \"shiftclick\", \"typetime\", \"appendtext\", \"setvalue\", \"typeedit\", \"submitsearch\", \"selectmulti\", \"chooseradio\", \"setslider\", \"setdate\", \"setcolor\", \"expanddetails\", \"verifyvisible\", \"verifyenabled\", \"pierceshadow\", \"clickpoint\", \"clicktext\", \"clickaria\", \"clickname\", \"resolvexpath\", \"deriveselector\", \"fingerprintsection\"];\n\n/** Topic rows that group the new interaction and observation kinds inside each risk class. */\nconst topictags: Array<{ topic: string; kinds: string[] }> = [\n { topic: \"pointer\", kinds: [\"movepointer\", \"clickpoint\", \"shiftclick\", \"clicktext\", \"clickaria\", \"clickname\", \"pierceshadow\"] },\n { topic: \"typing\", kinds: [\"typetime\", \"appendtext\", \"setvalue\", \"typeedit\", \"submitsearch\"] },\n { topic: \"keys\", kinds: [\"keyhold\", \"keyrelease\"] },\n { topic: \"controls\", kinds: [\"selectmulti\", \"chooseradio\", \"setslider\", \"setdate\", \"setcolor\", \"expanddetails\"] },\n { topic: \"dialogs\", kinds: [\"dismissdialog\"] },\n { topic: \"frames\", kinds: [\"enterframe\"] },\n { topic: \"retry\", kinds: [\"retryaction\"] },\n { topic: \"reads\", kinds: [\"mapclicks\", \"verifyvisible\", \"verifyenabled\", \"resolvexpath\"] },\n { topic: \"observation\", kinds: [\"a11ytree\", \"readvisible\", \"readertree\", \"readoutline\", \"readselection\", \"readopengraph\", \"readlang\", \"detectlanguage\", \"listshadow\", \"listframes\", \"readscrollpos\"] },\n { topic: \"detection\", kinds: [\"detectlists\", \"detecttables\", \"detectinfinitescroll\", \"detectvirtual\", \"detectlazy\", \"detectsticky\", \"detectscrolllock\", \"countpages\", \"classifypage\", \"fingerprintsection\"] },\n { topic: \"watch\", kinds: [\"watchmutate\", \"watchbanner\", \"watchfocus\", \"waitquiet\", \"readjson\", \"diffsnapshots\", \"deriveselector\"] },\n];\n\nfunction steptopic(kind: string): string | undefined {\n return topictags.find(tag => tag.kinds.includes(kind))?.topic;\n}\n\n/** Renders plan completion as a live progress ratio. */\nfunction renderprogress(plan: agentplan, completed: string[]): void {\n if (!progressnode) return;\n const total = plan.steps.length || 1;\n progressnode.max = total;\n progressnode.value = completed.length;\n progressnode.textContent = `${completed.length} of ${plan.steps.length} reviewed steps executed`;\n}\n\n/** Renders the latest structured outcome of one step beside its review entry. */\nfunction renderoutcome(step: toolstep, outcomes: stepoutcome[]): HTMLElement | null {\n const outcome = [...outcomes].reverse().find(item => item.stepid === step.id && item.ok) ?? [...outcomes].reverse().find(item => item.stepid === step.id);\n if (!outcome) return null;\n const node = document.createElement(\"details\");\n node.className = \"outcome\";\n const summary = document.createElement(\"summary\");\n summary.textContent = `${outcome.ok ? \"result\" : \"failure\"}: ${outcome.summary}`;\n node.append(summary);\n if (outcome.details && Object.keys(outcome.details).length > 0) {\n const payload = document.createElement(\"pre\");\n payload.textContent = JSON.stringify(outcome.details, null, 2).slice(0, 4000);\n node.append(payload);\n }\n return node;\n}\n\n/** Renders the hold id of a key hold or release step beside its summary. */\nfunction holddetail(step: toolstep): string {\n if (step.kind === \"keyhold\") {\n const holdid = options(step).holdid;\n return typeof holdid === \"string\" && holdid ? ` \u00B7 hold id ${holdid}` : \"\";\n }\n if (step.kind === \"keyrelease\") return step.value ? ` \u00B7 releases hold id ${step.value}` : \"\";\n return \"\";\n}\n\n/** Renders the retry attempts of one retry step on the step timeline. */\nfunction retrydetail(step: toolstep, retries: retryoutcome[]): HTMLElement | null {\n const latest = [...retries].reverse().find(item => item.stepid === step.id);\n if (!latest) return null;\n const node = document.createElement(\"p\");\n node.className = \"timeline\";\n node.textContent = `retry timeline: ${latest.attempts} attempt${latest.attempts === 1 ? \"\" : \"s\"} \u00B7 ${latest.movement.toFixed(1)} px movement \u00B7 ${latest.ok ? \"succeeded\" : \"failed\"}`;\n return node;\n}\n\n/** Renders the network quiet progress of one waitquiet step from its outcome evidence. */\nfunction quietdetail(step: toolstep, outcomes: stepoutcome[]): HTMLElement | null {\n if (step.kind !== \"waitquiet\") return null;\n const latest = [...outcomes].reverse().find(outcome => outcome.stepid === step.id);\n if (!latest) return null;\n const samples = Array.isArray(latest.details?.samples) ? latest.details?.samples as Array<{ at: number; quietfor: number }> : [];\n const idle = typeof latest.details?.idle === \"number\" ? latest.details?.idle : 0;\n const last = samples[samples.length - 1];\n const node = document.createElement(\"p\");\n node.className = \"timeline\";\n node.textContent = `network quiet: ${samples.length} sample${samples.length === 1 ? \"\" : \"s\"} \u00B7 quiet for ${Math.round(last?.quietfor ?? 0)} ms \u00B7 idle threshold ${idle} ms \u00B7 ${latest.ok ? \"quiet reached\" : \"still busy\"}`;\n return node;\n}\n\n/** Renders the resolved target details of one previewed interaction step before approval. */\nfunction renderpreview(step: toolstep): HTMLElement | null {\n const preview = previews.get(step.id);\n if (!preview) return null;\n const node = document.createElement(\"details\");\n node.className = \"outcome\";\n const summary = document.createElement(\"summary\");\n summary.textContent = `preview: ${preview.summary}`;\n node.append(summary);\n if (preview.resolvedtarget) {\n const payload = document.createElement(\"pre\");\n payload.textContent = JSON.stringify(preview.resolvedtarget, null, 2);\n node.append(payload);\n }\n if (preview.candidates && preview.candidates.length > 1) {\n const chooser = document.createElement(\"p\");\n chooser.textContent = \"Ambiguous resolution; choose one candidate as the target hint:\";\n node.append(chooser);\n for (const candidate of preview.candidates) {\n node.append(\" \", button(`Choose \"${candidate}\"`, async () => { pickhint(`target hint: ${candidate}`); }));\n }\n }\n return node;\n}\n\nfunction stepitem(plan: agentplan, step: toolstep, completed: string[], outcomes: stepoutcome[], retries: retryoutcome[]): HTMLLIElement {\n const item = document.createElement(\"li\");\n const done = completed.includes(step.id);\n item.textContent = `${done ? \"\u2713\" : \"\"} ${step.summary}${holddetail(step)}`;\n const outcome = renderoutcome(step, outcomes);\n if (outcome) item.append(outcome);\n const timeline = step.kind === \"retryaction\" ? retrydetail(step, retries) : quietdetail(step, outcomes);\n if (timeline) item.append(timeline);\n const preview = renderpreview(step);\n if (preview) item.append(preview);\n const hastarget = Boolean(step.target) || options(step).targetref !== undefined;\n if (!done && hastarget && previewkinds.includes(step.kind) && [\"pending\", \"approved\"].includes(plan.state)) item.append(\" \", button(\"Preview current target\", async () => { const result = await request({ kind: \"preview\", stepid: step.id }) as previewresult; previews.set(step.id, result); status(result.summary); await refresh(); }));\n if (!done && plan.state === \"approved\") item.append(\" \", button(\"Run this reviewed step\", async () => { const result = await request({ kind: \"execute\", stepid: step.id }) as { summary: string }; status(result.summary); await refresh(); }));\n return item;\n}\n\nfunction steplist(plan: agentplan, steps: toolstep[], completed: string[], outcomes: stepoutcome[], retries: retryoutcome[], risk: toolstep[\"risk\"]): HTMLElement | null {\n const group = steps.filter(step => step.risk === risk);\n if (group.length === 0) return null;\n const section = document.createElement(\"section\");\n const heading = document.createElement(\"h3\");\n heading.textContent = `${risk} steps`;\n section.append(heading);\n const general = group.filter(step => steptopic(step.kind) === undefined);\n if (general.length > 0) {\n const list = document.createElement(\"ol\");\n for (const step of general) list.append(stepitem(plan, step, completed, outcomes, retries));\n section.append(list);\n }\n for (const tag of topictags) {\n const tagged = group.filter(step => steptopic(step.kind) === tag.topic);\n if (tagged.length === 0) continue;\n const row = document.createElement(\"h4\");\n row.textContent = `${tag.topic} steps`;\n section.append(row);\n const list = document.createElement(\"ol\");\n for (const step of tagged) list.append(stepitem(plan, step, completed, outcomes, retries));\n section.append(list);\n }\n return section;\n}\n\nfunction renderplan(plan?: agentplan, progress?: planprogress, outcomes: stepoutcome[] = [], retries: retryoutcome[] = []): void {\n if (!planroot) return;\n planroot.replaceChildren();\n if (!plan) { planroot.textContent = \"Start a session, then request a local or endpoint plan. No task runs before review.\"; if (progressnode) progressnode.value = 0; return; }\n const title = document.createElement(\"h2\"); title.textContent = `${plan.state}: ${plan.objective}`; planroot.append(title);\n const completed = progress?.planid === plan.id ? progress.completedsteps : [];\n renderprogress(plan, completed);\n const sensitive = steplist(plan, plan.steps, completed, outcomes, retries, \"sensitive\");\n const interaction = steplist(plan, plan.steps, completed, outcomes, retries, \"interaction\");\n const read = steplist(plan, plan.steps, completed, outcomes, retries, \"read\");\n for (const group of [sensitive, interaction, read]) if (group) planroot.append(group);\n if (plan.state === \"pending\") { planroot.append(button(\"Approve reviewed plan\", async () => { await request({ kind: \"approve\" }); await refresh(); }), button(\"Reject plan\", async () => { await request({ kind: \"reject\" }); await refresh(); })); }\n if (plan.state === \"completed\" && plan.completedat) { const note = document.createElement(\"p\"); note.textContent = \"Every reviewed step has executed and the plan is closed.\"; planroot.append(note); }\n}\n\n/** Records one clickable map entry or candidate as the target hint for the next plan. */\nfunction pickhint(hint: string): void {\n if (objective) objective.value = objective.value ? `${objective.value}\\n${hint}` : hint;\n status(`${hint} recorded as the target hint for the next plan.`);\n}\n\n/** Renders the clickable map as a numbered list beside the plan and lets the user pick entries. */\nfunction rendermap(map?: clickablemap): void {\n if (!maproot) return;\n maproot.replaceChildren();\n if (!map || map.entries.length === 0) { maproot.textContent = \"Run a mapclicks step to number every clickable element on the page.\"; return; }\n for (const entry of map.entries) {\n const item = document.createElement(\"li\");\n const pick = document.createElement(\"button\");\n pick.type = \"button\";\n pick.textContent = `${entry.number}. ${entry.label || entry.selector} (${entry.role})`;\n pick.addEventListener(\"click\", () => pickhint(`target hint: ${entry.selector} (map entry ${entry.number}, ${entry.label || entry.role})`));\n item.append(pick);\n maproot.append(item);\n }\n}\n\n/** Renders the latest accessibility tree beside the dom snapshot as indented role lines. */\nfunction rendera11y(capture?: a11ycapture): void {\n if (!a11yroot) return;\n a11yroot.replaceChildren();\n if (!capture) { a11yroot.textContent = \"Run an a11ytree step to capture the accessibility tree beside the dom snapshot.\"; return; }\n const lines: string[] = [];\n const walk = (node: a11ynode, depth: number): void => {\n if (lines.length >= 80) return;\n const states = node.states.length > 0 ? ` [${node.states.join(\", \")}]` : \"\";\n const value = node.value !== undefined ? ` = ${node.value}` : \"\";\n lines.push(`${\"\u00B7 \".repeat(depth)}${node.role}: ${node.name || \"(unnamed)\"}${states}${value}`);\n for (const child of node.children) walk(child, depth + 1);\n };\n walk(capture.tree, 0);\n const payload = document.createElement(\"pre\");\n payload.textContent = lines.join(\"\\n\");\n a11yroot.append(payload);\n}\n\n/** Renders the latest reader view text with heading blocks highlighted. */\nfunction renderreader(capture?: readercapture): void {\n if (!readerroot) return;\n readerroot.replaceChildren();\n if (!capture) { readerroot.textContent = \"Run a readertree step to extract the reader view.\"; return; }\n const title = document.createElement(\"p\");\n title.textContent = `${capture.article.title || \"Untitled\"}${capture.article.byline ? ` \u00B7 ${capture.article.byline}` : \"\"} \u00B7 ${capture.article.words} words \u00B7 ${capture.article.blocks.length} blocks`;\n readerroot.append(title);\n for (const block of capture.article.blocks.slice(0, 40)) {\n const line = document.createElement(\"p\");\n line.className = /^h\\d$/.test(block.kind) ? \"readerblock heading\" : \"readerblock\";\n line.textContent = `${block.kind}: ${block.text.slice(0, 200)}`;\n readerroot.append(line);\n }\n}\n\n/** Shows detected lists, tables and pagination shapes as plan suggestions the user can pick. */\nfunction renderdetections(plan: agentplan | undefined, outcomes: stepoutcome[]): void {\n if (!detectionsroot) return;\n detectionsroot.replaceChildren();\n if (!plan) { detectionsroot.textContent = \"Detection steps list their detected lists, tables and pagination shapes here as suggestions.\"; return; }\n const kindof = (stepid: string): string | undefined => plan.steps.find(step => step.id === stepid)?.kind;\n const latest = (kind: string): stepoutcome | undefined => [...outcomes].reverse().find(outcome => outcome.ok && kindof(outcome.stepid) === kind);\n let shown = 0;\n const listoutcome = latest(\"detectlists\");\n const lists = Array.isArray(listoutcome?.details?.lists) ? listoutcome?.details?.lists as listpattern[] : [];\n for (const pattern of lists.slice(0, 6)) {\n const item = document.createElement(\"li\");\n const pick = document.createElement(\"button\");\n pick.type = \"button\";\n pick.textContent = `list of ${pattern.repeat} items \u00B7 ${pattern.itemselector}`;\n pick.addEventListener(\"click\", () => pickhint(`target hint: ${pattern.itemselector} (repeated list item of ${pattern.container})`));\n item.append(pick);\n detectionsroot.append(item);\n shown += 1;\n }\n const tableoutcome = latest(\"detecttables\");\n const tables = Array.isArray(tableoutcome?.details?.tables) ? tableoutcome?.details?.tables as tableshape[] : [];\n for (const table of tables.slice(0, 6)) {\n const item = document.createElement(\"li\");\n const pick = document.createElement(\"button\");\n pick.type = \"button\";\n pick.textContent = `table of ${table.rows} rows \u00B7 ${table.columns.length} columns \u00B7 ${table.selector}`;\n pick.addEventListener(\"click\", () => pickhint(`target hint: ${table.selector} (detected data table)`));\n item.append(pick);\n detectionsroot.append(item);\n shown += 1;\n }\n const paginationoutcome = latest(\"countpages\");\n if (paginationoutcome) {\n const item = document.createElement(\"li\");\n const current = typeof paginationoutcome.details?.current === \"number\" ? paginationoutcome.details?.current : 0;\n const total = typeof paginationoutcome.details?.total === \"number\" ? paginationoutcome.details?.total : 0;\n const text = document.createElement(\"span\");\n text.textContent = `pagination: current page ${current} \u00B7 estimated total ${total}`;\n item.append(text);\n detectionsroot.append(item);\n shown += 1;\n }\n if (shown === 0) detectionsroot.textContent = \"Detected lists, tables and pagination shapes appear here as plan suggestions.\";\n}\n\n/** Shows the live mutation and focus stream observed during watched steps. */\nfunction renderstream(mutationevents: mutationevent[], focusevents: focusevent[]): void {\n if (!streamroot) return;\n streamroot.replaceChildren();\n if (mutationevents.length === 0 && focusevents.length === 0) { streamroot.textContent = \"Watched steps stream their mutation and focus events here.\"; return; }\n for (const event of mutationevents.slice(0, 6)) {\n const item = document.createElement(\"li\");\n item.textContent = `${new Date(event.at).toLocaleTimeString()} \u00B7 mutation ${event.event} \u00B7 ${event.targetpath}`;\n streamroot.append(item);\n }\n for (const event of focusevents.slice(0, 6)) {\n const item = document.createElement(\"li\");\n item.textContent = `${new Date(event.at).toLocaleTimeString()} \u00B7 focus ${event.kind} \u00B7 ${event.targetpath}`;\n streamroot.append(item);\n }\n}\n\n/** Renders the latest snapshot diff with added, removed and changed rows. */\nfunction renderdiffs(diffs: snapshotdiff[]): void {\n if (!diffsroot) return;\n diffsroot.replaceChildren();\n const latest = diffs[0];\n if (!latest) { diffsroot.textContent = \"Diff two captured observation versions with a diffsnapshots step.\"; return; }\n const heading = document.createElement(\"p\");\n heading.textContent = `version ${latest.baseversion} \u2192 ${latest.targetversion}: ${latest.added.length} added \u00B7 ${latest.removed.length} removed \u00B7 ${latest.changed.length} changed`;\n diffsroot.append(heading);\n const list = document.createElement(\"ul\");\n for (const entry of [...latest.added, ...latest.removed, ...latest.changed].slice(0, 12)) {\n const item = document.createElement(\"li\");\n item.className = `diffrow ${entry.kind}`;\n item.textContent = `${entry.kind} \u00B7 ${entry.selector} \u00B7 ${entry.summary}`;\n list.append(item);\n }\n diffsroot.append(list);\n}\n\n/** Flags consent banners with a review card before any interaction. */\nfunction renderbanners(banners: bannerreport[]): void {\n if (!bannersroot) return;\n bannersroot.replaceChildren();\n if (banners.length === 0) { bannersroot.textContent = \"No consent banner has been observed yet.\"; return; }\n for (const banner of banners.slice(0, 3)) {\n const card = document.createElement(\"div\");\n card.className = \"bannercard\";\n const title = document.createElement(\"p\");\n title.textContent = `${banner.kind} banner detected \u2014 review it before any interaction.`;\n const text = document.createElement(\"p\");\n text.textContent = banner.text.slice(0, 160) || \"(no banner text)\";\n const controls = document.createElement(\"p\");\n controls.textContent = `controls: ${banner.controls.length > 0 ? banner.controls.join(\", \") : \"none\"}`;\n card.append(title, text, controls);\n bannersroot.append(card);\n }\n}\n\n/** Shows derived selector candidates with their stability scores for reuse. */\nfunction renderselectors(selectors: derivedselector[]): void {\n if (!selectorsroot) return;\n selectorsroot.replaceChildren();\n if (selectors.length === 0) { selectorsroot.textContent = \"Run a deriveselector step to rank stable selectors.\"; return; }\n for (const record of selectors.slice(0, 8)) {\n const item = document.createElement(\"li\");\n const pick = document.createElement(\"button\");\n pick.type = \"button\";\n pick.textContent = `${record.selector} (${record.strategy} \u00B7 stability ${record.score})`;\n pick.addEventListener(\"click\", () => pickhint(`target hint: ${record.selector} (derived ${record.strategy} selector)`));\n item.append(pick);\n selectorsroot.append(item);\n }\n}\n\nfunction rendercapabilities(report?: capabilityreport): void {\n if (!capabilitiestext) return;\n if (!report) { capabilitiestext.textContent = \"Optional capabilities unknown.\"; return; }\n capabilitiestext.textContent = `tabs ${report.tabs ? \"granted\" : \"absent\"} \u00B7 downloads ${report.downloads ? \"granted\" : \"absent\"} \u00B7 clipboard read ${report.clipboardread ? \"granted\" : \"absent\"} \u00B7 clipboard write ${report.clipboardwrite ? \"granted\" : \"absent\"}`;\n}\n\nfunction renderaudit(events: auditevent[]): void { if (!auditroot) return; auditroot.replaceChildren(); for (const event of events.slice(0, 12)) { const item = document.createElement(\"li\"); item.textContent = `${new Date(event.at).toLocaleTimeString()} \u00B7 ${event.kind} \u00B7 ${event.summary}`; auditroot.append(item); } }\nfunction renderdiagnostic(report?: diagnosticreport): void { if (!diagnosticroot) return; diagnosticroot.replaceChildren(); if (!report) { diagnosticroot.textContent = \"Run a local diagnostic after starting a session to record bridge and page-shape health.\"; return; } const values = [`origin: ${report.origin}`, `title: ${report.title || \"untitled\"}`, `interactive elements: ${report.interactivecount}`, `forms: ${report.formcount}`, `page text length: ${report.textlength}`, `bridge available: ${report.bridgeavailable ? \"yes\" : \"no\"}`]; for (const value of values) { const item = document.createElement(\"li\"); item.textContent = value; diagnosticroot.append(item); } }\nasync function refresh(): Promise<void> { const context = await request({ kind: \"context\" }) as { plan?: agentplan; progress?: planprogress; diagnostic?: diagnosticreport; audit: auditevent[]; outcomes?: stepoutcome[]; capabilities?: capabilityreport; session?: { id: string; pausedat?: number }; map?: clickablemap; retries?: retryoutcome[]; a11y?: a11ycapture; reader?: readercapture; banners?: bannerreport[]; mutationevents?: mutationevent[]; focusevents?: focusevent[]; diffs?: snapshotdiff[]; selectors?: derivedselector[] }; renderplan(context.plan, context.progress, context.outcomes ?? [], context.retries ?? []); renderdiagnostic(context.diagnostic); rendermap(context.map); rendera11y(context.a11y); renderreader(context.reader); renderdetections(context.plan, context.outcomes ?? []); renderstream(context.mutationevents ?? [], context.focusevents ?? []); renderdiffs(context.diffs ?? []); renderbanners(context.banners ?? []); renderselectors(context.selectors ?? []); renderaudit(context.audit); rendercapabilities(context.capabilities); if (context.session?.pausedat) status(\"Session paused. Reviewed actions are blocked until resume.\"); else status(context.session ? \"Active session is visible. The extension is waiting for review.\" : \"No active browser session.\"); }\nasync function create(kind: \"proposelocal\" | \"proposeremote\"): Promise<void> { await request({ kind, objective: objective?.value ?? \"\" }); await refresh(); }\nlocalbutton?.addEventListener(\"click\", () => create(\"proposelocal\").catch(error => status(error instanceof Error ? error.message : String(error), true)));\nremotebutton?.addEventListener(\"click\", () => create(\"proposeremote\").catch(error => status(error instanceof Error ? error.message : String(error), true)));\ndiagnosticbutton?.addEventListener(\"click\", () => request({ kind: \"diagnostic\" }).then(() => refresh()).catch(error => status(error instanceof Error ? error.message : String(error), true)));\nrefresh().catch(error => status(error instanceof Error ? error.message : String(error), true));\n"],
|
|
5
|
-
"mappings": ";AAEA,IAAM,YAAY,SAAS,cAAmC,YAAY;AAC1E,IAAM,cAAc,SAAS,cAAiC,YAAY;AAC1E,IAAM,eAAe,SAAS,cAAiC,aAAa;AAC5E,IAAM,mBAAmB,SAAS,cAAiC,aAAa;AAChF,IAAM,WAAW,SAAS,cAA2B,OAAO;AAC5D,IAAM,YAAY,SAAS,cAA2B,QAAQ;AAC9D,IAAM,iBAAiB,SAAS,cAA2B,cAAc;AACzE,IAAM,UAAU,SAAS,cAA2B,MAAM;AAC1D,IAAM,WAAW,SAAS,cAA2B,OAAO;AAC5D,IAAM,aAAa,SAAS,cAA2B,SAAS;AAChE,IAAM,iBAAiB,SAAS,cAA2B,aAAa;AACxE,IAAM,aAAa,SAAS,cAA2B,SAAS;AAChE,IAAM,YAAY,SAAS,cAA2B,QAAQ;AAC9D,IAAM,cAAc,SAAS,cAA2B,UAAU;AAClE,IAAM,gBAAgB,SAAS,cAA2B,YAAY;AACt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eAAa,QAAQ,MAAM;AAAG,mBAAiB,QAAQ,MAAM,QAAQ,YAAY,CAAC,CAAC;AAAG,eAAa,QAAQ,kBAAkB,CAAC,GAAG,QAAQ,eAAe,CAAC,CAAC;AAAG,cAAY,QAAQ,SAAS,CAAC,CAAC;AAAG,gBAAc,QAAQ,WAAW,CAAC,CAAC;AAAG,kBAAgB,QAAQ,aAAa,CAAC,CAAC;AAAG,cAAY,QAAQ,KAAK;AAAG,qBAAmB,QAAQ,YAAY;AAAG,MAAI,QAAQ,SAAS,SAAU,QAAO,4DAA4D;AAAA,MAAQ,QAAO,QAAQ,UAAU,oEAAoE,4BAA4B;AAAG;AAClwC,eAAe,OAAO,MAAuD;AAAE,QAAM,QAAQ,EAAE,MAAM,WAAW,WAAW,SAAS,GAAG,CAAC;AAAG,QAAM,QAAQ;AAAG;AAC5J,aAAa,iBAAiB,SAAS,MAAM,OAAO,cAAc,EAAE,MAAM,WAAS,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG,IAAI,CAAC,CAAC;AACxJ,cAAc,iBAAiB,SAAS,MAAM,OAAO,eAAe,EAAE,MAAM,WAAS,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG,IAAI,CAAC,CAAC;AAC1J,kBAAkB,iBAAiB,SAAS,MAAM,QAAQ,EAAE,MAAM,aAAa,CAAC,EAAE,KAAK,MAAM,QAAQ,CAAC,EAAE,MAAM,WAAS,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG,IAAI,CAAC,CAAC;AAC5L,QAAQ,EAAE,MAAM,WAAS,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG,IAAI,CAAC;",
|
|
6
|
-
"names": []
|
|
3
|
+
"sources": ["../../policy.ts", "../tabscommand.ts", "../sidepanel.ts"],
|
|
4
|
+
"sourcesContent": ["import type { actionkind, agentplan, agentsession, endpointconfig, observationmode, policyevaluation, runsettings, safetyverdict, toolstep } from \"./types.js\";\n\nconst sensitiveactions = new Set<actionkind>([\"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\"]);\nconst interactionactions = new Set<actionkind>([\"focus\", \"scroll\", \"hover\", \"clickdeep\", \"rightclick\", \"doubleclick\", \"scrollpage\", \"scrollby\", \"scrollend\", \"scrolltop\", \"fullscreen\", \"zoomset\", \"movepointer\", \"clicktext\", \"clickaria\", \"clickname\", \"expanddetails\", \"pierceshadow\", \"retryaction\"]);\nconst readactions = new Set<actionkind>([\"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\"]);\nconst allowedactions = new Set<actionkind>([...sensitiveactions, ...interactionactions, ...readactions]);\nconst watchactions = new Set<actionkind>([\"watchmutate\", \"watchbanner\", \"watchfocus\", \"watchtab\"]);\nconst targetactions = new Set<actionkind>([\"inspect\", \"focus\", \"click\", \"type\", \"scroll\", \"select\", \"hover\", \"clickdeep\", \"rightclick\", \"doubleclick\", \"drag\", \"drop\", \"upload\", \"clear\", \"check\", \"uncheck\", \"toggle\", \"submit\", \"readattribute\", \"readstyle\", \"readgeometry\", \"readvalue\", \"readtext\", \"readhtml\", \"countelements\", \"readtable\", \"highlight\", \"setattribute\", \"removeattribute\", \"waitfor\", \"shiftclick\", \"typetime\", \"appendtext\", \"setvalue\", \"typeedit\", \"submitsearch\", \"selectmulti\", \"chooseradio\", \"setslider\", \"setdate\", \"setcolor\", \"expanddetails\", \"verifyvisible\", \"verifyenabled\", \"pierceshadow\", \"deriveselector\", \"fingerprintsection\"]);\nconst valueactions = new Set<actionkind>([\"presskey\", \"drag\", \"drop\", \"upload\", \"readattribute\", \"removeattribute\", \"waittext\", \"evaluate\", \"zoomset\", \"tabactivate\", \"tabclose\", \"tabreload\", \"windowclose\", \"windowresize\", \"tabcreate\", \"windowcreate\", \"downloadfile\", \"typetime\", \"appendtext\", \"setvalue\", \"typeedit\", \"keyhold\", \"keyrelease\", \"chooseradio\", \"setslider\", \"setdate\", \"setcolor\", \"followlink\", \"setfragment\", \"handleauth\", \"navintent\", \"openclipboard\", \"checksafe\", \"reopentab\", \"spanav\", \"duplicatetab\", \"pintab\", \"mutetab\", \"movetab\", \"movetabwindow\", \"searchtabs\", \"badgetab\", \"attachmeta\", \"focuswindow\", \"maximizewindow\", \"minimizewindow\", \"restorewindow\", \"incognitowindow\"]);\nconst tabscommandactions = new Set<actionkind>([\"querytabs\", \"duplicatetab\", \"closepattern\", \"pintab\", \"mutetab\", \"movetab\", \"movetabwindow\", \"grouptabs\", \"colorgroup\", \"collapsegroup\", \"discardtab\", \"reloadtabs\", \"zoomin\", \"zoomout\", \"watchtab\", \"switchtab\", \"maximizewindow\", \"minimizewindow\", \"restorewindow\", \"focuswindow\", \"scratchwindow\", \"incognitowindow\", \"restoretab\", \"savelayout\", \"restorelayout\", \"findclones\", \"searchtabs\", \"badgetab\", \"attachmeta\", \"listaudio\", \"reopenrun\", \"snapshotsession\"]);\nconst layoutmutationactions = new Set<actionkind>([\"grouptabs\", \"colorgroup\", \"collapsegroup\", \"savelayout\", \"restorelayout\"]);\n/** Chromium tab group colors accepted as reviewed group color choices. */\nconst groupcolors = [\"grey\", \"blue\", \"red\", \"yellow\", \"green\", \"pink\", \"purple\", \"cyan\", \"orange\"];\n\n/** Normalizes a user supplied HTTPS endpoint without preserving a provider lock-in. */\nexport function normalizeendpoint(value: string): endpointconfig {\n const endpoint = new URL(value.trim());\n if (endpoint.protocol !== \"https:\") throw new Error(\"Devthink accepts HTTPS endpoints only.\");\n if (endpoint.username || endpoint.password) throw new Error(\"Endpoint credentials are not allowed in the URL.\");\n return { endpoint: endpoint.toString(), origin: endpoint.origin, configuredat: Date.now() };\n}\n\n/** Creates the exact optional host pattern requested from Chromium. */\nexport function hostpattern(origin: string): string {\n const parsed = new URL(origin);\n if (parsed.protocol !== \"https:\") throw new Error(\"Only HTTPS origins can be granted.\");\n return `${parsed.origin}/*`;\n}\n\n/** True when the action kind observes the page over a reviewed lifetime window. */\nexport function iswatchkind(kind: actionkind): boolean {\n return watchactions.has(kind);\n}\n\n/** Grades the observation mode of a kind: passive capture, watched lifetimes or diffing passes. */\nexport function observationmodeof(kind: actionkind): observationmode {\n if (watchactions.has(kind) || kind === \"waitquiet\") return \"watching\";\n if (kind === \"diffsnapshots\") return \"diffing\";\n return \"passive\";\n}\n\n/** Defines action risk from the fixed local allowlist. */\nexport function actionrisk(kind: actionkind): \"read\" | \"interaction\" | \"sensitive\" {\n if (!allowedactions.has(kind)) throw new Error(\"Unsupported browser action.\");\n if (sensitiveactions.has(kind)) return \"sensitive\";\n return interactionactions.has(kind) ? \"interaction\" : \"read\";\n}\n\n/** True when the action kind accepts a css selector target or a reviewed targetref. */\nexport function needstarget(kind: actionkind): boolean {\n return targetactions.has(kind);\n}\n\n/** Parses the reviewed JSON options of a step; malformed payloads are rejected early. */\nexport function parseoptions(step: toolstep): Record<string, unknown> {\n if (step.options === undefined) return {};\n let parsed: unknown;\n try { parsed = JSON.parse(step.options); } catch { throw new Error(\"Step options must be a JSON object.\"); }\n if (!parsed || typeof parsed !== \"object\" || Array.isArray(parsed)) throw new Error(\"Step options must be a JSON object.\");\n return parsed as Record<string, unknown>;\n}\n\n/** Maps an action kind to the optional browser permission it requires, if any. */\nexport function requiredcapability(kind: actionkind): string | undefined {\n if (kind === \"tablist\") return \"tabs\";\n if (kind === \"downloadfile\") return \"downloads\";\n if (kind === \"openclipboard\") return \"clipboardRead\";\n if (kind === \"openlink\" || kind === \"openprivate\" || kind === \"navlist\" || kind === \"batchopen\" || kind === \"reopentab\" || kind === \"deeplink\") return \"tabs\";\n if (tabscommandactions.has(kind)) return \"tabs\";\n return undefined;\n}\n\n/** True when the kind commands tabs or windows beyond the active tab and needs the optional tabs capability. */\nexport function istabscommandkind(kind: actionkind): boolean {\n return tabscommandactions.has(kind);\n}\n\n/** True when the kind mutates tab groups or layouts and therefore stays inside the active session. */\nexport function islayoutkind(kind: actionkind): boolean {\n return layoutmutationactions.has(kind);\n}\n\n/** Restricts group and layout mutations to the active session: they refuse without a live session. */\nexport function layoutmutationgranted(session: agentsession | undefined, now: number): policyevaluation {\n if (!session || session.stoppedat || session.expiresat <= now) return { allowed: false, reason: \"Group and layout mutations stay inside the active session.\" };\n return { allowed: true };\n}\n\n/** Requires explicit review before closing a window that holds more than one task tab. */\nexport function windowclosegate(tasktabcount: number, reviewed: boolean): policyevaluation {\n if (tasktabcount > 1 && !reviewed) return { allowed: false, reason: `The window holds ${tasktabcount} task tabs and needs explicit review before it closes.` };\n return { allowed: true };\n}\n\n/** Reads the user configured concurrent task tab ceiling; an absent value never refuses a tab. */\nexport function tasktabceiling(settings: runsettings | undefined): number | undefined {\n const ceiling = settings?.tasktabceiling;\n return typeof ceiling === \"number\" && Number.isFinite(ceiling) && ceiling >= 0 ? ceiling : undefined;\n}\n\n/** Parses the reviewed wait duration of a wait step with no upper bound. */\nexport function waitduration(step: toolstep): number {\n const requested = step.value ? Number.parseInt(step.value, 10) : 250;\n if (!Number.isFinite(requested) || requested < 0) throw new Error(\"Wait duration must be zero or a positive number of milliseconds.\");\n return requested;\n}\n\nfunction isnumericid(value: unknown): value is string {\n return typeof value === \"string\" && /^\\d+$/.test(value);\n}\n\nfunction numericoption(options: Record<string, unknown>, key: string): boolean {\n return options[key] === undefined || (typeof options[key] === \"number\" && Number.isFinite(options[key] as number));\n}\n\n/** True when an optional numeric option is absent or a finite number of zero or more. */\nfunction nonnegativeoption(options: Record<string, unknown>, key: string): boolean {\n return numericoption(options, key) && !(typeof options[key] === \"number\" && (options[key] as number) < 0);\n}\n\nfunction isnonempty(value: unknown): value is string {\n return typeof value === \"string\" && value.trim().length > 0;\n}\n\nfunction ispoint(value: unknown): boolean {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return false;\n const point = value as Record<string, unknown>;\n return typeof point.x === \"number\" && Number.isFinite(point.x) && typeof point.y === \"number\" && Number.isFinite(point.y);\n}\n\n/** Grades a resolution match count: zero is absent, one is resolved and more than one is refused as ambiguous. */\nexport function resolutionverdict(count: number): \"absent\" | \"resolved\" | \"ambiguous\" {\n if (!Number.isFinite(count) || count <= 0) return \"absent\";\n return count === 1 ? \"resolved\" : \"ambiguous\";\n}\n\n/** Validates the reviewed targetref grammar of every resolution mode and rejects empty references. */\nexport function validatetargetref(reference: unknown): policyevaluation {\n if (!reference || typeof reference !== \"object\" || Array.isArray(reference)) return { allowed: false, reason: \"The reviewed target reference must be an object.\" };\n const ref = reference as Record<string, unknown>;\n if (ref.mode === \"selector\") return isnonempty(ref.selector) ? { allowed: true } : { allowed: false, reason: \"The selector target reference needs a non-empty selector.\" };\n if (ref.mode === \"text\") return isnonempty(ref.text) ? { allowed: true } : { allowed: false, reason: \"The text target reference needs non-empty text.\" };\n if (ref.mode === \"aria\") {\n if (!isnonempty(ref.role)) return { allowed: false, reason: \"The aria target reference needs a non-empty role.\" };\n return isnonempty(ref.name) ? { allowed: true } : { allowed: false, reason: \"The aria target reference needs a non-empty name.\" };\n }\n if (ref.mode === \"name\") return isnonempty(ref.name) ? { allowed: true } : { allowed: false, reason: \"The name target reference needs a non-empty name.\" };\n if (ref.mode === \"xpath\") return isnonempty(ref.xpath) ? { allowed: true } : { allowed: false, reason: \"The xpath target reference needs a non-empty expression.\" };\n if (ref.mode === \"index\") {\n const index = ref.index;\n return typeof index === \"number\" && Number.isInteger(index) && index >= 1 ? { allowed: true } : { allowed: false, reason: \"The index target reference needs a positive integer map number.\" };\n }\n if (ref.mode === \"point\") {\n const pointok = typeof ref.x === \"number\" && Number.isFinite(ref.x) && typeof ref.y === \"number\" && Number.isFinite(ref.y);\n return pointok ? { allowed: true } : { allowed: false, reason: \"The point target reference needs numeric x and y coordinates.\" };\n }\n return { allowed: false, reason: \"The target reference mode must be selector, text, aria, name, xpath, index or point.\" };\n}\n\n/** True when the session origin grants cover the given origin; a session without grants only allows its own origin. */\nexport function origingranted(session: agentsession | undefined, origin: string): boolean {\n if (!session) return false;\n const grants = session.grants ?? [session.origin];\n return grants.includes(origin);\n}\n\n/** Decides whether an unreviewed origin may open: the session grants cover it or a safe checksafe verdict vouches for it. */\nexport function originverified(url: string, grants: string[], verdicts: safetyverdict[]): policyevaluation {\n let origin = \"\";\n try { origin = new URL(url).origin; } catch { return { allowed: false, reason: \"The reviewed navigation URL is invalid.\" }; }\n if (grants.includes(origin)) return { allowed: true };\n const covered = verdicts.find(verdict => verdict.safe && (verdict.url === url || (safeorigin(verdict.url) === origin)));\n if (covered) return { allowed: true };\n return { allowed: false, reason: `The origin ${origin} is outside the session grants and has no safe checksafe verdict; run checksafe and review it first.` };\n}\n\nfunction safeorigin(url: string): string {\n try { return new URL(url).origin; } catch { return \"\"; }\n}\n\n/** Refuses navigation that would move a granted task tab outside the session origin grants until the user consents. */\nexport function navigationgranted(session: agentsession | undefined, url: string): policyevaluation {\n let origin = \"\";\n try { origin = new URL(url).origin; } catch { return { allowed: false, reason: \"The reviewed navigation URL is invalid.\" }; }\n if (origingranted(session, origin)) return { allowed: true };\n return { allowed: false, reason: `Navigation to ${origin} leaves the task tab origins and needs the user consent of a session grant first.` };\n}\n\n/** Validates the reviewed inner step of a retry or frame wrapper against the same rules as a top-level step. */\nfunction validateinnerstep(options: Record<string, unknown>, origin: string): policyevaluation {\n const stepid = options.stepid;\n const kind = options.kind;\n if (isnonempty(stepid)) {\n if (kind !== undefined) return { allowed: false, reason: \"The reviewed wrapper must reference a step id or an inline step, not both.\" };\n return { allowed: true };\n }\n if (typeof kind !== \"string\" || !kind.trim()) return { allowed: false, reason: \"A reviewed step id or inline step kind is required in options.\" };\n if (kind === \"retryaction\" || kind === \"enterframe\") return { allowed: false, reason: \"The reviewed inner step cannot be another wrapper kind.\" };\n if (!allowedactions.has(kind as actionkind)) return { allowed: false, reason: \"The reviewed inner step kind is unsupported.\" };\n const inneroptions = options.options;\n if (inneroptions !== undefined && (!inneroptions || typeof inneroptions !== \"object\" || Array.isArray(inneroptions))) return { allowed: false, reason: \"The reviewed inner step options must be an object.\" };\n const inner: toolstep = {\n id: \"inner\",\n kind: kind as actionkind,\n summary: \"Reviewed inner step.\",\n risk: actionrisk(kind as actionkind),\n ...(isnonempty(options.target) ? { target: options.target } : {}),\n ...(isnonempty(options.value) ? { value: options.value } : {}),\n ...(inneroptions !== undefined ? { options: JSON.stringify(inneroptions) } : {}),\n };\n return validatestep(inner, origin);\n}\n\n/** True when a reviewed https url parses. */\nfunction ishttpsurl(value: unknown): value is string {\n if (typeof value !== \"string\" || !value.trim()) return false;\n try { return new URL(value).protocol === \"https:\"; } catch { return false; }\n}\n\n/** Validates the reviewed navtarget grammar of a navigation step. */\nfunction validatenavtarget(value: unknown, kind: string): policyevaluation {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return { allowed: false, reason: \"A reviewed navtarget with a url is required in options.\" };\n const target = value as Record<string, unknown>;\n if (!ishttpsurl(target.url)) return { allowed: false, reason: \"The reviewed navtarget url must use HTTPS.\" };\n const container = target.container ?? \"tab\";\n if (container !== \"current\" && container !== \"tab\" && container !== \"window\" && container !== \"private\") return { allowed: false, reason: \"The reviewed navtarget container must be current, tab, window or private.\" };\n if (target.position !== undefined && target.position !== \"adjacent\" && target.position !== \"end\") return { allowed: false, reason: \"The reviewed navtarget position must be adjacent or end.\" };\n if (kind === \"openprivate\" && container !== \"private\") return { allowed: false, reason: \"The openprivate step requires the private container.\" };\n if (kind === \"openlink\" && container === \"private\") return { allowed: false, reason: \"The openlink step cannot open the private container; use openprivate.\" };\n return { allowed: true };\n}\n\n/** Validates the reviewed waitprofile grammar with its load signals, thresholds and per origin overrides. */\nfunction validatewaitprofile(value: unknown): policyevaluation {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return { allowed: false, reason: \"A reviewed waitprofile with load signals is required in options.\" };\n const profile = value as Record<string, unknown>;\n if (!Array.isArray(profile.signals) || profile.signals.length === 0 || !profile.signals.every(signal => isnonempty(signal))) return { allowed: false, reason: \"The reviewed waitprofile needs a non-empty list of load signals.\" };\n if (!nonnegativeoption(profile, \"idle\")) return { allowed: false, reason: \"The reviewed waitprofile idle threshold must be zero or a positive number of milliseconds.\" };\n if (!nonnegativeoption(profile, \"timeout\")) return { allowed: false, reason: \"The reviewed waitprofile timeout must be zero or a positive number of milliseconds.\" };\n if (profile.overrides !== undefined) {\n if (!Array.isArray(profile.overrides) || profile.overrides.length === 0) return { allowed: false, reason: \"The reviewed waitprofile overrides must be a non-empty list when present.\" };\n for (const entry of profile.overrides) {\n if (!entry || typeof entry !== \"object\" || Array.isArray(entry)) return { allowed: false, reason: \"Every reviewed waitprofile override must be an object with an origin.\" };\n const override = entry as Record<string, unknown>;\n if (!ishttpsurl(override.origin)) return { allowed: false, reason: \"Every reviewed waitprofile override origin must use HTTPS.\" };\n if (override.signals !== undefined && (!Array.isArray(override.signals) || !override.signals.every(signal => isnonempty(signal)))) return { allowed: false, reason: \"The reviewed waitprofile override signals must be a list of non-empty strings.\" };\n if (!nonnegativeoption(override, \"idle\") || !nonnegativeoption(override, \"timeout\")) return { allowed: false, reason: \"The reviewed waitprofile override thresholds must be zero or positive numbers.\" };\n }\n }\n return { allowed: true };\n}\n\n/** Validates the reviewed urlpattern grammar with its match mode plus query and fragment parts. */\nexport function validateurlpattern(value: unknown): policyevaluation {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return { allowed: false, reason: \"A reviewed urlpattern is required in options.\" };\n const pattern = value as Record<string, unknown>;\n if (pattern.mode !== \"exact\" && pattern.mode !== \"prefix\" && pattern.mode !== \"host\" && pattern.mode !== \"pattern\") return { allowed: false, reason: \"The reviewed urlpattern mode must be exact, prefix, host or pattern.\" };\n if (!ishttpsurl(pattern.url)) return { allowed: false, reason: \"The reviewed urlpattern url must use HTTPS.\" };\n if (pattern.query !== undefined) {\n if (!pattern.query || typeof pattern.query !== \"object\" || Array.isArray(pattern.query)) return { allowed: false, reason: \"The reviewed urlpattern query part must be an object of parameter names and values.\" };\n for (const item of Object.values(pattern.query)) if (typeof item !== \"string\") return { allowed: false, reason: \"The reviewed urlpattern query values must be strings.\" };\n }\n if (pattern.fragment !== undefined && !isnonempty(pattern.fragment)) return { allowed: false, reason: \"The reviewed urlpattern fragment must be a non-empty string.\" };\n return { allowed: true };\n}\n\n/** Validates a reviewed non-empty list of HTTPS urls in options. */\nfunction validateurllist(options: Record<string, unknown>, key: string): policyevaluation {\n const urls = options[key];\n if (!Array.isArray(urls) || urls.length === 0 || !urls.every(url => ishttpsurl(url))) return { allowed: false, reason: `A reviewed non-empty list of HTTPS urls is required in options as ${key}.` };\n return { allowed: true };\n}\n\n/** Validates the reviewed ratelimit grammar of a navrate step; the window and ceiling stay user configured with no hardcoded cap. */\nfunction validateratelimit(value: unknown): policyevaluation {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return { allowed: false, reason: \"A reviewed ratelimit with a window and a ceiling is required in options.\" };\n const limit = value as Record<string, unknown>;\n if (limit.domain !== undefined && !isnonempty(limit.domain)) return { allowed: false, reason: \"The reviewed ratelimit domain must be a non-empty string.\" };\n if (typeof limit.window !== \"number\" || !Number.isFinite(limit.window) || limit.window <= 0) return { allowed: false, reason: \"The reviewed ratelimit window must be a positive number of milliseconds with no code ceiling.\" };\n if (typeof limit.ceiling !== \"number\" || !Number.isInteger(limit.ceiling) || limit.ceiling < 1) return { allowed: false, reason: \"The reviewed ratelimit ceiling must be a positive integer with no code ceiling.\" };\n return { allowed: true };\n}\n\n/** Validates the reviewed tabquery grammar with url, title, id and pattern matchers; at least one matcher is required. */\nexport function validatetabquery(value: unknown): policyevaluation {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return { allowed: false, reason: \"A reviewed tabquery with at least one matcher is required in options.\" };\n const query = value as Record<string, unknown>;\n const hasmatcher = query.url !== undefined || query.title !== undefined || query.id !== undefined || query.pattern !== undefined;\n if (!hasmatcher) return { allowed: false, reason: \"The reviewed tabquery needs a url, title, id or pattern matcher.\" };\n if (query.url !== undefined && !isnonempty(query.url)) return { allowed: false, reason: \"The reviewed tabquery url matcher must be a non-empty string.\" };\n if (query.title !== undefined && !isnonempty(query.title)) return { allowed: false, reason: \"The reviewed tabquery title matcher must be a non-empty string.\" };\n if (query.pattern !== undefined && !isnonempty(query.pattern)) return { allowed: false, reason: \"The reviewed tabquery pattern matcher must be a non-empty string.\" };\n if (query.id !== undefined && (typeof query.id !== \"number\" || !Number.isInteger(query.id) || query.id < 0)) return { allowed: false, reason: \"The reviewed tabquery id matcher must be a non-negative integer tab id.\" };\n return { allowed: true };\n}\n\n/** Validates a reviewed group color choice against the Chromium tab group palette. */\nfunction validategroupcolor(value: unknown): boolean {\n return typeof value === \"string\" && (groupcolors as string[]).includes(value);\n}\n\n/** Validates a reviewed list of numeric browser ids in options. */\nfunction validateidlist(options: Record<string, unknown>, key: string): boolean {\n const ids = options[key];\n return Array.isArray(ids) && ids.length > 0 && ids.every(id => typeof id === \"number\" && Number.isInteger(id) && id >= 0);\n}\n\n/** Validates the reviewed tab and window parameter grammar of the tabs and windows command family. */\nfunction validatetabsgrammar(step: toolstep, options: Record<string, unknown>): policyevaluation {\n const kind = step.kind;\n if (kind === \"querytabs\" || kind === \"closepattern\") {\n const querycheck = validatetabquery(options.tabquery);\n if (!querycheck.allowed) return querycheck;\n if (kind === \"closepattern\" && options.reviewed !== true) return { allowed: false, reason: \"The close pattern needs the explicit reviewed flag before any tab closes.\" };\n }\n if (kind === \"duplicatetab\" || kind === \"pintab\" || kind === \"mutetab\" || kind === \"movetab\" || kind === \"movetabwindow\" || kind === \"badgetab\" || kind === \"attachmeta\") {\n if (!isnumericid(step.value)) return { allowed: false, reason: \"A numeric browser tab id is required.\" };\n }\n if (kind === \"focuswindow\" || kind === \"maximizewindow\" || kind === \"minimizewindow\" || kind === \"restorewindow\") {\n if (!isnumericid(step.value)) return { allowed: false, reason: \"A numeric browser window id is required.\" };\n }\n if (kind === \"pintab\" && typeof options.pinned !== \"boolean\") return { allowed: false, reason: \"A reviewed pinned flag is required in options.\" };\n if (kind === \"mutetab\" && typeof options.muted !== \"boolean\") return { allowed: false, reason: \"A reviewed muted flag is required in options.\" };\n if (kind === \"movetab\") {\n if (typeof options.index !== \"number\" || !Number.isInteger(options.index) || options.index < 0) return { allowed: false, reason: \"A reviewed non-negative target index is required in options.\" };\n }\n if (kind === \"movetabwindow\") {\n if (typeof options.windowid !== \"number\" || !Number.isInteger(options.windowid) || options.windowid < 0) return { allowed: false, reason: \"A reviewed target window id is required in options.\" };\n }\n if (kind === \"grouptabs\") {\n const group = options.group;\n if (!group || typeof group !== \"object\" || Array.isArray(group)) return { allowed: false, reason: \"A reviewed group with a name is required in options.\" };\n const spec = group as Record<string, unknown>;\n if (!isnonempty(spec.name)) return { allowed: false, reason: \"The reviewed group needs a non-empty name.\" };\n if (!validategroupcolor(spec.color)) return { allowed: false, reason: \"The reviewed group color must be a Chromium tab group color.\" };\n if (!validateidlist(spec, \"tabids\")) return { allowed: false, reason: \"The reviewed group needs a non-empty list of member tab ids.\" };\n }\n if (kind === \"colorgroup\") {\n if (!isnonempty(options.name)) return { allowed: false, reason: \"A reviewed group name is required in options.\" };\n if (!validategroupcolor(options.color)) return { allowed: false, reason: \"The reviewed group color must be a Chromium tab group color.\" };\n }\n if (kind === \"collapsegroup\") {\n if (!isnonempty(options.name)) return { allowed: false, reason: \"A reviewed group name is required in options.\" };\n if (typeof options.collapsed !== \"boolean\") return { allowed: false, reason: \"A reviewed collapsed flag is required in options.\" };\n }\n if (kind === \"discardtab\" || kind === \"reloadtabs\") {\n if (!isnumericid(step.value) && !validateidlist(options, \"tabs\")) return { allowed: false, reason: \"A numeric tab id or a reviewed list of tab ids is required.\" };\n }\n if (kind === \"zoomin\" || kind === \"zoomout\") {\n if (options.step !== undefined && (typeof options.step !== \"number\" || !Number.isFinite(options.step) || options.step <= 0)) return { allowed: false, reason: \"The reviewed zoom step must be a positive number with no code ceiling.\" };\n if (step.value !== undefined && step.value !== \"\" && !isnumericid(step.value)) return { allowed: false, reason: \"The reviewed zoom target must be a numeric tab id.\" };\n }\n if (kind === \"switchtab\") {\n if (options.direction !== \"next\" && options.direction !== \"previous\") return { allowed: false, reason: \"A reviewed switch direction of next or previous is required in options.\" };\n }\n if (kind === \"restorewindow\") {\n const bounds = options.bounds;\n if (bounds !== undefined) {\n if (!bounds || typeof bounds !== \"object\" || Array.isArray(bounds)) return { allowed: false, reason: \"The reviewed window bounds must be an object.\" };\n const shape = bounds as Record<string, unknown>;\n for (const field of [\"left\", \"top\", \"width\", \"height\"]) {\n if (typeof shape[field] !== \"number\" || !Number.isFinite(shape[field])) return { allowed: false, reason: \"The reviewed window bounds need numeric left, top, width and height.\" };\n }\n }\n }\n if (kind === \"scratchwindow\") {\n if (step.value !== undefined && step.value !== \"\" && !ishttpsurl(step.value)) return { allowed: false, reason: \"The reviewed scratch window url must use HTTPS.\" };\n }\n if (kind === \"incognitowindow\" && !ishttpsurl(step.value)) return { allowed: false, reason: \"A reviewed HTTPS url is required to open an incognito window.\" };\n if (kind === \"restoretab\" && step.value !== undefined && step.value !== \"\" && !ishttpsurl(step.value)) return { allowed: false, reason: \"The reviewed restore url must use HTTPS.\" };\n if (kind === \"savelayout\" || kind === \"restorelayout\") {\n if (!isnonempty(options.name)) return { allowed: false, reason: \"A reviewed layout name is required in options.\" };\n }\n if (kind === \"badgetab\") {\n if (!isnonempty(options.label)) return { allowed: false, reason: \"A reviewed badge label is required in options.\" };\n if (options.taskid !== undefined && !isnonempty(options.taskid)) return { allowed: false, reason: \"The reviewed badge task id must be a non-empty string.\" };\n }\n if (kind === \"attachmeta\") {\n const labels = options.labels;\n const taskrefs = options.taskrefs;\n const haslabels = Array.isArray(labels) && labels.length > 0 && labels.every(label => isnonempty(label));\n const hastaskrefs = Array.isArray(taskrefs) && taskrefs.length > 0 && taskrefs.every(ref => isnonempty(ref));\n if (!haslabels && !hastaskrefs) return { allowed: false, reason: \"Reviewed labels or task refs are required in options to attach metadata.\" };\n if (options.provenance !== undefined && !isnonempty(options.provenance)) return { allowed: false, reason: \"The reviewed provenance must be a non-empty string.\" };\n }\n if (kind === \"reopenrun\" && !isnonempty(options.run)) return { allowed: false, reason: \"A reviewed run id is required in options to reopen its tabs.\" };\n return { allowed: true };\n}\n\n/** Validates a single proposal against the active tab origin and local policy. */\nexport function validatestep(step: toolstep, origin: string): policyevaluation {\n if (!allowedactions.has(step.kind)) return { allowed: false, reason: \"Unsupported action kind.\" };\n if (!step.summary.trim()) return { allowed: false, reason: \"A human-readable action summary is required.\" };\n let options: Record<string, unknown>;\n try { options = parseoptions(step); } catch { return { allowed: false, reason: \"Step options must be a JSON object.\" }; }\n const hastargetref = options.targetref !== undefined;\n if (targetactions.has(step.kind) && !step.target?.trim() && !hastargetref) return { allowed: false, reason: \"A page target is required.\" };\n if (valueactions.has(step.kind) && !step.value?.trim()) return { allowed: false, reason: \"A reviewed value is required.\" };\n if (step.kind === \"select\" && !step.value?.trim()) return { allowed: false, reason: \"A reviewed option value is required.\" };\n if (step.kind === \"navigate\" && !step.value) return { allowed: false, reason: \"A navigation URL is required.\" };\n if (hastargetref) {\n const reference = validatetargetref(options.targetref);\n if (!reference.allowed) return reference;\n }\n if (step.kind === \"wait\") {\n try { waitduration(step); } catch { return { allowed: false, reason: \"Wait duration must be zero or a positive number of milliseconds.\" }; }\n }\n if (step.kind === \"navigate\") {\n try {\n if (new URL(step.value ?? \"\").origin !== origin) return { allowed: false, reason: \"Navigation must remain within the approved origin.\" };\n } catch {\n return { allowed: false, reason: \"Navigation URL is invalid.\" };\n }\n }\n if (step.kind === \"tabcreate\" || step.kind === \"windowcreate\" || step.kind === \"downloadfile\") {\n try {\n const url = new URL(step.value ?? \"\");\n if (url.protocol !== \"https:\") return { allowed: false, reason: \"The reviewed URL must use HTTPS.\" };\n } catch {\n return { allowed: false, reason: \"The reviewed URL is invalid.\" };\n }\n }\n if (step.kind === \"tabactivate\" || step.kind === \"tabclose\" || step.kind === \"tabreload\" || step.kind === \"windowclose\" || step.kind === \"windowresize\") {\n if (!isnumericid(step.value)) return { allowed: false, reason: \"A numeric browser id is required.\" };\n }\n if (step.kind === \"zoomset\") {\n const zoom = Number(step.value);\n if (!Number.isFinite(zoom) || zoom <= 0) return { allowed: false, reason: \"The reviewed zoom must be a positive number.\" };\n }\n if (step.kind === \"setattribute\" || step.kind === \"writestorage\") {\n const keyname = step.kind === \"setattribute\" ? \"name\" : \"key\";\n if (typeof options[keyname] !== \"string\" || !(options[keyname] as string).trim()) return { allowed: false, reason: `A reviewed ${keyname} is required in options.` };\n if (typeof options.value !== \"string\") return { allowed: false, reason: \"A reviewed value is required in options.\" };\n }\n if (step.kind === \"windowresize\") {\n if (typeof options.width !== \"number\" || typeof options.height !== \"number\" || !Number.isFinite(options.width) || !Number.isFinite(options.height)) return { allowed: false, reason: \"Reviewed width and height numbers are required in options.\" };\n }\n if ((step.kind === \"scrollpage\" || step.kind === \"scrollby\") && (!numericoption(options, \"x\") || !numericoption(options, \"y\"))) return { allowed: false, reason: \"Scroll amounts must be numbers in options.\" };\n if (step.kind === \"waitfor\" && options.timeout !== undefined && (typeof options.timeout !== \"number\" || options.timeout < 0)) return { allowed: false, reason: \"The waitfor timeout must be zero or a positive number of milliseconds.\" };\n if (step.kind === \"movepointer\") {\n const path = options.pointpath;\n if (!path || typeof path !== \"object\" || Array.isArray(path)) return { allowed: false, reason: \"A reviewed pointpath with start and end points is required in options.\" };\n const points = path as Record<string, unknown>;\n if (!ispoint(points.start) || !ispoint(points.end)) return { allowed: false, reason: \"The reviewed pointpath needs numeric start and end points.\" };\n if (points.waypoints !== undefined && (!Array.isArray(points.waypoints) || !points.waypoints.every(waypoint => ispoint(waypoint)))) return { allowed: false, reason: \"The reviewed pointpath waypoints must be numeric points.\" };\n if (!nonnegativeoption(points, \"duration\")) return { allowed: false, reason: \"The reviewed pointpath duration must be zero or a positive number of milliseconds.\" };\n const speed = options.speedprofile;\n if (speed !== undefined) {\n if (!speed || typeof speed !== \"object\" || Array.isArray(speed)) return { allowed: false, reason: \"The reviewed speed profile must be an object.\" };\n const profile = speed as Record<string, unknown>;\n if (profile.easing !== undefined && profile.easing !== \"linear\" && profile.easing !== \"easeinout\") return { allowed: false, reason: \"The reviewed easing must be linear or easeinout.\" };\n if (!nonnegativeoption(profile, \"peak\")) return { allowed: false, reason: \"The reviewed peak velocity must be zero or a positive number.\" };\n if (!nonnegativeoption(profile, \"jitter\")) return { allowed: false, reason: \"The reviewed jitter window must be zero or a positive number of milliseconds.\" };\n }\n }\n if (step.kind === \"clickpoint\" && (!hastargetref || (options.targetref as Record<string, unknown>).mode !== \"point\")) return { allowed: false, reason: \"A reviewed point target reference is required in options.\" };\n if (step.kind === \"clicktext\" && (!hastargetref || (options.targetref as Record<string, unknown>).mode !== \"text\")) return { allowed: false, reason: \"A reviewed text target reference is required in options.\" };\n if (step.kind === \"clickaria\" && (!hastargetref || (options.targetref as Record<string, unknown>).mode !== \"aria\")) return { allowed: false, reason: \"A reviewed aria target reference is required in options.\" };\n if (step.kind === \"clickname\" && (!hastargetref || (options.targetref as Record<string, unknown>).mode !== \"name\")) return { allowed: false, reason: \"A reviewed name target reference is required in options.\" };\n if (step.kind === \"resolvexpath\" && (!hastargetref || (options.targetref as Record<string, unknown>).mode !== \"xpath\")) return { allowed: false, reason: \"A reviewed xpath target reference is required in options.\" };\n if (step.kind === \"typetime\" && options.delay !== undefined && (typeof options.delay !== \"number\" || !Number.isFinite(options.delay) || options.delay < 0)) return { allowed: false, reason: \"The reviewed per keystroke delay must be zero or a positive number of milliseconds.\" };\n if (step.kind === \"submitsearch\") {\n if (!isnonempty(options.results)) return { allowed: false, reason: \"A reviewed results region selector is required in options.\" };\n if (options.timeout !== undefined && (typeof options.timeout !== \"number\" || !Number.isFinite(options.timeout) || options.timeout < 0)) return { allowed: false, reason: \"The submitsearch timeout must be zero or a positive number of milliseconds.\" };\n }\n if (step.kind === \"selectmulti\") {\n const values = options.values;\n if (!Array.isArray(values) || values.length === 0 || !values.every(value => isnonempty(value))) return { allowed: false, reason: \"A reviewed list of option values is required in options.\" };\n }\n if (step.kind === \"setslider\") {\n const slider = Number(step.value);\n if (!Number.isFinite(slider)) return { allowed: false, reason: \"The reviewed slider value must be a number.\" };\n }\n if (step.kind === \"setdate\" && !/^\\d{4}-\\d{2}-\\d{2}$/.test(step.value ?? \"\")) return { allowed: false, reason: \"The reviewed date must use the yyyy-mm-dd form.\" };\n if (step.kind === \"setcolor\" && !/^#[0-9a-fA-F]{6}$/.test(step.value ?? \"\")) return { allowed: false, reason: \"The reviewed color must use the #rrggbb form.\" };\n if (step.kind === \"keyhold\" && options.holdid !== undefined && !isnonempty(options.holdid)) return { allowed: false, reason: \"The reviewed hold id must be a non-empty string.\" };\n if (step.kind === \"dismissdialog\") {\n const accept = options.accept;\n const answer = options.answer;\n if (accept === undefined && !isnonempty(answer)) return { allowed: false, reason: \"A reviewed accept flag or prompt answer is required in options.\" };\n if (accept !== undefined && typeof accept !== \"boolean\") return { allowed: false, reason: \"The reviewed dialog accept flag must be a boolean.\" };\n if (answer !== undefined && !isnonempty(answer)) return { allowed: false, reason: \"The reviewed prompt answer must be a non-empty string.\" };\n }\n if (step.kind === \"pierceshadow\" && options.shadow !== undefined) {\n if (!Array.isArray(options.shadow) || !options.shadow.every(item => isnonempty(item))) return { allowed: false, reason: \"The reviewed shadow path must be a list of non-empty selectors.\" };\n }\n if (step.kind === \"enterframe\") {\n const path = options.framepath;\n if (!Array.isArray(path) || path.length === 0 || !path.every(item => typeof item === \"number\" && Number.isInteger(item) && item >= 0)) return { allowed: false, reason: \"A reviewed frame path of frame indexes is required in options.\" };\n return validateinnerstep(options, origin);\n }\n if (step.kind === \"retryaction\") {\n const inner = validateinnerstep(options, origin);\n if (!inner.allowed) return inner;\n const rule = options.retryrule;\n if (!rule || typeof rule !== \"object\" || Array.isArray(rule)) return { allowed: false, reason: \"A reviewed retry rule with attempts is required in options.\" };\n const retry = rule as Record<string, unknown>;\n if (typeof retry.attempts !== \"number\" || !Number.isInteger(retry.attempts) || retry.attempts < 1) return { allowed: false, reason: \"The reviewed retry attempts must be a positive integer with no code ceiling.\" };\n if (!nonnegativeoption(retry, \"settle\")) return { allowed: false, reason: \"The reviewed retry settle window must be zero or a positive number of milliseconds.\" };\n if (!nonnegativeoption(retry, \"tolerance\")) return { allowed: false, reason: \"The reviewed retry movement tolerance must be zero or a positive number of pixels.\" };\n }\n if (watchactions.has(step.kind)) {\n if (typeof options.lifetime !== \"number\" || !Number.isFinite(options.lifetime) || options.lifetime <= 0) return { allowed: false, reason: \"A reviewed watch lifetime window in milliseconds is required in options.\" };\n if (options.scopes !== undefined && (!Array.isArray(options.scopes) || !options.scopes.every(scope => isnonempty(scope)))) return { allowed: false, reason: \"The reviewed watch scopes must be a list of non-empty selectors.\" };\n if (options.events !== undefined && (!Array.isArray(options.events) || !options.events.every(event => isnonempty(event)))) return { allowed: false, reason: \"The reviewed watch event kinds must be a list of non-empty strings.\" };\n if (!nonnegativeoption(options, \"poll\")) return { allowed: false, reason: \"The reviewed watch poll interval must be zero or a positive number of milliseconds.\" };\n }\n if (step.kind === \"waitquiet\") {\n const rule = options.quietrule;\n if (!rule || typeof rule !== \"object\" || Array.isArray(rule)) return { allowed: false, reason: \"A reviewed quietrule with an idle threshold is required in options.\" };\n const quiet = rule as Record<string, unknown>;\n if (typeof quiet.idle !== \"number\" || !Number.isFinite(quiet.idle) || quiet.idle <= 0) return { allowed: false, reason: \"The reviewed quiet idle threshold must be a positive number of milliseconds with no code ceiling.\" };\n if (!nonnegativeoption(quiet, \"poll\")) return { allowed: false, reason: \"The reviewed quiet poll interval must be zero or a positive number of milliseconds.\" };\n if (!nonnegativeoption(quiet, \"timeout\")) return { allowed: false, reason: \"The reviewed quiet timeout must be zero or a positive number of milliseconds.\" };\n }\n if (step.kind === \"diffsnapshots\") {\n const versions = options.versions;\n if (!Array.isArray(versions) || versions.length !== 2 || !versions.every(version => typeof version === \"number\" && Number.isInteger(version) && version >= 1)) return { allowed: false, reason: \"Two reviewed observation version numbers are required in options.\" };\n }\n if (step.kind === \"openlink\" || step.kind === \"openprivate\" || step.kind === \"deeplink\") {\n const targetcheck = validatenavtarget(options.navtarget, step.kind);\n if (!targetcheck.allowed) return targetcheck;\n if (step.kind === \"deeplink\") {\n const app = options.app;\n if (!isnonempty(app)) return { allowed: false, reason: \"A reviewed deep link app pattern is required in options.\" };\n const params = options.params;\n if (params !== undefined && (!params || typeof params !== \"object\" || Array.isArray(params) || !Object.values(params).every(item => typeof item === \"string\"))) return { allowed: false, reason: \"The reviewed deep link params must be an object of string values.\" };\n }\n }\n if (step.kind === \"waitload\" && !nonnegativeoption(options, \"timeout\")) return { allowed: false, reason: \"The waitload timeout must be zero or a positive number of milliseconds.\" };\n if (step.kind === \"waiturl\" || step.kind === \"spawait\") {\n if (step.kind === \"waiturl\") {\n const patterncheck = validateurlpattern(options.urlpattern);\n if (!patterncheck.allowed) return patterncheck;\n }\n if (!nonnegativeoption(options, \"timeout\")) return { allowed: false, reason: \"The wait timeout must be zero or a positive number of milliseconds.\" };\n if (!nonnegativeoption(options, \"poll\")) return { allowed: false, reason: \"The wait poll interval must be zero or a positive number of milliseconds.\" };\n }\n if (step.kind === \"followlink\") {\n if (options.fragment !== undefined && typeof options.fragment !== \"boolean\") return { allowed: false, reason: \"The reviewed followlink fragment flag must be a boolean.\" };\n }\n if (step.kind === \"spanav\") {\n if (options.routepattern !== undefined) {\n const routecheck = validateurlpattern(options.routepattern);\n if (!routecheck.allowed) return routecheck;\n }\n if (!nonnegativeoption(options, \"timeout\")) return { allowed: false, reason: \"The spanav route timeout must be zero or a positive number of milliseconds.\" };\n }\n if (step.kind === \"rewritequery\") {\n const set = options.set;\n const remove = options.remove;\n if (set === undefined && remove === undefined) return { allowed: false, reason: \"Reviewed query parameters to set or remove are required in options.\" };\n if (set !== undefined && (!set || typeof set !== \"object\" || Array.isArray(set) || !Object.values(set).every(item => typeof item === \"string\"))) return { allowed: false, reason: \"The reviewed query parameters to set must be an object of string values.\" };\n if (remove !== undefined && (!Array.isArray(remove) || !remove.every(item => isnonempty(item)))) return { allowed: false, reason: \"The reviewed query parameters to remove must be a list of non-empty names.\" };\n }\n if (step.kind === \"navlist\") {\n const listcheck = validateurllist(options, \"urls\");\n if (!listcheck.allowed) return listcheck;\n }\n if (step.kind === \"navprofile\") {\n const profilecheck = validatewaitprofile(options.waitprofile);\n if (!profilecheck.allowed) return profilecheck;\n }\n if (step.kind === \"handleauth\" && !ishttpsurl(step.value)) return { allowed: false, reason: \"A reviewed HTTPS origin or url is required as the auth target.\" };\n if (step.kind === \"printpdf\" && options.name !== undefined && !isnonempty(options.name)) return { allowed: false, reason: \"The reviewed artifact name must be a non-empty string.\" };\n if (step.kind === \"prefetch\") {\n const listcheck = validateurllist(options, \"urls\");\n if (!listcheck.allowed) return listcheck;\n }\n if (step.kind === \"preconnect\") {\n const origins = options.origins;\n if (!Array.isArray(origins) || origins.length === 0 || !origins.every(originurl => ishttpsurl(originurl))) return { allowed: false, reason: \"A reviewed non-empty list of HTTPS origins is required in options.\" };\n }\n if (step.kind === \"reopentab\" && step.value !== undefined && !ishttpsurl(step.value)) return { allowed: false, reason: \"The reviewed reopen url must use HTTPS.\" };\n if (step.kind === \"navrate\") {\n const limitcheck = validateratelimit(options.ratelimit);\n if (!limitcheck.allowed) return limitcheck;\n }\n if (step.kind === \"checksafe\" && !ishttpsurl(step.value)) return { allowed: false, reason: \"A reviewed HTTPS url is required for the safety check.\" };\n if (step.kind === \"batchopen\") {\n const listcheck = validateurllist(options, \"urls\");\n if (!listcheck.allowed) return listcheck;\n }\n if (istabscommandkind(step.kind)) {\n const tabscheck = validatetabsgrammar(step, options);\n if (!tabscheck.allowed) return tabscheck;\n }\n if (step.kind === \"tabcreate\") {\n if (options.background !== undefined && typeof options.background !== \"boolean\") return { allowed: false, reason: \"The reviewed background flag must be a boolean.\" };\n if (options.window !== undefined && (typeof options.window !== \"number\" || !Number.isInteger(options.window) || options.window < 0)) return { allowed: false, reason: \"The reviewed target window id must be a non-negative integer.\" };\n }\n if (step.kind === \"windowcreate\") {\n for (const field of [\"left\", \"top\", \"width\", \"height\"]) {\n if (options[field] !== undefined && (typeof options[field] !== \"number\" || !Number.isFinite(options[field]))) return { allowed: false, reason: `The reviewed window ${field} must be a number.` };\n }\n if (options.state !== undefined && ![\"normal\", \"maximized\", \"minimized\", \"fullscreen\"].includes(options.state as string)) return { allowed: false, reason: \"The reviewed window state must be normal, maximized, minimized or fullscreen.\" };\n }\n return { allowed: true };\n}\n\n/** Shared session gate: a live, unpaused session that still matches the active tab. */\nfunction sessiongate(input: { session: agentsession | undefined; tabid: number; origin: string; now: number; action: string }): policyevaluation {\n if (!input.session || input.session.stoppedat) return { allowed: false, reason: \"No active browser session exists.\" };\n if (input.session.expiresat <= input.now) return { allowed: false, reason: \"The browser session has expired.\" };\n if (input.session.pausedat) return { allowed: false, reason: `The browser session is paused and cannot ${input.action}.` };\n if (input.session.tabid !== input.tabid || input.session.origin !== input.origin) return { allowed: false, reason: `The ${input.action} is outside the approved tab or origin.` };\n return { allowed: true };\n}\n\n/** Applies the consent gate immediately before an action reaches the page bridge. */\nexport function canexecute(input: { session: agentsession | undefined; plan: agentplan | undefined; step: toolstep; tabid: number; origin: string; now?: number; verdicts?: safetyverdict[] }): policyevaluation {\n const now = input.now ?? Date.now();\n const gate = sessiongate({ session: input.session, tabid: input.tabid, origin: input.origin, now, action: \"execute an action\" });\n if (!gate.allowed) return gate;\n if (!input.plan || input.plan.state !== \"approved\") return { allowed: false, reason: \"The plan has not received explicit approval.\" };\n if (input.plan.expiresat <= now) return { allowed: false, reason: \"The approved plan has expired.\" };\n if ((input.step.kind === \"pierceshadow\" || input.step.kind === \"enterframe\") && !origingranted(input.session, input.origin)) return { allowed: false, reason: \"The shadow or frame step is outside the session origin grants.\" };\n if (input.step.kind === \"readjson\" && !origingranted(input.session, input.origin)) return { allowed: false, reason: \"The json state read is outside the session origin grants.\" };\n if (input.step.kind === \"navlist\") {\n let options: Record<string, unknown> = {};\n try { options = parseoptions(input.step); } catch { options = {}; }\n for (const url of Array.isArray(options.urls) ? options.urls : []) {\n if (typeof url !== \"string\") continue;\n const navigation = navigationgranted(input.session, url);\n if (!navigation.allowed) return navigation;\n }\n }\n if (islayoutkind(input.step.kind) && !layoutmutationgranted(input.session, now).allowed) return { allowed: false, reason: \"Group and layout mutations stay inside the active session.\" };\n if (input.step.kind === \"openlink\" || input.step.kind === \"openprivate\" || input.step.kind === \"batchopen\" || input.step.kind === \"prefetch\" || input.step.kind === \"deeplink\" || input.step.kind === \"reopentab\") {\n let options: Record<string, unknown> = {};\n try { options = parseoptions(input.step); } catch { options = {}; }\n const grammar = validatestep(input.step, input.origin);\n if (!grammar.allowed) return grammar;\n const grants = input.session?.grants ?? [input.session?.origin ?? input.origin];\n const targets: unknown[] = input.step.kind === \"batchopen\" || input.step.kind === \"prefetch\" ? (Array.isArray(options.urls) ? options.urls : []) : input.step.kind === \"reopentab\" ? [input.step.value] : [(options.navtarget as Record<string, unknown> | undefined)?.url];\n for (const target of targets) {\n if (typeof target !== \"string\" || !target) continue;\n const verified = originverified(target, grants, input.verdicts ?? []);\n if (!verified.allowed) return verified;\n }\n }\n return validatestep(input.step, input.origin);\n}\n\n/** Allows a non-mutating, temporary target preview during plan review. */\nexport function canpreview(input: { session: agentsession | undefined; plan: agentplan | undefined; step: toolstep; tabid: number; origin: string; now?: number }): policyevaluation {\n const now = input.now ?? Date.now();\n const gate = sessiongate({ session: input.session, tabid: input.tabid, origin: input.origin, now, action: \"preview a target\" });\n if (!gate.allowed) return gate;\n if (!input.plan || ![\"pending\", \"approved\"].includes(input.plan.state)) return { allowed: false, reason: \"Only a reviewed pending or approved plan can be previewed.\" };\n if (input.plan.expiresat <= now) return { allowed: false, reason: \"The reviewed plan has expired.\" };\n let options: Record<string, unknown> = {};\n try { options = parseoptions(input.step); } catch { options = {}; }\n if (!targetactions.has(input.step.kind) && options.targetref === undefined) return { allowed: false, reason: \"Only a target-based action can be previewed.\" };\n return validatestep(input.step, input.origin);\n}\n", "import type { tabgrouprecord, tablayout, tabquery, tabwatchevent, toolstep } from \"../types.js\";\nimport { parseoptions } from \"../policy.js\";\nimport { assigntasktab, tasktabs } from \"../progress.js\";\nimport type { planprogress } from \"../types.js\";\n\n/**\n * Tabs and windows command logics for reviewed steps.\n * Every correlated rule for tab queries, clone detection, group membership, layouts, snapshots, watchers, badges, discard candidates, switcher order, zoom steps and the task tab budget lives in this file.\n */\n\n/** One serializable live tab shape resolved against the browser tab set. */\nexport interface tabshape {\n tabid: number;\n url: string;\n title: string;\n index: number;\n windowid: number;\n active: boolean;\n pinned: boolean;\n audible: boolean;\n muted: boolean;\n discarded: boolean;\n}\n\n/** One serializable live window shape with bounds, state and profile kind. */\nexport interface windowshape {\n windowid: number;\n left: number;\n top: number;\n width: number;\n height: number;\n state: \"normal\" | \"maximized\" | \"minimized\" | \"fullscreen\";\n incognito: boolean;\n focused: boolean;\n}\n\n/** Reads the reviewed tabquery of a tabs and windows command step; null when the step reviews none. */\nexport function parsetabquery(step: toolstep): tabquery | null {\n let options: Record<string, unknown> = {};\n try { options = parseoptions(step); } catch { options = {}; }\n const value = options.tabquery;\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return null;\n const query = value as Record<string, unknown>;\n return {\n ...(typeof query.url === \"string\" && query.url ? { url: query.url } : {}),\n ...(typeof query.title === \"string\" && query.title ? { title: query.title } : {}),\n ...(typeof query.id === \"number\" && Number.isInteger(query.id) && query.id >= 0 ? { id: query.id } : {}),\n ...(typeof query.pattern === \"string\" && query.pattern ? { pattern: query.pattern } : {}),\n };\n}\n\n/** Matches one reviewed wildcard pattern against a url; `*` spans one path segment and `**` spans any part. */\nexport function tabpatternmatches(pattern: string, url: string): boolean {\n const source = pattern.split(\"**\").map(part => part.split(\"*\").map(piece => piece.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")).join(\"[^/]*\")).join(\".*\");\n return new RegExp(`^${source}$`).test(url);\n}\n\n/** Resolves one reviewed tabquery against the live tab set: every matcher that exists must hold. */\nexport function querymatches(query: tabquery, tabs: tabshape[]): tabshape[] {\n return tabs.filter(tab => {\n if (query.id !== undefined && tab.tabid !== query.id) return false;\n if (query.url !== undefined && tab.url !== query.url) return false;\n if (query.title !== undefined && !tab.title.toLowerCase().includes(query.title.toLowerCase())) return false;\n if (query.pattern !== undefined && !tabpatternmatches(query.pattern, tab.url)) return false;\n return true;\n });\n}\n\n/** Normalizes one url for clone comparison by dropping the fragment and trailing slashes. */\nexport function normalizedtaburl(url: string): string {\n let normalized = url;\n const hash = normalized.indexOf(\"#\");\n if (hash >= 0) normalized = normalized.slice(0, hash);\n while (normalized.length > 1 && normalized.endsWith(\"/\")) normalized = normalized.slice(0, -1);\n return normalized;\n}\n\n/** One clone warning: a normalized url shared by more than one open tab. */\nexport interface clonewarning {\n url: string;\n tabids: number[];\n}\n\n/** Detects duplicate tabs by normalized url comparison and returns every url held by more than one tab. */\nexport function clonetabs(tabs: tabshape[]): clonewarning[] {\n const groups = new Map<string, number[]>();\n for (const tab of tabs) {\n if (!tab.url) continue;\n const key = normalizedtaburl(tab.url);\n groups.set(key, [...(groups.get(key) ?? []), tab.tabid]);\n }\n return [...groups.entries()].filter(([, tabids]) => tabids.length > 1).map(([url, tabids]) => ({ url, tabids }));\n}\n\n/** Searches across open tabs by title and url, case insensitive, returning matches in live order. */\nexport function searchtabmatches(tabs: tabshape[], text: string): tabshape[] {\n const needle = text.trim().toLowerCase();\n if (!needle) return [];\n return tabs.filter(tab => tab.title.toLowerCase().includes(needle) || tab.url.toLowerCase().includes(needle));\n}\n\n/** Lists the tabs that are playing audio: audible or muted but still playing. */\nexport function audiotabs(tabs: tabshape[]): tabshape[] {\n return tabs.filter(tab => tab.audible || (tab.muted && tab.audible));\n}\n\n/** Returns the inactive, unpinned and not yet discarded tabs a discardtab step may release. */\nexport function discardcandidates(tabs: tabshape[]): tabshape[] {\n return tabs.filter(tab => !tab.active && !tab.pinned && !tab.discarded && tab.url.length > 0);\n}\n\n/** Restores discarded tabs on demand without losing their urls; every discarded tab keeps its url for reload. */\nexport function restorediscarded(tabs: tabshape[]): Array<{ tabid: number; url: string }> {\n return tabs.filter(tab => tab.discarded && tab.url.length > 0).map(tab => ({ tabid: tab.tabid, url: tab.url }));\n}\n\n/** Captures one tab layout with name, tabs, groups, positions and window bounds from the live browser state. */\nexport function buildlayout(name: string, tabs: tabshape[], windows: windowshape[], groups: tabgrouprecord[], scratchwindowids: number[], at: number): tablayout {\n return {\n name,\n tabs: tabs.map(tab => ({ url: tab.url, title: tab.title, pinned: tab.pinned, index: tab.index, windowid: tab.windowid })),\n groups: groups.map(group => ({ name: group.name, color: group.color, tabids: group.tabids.filter(tabid => tabs.some(tab => tab.tabid === tabid)), collapsed: group.collapsed })),\n windows: windows.map(item => ({ windowid: item.windowid, state: { bounds: { left: item.left, top: item.top, width: item.width, height: item.height }, maximized: item.state === \"maximized\", profile: item.incognito ? \"incognito\" : scratchwindowids.includes(item.windowid) ? \"scratch\" : \"normal\" } })),\n savedat: at,\n };\n}\n\n/** Plans the restore of one saved layout: only urls that are not already open come back, in layout order. */\nexport function layoutrestoreplan(layout: tablayout, openurls: string[]): string[] {\n const open = new Set(openurls.map(url => normalizedtaburl(url)));\n return layout.tabs.map(tab => tab.url).filter(url => url.length > 0 && !open.has(normalizedtaburl(url)));\n}\n\n/** Keeps tabgroup membership through moves: member ids survive, their order follows the live tab order and closed members drop out. */\nexport function regroupaftermoves(groups: tabgrouprecord[], tabs: tabshape[], at: number): tabgrouprecord[] {\n const order = new Map(tabs.map(tab => [tab.tabid, tab.index]));\n return groups.map(group => {\n const members = group.tabids.filter(tabid => order.has(tabid));\n if (members.length === 0) return group;\n const ordered = [...members].sort((left, right) => (order.get(left) ?? 0) - (order.get(right) ?? 0));\n return ordered.length === group.tabids.length && ordered.every((tabid, index) => tabid === group.tabids[index]) ? group : { ...group, tabids: ordered, savedat: at };\n });\n}\n\n/** Renames one stored tab group while keeping its color choice, member tabs and collapse state. */\nexport function renamegroup(groups: tabgrouprecord[], name: string, newname: string, at: number): tabgrouprecord[] {\n return groups.map(group => group.name === name ? { ...group, name: newname, savedat: at } : group);\n}\n\n/** Counts the task tabs that live inside one window so the close gate can demand review. */\nexport function tasktabsinwindow(tabs: tabshape[], windowid: number, tasktabids: number[]): number {\n const tasks = new Set(tasktabids);\n return tabs.filter(tab => tab.windowid === windowid && tasks.has(tab.tabid)).length;\n}\n\n/** Selects the tabs a reviewed closepattern may close; the session tab itself is always refused protection. */\nexport function closeselection(query: tabquery, tabs: tabshape[], sessiontabid: number): { targets: tabshape[]; refused: tabshape[] } {\n const matches = querymatches(query, tabs);\n return {\n targets: matches.filter(tab => tab.tabid !== sessiontabid),\n refused: matches.filter(tab => tab.tabid === sessiontabid),\n };\n}\n\n/** Applies one reviewed zoom step with no code ceiling; a step never crosses zero, so it keeps the current zoom instead. */\nexport function zoomstep(current: number, direction: \"in\" | \"out\", step: number): number {\n const next = direction === \"in\" ? current + step : current - step;\n return next > 0 ? Number(next.toFixed(4)) : current;\n}\n\n/** Resolves the neighbor tab index a switchtab step activates, wrapping at both ends of the window. */\nexport function switchtarget(tabs: tabshape[], direction: \"next\" | \"previous\", currentindex: number): number | undefined {\n if (tabs.length === 0) return undefined;\n const offset = direction === \"next\" ? 1 : -1;\n return (currentindex + offset + tabs.length) % tabs.length;\n}\n\n/** Orders the quick switcher list by recency with filter keys; unseen tabs follow in live index order. */\nexport function switcherlist(tabs: tabshape[], recency: Array<{ tabid: number; at: number }>, filter: string): tabshape[] {\n const needle = filter.trim().toLowerCase();\n const matches = needle ? tabs.filter(tab => tab.title.toLowerCase().includes(needle) || tab.url.toLowerCase().includes(needle)) : [...tabs];\n const lastrun = new Map(recency.map(entry => [entry.tabid, entry.at]));\n return [...matches].sort((left, right) => {\n const leftat = lastrun.get(left.tabid) ?? -1;\n const rightat = lastrun.get(right.tabid) ?? -1;\n if (leftat !== rightat) return rightat - leftat;\n return left.index - right.index;\n });\n}\n\n/** Dispatches the tab events of one watchtab registration into the step result, honoring the reviewed event filters. */\nexport function watchtabdispatch(events: tabwatchevent[], watchid: string, filters: string[]): tabwatchevent[] {\n const allowed = filters.length > 0 ? new Set(filters) : undefined;\n return events.filter(event => event.watchid === watchid && (allowed === undefined || allowed.has(event.event)));\n}\n\n/** Computes the per task badge from the live progress state of the task. */\nexport function badgefromprogress(completed: number, total: number): { label: string; done: boolean } {\n if (total <= 0) return { label: \"idle\", done: false };\n if (completed >= total) return { label: \"done\", done: true };\n return { label: `${completed}/${total}`, done: false };\n}\n\n/** Grades the concurrent task tab budget: a user configured ceiling refuses, an absent ceiling never refuses. */\nexport function tasktabgauge(used: number, ceiling: number | undefined): { used: number; ceiling: number | undefined; over: boolean } {\n return { used, ceiling, over: ceiling !== undefined && used > ceiling };\n}\n\n/** True when a window profile inherits the session origin grants; incognito windows stay separated. */\nexport function windowprofilegrants(profile: \"normal\" | \"incognito\" | \"scratch\"): boolean {\n return profile !== \"incognito\";\n}\n\n/** Assigns every task tab of the plan progress, used when tabmeta routing records a tab for the plan steps. */\nexport function assigntasktabs(progress: planprogress | undefined, planid: string, tabids: number[], now: number): planprogress {\n let next = progress;\n for (const tabid of tabids) next = assigntasktab(next, planid, tabid, now);\n return next ?? { planid, completedsteps: [], tasktabs: [], updatedat: now };\n}\n\n/** Returns the task tabs tracked by one plan progress, used for window close review and badge refresh. */\nexport function trackedtasktabs(progress: planprogress | undefined, planid: string): number[] {\n return tasktabs(progress, planid);\n}\n", "import type { a11ycapture, a11ynode, agentplan, artifactrecord, auditevent, bannerreport, capabilityreport, clickablemap, closedtab, controltabstate, curatedlist, derivedselector, diagnosticreport, focusevent, listpattern, mutationevent, navcontrol, navrecord, navqueues, planprogress, ratelimitstate, readercapture, resolvedtarget, retryoutcome, safetyverdict, sessionsnapshot, snapshotdiff, stepoutcome, tabbadge, tabgrouprecord, tablayout, tabmeta, tableshape, toolstep, trailentry, waitprofilerecord } from \"../types.js\";\nimport { switcherlist, type tabshape, type windowshape } from \"./tabscommand.js\";\n\nconst objective = document.querySelector<HTMLTextAreaElement>(\"#objective\");\nconst localbutton = document.querySelector<HTMLButtonElement>(\"#localplan\");\nconst remotebutton = document.querySelector<HTMLButtonElement>(\"#remoteplan\");\nconst diagnosticbutton = document.querySelector<HTMLButtonElement>(\"#diagnostic\");\nconst planroot = document.querySelector<HTMLElement>(\"#plan\");\nconst auditroot = document.querySelector<HTMLElement>(\"#audit\");\nconst diagnosticroot = document.querySelector<HTMLElement>(\"#diagnostics\");\nconst maproot = document.querySelector<HTMLElement>(\"#map\");\nconst a11yroot = document.querySelector<HTMLElement>(\"#a11y\");\nconst readerroot = document.querySelector<HTMLElement>(\"#reader\");\nconst detectionsroot = document.querySelector<HTMLElement>(\"#detections\");\nconst streamroot = document.querySelector<HTMLElement>(\"#stream\");\nconst diffsroot = document.querySelector<HTMLElement>(\"#diffs\");\nconst bannersroot = document.querySelector<HTMLElement>(\"#banners\");\nconst selectorsroot = document.querySelector<HTMLElement>(\"#selectors\");\nconst trailroot = document.querySelector<HTMLElement>(\"#trail\");\nconst navigationroot = document.querySelector<HTMLElement>(\"#navigation\");\nconst tabswindowsroot = document.querySelector<HTMLElement>(\"#tabswindows\");\nconst statusnode = document.querySelector<HTMLElement>(\"#status\");\nconst progressnode = document.querySelector<HTMLProgressElement>(\"#planprogress\");\nconst capabilitiestext = document.querySelector<HTMLElement>(\"#capabilitiestext\");\n\ntype previewresult = { ok: boolean; summary: string; resolvedtarget?: resolvedtarget; candidates?: string[] };\nconst previews = new Map<string, previewresult>();\n\n/** Safely reads the reviewed options object of one step. */\nfunction options(step: toolstep): Record<string, unknown> {\n if (!step.options) return {};\n try {\n const parsed = JSON.parse(step.options);\n return parsed && typeof parsed === \"object\" && !Array.isArray(parsed) ? (parsed as Record<string, unknown>) : {};\n } catch { return {}; }\n}\n\nfunction status(message: string, error = false): void { if (statusnode) { statusnode.textContent = message; statusnode.dataset.state = error ? \"error\" : \"ready\"; } }\nasync function request(message: unknown): Promise<unknown> { const response = await chrome.runtime.sendMessage(message) as { ok: boolean; value?: unknown; error?: string }; if (!response.ok) throw new Error(response.error); return response.value; }\nfunction button(label: string, action: () => Promise<void>, disabled = false): HTMLButtonElement { const element = document.createElement(\"button\"); element.type = \"button\"; element.textContent = label; element.disabled = disabled; element.addEventListener(\"click\", () => action().catch(error => status(error instanceof Error ? error.message : String(error), true))); return element; }\n\n/** Kinds addressable by a css target or a reviewed targetref; only these can be previewed. */\nconst previewkinds = [\"focus\", \"inspect\", \"click\", \"type\", \"scroll\", \"select\", \"hover\", \"clickdeep\", \"rightclick\", \"doubleclick\", \"drag\", \"drop\", \"upload\", \"clear\", \"check\", \"uncheck\", \"toggle\", \"submit\", \"readattribute\", \"readstyle\", \"readgeometry\", \"readvalue\", \"readtext\", \"readhtml\", \"countelements\", \"readtable\", \"highlight\", \"setattribute\", \"removeattribute\", \"waitfor\", \"shiftclick\", \"typetime\", \"appendtext\", \"setvalue\", \"typeedit\", \"submitsearch\", \"selectmulti\", \"chooseradio\", \"setslider\", \"setdate\", \"setcolor\", \"expanddetails\", \"verifyvisible\", \"verifyenabled\", \"pierceshadow\", \"clickpoint\", \"clicktext\", \"clickaria\", \"clickname\", \"resolvexpath\", \"deriveselector\", \"fingerprintsection\"];\n\n/** Topic rows that group the new interaction and observation kinds inside each risk class. */\nconst topictags: Array<{ topic: string; kinds: string[] }> = [\n { topic: \"pointer\", kinds: [\"movepointer\", \"clickpoint\", \"shiftclick\", \"clicktext\", \"clickaria\", \"clickname\", \"pierceshadow\"] },\n { topic: \"typing\", kinds: [\"typetime\", \"appendtext\", \"setvalue\", \"typeedit\", \"submitsearch\"] },\n { topic: \"keys\", kinds: [\"keyhold\", \"keyrelease\"] },\n { topic: \"controls\", kinds: [\"selectmulti\", \"chooseradio\", \"setslider\", \"setdate\", \"setcolor\", \"expanddetails\"] },\n { topic: \"dialogs\", kinds: [\"dismissdialog\"] },\n { topic: \"frames\", kinds: [\"enterframe\"] },\n { topic: \"retry\", kinds: [\"retryaction\"] },\n { topic: \"reads\", kinds: [\"mapclicks\", \"verifyvisible\", \"verifyenabled\", \"resolvexpath\"] },\n { topic: \"observation\", kinds: [\"a11ytree\", \"readvisible\", \"readertree\", \"readoutline\", \"readselection\", \"readopengraph\", \"readlang\", \"detectlanguage\", \"listshadow\", \"listframes\", \"readscrollpos\"] },\n { topic: \"detection\", kinds: [\"detectlists\", \"detecttables\", \"detectinfinitescroll\", \"detectvirtual\", \"detectlazy\", \"detectsticky\", \"detectscrolllock\", \"countpages\", \"classifypage\", \"fingerprintsection\"] },\n { topic: \"watch\", kinds: [\"watchmutate\", \"watchbanner\", \"watchfocus\", \"waitquiet\", \"readjson\", \"diffsnapshots\", \"deriveselector\"] },\n { topic: \"navigation\", kinds: [\"openlink\", \"openprivate\", \"reloadcache\", \"stopnav\", \"waitload\", \"waiturl\", \"followlink\", \"spanav\", \"spawait\", \"rewritequery\", \"setfragment\", \"navlist\", \"navprofile\", \"detecthttp\", \"readredirects\", \"readfinalurl\", \"handleauth\", \"printpdf\", \"prefetch\", \"preconnect\", \"deeplink\", \"reopentab\", \"trailaudit\", \"pausenav\", \"navintent\", \"navrate\", \"openclipboard\", \"checksafe\", \"batchopen\"] },\n { topic: \"tabs\", kinds: [\"querytabs\", \"duplicatetab\", \"closepattern\", \"pintab\", \"mutetab\", \"movetab\", \"movetabwindow\", \"grouptabs\", \"colorgroup\", \"collapsegroup\", \"discardtab\", \"reloadtabs\", \"zoomin\", \"zoomout\", \"watchtab\", \"switchtab\", \"maximizewindow\", \"minimizewindow\", \"restorewindow\", \"focuswindow\", \"scratchwindow\", \"incognitowindow\", \"restoretab\", \"savelayout\", \"restorelayout\", \"findclones\", \"searchtabs\", \"badgetab\", \"attachmeta\", \"listaudio\", \"reopenrun\", \"snapshotsession\"] },\n];\n\nfunction steptopic(kind: string): string | undefined {\n return topictags.find(tag => tag.kinds.includes(kind))?.topic;\n}\n\n/** Renders plan completion as a live progress ratio. */\nfunction renderprogress(plan: agentplan, completed: string[]): void {\n if (!progressnode) return;\n const total = plan.steps.length || 1;\n progressnode.max = total;\n progressnode.value = completed.length;\n progressnode.textContent = `${completed.length} of ${plan.steps.length} reviewed steps executed`;\n}\n\n/** Renders the latest structured outcome of one step beside its review entry. */\nfunction renderoutcome(step: toolstep, outcomes: stepoutcome[]): HTMLElement | null {\n const outcome = [...outcomes].reverse().find(item => item.stepid === step.id && item.ok) ?? [...outcomes].reverse().find(item => item.stepid === step.id);\n if (!outcome) return null;\n const node = document.createElement(\"details\");\n node.className = \"outcome\";\n const summary = document.createElement(\"summary\");\n summary.textContent = `${outcome.ok ? \"result\" : \"failure\"}: ${outcome.summary}`;\n node.append(summary);\n if (outcome.details && Object.keys(outcome.details).length > 0) {\n const payload = document.createElement(\"pre\");\n payload.textContent = JSON.stringify(outcome.details, null, 2).slice(0, 4000);\n node.append(payload);\n }\n return node;\n}\n\n/** Renders the hold id of a key hold or release step beside its summary. */\nfunction holddetail(step: toolstep): string {\n if (step.kind === \"keyhold\") {\n const holdid = options(step).holdid;\n return typeof holdid === \"string\" && holdid ? ` \u00B7 hold id ${holdid}` : \"\";\n }\n if (step.kind === \"keyrelease\") return step.value ? ` \u00B7 releases hold id ${step.value}` : \"\";\n return \"\";\n}\n\n/** Renders the retry attempts of one retry step on the step timeline. */\nfunction retrydetail(step: toolstep, retries: retryoutcome[]): HTMLElement | null {\n const latest = [...retries].reverse().find(item => item.stepid === step.id);\n if (!latest) return null;\n const node = document.createElement(\"p\");\n node.className = \"timeline\";\n node.textContent = `retry timeline: ${latest.attempts} attempt${latest.attempts === 1 ? \"\" : \"s\"} \u00B7 ${latest.movement.toFixed(1)} px movement \u00B7 ${latest.ok ? \"succeeded\" : \"failed\"}`;\n return node;\n}\n\n/** Renders the network quiet progress of one waitquiet step from its outcome evidence. */\nfunction quietdetail(step: toolstep, outcomes: stepoutcome[]): HTMLElement | null {\n if (step.kind !== \"waitquiet\") return null;\n const latest = [...outcomes].reverse().find(outcome => outcome.stepid === step.id);\n if (!latest) return null;\n const samples = Array.isArray(latest.details?.samples) ? latest.details?.samples as Array<{ at: number; quietfor: number }> : [];\n const idle = typeof latest.details?.idle === \"number\" ? latest.details?.idle : 0;\n const last = samples[samples.length - 1];\n const node = document.createElement(\"p\");\n node.className = \"timeline\";\n node.textContent = `network quiet: ${samples.length} sample${samples.length === 1 ? \"\" : \"s\"} \u00B7 quiet for ${Math.round(last?.quietfor ?? 0)} ms \u00B7 idle threshold ${idle} ms \u00B7 ${latest.ok ? \"quiet reached\" : \"still busy\"}`;\n return node;\n}\n\n/** Renders the navlist progress of one navlist step with the current url and the remaining count. */\nfunction navlistdetail(step: toolstep, progress: planprogress | undefined, outcomes: stepoutcome[]): HTMLElement | null {\n if (step.kind !== \"navlist\") return null;\n const entries = (progress?.outcomes ?? []).filter(outcome => outcome.stepid === step.id && outcome.details?.naventry !== undefined).map(outcome => outcome.details?.naventry as { index: number; url: string; ok: boolean });\n const total = entries.length > 0 ? Math.max(...entries.map(entry => entry.index)) + 1 : 0;\n const latestoutcome = [...outcomes].reverse().find(outcome => outcome.stepid === step.id);\n const remaining = typeof latestoutcome?.details?.remaining === \"number\" ? latestoutcome.details?.remaining : 0;\n const current = entries[entries.length - 1];\n const node = document.createElement(\"p\");\n node.className = \"timeline\";\n node.textContent = entries.length === 0\n ? \"navigation list: no entry completed yet\"\n : `navigation list: ${entries.filter(entry => entry.ok).length} of ${total} entries completed \u00B7 current url ${current?.url ?? \"\"} \u00B7 ${remaining} remaining`;\n return node;\n}\n\n/** Renders the redirect chain and final url of one navigation step from its outcome evidence. */\nfunction redirectdetail(step: toolstep, outcomes: stepoutcome[]): HTMLElement | null {\n if (![\"navigate\", \"followlink\", \"spanav\", \"navlist\", \"openlink\", \"reloadcache\"].includes(step.kind)) return null;\n const latest = [...outcomes].reverse().find(outcome => outcome.stepid === step.id && outcome.details?.hops !== undefined);\n if (!latest) return null;\n const hops = typeof latest.details?.hops === \"number\" ? latest.details?.hops : 0;\n const final = typeof latest.details?.finalurl === \"string\" ? latest.details?.finalurl : \"\";\n const node = document.createElement(\"p\");\n node.className = \"timeline\";\n node.textContent = `redirects: ${Math.max(0, hops - 1)} hop${hops - 1 === 1 ? \"\" : \"s\"} \u00B7 final url ${final || \"unknown\"}`;\n return node;\n}\n\n/** Renders the resolved target details of one previewed interaction step before approval. */\nfunction renderpreview(step: toolstep): HTMLElement | null {\n const preview = previews.get(step.id);\n if (!preview) return null;\n const node = document.createElement(\"details\");\n node.className = \"outcome\";\n const summary = document.createElement(\"summary\");\n summary.textContent = `preview: ${preview.summary}`;\n node.append(summary);\n if (preview.resolvedtarget) {\n const payload = document.createElement(\"pre\");\n payload.textContent = JSON.stringify(preview.resolvedtarget, null, 2);\n node.append(payload);\n }\n if (preview.candidates && preview.candidates.length > 1) {\n const chooser = document.createElement(\"p\");\n chooser.textContent = \"Ambiguous resolution; choose one candidate as the target hint:\";\n node.append(chooser);\n for (const candidate of preview.candidates) {\n node.append(\" \", button(`Choose \"${candidate}\"`, async () => { pickhint(`target hint: ${candidate}`); }));\n }\n }\n return node;\n}\n\nfunction stepitem(plan: agentplan, step: toolstep, completed: string[], outcomes: stepoutcome[], retries: retryoutcome[], progress?: planprogress): HTMLLIElement {\n const item = document.createElement(\"li\");\n const done = completed.includes(step.id);\n item.textContent = `${done ? \"\u2713\" : \"\"} ${step.summary}${holddetail(step)}`;\n const outcome = renderoutcome(step, outcomes);\n if (outcome) item.append(outcome);\n const timeline = step.kind === \"retryaction\" ? retrydetail(step, retries) : quietdetail(step, outcomes);\n if (timeline) item.append(timeline);\n const navlist = navlistdetail(step, progress, outcomes);\n if (navlist) item.append(navlist);\n const redirects = redirectdetail(step, outcomes);\n if (redirects) item.append(redirects);\n const preview = renderpreview(step);\n if (preview) item.append(preview);\n const hastarget = Boolean(step.target) || options(step).targetref !== undefined;\n if (!done && hastarget && previewkinds.includes(step.kind) && [\"pending\", \"approved\"].includes(plan.state)) item.append(\" \", button(\"Preview current target\", async () => { const result = await request({ kind: \"preview\", stepid: step.id }) as previewresult; previews.set(step.id, result); status(result.summary); await refresh(); }));\n if (!done && plan.state === \"approved\") item.append(\" \", button(\"Run this reviewed step\", async () => { const result = await request({ kind: \"execute\", stepid: step.id }) as { summary: string }; status(result.summary); await refresh(); }));\n return item;\n}\n\nfunction steplist(plan: agentplan, steps: toolstep[], completed: string[], outcomes: stepoutcome[], retries: retryoutcome[], risk: toolstep[\"risk\"], progress?: planprogress): HTMLElement | null {\n const group = steps.filter(step => step.risk === risk);\n if (group.length === 0) return null;\n const section = document.createElement(\"section\");\n const heading = document.createElement(\"h3\");\n heading.textContent = `${risk} steps`;\n section.append(heading);\n const general = group.filter(step => steptopic(step.kind) === undefined);\n if (general.length > 0) {\n const list = document.createElement(\"ol\");\n for (const step of general) list.append(stepitem(plan, step, completed, outcomes, retries, progress));\n section.append(list);\n }\n for (const tag of topictags) {\n const tagged = group.filter(step => steptopic(step.kind) === tag.topic);\n if (tagged.length === 0) continue;\n const row = document.createElement(\"h4\");\n row.textContent = `${tag.topic} steps`;\n section.append(row);\n const list = document.createElement(\"ol\");\n for (const step of tagged) list.append(stepitem(plan, step, completed, outcomes, retries, progress));\n section.append(list);\n }\n return section;\n}\n\nfunction renderplan(plan?: agentplan, progress?: planprogress, outcomes: stepoutcome[] = [], retries: retryoutcome[] = []): void {\n if (!planroot) return;\n planroot.replaceChildren();\n if (!plan) { planroot.textContent = \"Start a session, then request a local or endpoint plan. No task runs before review.\"; if (progressnode) progressnode.value = 0; return; }\n const title = document.createElement(\"h2\"); title.textContent = `${plan.state}: ${plan.objective}`; planroot.append(title);\n const completed = progress?.planid === plan.id ? progress.completedsteps : [];\n renderprogress(plan, completed);\n const sensitive = steplist(plan, plan.steps, completed, outcomes, retries, \"sensitive\", progress);\n const interaction = steplist(plan, plan.steps, completed, outcomes, retries, \"interaction\", progress);\n const read = steplist(plan, plan.steps, completed, outcomes, retries, \"read\", progress);\n for (const group of [sensitive, interaction, read]) if (group) planroot.append(group);\n if (plan.state === \"pending\") { planroot.append(button(\"Approve reviewed plan\", async () => { await request({ kind: \"approve\" }); await refresh(); }), button(\"Reject plan\", async () => { await request({ kind: \"reject\" }); await refresh(); })); }\n if (plan.state === \"completed\" && plan.completedat) { const note = document.createElement(\"p\"); note.textContent = \"Every reviewed step has executed and the plan is closed.\"; planroot.append(note); }\n}\n\n/** Records one clickable map entry or candidate as the target hint for the next plan. */\nfunction pickhint(hint: string): void {\n if (objective) objective.value = objective.value ? `${objective.value}\\n${hint}` : hint;\n status(`${hint} recorded as the target hint for the next plan.`);\n}\n\n/** Renders the clickable map as a numbered list beside the plan and lets the user pick entries. */\nfunction rendermap(map?: clickablemap): void {\n if (!maproot) return;\n maproot.replaceChildren();\n if (!map || map.entries.length === 0) { maproot.textContent = \"Run a mapclicks step to number every clickable element on the page.\"; return; }\n for (const entry of map.entries) {\n const item = document.createElement(\"li\");\n const pick = document.createElement(\"button\");\n pick.type = \"button\";\n pick.textContent = `${entry.number}. ${entry.label || entry.selector} (${entry.role})`;\n pick.addEventListener(\"click\", () => pickhint(`target hint: ${entry.selector} (map entry ${entry.number}, ${entry.label || entry.role})`));\n item.append(pick);\n maproot.append(item);\n }\n}\n\n/** Renders the latest accessibility tree beside the dom snapshot as indented role lines. */\nfunction rendera11y(capture?: a11ycapture): void {\n if (!a11yroot) return;\n a11yroot.replaceChildren();\n if (!capture) { a11yroot.textContent = \"Run an a11ytree step to capture the accessibility tree beside the dom snapshot.\"; return; }\n const lines: string[] = [];\n const walk = (node: a11ynode, depth: number): void => {\n if (lines.length >= 80) return;\n const states = node.states.length > 0 ? ` [${node.states.join(\", \")}]` : \"\";\n const value = node.value !== undefined ? ` = ${node.value}` : \"\";\n lines.push(`${\"\u00B7 \".repeat(depth)}${node.role}: ${node.name || \"(unnamed)\"}${states}${value}`);\n for (const child of node.children) walk(child, depth + 1);\n };\n walk(capture.tree, 0);\n const payload = document.createElement(\"pre\");\n payload.textContent = lines.join(\"\\n\");\n a11yroot.append(payload);\n}\n\n/** Renders the latest reader view text with heading blocks highlighted. */\nfunction renderreader(capture?: readercapture): void {\n if (!readerroot) return;\n readerroot.replaceChildren();\n if (!capture) { readerroot.textContent = \"Run a readertree step to extract the reader view.\"; return; }\n const title = document.createElement(\"p\");\n title.textContent = `${capture.article.title || \"Untitled\"}${capture.article.byline ? ` \u00B7 ${capture.article.byline}` : \"\"} \u00B7 ${capture.article.words} words \u00B7 ${capture.article.blocks.length} blocks`;\n readerroot.append(title);\n for (const block of capture.article.blocks.slice(0, 40)) {\n const line = document.createElement(\"p\");\n line.className = /^h\\d$/.test(block.kind) ? \"readerblock heading\" : \"readerblock\";\n line.textContent = `${block.kind}: ${block.text.slice(0, 200)}`;\n readerroot.append(line);\n }\n}\n\n/** Shows detected lists, tables and pagination shapes as plan suggestions the user can pick. */\nfunction renderdetections(plan: agentplan | undefined, outcomes: stepoutcome[]): void {\n if (!detectionsroot) return;\n detectionsroot.replaceChildren();\n if (!plan) { detectionsroot.textContent = \"Detection steps list their detected lists, tables and pagination shapes here as suggestions.\"; return; }\n const kindof = (stepid: string): string | undefined => plan.steps.find(step => step.id === stepid)?.kind;\n const latest = (kind: string): stepoutcome | undefined => [...outcomes].reverse().find(outcome => outcome.ok && kindof(outcome.stepid) === kind);\n let shown = 0;\n const listoutcome = latest(\"detectlists\");\n const lists = Array.isArray(listoutcome?.details?.lists) ? listoutcome?.details?.lists as listpattern[] : [];\n for (const pattern of lists.slice(0, 6)) {\n const item = document.createElement(\"li\");\n const pick = document.createElement(\"button\");\n pick.type = \"button\";\n pick.textContent = `list of ${pattern.repeat} items \u00B7 ${pattern.itemselector}`;\n pick.addEventListener(\"click\", () => pickhint(`target hint: ${pattern.itemselector} (repeated list item of ${pattern.container})`));\n item.append(pick);\n detectionsroot.append(item);\n shown += 1;\n }\n const tableoutcome = latest(\"detecttables\");\n const tables = Array.isArray(tableoutcome?.details?.tables) ? tableoutcome?.details?.tables as tableshape[] : [];\n for (const table of tables.slice(0, 6)) {\n const item = document.createElement(\"li\");\n const pick = document.createElement(\"button\");\n pick.type = \"button\";\n pick.textContent = `table of ${table.rows} rows \u00B7 ${table.columns.length} columns \u00B7 ${table.selector}`;\n pick.addEventListener(\"click\", () => pickhint(`target hint: ${table.selector} (detected data table)`));\n item.append(pick);\n detectionsroot.append(item);\n shown += 1;\n }\n const paginationoutcome = latest(\"countpages\");\n if (paginationoutcome) {\n const item = document.createElement(\"li\");\n const current = typeof paginationoutcome.details?.current === \"number\" ? paginationoutcome.details?.current : 0;\n const total = typeof paginationoutcome.details?.total === \"number\" ? paginationoutcome.details?.total : 0;\n const text = document.createElement(\"span\");\n text.textContent = `pagination: current page ${current} \u00B7 estimated total ${total}`;\n item.append(text);\n detectionsroot.append(item);\n shown += 1;\n }\n if (shown === 0) detectionsroot.textContent = \"Detected lists, tables and pagination shapes appear here as plan suggestions.\";\n}\n\n/** Shows the live mutation and focus stream observed during watched steps. */\nfunction renderstream(mutationevents: mutationevent[], focusevents: focusevent[]): void {\n if (!streamroot) return;\n streamroot.replaceChildren();\n if (mutationevents.length === 0 && focusevents.length === 0) { streamroot.textContent = \"Watched steps stream their mutation and focus events here.\"; return; }\n for (const event of mutationevents.slice(0, 6)) {\n const item = document.createElement(\"li\");\n item.textContent = `${new Date(event.at).toLocaleTimeString()} \u00B7 mutation ${event.event} \u00B7 ${event.targetpath}`;\n streamroot.append(item);\n }\n for (const event of focusevents.slice(0, 6)) {\n const item = document.createElement(\"li\");\n item.textContent = `${new Date(event.at).toLocaleTimeString()} \u00B7 focus ${event.kind} \u00B7 ${event.targetpath}`;\n streamroot.append(item);\n }\n}\n\n/** Renders the latest snapshot diff with added, removed and changed rows. */\nfunction renderdiffs(diffs: snapshotdiff[]): void {\n if (!diffsroot) return;\n diffsroot.replaceChildren();\n const latest = diffs[0];\n if (!latest) { diffsroot.textContent = \"Diff two captured observation versions with a diffsnapshots step.\"; return; }\n const heading = document.createElement(\"p\");\n heading.textContent = `version ${latest.baseversion} \u2192 ${latest.targetversion}: ${latest.added.length} added \u00B7 ${latest.removed.length} removed \u00B7 ${latest.changed.length} changed`;\n diffsroot.append(heading);\n const list = document.createElement(\"ul\");\n for (const entry of [...latest.added, ...latest.removed, ...latest.changed].slice(0, 12)) {\n const item = document.createElement(\"li\");\n item.className = `diffrow ${entry.kind}`;\n item.textContent = `${entry.kind} \u00B7 ${entry.selector} \u00B7 ${entry.summary}`;\n list.append(item);\n }\n diffsroot.append(list);\n}\n\n/** Flags consent banners with a review card before any interaction. */\nfunction renderbanners(banners: bannerreport[]): void {\n if (!bannersroot) return;\n bannersroot.replaceChildren();\n if (banners.length === 0) { bannersroot.textContent = \"No consent banner has been observed yet.\"; return; }\n for (const banner of banners.slice(0, 3)) {\n const card = document.createElement(\"div\");\n card.className = \"bannercard\";\n const title = document.createElement(\"p\");\n title.textContent = `${banner.kind} banner detected \u2014 review it before any interaction.`;\n const text = document.createElement(\"p\");\n text.textContent = banner.text.slice(0, 160) || \"(no banner text)\";\n const controls = document.createElement(\"p\");\n controls.textContent = `controls: ${banner.controls.length > 0 ? banner.controls.join(\", \") : \"none\"}`;\n card.append(title, text, controls);\n bannersroot.append(card);\n }\n}\n\n/** Shows derived selector candidates with their stability scores for reuse. */\nfunction renderselectors(selectors: derivedselector[]): void {\n if (!selectorsroot) return;\n selectorsroot.replaceChildren();\n if (selectors.length === 0) { selectorsroot.textContent = \"Run a deriveselector step to rank stable selectors.\"; return; }\n for (const record of selectors.slice(0, 8)) {\n const item = document.createElement(\"li\");\n const pick = document.createElement(\"button\");\n pick.type = \"button\";\n pick.textContent = `${record.selector} (${record.strategy} \u00B7 stability ${record.score})`;\n pick.addEventListener(\"click\", () => pickhint(`target hint: ${record.selector} (derived ${record.strategy} selector)`));\n item.append(pick);\n selectorsroot.append(item);\n }\n}\n\n/** Renders the navigation trail of the session as a timeline of visited urls. */\nfunction rendertrail(trail: trailentry[]): void {\n if (!trailroot) return;\n trailroot.replaceChildren();\n if (trail.length === 0) { trailroot.textContent = \"No page has been visited inside a reviewed navigation step yet.\"; return; }\n for (const entry of [...trail].reverse().slice(0, 12)) {\n const item = document.createElement(\"li\");\n item.textContent = `${new Date(entry.at).toLocaleTimeString()} \u00B7 ${entry.url}${entry.title ? ` \u00B7 ${entry.title}` : \"\"}${entry.stepid ? ` \u00B7 step ${entry.stepid}` : \"\"}`;\n trailroot.append(item);\n }\n}\n\n/** Renders the navigation state: paused navigation, rate limit windows per domain, wait profiles, redirect chains, curated lists, safety verdicts, artifacts and the basic auth prompt behind the consent gate. */\nfunction rendernavigation(context: { session?: { stoppedat?: number; expiresat: number; origin?: string }; navcontrol?: navcontrol; ratestates?: ratelimitstate[]; waitprofiles?: waitprofilerecord[]; navrecords?: navrecord[]; curated?: curatedlist[]; safeties?: safetyverdict[]; auths?: Array<{ origin: string; username: string; reviewedat: number }>; navqueues?: navqueues; artifacts?: artifactrecord[] }): void {\n if (!navigationroot) return;\n navigationroot.replaceChildren();\n const paused = document.createElement(\"p\");\n if (context.navcontrol?.pausedat) {\n paused.className = \"bannercard\";\n paused.textContent = `Navigation is paused while ${context.navcontrol.reason ?? \"a consent prompt is open\"}; reviewed navigation steps are blocked until it resumes.`;\n } else {\n paused.textContent = \"Navigation is live; no consent prompt holds it.\";\n }\n navigationroot.append(paused);\n const rates = context.ratestates ?? [];\n if (rates.length > 0) {\n const heading = document.createElement(\"p\");\n heading.textContent = \"rate limit windows per domain:\";\n navigationroot.append(heading);\n const list = document.createElement(\"ul\");\n for (const state of rates.slice(0, 6)) {\n const item = document.createElement(\"li\");\n item.textContent = `${state.domain}: ${state.count} of ${state.limit.ceiling} navigations inside the reviewed window of ${state.limit.window} ms`;\n list.append(item);\n }\n navigationroot.append(list);\n }\n const records = context.navrecords ?? [];\n const record = records[0];\n if (record) {\n const chain = document.createElement(\"p\");\n chain.textContent = `latest navigation: ${Math.max(0, record.chain.hops.length - 1)} redirect${record.chain.hops.length - 1 === 1 ? \"\" : \"s\"} \u00B7 final url ${record.finalurl}`;\n navigationroot.append(chain);\n const hops = document.createElement(\"ul\");\n for (const hop of record.chain.hops.slice(0, 6)) {\n const item = document.createElement(\"li\");\n let path = hop.url;\n try { path = new URL(hop.url).pathname; } catch { path = hop.url; }\n item.textContent = `hop ${path} \u00B7 status ${hop.status} \u00B7 ${new Date(hop.at).toLocaleTimeString()}`;\n hops.append(item);\n }\n navigationroot.append(hops);\n }\n const curatedlists = context.curated ?? [];\n if (curatedlists.length > 0) {\n const heading = document.createElement(\"p\");\n heading.textContent = \"curated link lists with per url safety states:\";\n navigationroot.append(heading);\n for (const list of curatedlists.slice(0, 3)) {\n const card = document.createElement(\"div\");\n card.className = \"bannercard\";\n const title = document.createElement(\"p\");\n title.textContent = `${list.links.length} curated url${list.links.length === 1 ? \"\" : \"s\"}${list.reviewedat ? \" \u00B7 opened after review\" : \" \u00B7 waiting for review\"}`;\n card.append(title);\n for (const link of list.links.slice(0, 8)) {\n const line = document.createElement(\"p\");\n line.textContent = `${link.verdict === \"safe\" ? \"\u2713\" : \"\u2717\"} ${link.url}${link.reasons.length > 0 ? ` \u00B7 ${link.reasons.join(\"; \")}` : \"\"}`;\n card.append(line);\n }\n navigationroot.append(card);\n }\n }\n const safeties = context.safeties ?? [];\n const runner = document.createElement(\"p\");\n const checkinput = document.createElement(\"input\");\n checkinput.type = \"url\";\n checkinput.placeholder = \"https://external.example/link\";\n checkinput.setAttribute(\"aria-label\", \"url to verify with checksafe\");\n const checkbutton = button(\"Run checksafe\", async () => {\n const verdict = await request({ kind: \"checksafe\", url: checkinput.value }) as safetyverdict;\n status(verdict.safe ? `${verdict.url} passed every safety check.` : `${verdict.url} is unsafe: ${verdict.reasons.join(\"; \")}.`);\n await refresh();\n });\n runner.append(checkinput, \" \", checkbutton);\n navigationroot.append(runner);\n if (safeties.length > 0) {\n const list = document.createElement(\"ul\");\n for (const verdict of safeties.slice(0, 6)) {\n const item = document.createElement(\"li\");\n item.textContent = `${verdict.safe ? \"safe\" : \"unsafe\"} \u00B7 ${verdict.url}${verdict.reasons.length > 0 ? ` \u00B7 ${verdict.reasons.join(\"; \")}` : \"\"}`;\n list.append(item);\n }\n navigationroot.append(list);\n }\n const active = context.session && !context.session.stoppedat && context.session.expiresat > Date.now();\n const authcard = document.createElement(\"div\");\n authcard.className = \"bannercard\";\n const authtitle = document.createElement(\"p\");\n authtitle.textContent = active ? \"basic auth credentials (stored only after your explicit review):\" : \"basic auth credentials need an active session before they can be reviewed.\";\n authcard.append(authtitle);\n if (active) {\n const origininput = document.createElement(\"input\");\n origininput.type = \"url\";\n origininput.placeholder = context.session?.origin ?? \"https://example.com\";\n origininput.setAttribute(\"aria-label\", \"auth origin\");\n const userinput = document.createElement(\"input\");\n userinput.type = \"text\";\n userinput.placeholder = \"username\";\n userinput.setAttribute(\"aria-label\", \"auth username\");\n const passinput = document.createElement(\"input\");\n passinput.type = \"password\";\n passinput.placeholder = \"password\";\n passinput.setAttribute(\"aria-label\", \"auth password\");\n const storebutton = button(\"Store reviewed credentials\", async () => {\n const stored = await request({ kind: \"storeauth\", origin: origininput.value, username: userinput.value, password: passinput.value }) as { origin: string };\n status(`Reviewed basic auth credentials stored for ${stored.origin}.`);\n await refresh();\n });\n authcard.append(origininput, \" \", userinput, \" \", passinput, \" \", storebutton);\n }\n navigationroot.append(authcard);\n const auths = context.auths ?? [];\n if (auths.length > 0) {\n const list = document.createElement(\"ul\");\n for (const record of auths.slice(0, 4)) {\n const item = document.createElement(\"li\");\n item.textContent = `basic auth for ${record.origin} as ${record.username}, reviewed ${new Date(record.reviewedat).toLocaleString()}`;\n list.append(item);\n }\n navigationroot.append(list);\n }\n const artifacts = context.artifacts ?? [];\n if (artifacts.length > 0) {\n const heading = document.createElement(\"p\");\n heading.textContent = \"task artifacts:\";\n navigationroot.append(heading);\n const list = document.createElement(\"ul\");\n for (const artifact of artifacts.slice(0, 6)) {\n const item = document.createElement(\"li\");\n item.textContent = `${artifact.kind}: ${artifact.name} \u00B7 step ${artifact.stepid}`;\n list.append(item);\n }\n navigationroot.append(list);\n }\n}\n\n/** Renders the tabs and windows command surface: quick switcher, groups, badges, audio state, layouts, snapshots, clone warnings, the task tab budget gauge and the pinned control tab feed. */\nfunction rendertabswindows(context: { session?: { stoppedat?: number; expiresat: number }; plan?: agentplan; progress?: planprogress; tabs?: tabshape[]; windows?: windowshape[]; tabgroups?: tabgrouprecord[]; badges?: tabbadge[]; tabmetas?: tabmeta[]; clones?: Array<{ url: string; tabids: number[] }>; layouts?: tablayout[]; snapshots?: sessionsnapshot[]; closedtabs?: closedtab[]; tasktabgauge?: { used: number; ceiling?: number; over: boolean }; controltab?: controltabstate }): void {\n if (!tabswindowsroot) return;\n tabswindowsroot.replaceChildren();\n const tabs = context.tabs ?? [];\n const badges = context.badges ?? [];\n const metas = context.tabmetas ?? [];\n const active = context.session && !context.session.stoppedat && context.session.expiresat > Date.now();\n const gauge = context.tasktabgauge ?? { used: 0, ceiling: undefined, over: false };\n const budget = document.createElement(\"p\");\n budget.className = gauge.over ? \"bannercard\" : \"\";\n budget.textContent = `task tab budget: ${gauge.used} tab${gauge.used === 1 ? \"\" : \"s\"} with active tasks${gauge.ceiling !== undefined ? ` of the user configured ceiling ${gauge.ceiling}` : \" with no user ceiling configured\"}${gauge.over ? \" \u2014 over the reviewed budget\" : \"\"}`;\n tabswindowsroot.append(budget);\n const ceilinginput = document.createElement(\"input\");\n ceilinginput.type = \"number\";\n ceilinginput.min = \"0\";\n ceilinginput.placeholder = gauge.ceiling !== undefined ? String(gauge.ceiling) : \"no ceiling\";\n ceilinginput.setAttribute(\"aria-label\", \"concurrent task tab ceiling\");\n const ceilingbutton = button(\"Save task tab ceiling\", async () => {\n await request({ kind: \"settasktabceiling\", ceiling: ceilinginput.value === \"\" ? undefined : Number(ceilinginput.value) });\n status(`Task tab ceiling saved as ${ceilinginput.value === \"\" ? \"no ceiling\" : ceilinginput.value}; the value stays a user choice.`);\n await refresh();\n });\n tabswindowsroot.append(ceilinginput, \" \", ceilingbutton);\n const switcherheading = document.createElement(\"p\");\n switcherheading.textContent = \"quick switcher (ordered by recency, filter by title or url):\";\n tabswindowsroot.append(switcherheading);\n const filterinput = document.createElement(\"input\");\n filterinput.type = \"search\";\n filterinput.placeholder = \"filter open tabs\";\n filterinput.setAttribute(\"aria-label\", \"quick switcher filter\");\n const switchlist = document.createElement(\"ul\");\n const renderswitchlist = (): void => {\n switchlist.replaceChildren();\n const ordered = switcherlist(tabs, [], filterinput.value).slice(0, 10);\n for (const tab of ordered) {\n const item = document.createElement(\"li\");\n const jump = document.createElement(\"button\");\n jump.type = \"button\";\n const badge = badges.find(entry => entry.tabid === tab.tabid);\n const meta = metas.find(entry => entry.tabid === tab.tabid);\n jump.textContent = `${tab.title || tab.url}${tab.pinned ? \" \uD83D\uDCCC\" : \"\"}${tab.audible || tab.muted ? ` ${tab.muted ? \"\uD83D\uDD07\" : \"\uD83D\uDD0A\"}` : \"\"}${badge ? ` [${badge.label}]` : \"\"}${meta && meta.labels.length > 0 ? ` (${meta.labels.join(\", \")})` : \"\"}`;\n jump.addEventListener(\"click\", () => request({ kind: \"jumptotab\", tabid: tab.tabid }).then(() => status(`Jumped to tab ${tab.tabid}.`)).catch(error => status(error instanceof Error ? error.message : String(error), true)));\n item.append(jump);\n switchlist.append(item);\n }\n if (ordered.length === 0) { const empty = document.createElement(\"li\"); empty.textContent = \"no open tab matches the filter\"; switchlist.append(empty); }\n };\n filterinput.addEventListener(\"input\", renderswitchlist);\n tabswindowsroot.append(filterinput, switchlist);\n renderswitchlist();\n const searchinput = document.createElement(\"input\");\n searchinput.type = \"search\";\n searchinput.placeholder = \"search across open tabs by title and url\";\n searchinput.setAttribute(\"aria-label\", \"searchtabs text\");\n const searchresults = document.createElement(\"ul\");\n const searchbutton = button(\"Run searchtabs\", async () => {\n const result = await request({ kind: \"tabsearch\", text: searchinput.value }) as { matches: tabshape[] };\n searchresults.replaceChildren();\n for (const tab of result.matches.slice(0, 10)) {\n const item = document.createElement(\"li\");\n const jump = document.createElement(\"button\");\n jump.type = \"button\";\n jump.textContent = `${tab.title || tab.url} \u00B7 ${tab.url}`;\n jump.addEventListener(\"click\", () => request({ kind: \"jumptotab\", tabid: tab.tabid }).then(() => status(`Jumped to tab ${tab.tabid}.`)).catch(error => status(error instanceof Error ? error.message : String(error), true)));\n item.append(jump);\n searchresults.append(item);\n }\n status(`searchtabs matched ${result.matches.length} open tab${result.matches.length === 1 ? \"\" : \"s\"}.`);\n });\n tabswindowsroot.append(searchinput, \" \", searchbutton, searchresults);\n const clones = context.clones ?? [];\n for (const clone of clones.slice(0, 3)) {\n const warning = document.createElement(\"p\");\n warning.className = \"bannercard\";\n warning.textContent = `duplicate tab warning: ${clone.tabids.length} open tabs share the url ${clone.url} (tabs ${clone.tabids.join(\", \")})`;\n tabswindowsroot.append(warning);\n }\n const groups = context.tabgroups ?? [];\n if (groups.length > 0) {\n const groupsheading = document.createElement(\"p\");\n groupsheading.textContent = \"tab groups with colors and collapse states:\";\n tabswindowsroot.append(groupsheading);\n const grouplist = document.createElement(\"ul\");\n for (const group of groups.slice(0, 6)) {\n const item = document.createElement(\"li\");\n item.textContent = `${group.name} \u00B7 ${group.color} \u00B7 ${group.collapsed ? \"collapsed\" : \"expanded\"} \u00B7 ${group.tabids.length} member tab${group.tabids.length === 1 ? \"\" : \"s\"}`;\n grouplist.append(item);\n }\n tabswindowsroot.append(grouplist);\n }\n const windows = context.windows ?? [];\n if (windows.length > 0) {\n const windowsheading = document.createElement(\"p\");\n windowsheading.textContent = \"windows with layouts and bounds:\";\n tabswindowsroot.append(windowsheading);\n const windowlist = document.createElement(\"ul\");\n for (const item of windows.slice(0, 6)) {\n const entry = document.createElement(\"li\");\n entry.textContent = `window ${item.windowid} \u00B7 ${item.state} \u00B7 bounds ${item.left}\u00D7${item.top} ${item.width}\u00D7${item.height}${item.incognito ? \" \u00B7 incognito, grants not inherited\" : \"\"}${item.focused ? \" \u00B7 focused\" : \"\"}`;\n const closebutton = button(\"Close window\", async () => {\n const tasktabids = (context.progress?.tasktabs ?? []);\n const tabsoftask = (context.tabs ?? []).filter(tab => tab.windowid === item.windowid && tasktabids.includes(tab.tabid));\n const reviewed = tabsoftask.length > 1 ? window.confirm(`This window holds ${tabsoftask.length} task tabs. Close it anyway under explicit review?`) : true;\n await request({ kind: \"closewindow\", windowid: item.windowid, reviewed });\n status(`Closed window ${item.windowid}.`);\n await refresh();\n });\n entry.append(\" \", closebutton);\n windowlist.append(entry);\n }\n tabswindowsroot.append(windowlist);\n }\n const layoutcontrols = document.createElement(\"p\");\n const layoutname = document.createElement(\"input\");\n layoutname.type = \"text\";\n layoutname.placeholder = \"layout name\";\n layoutname.setAttribute(\"aria-label\", \"layout name\");\n const savebutton = button(\"Save layout\", async () => {\n if (!active) { status(\"Layout save stays inside an active session.\", true); return; }\n await request({ kind: \"savelayout\", name: layoutname.value });\n status(`Saved the tab layout ${layoutname.value}.`);\n await refresh();\n });\n const restorebutton = button(\"Restore layout\", async () => {\n if (!active) { status(\"Layout restore stays inside an active session.\", true); return; }\n const result = await request({ kind: \"restorelayout\", name: layoutname.value }) as { reopened: number };\n status(`Restored the tab layout ${layoutname.value}: ${result.reopened} tab${result.reopened === 1 ? \"\" : \"s\"} reopened.`);\n await refresh();\n });\n layoutcontrols.append(layoutname, \" \", savebutton, \" \", restorebutton);\n tabswindowsroot.append(layoutcontrols);\n const layouts = context.layouts ?? [];\n if (layouts.length > 0) {\n const layoutlist = document.createElement(\"ul\");\n for (const layout of layouts.slice(0, 4)) {\n const item = document.createElement(\"li\");\n item.textContent = `${layout.name} \u00B7 ${layout.tabs.length} tab${layout.tabs.length === 1 ? \"\" : \"s\"} \u00B7 ${layout.groups.length} group${layout.groups.length === 1 ? \"\" : \"s\"} \u00B7 ${layout.windows.length} window bound${layout.windows.length === 1 ? \"\" : \"s\"} \u00B7 saved ${new Date(layout.savedat).toLocaleString()}`;\n layoutlist.append(item);\n }\n tabswindowsroot.append(layoutlist);\n }\n const snapshots = context.snapshots ?? [];\n if (snapshots.length > 0) {\n const snapcard = document.createElement(\"div\");\n snapcard.className = \"bannercard\";\n const snaptitle = document.createElement(\"p\");\n snaptitle.textContent = `session snapshot card: ${snapshots.length} snapshot${snapshots.length === 1 ? \"\" : \"s\"} stored`;\n snapcard.append(snaptitle);\n for (const snapshot of snapshots.slice(0, 3)) {\n const row = document.createElement(\"p\");\n row.textContent = `${snapshot.layout.tabs.length} tabs \u00B7 captured ${new Date(snapshot.capturedat).toLocaleString()}`;\n const restore = button(\"Restore snapshot\", async () => {\n const result = await request({ kind: \"restoresnapshot\", id: snapshot.id }) as { reopened: number };\n status(`Restored the session snapshot: ${result.reopened} tab${result.reopened === 1 ? \"\" : \"s\"} reopened.`);\n await refresh();\n });\n row.append(\" \", restore);\n snapcard.append(row);\n }\n tabswindowsroot.append(snapcard);\n }\n const controlcard = document.createElement(\"div\");\n controlcard.className = \"bannercard\";\n const controlstate = context.controltab;\n const completed = context.progress?.completedsteps.length ?? 0;\n const total = context.plan?.steps.length ?? 0;\n controlcard.textContent = `pinned control tab feed: ${controlstate?.enabled ? `open as tab ${controlstate.tabid} with the live task status ${completed} of ${total} reviewed steps executed` : \"disabled\"}${context.plan ? ` \u00B7 ${context.plan.state}` : \" \u00B7 no plan\"}`;\n const controlbutton = button(controlstate?.enabled ? \"Close pinned control tab\" : \"Open pinned control tab\", async () => {\n await request({ kind: \"controltab\", enabled: !controlstate?.enabled });\n status(controlstate?.enabled ? \"The pinned control tab was closed.\" : \"The pinned control tab was opened with the live task feed.\");\n await refresh();\n });\n controlcard.append(\" \", controlbutton);\n tabswindowsroot.append(controlcard);\n}\n\nfunction rendercapabilities(report?: capabilityreport): void {\n if (!capabilitiestext) return;\n if (!report) { capabilitiestext.textContent = \"Optional capabilities unknown.\"; return; }\n capabilitiestext.textContent = `tabs ${report.tabs ? \"granted\" : \"absent\"} \u00B7 downloads ${report.downloads ? \"granted\" : \"absent\"} \u00B7 clipboard read ${report.clipboardread ? \"granted\" : \"absent\"} \u00B7 clipboard write ${report.clipboardwrite ? \"granted\" : \"absent\"}`;\n}\n\nfunction renderaudit(events: auditevent[]): void { if (!auditroot) return; auditroot.replaceChildren(); for (const event of events.slice(0, 12)) { const item = document.createElement(\"li\"); item.textContent = `${new Date(event.at).toLocaleTimeString()} \u00B7 ${event.kind} \u00B7 ${event.summary}`; auditroot.append(item); } }\nfunction renderdiagnostic(report?: diagnosticreport): void { if (!diagnosticroot) return; diagnosticroot.replaceChildren(); if (!report) { diagnosticroot.textContent = \"Run a local diagnostic after starting a session to record bridge and page-shape health.\"; return; } const values = [`origin: ${report.origin}`, `title: ${report.title || \"untitled\"}`, `interactive elements: ${report.interactivecount}`, `forms: ${report.formcount}`, `page text length: ${report.textlength}`, `bridge available: ${report.bridgeavailable ? \"yes\" : \"no\"}`]; for (const value of values) { const item = document.createElement(\"li\"); item.textContent = value; diagnosticroot.append(item); } }\nasync function refresh(): Promise<void> { const context = await request({ kind: \"context\" }) as { plan?: agentplan; progress?: planprogress; diagnostic?: diagnosticreport; audit: auditevent[]; outcomes?: stepoutcome[]; capabilities?: capabilityreport; session?: { id: string; pausedat?: number; stoppedat?: number; expiresat: number; origin?: string }; map?: clickablemap; retries?: retryoutcome[]; a11y?: a11ycapture; reader?: readercapture; banners?: bannerreport[]; mutationevents?: mutationevent[]; focusevents?: focusevent[]; diffs?: snapshotdiff[]; selectors?: derivedselector[]; trail?: { trail: trailentry[] }; navrecords?: navrecord[]; ratestates?: ratelimitstate[]; safeties?: safetyverdict[]; curated?: curatedlist[]; waitprofiles?: waitprofilerecord[]; auths?: Array<{ origin: string; username: string; reviewedat: number }>; navcontrol?: navcontrol; navqueues?: navqueues; artifacts?: artifactrecord[]; tabs?: tabshape[]; windows?: windowshape[]; tabgroups?: tabgrouprecord[]; badges?: tabbadge[]; tabmetas?: tabmeta[]; clones?: Array<{ url: string; tabids: number[] }>; layouts?: tablayout[]; snapshots?: sessionsnapshot[]; closedtabs?: closedtab[]; tasktabgauge?: { used: number; ceiling?: number; over: boolean }; controltab?: controltabstate }; renderplan(context.plan, context.progress, context.outcomes ?? [], context.retries ?? []); renderdiagnostic(context.diagnostic); rendermap(context.map); rendera11y(context.a11y); renderreader(context.reader); renderdetections(context.plan, context.outcomes ?? []); renderstream(context.mutationevents ?? [], context.focusevents ?? []); renderdiffs(context.diffs ?? []); renderbanners(context.banners ?? []); renderselectors(context.selectors ?? []); rendertrail(context.trail?.trail ?? []); rendernavigation(context); rendertabswindows(context); renderaudit(context.audit); rendercapabilities(context.capabilities); if (context.session?.pausedat) status(\"Session paused. Reviewed actions are blocked until resume.\"); else status(context.session ? \"Active session is visible. The extension is waiting for review.\" : \"No active browser session.\"); }\nasync function create(kind: \"proposelocal\" | \"proposeremote\"): Promise<void> { await request({ kind, objective: objective?.value ?? \"\" }); await refresh(); }\nlocalbutton?.addEventListener(\"click\", () => create(\"proposelocal\").catch(error => status(error instanceof Error ? error.message : String(error), true)));\nremotebutton?.addEventListener(\"click\", () => create(\"proposeremote\").catch(error => status(error instanceof Error ? error.message : String(error), true)));\ndiagnosticbutton?.addEventListener(\"click\", () => request({ kind: \"diagnostic\" }).then(() => refresh()).catch(error => status(error instanceof Error ? error.message : String(error), true)));\nrefresh().catch(error => status(error instanceof Error ? error.message : String(error), true));\n"],
|
|
5
|
+
"mappings": ";AAEA,IAAM,mBAAmB,oBAAI,IAAgB,CAAC,SAAS,QAAQ,YAAY,UAAU,YAAY,QAAQ,QAAQ,UAAU,SAAS,SAAS,WAAW,UAAU,UAAU,UAAU,QAAQ,WAAW,gBAAgB,gBAAgB,mBAAmB,YAAY,aAAa,eAAe,YAAY,aAAa,gBAAgB,eAAe,gBAAgB,gBAAgB,cAAc,cAAc,iBAAiB,cAAc,YAAY,cAAc,YAAY,YAAY,WAAW,cAAc,gBAAgB,eAAe,eAAe,aAAa,WAAW,YAAY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AAO,KAAK,GAAG,IAAI,CAAC,CAAC;AAC1J,kBAAkB,iBAAiB,SAAS,MAAM,QAAQ,EAAE,MAAM,aAAa,CAAC,EAAE,KAAK,MAAM,QAAQ,CAAC,EAAE,MAAM,WAAS,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG,IAAI,CAAC,CAAC;AAC5L,QAAQ,EAAE,MAAM,WAAS,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,GAAG,IAAI,CAAC;",
|
|
6
|
+
"names": ["record"]
|
|
7
7
|
}
|
package/extension/manifest.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"manifest_version": 3,
|
|
3
3
|
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnOEjO8Z0PDgQyfvawGcaO2j+o0GLCFTLNj7TkYC/Avo9l2NenMRq7gp90Nfd7E9MViv/OMcCKSYZ5unv12QPRtv31C+a5UQWDFAOP/cH5mwMd6hsayElrSoW8ta+FwFqmr9dIFkn7cQEU3YhZr4Gcbs+ycUHOxVgDA4NBKB0rQ6e9VW5LvTw0isRYUrqM+M72vKxHk9zUIYYn/LGPvottKBYi2GLr0PHSeC2UE+Shmq7vcFIXj6hDjvD4kLJ5sKoUllEcZ1TPuBcnHUQ9ndKA5iktXDQOIJCUJmi7a0YJ2PGg7fvpYfT9k0ai/qZ+pIoRfoOEwE01bPoDn7NjeYnNQIDAQAB",
|
|
4
4
|
"name": "Devthink",
|
|
5
|
-
"version": "1.1.
|
|
5
|
+
"version": "1.1.36",
|
|
6
6
|
"description": "A consent-first bridge for reviewed browser-agent tasks.",
|
|
7
7
|
"permissions": [
|
|
8
8
|
"activeTab",
|