@wenathlan/extension 1.1.37 → 1.1.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dist/index.js +440 -8
- package/dist/index.js.map +2 -2
- package/dist/memory.d.ts +83 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/policy.d.ts +25 -1
- package/dist/policy.d.ts.map +1 -1
- package/dist/protocol.d.ts +46 -1
- package/dist/protocol.d.ts.map +1 -1
- package/dist/types.d.ts +209 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/extension/dist/background.js +1540 -14
- package/extension/dist/background.js.map +4 -4
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/pagebridge.js +199 -2
- package/extension/dist/pagebridge.js.map +4 -4
- package/extension/dist/popup.html +1 -1
- package/extension/dist/popup.js +41 -2
- package/extension/dist/popup.js.map +2 -2
- package/extension/dist/sidepanel.html +1 -1
- package/extension/dist/sidepanel.js +340 -2
- package/extension/dist/sidepanel.js.map +4 -4
- package/extension/manifest.json +1 -1
- package/package.json +1 -1
package/dist/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../memory.ts", "../policy.ts", "../version.ts", "../types.ts", "../protocol.ts"],
|
|
4
|
-
"sourcesContent": ["import type { a11ycapture, agentplan, agentsession, artifactrecord, auditevent, authrecord, bannerreport, capabilityreport, captchahandoff, clickablemap, closedtab, controltabstate, curatedlist, derivedselector, detectionrecord, diagnosticreport, dialogdecision, dialogpolicy, endpointconfig, errorreport, focusevent, formprofile, keyholdstate, mutationevent, navcontrol, navintentrecord, navqueues, navrecord, observationrecord, pagesignals, planprogress, ratelimitstate, readercapture, recenttab, resolutionsummary, retryoutcome, runsettings, safetyverdict, sessionsnapshot, snapshotdiff, stepoutcome, submitticket, tabbadge, tabgrouprecord, tablayout, tabmeta, tabwatchevent, templateprofile, trailentry, typeaheadpick, waitprofilerecord, watchregistration, wizardstate } from \"./types.js\";\n\n/** Provides a small storage seam that works in browser, tests and future adapters. */\nexport interface memoryadapter {\n get<T>(key: string): Promise<T | undefined>;\n set<T>(key: string, value: T): Promise<void>;\n}\n\n/**\n * Local memory for sessions, plans, audit evidence and interaction state.\n * Correlated rules for every stored record live in this one seam; each accessor is a one line storage delegation so future backends replace the adapter only.\n */\nexport class sessionmemory {\n constructor(private readonly adapter: memoryadapter) {}\n\n async getconfig(): Promise<endpointconfig | undefined> { return this.adapter.get<endpointconfig>(\"config\"); }\n async setconfig(value: endpointconfig): Promise<void> { return this.adapter.set(\"config\", value); }\n async getsession(): Promise<agentsession | undefined> { return this.adapter.get<agentsession>(\"session\"); }\n async setsession(value: agentsession): Promise<void> { return this.adapter.set(\"session\", value); }\n async getplan(): Promise<agentplan | undefined> { return this.adapter.get<agentplan>(\"plan\"); }\n async setplan(value: agentplan): Promise<void> { return this.adapter.set(\"plan\", value); }\n async getdiagnostic(): Promise<diagnosticreport | undefined> { return this.adapter.get<diagnosticreport>(\"diagnostic\"); }\n async setdiagnostic(value: diagnosticreport): Promise<void> { return this.adapter.set(\"diagnostic\", value); }\n async getprogress(): Promise<planprogress | undefined> { return this.adapter.get<planprogress>(\"progress\"); }\n async setprogress(value: planprogress): Promise<void> { return this.adapter.set(\"progress\", value); }\n async getcapabilities(): Promise<capabilityreport | undefined> { return this.adapter.get<capabilityreport>(\"capabilities\"); }\n async setcapabilities(value: capabilityreport): Promise<void> { return this.adapter.set(\"capabilities\", value); }\n async getsettings(): Promise<runsettings | undefined> { return this.adapter.get<runsettings>(\"settings\"); }\n async setsettings(value: runsettings): Promise<void> { return this.adapter.set(\"settings\", value); }\n async getaudit(): Promise<auditevent[]> { return (await this.adapter.get<auditevent[]>(\"audit\")) ?? []; }\n async getoutcomes(): Promise<stepoutcome[]> { return (await this.adapter.get<stepoutcome[]>(\"outcomes\")) ?? []; }\n\n /** Records one audit event; retention is a user setting and an absent setting keeps every event. */\n async addaudi(event: auditevent): Promise<void> {\n const records = await this.getaudit();\n const combined = [event, ...records];\n const retention = (await this.getsettings())?.auditretention;\n await this.adapter.set(\"audit\", retention === undefined ? combined : combined.slice(0, retention));\n }\n\n /** Records one step outcome; retention is a user setting and an absent setting keeps every outcome. */\n async addoutcome(outcome: stepoutcome): Promise<void> {\n const records = await this.getoutcomes();\n const combined = [outcome, ...records];\n const retention = (await this.getsettings())?.outcomeretention;\n await this.adapter.set(\"outcomes\", retention === undefined ? combined : combined.slice(0, retention));\n }\n\n /** Stores one clickable map under its observation version so every captured map stays available. */\n async setmap(map: clickablemap): Promise<void> { return this.adapter.set(`map${map.version}`, map); }\n\n /** Returns one stored clickable map by its observation version. */\n async getmap(version: number): Promise<clickablemap | undefined> { return this.adapter.get<clickablemap>(`map${version}`); }\n\n /** Advances and persists the observation version counter used to stamp clickable maps. */\n async nextobservationversion(): Promise<number> {\n const current = (await this.adapter.get<number>(\"observationversion\")) ?? 0;\n const next = current + 1;\n await this.adapter.set(\"observationversion\", next);\n return next;\n }\n\n /** Returns the latest observation version used to stamp a clickable map. */\n async getobservationversion(): Promise<number | undefined> { return this.adapter.get<number>(\"observationversion\"); }\n\n /** Returns the key hold registry, persisted so holds survive service worker restarts. */\n async getholds(): Promise<keyholdstate[]> { return (await this.adapter.get<keyholdstate[]>(\"holds\")) ?? []; }\n\n /** Replaces the key hold registry after one press or release transition. */\n async setholds(holds: keyholdstate[]): Promise<void> { return this.adapter.set(\"holds\", holds); }\n\n /** Returns every dialog decision recorded for the audit trail. */\n async getdialogs(): Promise<dialogdecision[]> { return (await this.adapter.get<dialogdecision[]>(\"dialogs\")) ?? []; }\n\n /** Records one dialog decision with the reviewed answer and the observed dialog text. */\n async adddialog(decision: dialogdecision): Promise<void> {\n const records = await this.getdialogs();\n await this.adapter.set(\"dialogs\", [decision, ...records]);\n }\n\n /** Returns every retry outcome recorded with attempts and movement deltas. */\n async getretries(): Promise<retryoutcome[]> { return (await this.adapter.get<retryoutcome[]>(\"retries\")) ?? []; }\n\n /** Records one retry outcome with the attempts made and the movement delta observed. */\n async addretry(outcome: retryoutcome): Promise<void> {\n const records = await this.getretries();\n await this.adapter.set(\"retries\", [outcome, ...records]);\n }\n\n /** Returns every resolution summary stored per target mode. */\n async getresolutions(): Promise<resolutionsummary[]> { return (await this.adapter.get<resolutionsummary[]>(\"resolutions\")) ?? []; }\n\n /** Records one resolution summary for later selector derivation. */\n async addresolution(summary: resolutionsummary): Promise<void> {\n const records = await this.getresolutions();\n await this.adapter.set(\"resolutions\", [summary, ...records]);\n }\n\n /** Returns the reviewed default dialog policy kept for the session auto handler. */\n async getdialogpolicy(): Promise<dialogpolicy | undefined> { return this.adapter.get<dialogpolicy>(\"dialogpolicy\"); }\n\n /** Stores the reviewed default dialog policy of the latest approved plan. */\n async setdialogpolicy(policy: dialogpolicy): Promise<void> { return this.adapter.set(\"dialogpolicy\", policy); }\n\n /** Stores one observation capture under its version so every observation version stays available. */\n async setobservation(record: observationrecord): Promise<void> { return this.adapter.set(`observation${record.version}`, record); }\n\n /** Returns one stored observation version. */\n async getobservation(version: number): Promise<observationrecord | undefined> { return this.adapter.get<observationrecord>(`observation${version}`); }\n\n /** Returns the observation retention window; an absent setting keeps every capture. */\n private async observationretention(): Promise<number | undefined> { return (await this.getsettings())?.observationretention; }\n\n /** Stores one accessibility tree capture; retention is a user setting and an absent setting keeps every tree. */\n async adda11ytree(capture: a11ycapture): Promise<void> {\n const records = await this.geta11ytrees();\n const combined = [capture, ...records];\n const retention = await this.observationretention();\n await this.adapter.set(\"a11ytrees\", retention === undefined ? combined : combined.slice(0, retention));\n }\n\n /** Returns every stored accessibility tree capture, newest first. */\n async geta11ytrees(): Promise<a11ycapture[]> { return (await this.adapter.get<a11ycapture[]>(\"a11ytrees\")) ?? []; }\n\n /** Stores one reader article capture; retention is a user setting and an absent setting keeps every article. */\n async addreaderarticle(capture: readercapture): Promise<void> {\n const records = await this.getreaderarticles();\n const combined = [capture, ...records];\n const retention = await this.observationretention();\n await this.adapter.set(\"readerarticles\", retention === undefined ? combined : combined.slice(0, retention));\n }\n\n /** Returns every stored reader article capture, newest first. */\n async getreaderarticles(): Promise<readercapture[]> { return (await this.adapter.get<readercapture[]>(\"readerarticles\")) ?? []; }\n\n /** Records one dom mutation observed inside a reviewed watch. */\n async addmutationevent(event: mutationevent): Promise<void> {\n const records = await this.getmutationevents();\n await this.adapter.set(\"mutationevents\", [event, ...records]);\n }\n\n /** Returns the mutation event stream of every reviewed watch. */\n async getmutationevents(): Promise<mutationevent[]> { return (await this.adapter.get<mutationevent[]>(\"mutationevents\")) ?? []; }\n\n /** Records one focus change observed inside a reviewed watch. */\n async addfocusevent(event: focusevent): Promise<void> {\n const records = await this.getfocusevents();\n await this.adapter.set(\"focusevents\", [event, ...records]);\n }\n\n /** Returns the focus event stream of every reviewed watch. */\n async getfocusevents(): Promise<focusevent[]> { return (await this.adapter.get<focusevent[]>(\"focusevents\")) ?? []; }\n\n /** Records one consent banner observed by a reviewed banner watch. */\n async addbanner(event: bannerreport): Promise<void> {\n const records = await this.getbanners();\n await this.adapter.set(\"banners\", [event, ...records]);\n }\n\n /** Returns every consent banner report observed so far. */\n async getbanners(): Promise<bannerreport[]> { return (await this.adapter.get<bannerreport[]>(\"banners\")) ?? []; }\n\n /** Records one snapshot diff between two observation versions. */\n async adddiff(diff: snapshotdiff): Promise<void> {\n const records = await this.getdiffs();\n await this.adapter.set(\"diffs\", [diff, ...records]);\n }\n\n /** Returns every stored snapshot diff, newest first. */\n async getdiffs(): Promise<snapshotdiff[]> { return (await this.adapter.get<snapshotdiff[]>(\"diffs\")) ?? []; }\n\n /** Records one derived selector with its stability score for reuse. */\n async addselector(selector: derivedselector): Promise<void> {\n const records = await this.getselectors();\n await this.adapter.set(\"selectors\", [selector, ...records]);\n }\n\n /** Returns every stored derived selector with its stability score, newest first. */\n async getselectors(): Promise<derivedselector[]> { return (await this.adapter.get<derivedselector[]>(\"selectors\")) ?? []; }\n\n /** Records one detected template class or section fingerprint for its origin. */\n async addtemplate(profile: templateprofile): Promise<void> {\n const records = await this.gettemplates();\n await this.adapter.set(\"templates\", [profile, ...records]);\n }\n\n /** Returns every stored template class and section fingerprint, newest first. */\n async gettemplates(): Promise<templateprofile[]> { return (await this.adapter.get<templateprofile[]>(\"templates\")) ?? []; }\n\n /** Records one watch registration so it survives service worker restarts. */\n async addwatch(watch: watchregistration): Promise<void> {\n const records = await this.getwatches();\n await this.adapter.set(\"watches\", [watch, ...records]);\n }\n\n /** Returns every watch registration, newest first, including closed windows. */\n async getwatches(): Promise<watchregistration[]> { return (await this.adapter.get<watchregistration[]>(\"watches\")) ?? []; }\n\n /** Closes one watch registration by watch id once its reviewed lifetime window ends. */\n async closewatch(watchid: string, closedat: number): Promise<void> {\n const records = await this.getwatches();\n await this.adapter.set(\"watches\", records.map(watch => watch.watchid === watchid && watch.closedat === undefined ? { ...watch, closedat } : watch));\n }\n\n /** Returns the live page signals of language, template, scroll lock and banner state. */\n async getsignals(): Promise<pagesignals | undefined> { return this.adapter.get<pagesignals>(\"signals\"); }\n\n /** Replaces the live page signals after an observation step refreshes them. */\n async setsignals(signals: pagesignals): Promise<void> { return this.adapter.set(\"signals\", signals); }\n\n /** Appends one navigation trail entry of a session with its url, title, step ref and timestamp. */\n async addtrailentry(sessionid: string, entry: trailentry): Promise<void> {\n const records = await this.gettrail(sessionid);\n await this.adapter.set(`trail${sessionid}`, [...records, entry]);\n }\n\n /** Returns the navigation trail of a session, oldest first. */\n async gettrail(sessionid: string): Promise<trailentry[]> { return (await this.adapter.get<trailentry[]>(`trail${sessionid}`)) ?? []; }\n\n /** Stores one wait profile for an origin with user configured values, replacing the previous profile of that origin. */\n async setwaitprofile(record: waitprofilerecord): Promise<void> {\n const records = (await this.getwaitprofiles()).filter(item => item.origin !== record.origin);\n await this.adapter.set(\"waitprofiles\", [...records, record]);\n }\n\n /** Returns every stored wait profile with its origin and user configured values, newest first. */\n async getwaitprofiles(): Promise<waitprofilerecord[]> { return (await this.adapter.get<waitprofilerecord[]>(\"waitprofiles\")) ?? []; }\n\n /** Records one navigation step with its redirect chain and final url. */\n async addnavrecord(record: navrecord): Promise<void> {\n const records = await this.getnavrecords();\n await this.adapter.set(\"navrecords\", [record, ...records]);\n }\n\n /** Returns every stored navigation record with redirect chains and final urls, newest first. */\n async getnavrecords(): Promise<navrecord[]> { return (await this.adapter.get<navrecord[]>(\"navrecords\")) ?? []; }\n\n /** Records one navigation intent detected from a plan for audit review. */\n async addnavintent(record: navintentrecord): Promise<void> {\n const records = await this.getnavintents();\n await this.adapter.set(\"navintents\", [record, ...records]);\n }\n\n /** Returns every stored navigation intent record, newest first. */\n async getnavintents(): Promise<navintentrecord[]> { return (await this.adapter.get<navintentrecord[]>(\"navintents\")) ?? []; }\n\n /** Replaces the rate limit window state of one domain. */\n async setratestate(state: ratelimitstate): Promise<void> {\n const records = (await this.getratestates()).filter(item => item.domain !== state.domain);\n await this.adapter.set(\"ratestates\", [...records, state]);\n }\n\n /** Returns every rate limit window state per domain. */\n async getratestates(): Promise<ratelimitstate[]> { return (await this.adapter.get<ratelimitstate[]>(\"ratestates\")) ?? []; }\n\n /** Records one curated link list with its review state before batch opening. */\n async addcurated(list: curatedlist): Promise<void> {\n const records = await this.getcurateds();\n await this.adapter.set(\"curated\", [list, ...records]);\n }\n\n /** Returns every stored curated link list, newest first. */\n async getcurateds(): Promise<curatedlist[]> { return (await this.adapter.get<curatedlist[]>(\"curated\")) ?? []; }\n\n /** Stores reviewed basic auth credentials for one origin, replacing the previous record of that origin. */\n async setauth(record: authrecord): Promise<void> {\n const records = (await this.getauths()).filter(item => item.origin !== record.origin);\n await this.adapter.set(\"auths\", [...records, record]);\n }\n\n /** Returns every stored reviewed basic auth record per origin. */\n async getauths(): Promise<authrecord[]> { return (await this.adapter.get<authrecord[]>(\"auths\")) ?? []; }\n\n /** Records one task artifact routed into the artifact store. */\n async addartifact(record: artifactrecord): Promise<void> {\n const records = await this.getartifacts();\n await this.adapter.set(\"artifacts\", [record, ...records]);\n }\n\n /** Returns every stored task artifact, newest first. */\n async getartifacts(): Promise<artifactrecord[]> { return (await this.adapter.get<artifactrecord[]>(\"artifacts\")) ?? []; }\n\n /** Returns the navigation control state of paused navigation. */\n async getnavcontrol(): Promise<navcontrol | undefined> { return this.adapter.get<navcontrol>(\"navcontrol\"); }\n\n /** Replaces the navigation control state after a pause or resume transition. */\n async setnavcontrol(control: navcontrol): Promise<void> { return this.adapter.set(\"navcontrol\", control); }\n\n /** Records one url safety verdict produced by a checksafe verification. */\n async addsafety(verdict: safetyverdict): Promise<void> {\n const records = await this.getsafeties();\n await this.adapter.set(\"safeties\", [verdict, ...records]);\n }\n\n /** Returns every stored url safety verdict, newest first. */\n async getsafeties(): Promise<safetyverdict[]> { return (await this.adapter.get<safetyverdict[]>(\"safeties\")) ?? []; }\n\n /** Records one recently closed tab so a reopentab step can restore it. */\n async addrecenttab(tab: recenttab): Promise<void> {\n const records = await this.getrecenttabs();\n await this.adapter.set(\"recenttabs\", [tab, ...records]);\n }\n\n /** Returns every recently closed tab, newest first. */\n async getrecenttabs(): Promise<recenttab[]> { return (await this.adapter.get<recenttab[]>(\"recenttabs\")) ?? []; }\n\n /** Returns the queued prefetch and batch open target counts shown in the popup badge. */\n async getnavqueues(): Promise<navqueues | undefined> { return this.adapter.get<navqueues>(\"navqueues\"); }\n\n /** Replaces the queued prefetch and batch open target counts. */\n async setnavqueues(queues: navqueues): Promise<void> { return this.adapter.set(\"navqueues\", queues); }\n\n /** Returns the last known navigation state of a tab, kept across service worker restarts. */\n async getnavstate(tabid: number): Promise<navrecord | undefined> { return this.adapter.get<navrecord>(`navstate${tabid}`); }\n\n /** Replaces the last known navigation state of a tab. */\n async setnavstate(tabid: number, state: navrecord): Promise<void> { return this.adapter.set(`navstate${tabid}`, state); }\n\n /** Stores one named tab layout with its window bounds and group states, replacing the previous layout of that name. */\n async setlayout(layout: tablayout): Promise<void> {\n const records = (await this.getlayouts()).filter(item => item.name !== layout.name);\n await this.adapter.set(\"layouts\", [layout, ...records]);\n }\n\n /** Returns one saved tab layout by name with its timestamp. */\n async getlayout(name: string): Promise<tablayout | undefined> { return (await this.getlayouts()).find(item => item.name === name); }\n\n /** Returns every saved tab layout with its window bounds and group states. */\n async getlayouts(): Promise<tablayout[]> { return (await this.adapter.get<tablayout[]>(\"layouts\")) ?? []; }\n\n /** Stores one tab group definition with its color choice and member tabs, replacing the previous definition of that name. */\n async settabgroup(group: tabgrouprecord): Promise<void> {\n const records = (await this.gettabgroups()).filter(item => item.name !== group.name);\n await this.adapter.set(\"tabgroups\", [...records, group]);\n }\n\n /** Returns every stored tab group definition with its color choice, newest first. */\n async gettabgroups(): Promise<tabgrouprecord[]> { return (await this.adapter.get<tabgrouprecord[]>(\"tabgroups\")) ?? []; }\n\n /** Records one tabmeta record with task provenance, replacing the previous metadata of that tab. */\n async settabmeta(meta: tabmeta): Promise<void> {\n const records = (await this.gettabmetas()).filter(item => item.tabid !== meta.tabid);\n await this.adapter.set(\"tabmetas\", [...records, meta]);\n }\n\n /** Returns every stored tabmeta record with task provenance. */\n async gettabmetas(): Promise<tabmeta[]> { return (await this.adapter.get<tabmeta[]>(\"tabmetas\")) ?? []; }\n\n /** Records one session snapshot of tabs and windows for later restore. */\n async addsnapshot(snapshot: sessionsnapshot): Promise<void> {\n const records = await this.getsnapshots();\n await this.adapter.set(\"snapshots\", [snapshot, ...records]);\n }\n\n /** Returns every stored session snapshot, newest first. */\n async getsnapshots(): Promise<sessionsnapshot[]> { return (await this.adapter.get<sessionsnapshot[]>(\"snapshots\")) ?? []; }\n\n /** Records one closed tab in the history kept for restoretab and reopenrun. */\n async addclosedtab(tab: closedtab): Promise<void> {\n const records = await this.getclosedtabs();\n await this.adapter.set(\"closedtabs\", [tab, ...records]);\n }\n\n /** Returns the closed tab history, newest first. */\n async getclosedtabs(): Promise<closedtab[]> { return (await this.adapter.get<closedtab[]>(\"closedtabs\")) ?? []; }\n\n /** Stores one badge state per task, replacing the previous badge of that task. */\n async setbadge(badge: tabbadge): Promise<void> {\n const records = (await this.getbadges()).filter(item => item.taskid !== badge.taskid);\n await this.adapter.set(\"badges\", [...records, badge]);\n }\n\n /** Returns every stored badge state per task. */\n async getbadges(): Promise<tabbadge[]> { return (await this.adapter.get<tabbadge[]>(\"badges\")) ?? []; }\n\n /** Records one tab event observed inside a reviewed watchtab registration. */\n async addtabwatchevent(event: tabwatchevent): Promise<void> {\n const records = await this.gettabwatchevents();\n await this.adapter.set(\"tabwatchevents\", [event, ...records]);\n }\n\n /** Returns the tab event stream of every reviewed watchtab registration, newest first. */\n async gettabwatchevents(): Promise<tabwatchevent[]> { return (await this.adapter.get<tabwatchevent[]>(\"tabwatchevents\")) ?? []; }\n\n /** Returns the ids of the scratch windows opened for split work. */\n async getscratchwindows(): Promise<number[]> { return (await this.adapter.get<number[]>(\"scratchwindows\")) ?? []; }\n\n /** Replaces the scratch window id list after one scratch window opens or closes. */\n async setscratchwindows(ids: number[]): Promise<void> { return this.adapter.set(\"scratchwindows\", ids); }\n\n /** Returns the pinned control tab state with the live task feed. */\n async getcontroltab(): Promise<controltabstate | undefined> { return this.adapter.get<controltabstate>(\"controltab\"); }\n\n /** Replaces the pinned control tab state. */\n async setcontroltab(state: controltabstate): Promise<void> { return this.adapter.set(\"controltab\", state); }\n\n /** Stores one saved form profile under its reviewed name, replacing the previous profile of that name. */\n async setprofile(profile: formprofile): Promise<void> {\n const records = (await this.getprofiles()).filter(item => item.name !== profile.name);\n await this.adapter.set(\"formprofiles\", [profile, ...records]);\n }\n\n /** Returns one saved form profile by its reviewed name. */\n async getprofile(name: string): Promise<formprofile | undefined> { return (await this.getprofiles()).find(item => item.name === name); }\n\n /** Returns every saved form profile with its origin grants, newest first. */\n async getprofiles(): Promise<formprofile[]> { return (await this.adapter.get<formprofile[]>(\"formprofiles\")) ?? []; }\n\n /** Removes one saved form profile by its reviewed name. */\n async removeprofile(name: string): Promise<void> {\n const records = (await this.getprofiles()).filter(item => item.name !== name);\n await this.adapter.set(\"formprofiles\", records);\n }\n\n /** Records one wizard state with its step history. */\n async addwizard(state: wizardstate): Promise<void> {\n const records = await this.getwizards();\n await this.adapter.set(\"wizards\", [state, ...records]);\n }\n\n /** Returns every stored wizard state with its step history, newest first. */\n async getwizards(): Promise<wizardstate[]> { return (await this.adapter.get<wizardstate[]>(\"wizards\")) ?? []; }\n\n /** Stores one submission ticket with its values hash, replacing the previous ticket of that id. */\n async setticket(ticket: submitticket): Promise<void> {\n const records = (await this.gettickets()).filter(item => item.id !== ticket.id);\n await this.adapter.set(\"submittickets\", [ticket, ...records]);\n }\n\n /** Returns every stored submission ticket with its values hash, newest first. */\n async gettickets(): Promise<submitticket[]> { return (await this.adapter.get<submitticket[]>(\"submittickets\")) ?? []; }\n\n /** Records one collected error report for correction loops. */\n async adderrorreport(report: errorreport): Promise<void> {\n const records = await this.geterrorreports();\n await this.adapter.set(\"errorreports\", [report, ...records]);\n }\n\n /** Returns every stored error report, newest first. */\n async geterrorreports(): Promise<errorreport[]> { return (await this.adapter.get<errorreport[]>(\"errorreports\")) ?? []; }\n\n /** Records one typeahead pick observed when a reviewed suggestion entry was chosen. */\n async addpick(pick: typeaheadpick): Promise<void> {\n const records = await this.getpicks();\n await this.adapter.set(\"typeaheadpicks\", [pick, ...records]);\n }\n\n /** Returns every recorded typeahead pick, newest first. */\n async getpicks(): Promise<typeaheadpick[]> { return (await this.adapter.get<typeaheadpick[]>(\"typeaheadpicks\")) ?? []; }\n\n /** Records one captcha handoff while the plan waits for the user. */\n async addcaptcha(handoff: captchahandoff): Promise<void> {\n const records = await this.getcaptchas();\n await this.adapter.set(\"captchas\", [handoff, ...records]);\n }\n\n /** Returns every captcha handoff record with its resolution state, newest first. */\n async getcaptchas(): Promise<captchahandoff[]> { return (await this.adapter.get<captchahandoff[]>(\"captchas\")) ?? []; }\n\n /** Resolves one captcha handoff by id once the user finished it. */\n async resolvecaptcha(id: string, resolvedat: number): Promise<void> {\n const records = await this.getcaptchas();\n await this.adapter.set(\"captchas\", records.map(handoff => handoff.id === id && !handoff.resolved ? { ...handoff, resolved: true, resolvedat } : handoff));\n }\n\n /** Records one login or template detection for its origin. */\n async adddetection(record: detectionrecord): Promise<void> {\n const records = await this.getdetections();\n await this.adapter.set(\"detections\", [record, ...records]);\n }\n\n /** Returns every stored login and template detection per origin, newest first. */\n async getdetections(): Promise<detectionrecord[]> { return (await this.adapter.get<detectionrecord[]>(\"detections\")) ?? []; }\n\n /** Stores the reviewed one time code behind the consent gate of an active session. */\n async setcodevalue(value: string): Promise<void> { return this.adapter.set(\"codevalue\", value); }\n\n /** Returns the reviewed one time code, if the user stored one behind the consent gate. */\n async getcodevalue(): Promise<string | undefined> { return this.adapter.get<string>(\"codevalue\"); }\n}\n\n/** Creates identifiers locally without a network dependency. */\nexport function randomid(): string {\n return crypto.randomUUID();\n}\n", "import type { actionkind, agentplan, agentsession, endpointconfig, fieldkind, formprofile, 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\", \"fillform\", \"filllabel\", \"fillplaceholder\", \"submitform\", \"retryform\", \"runwizard\", \"selectchain\", \"picktypeahead\", \"pickdate\", \"attachfile\", \"fillcard\", \"fillcode\", \"consentpassword\"]);\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\", \"detectfields\", \"generatevalues\", \"saveprofiles\", \"asksubmit\", \"readerrors\", \"skiphoneypot\", \"detectlogin\", \"detecttemplate\", \"handoffcaptcha\"]);\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\", \"submitform\", \"retryform\", \"selectchain\", \"picktypeahead\", \"pickdate\", \"attachfile\", \"fillcode\", \"consentpassword\"]);\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\", \"asksubmit\", \"selectchain\", \"picktypeahead\", \"pickdate\", \"attachfile\", \"fillcode\", \"consentpassword\"]);\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 formactions = new Set<actionkind>([\"fillform\", \"filllabel\", \"fillplaceholder\", \"detectfields\", \"generatevalues\", \"saveprofiles\", \"asksubmit\", \"submitform\", \"readerrors\", \"retryform\", \"runwizard\", \"selectchain\", \"picktypeahead\", \"pickdate\", \"attachfile\", \"handoffcaptcha\", \"fillcard\", \"fillcode\", \"consentpassword\", \"skiphoneypot\", \"detectlogin\", \"detecttemplate\"]);\n/** Field kinds the form grammar accepts inside records, profiles and value rules. */\nconst fieldkinds: fieldkind[] = [\"text\", \"email\", \"phone\", \"date\", \"number\", \"select\", \"check\", \"radio\", \"file\", \"password\", \"card\", \"code\"];\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/** True when the kind belongs to the forms and data family. */\nexport function isformkind(kind: actionkind): boolean {\n return formactions.has(kind);\n}\n\n/** Validates the reviewed fieldmatch grammar of one form field entry. */\nexport function validatefieldmatch(value: unknown): policyevaluation {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return { allowed: false, reason: \"A reviewed field match is required in options.\" };\n const match = value as Record<string, unknown>;\n if (match.mode !== \"label\" && match.mode !== \"placeholder\" && match.mode !== \"arialabel\" && match.mode !== \"name\") return { allowed: false, reason: \"The reviewed field match mode must be label, placeholder, arialabel or name.\" };\n const key = match.mode === \"label\" ? \"label\" : match.mode === \"placeholder\" ? \"placeholder\" : match.mode === \"arialabel\" ? \"arialabel\" : \"name\";\n if (!isnonempty(match[key])) return { allowed: false, reason: `The reviewed ${match.mode} field match needs a non-empty ${key}.` };\n return { allowed: true };\n}\n\n/** Validates a reviewed structured form record; password entries are refused because passwords need the explicit consentpassword consent. */\nexport function validateformrecord(value: unknown): policyevaluation {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return { allowed: false, reason: \"A reviewed form record with entries is required in options.\" };\n const record = value as Record<string, unknown>;\n if (record.form !== undefined && !isnonempty(record.form)) return { allowed: false, reason: \"The reviewed form record form selector must be a non-empty string.\" };\n if (!Array.isArray(record.entries) || record.entries.length === 0) return { allowed: false, reason: \"The reviewed form record needs a non-empty list of entries.\" };\n for (const item of record.entries) {\n if (!item || typeof item !== \"object\" || Array.isArray(item)) return { allowed: false, reason: \"Every reviewed form record entry must be an object.\" };\n const entry = item as Record<string, unknown>;\n const matchcheck = validatefieldmatch(entry.match);\n if (!matchcheck.allowed) return matchcheck;\n if (typeof entry.kind !== \"string\" || !fieldkinds.includes(entry.kind as fieldkind)) return { allowed: false, reason: \"Every reviewed form record entry needs a known field kind.\" };\n if (typeof entry.value !== \"string\") return { allowed: false, reason: \"Every reviewed form record entry needs a string value.\" };\n if (entry.kind === \"password\") return { allowed: false, reason: \"Password entries are refused inside form records; use consentpassword with a reviewed consent ref.\" };\n }\n return { allowed: true };\n}\n\n/** Validates the reviewed valuegen grammar of a generatevalues step. */\nexport function validatevaluegen(value: unknown): policyevaluation {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return { allowed: false, reason: \"A reviewed valuegen rule with a field kind is required in options.\" };\n const rule = value as Record<string, unknown>;\n if (typeof rule.kind !== \"string\" || !fieldkinds.includes(rule.kind as fieldkind)) return { allowed: false, reason: \"The reviewed valuegen kind must be a known field kind.\" };\n if (rule.locale !== undefined && !isnonempty(rule.locale)) return { allowed: false, reason: \"The reviewed valuegen locale must be a non-empty string.\" };\n if (rule.seed !== undefined && (typeof rule.seed !== \"number\" || !Number.isFinite(rule.seed))) return { allowed: false, reason: \"The reviewed valuegen seed must be a finite number.\" };\n return { allowed: true };\n}\n\n/** Validates a reviewed list of label or placeholder value pairs for filllabel and fillplaceholder steps. */\nfunction validatefieldpairs(options: Record<string, unknown>, mode: \"label\" | \"placeholder\"): policyevaluation {\n const pairs = options.fields;\n if (!Array.isArray(pairs) || pairs.length === 0) return { allowed: false, reason: \"A reviewed non-empty list of field pairs is required in options.\" };\n for (const item of pairs) {\n if (!item || typeof item !== \"object\" || Array.isArray(item)) return { allowed: false, reason: \"Every reviewed field pair must be an object.\" };\n const pair = item as Record<string, unknown>;\n if (!isnonempty(pair[mode])) return { allowed: false, reason: `Every reviewed field pair needs a non-empty ${mode}.` };\n if (typeof pair.value !== \"string\" || !pair.value.trim()) return { allowed: false, reason: \"Every reviewed field pair needs a non-empty value.\" };\n }\n return { allowed: true };\n}\n\n/** Validates the reviewed card segment grammar of a fillcard step. */\nfunction validatecardsegments(value: unknown): policyevaluation {\n if (!Array.isArray(value) || value.length === 0) return { allowed: false, reason: \"A reviewed non-empty list of card segments is required in options.\" };\n for (const item of value) {\n if (!item || typeof item !== \"object\" || Array.isArray(item)) return { allowed: false, reason: \"Every reviewed card segment must be an object.\" };\n const segment = item as Record<string, unknown>;\n const matchcheck = validatefieldmatch(segment.match);\n if (!matchcheck.allowed) return matchcheck;\n if (typeof segment.value !== \"string\" || !segment.value.trim()) return { allowed: false, reason: \"Every reviewed card segment needs a non-empty value.\" };\n }\n return { allowed: true };\n}\n\n/** Validates the reviewed forms and data parameter grammar of the form family. */\nfunction validateformgrammar(step: toolstep, options: Record<string, unknown>): policyevaluation {\n const kind = step.kind;\n if (kind === \"fillform\" || (kind === \"saveprofiles\" && options.formrecord !== undefined)) {\n const recordcheck = validateformrecord(options.formrecord);\n if (!recordcheck.allowed) return recordcheck;\n }\n if (kind === \"filllabel\" || kind === \"fillplaceholder\") {\n const paircheck = validatefieldpairs(options, kind === \"filllabel\" ? \"label\" : \"placeholder\");\n if (!paircheck.allowed) return paircheck;\n }\n if (kind === \"generatevalues\" && options.valuegen !== undefined) {\n const rulecheck = validatevaluegen(options.valuegen);\n if (!rulecheck.allowed) return rulecheck;\n }\n if (kind === \"saveprofiles\" && !isnonempty(options.name)) return { allowed: false, reason: \"A reviewed profile name is required in options.\" };\n if (kind === \"submitform\" && !isnonempty(options.consentref)) return { allowed: false, reason: \"A reviewed consent ref of an approved asksubmit ticket is required in options.\" };\n if (kind === \"retryform\") {\n const backoff = options.backoff;\n if (!backoff || typeof backoff !== \"object\" || Array.isArray(backoff)) return { allowed: false, reason: \"A reviewed backoff rule with wait and factor is required in options.\" };\n const rule = backoff as Record<string, unknown>;\n if (typeof rule.wait !== \"number\" || !Number.isFinite(rule.wait) || rule.wait <= 0) return { allowed: false, reason: \"The reviewed retry backoff wait must be a positive number of milliseconds with no code ceiling.\" };\n if (typeof rule.factor !== \"number\" || !Number.isFinite(rule.factor) || rule.factor < 1) return { allowed: false, reason: \"The reviewed retry backoff factor must be one or greater with no code ceiling.\" };\n if (options.attempts !== undefined && (typeof options.attempts !== \"number\" || !Number.isInteger(options.attempts) || options.attempts < 1)) return { allowed: false, reason: \"The reviewed retry attempts must be a positive integer with no code ceiling.\" };\n }\n if (kind === \"runwizard\" && options.steps !== undefined && (typeof options.steps !== \"number\" || !Number.isInteger(options.steps) || options.steps < 1)) return { allowed: false, reason: \"The reviewed wizard step count must be a positive integer with no code ceiling.\" };\n if (kind === \"selectchain\") {\n if (!isnonempty(options.child)) return { allowed: false, reason: \"A reviewed child selector of the dependent control is required in options.\" };\n if (!nonnegativeoption(options, \"wait\")) return { allowed: false, reason: \"The reviewed dependent wait must be zero or a positive number of milliseconds.\" };\n }\n if (kind === \"picktypeahead\") {\n if (!isnonempty(options.pick)) return { allowed: false, reason: \"A reviewed suggestion entry to pick is required in options.\" };\n if (!nonnegativeoption(options, \"timeout\")) return { allowed: false, reason: \"The reviewed typeahead timeout must be zero or a positive number of milliseconds.\" };\n }\n if (kind === \"pickdate\" && !/^\\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 (kind === \"fillcard\") {\n const segmentcheck = validatecardsegments(options.segments);\n if (!segmentcheck.allowed) return segmentcheck;\n if (!nonnegativeoption(options, \"pause\")) return { allowed: false, reason: \"The reviewed card typing pause must be zero or a positive number of milliseconds.\" };\n }\n if (kind === \"fillcode\" && !isnonempty(options.source)) return { allowed: false, reason: \"A reviewed one time code source is required in options.\" };\n if (kind === \"consentpassword\" && !isnonempty(options.consentref)) return { allowed: false, reason: \"A reviewed consent ref is required in options before any password is filled.\" };\n return { allowed: true };\n}\n\n/** Requires an asksubmit review step before every form submission step. */\nexport function submitreviewgranted(steps: toolstep[], submitid: string): policyevaluation {\n const position = steps.findIndex(candidate => candidate.id === submitid);\n const asked = steps.some((candidate, index) => candidate.kind === \"asksubmit\" && (position === -1 || index < position));\n return asked ? { allowed: true } : { allowed: false, reason: \"Form submission requires an asksubmit review step before it.\" };\n}\n\n/** Requires a reviewed consent ref before any password field is filled. */\nexport function passwordconsentgranted(step: toolstep): policyevaluation {\n let options: Record<string, unknown> = {};\n try { options = parseoptions(step); } catch { options = {}; }\n const consentref = options.consentref;\n if (typeof consentref !== \"string\" || !consentref.trim()) return { allowed: false, reason: \"A password fill requires a reviewed consent ref in options.\" };\n return { allowed: true };\n}\n\n/** True when a numeric value passes the Luhn checksum used by card networks. */\nfunction luhnvalid(digits: string): boolean {\n let sum = 0;\n let double = false;\n for (let index = digits.length - 1; index >= 0; index -= 1) {\n let value = Number.parseInt(digits[index] ?? \"\", 10);\n if (!Number.isFinite(value)) return false;\n if (double) { value *= 2; if (value > 9) value -= 9; }\n sum += value;\n double = !double;\n }\n return sum % 10 === 0;\n}\n\n/** Refuses generated values that look like real card numbers or personal identifiers; test prefixed card values stay allowed. */\nexport function generatedvalueallowed(value: string): policyevaluation {\n const compact = value.replace(/[\\s-]/g, \"\");\n if (/^\\d{13,19}$/.test(compact) && luhnvalid(compact) && !compact.startsWith(\"4111\")) return { allowed: false, reason: \"The generated value looks like a real card number and is refused; generated card values use the 4111 test prefix.\" };\n if (/^\\d{3}-\\d{2}-\\d{4}$/.test(value.trim())) return { allowed: false, reason: \"The generated value looks like a personal identifier and is refused.\" };\n return { allowed: true };\n}\n\n/** Requires the origin grants of a saved profile to cover the origin before its values fill a page. */\nexport function profilegrantgranted(profile: formprofile, origin: string): policyevaluation {\n if (!profile.grants.includes(origin)) return { allowed: false, reason: `The saved profile ${profile.name} is not granted to ${origin}; add the origin to the profile grants first.` };\n return { allowed: true };\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 (isformkind(step.kind)) {\n const formcheck = validateformgrammar(step, options);\n if (!formcheck.allowed) return formcheck;\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 === \"submitform\" || input.step.kind === \"retryform\") {\n if (!input.plan) return { allowed: false, reason: \"Form submission requires an asksubmit review step before it.\" };\n const reviewgate = submitreviewgranted(input.plan.steps, input.step.id);\n if (!reviewgate.allowed) return reviewgate;\n }\n if (input.step.kind === \"consentpassword\") {\n const consentgate = passwordconsentgranted(input.step);\n if (!consentgate.allowed) return consentgate;\n }\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", "/** Canonical package version synchronized from package.json. */\nexport const packageversion = \"1.1.37\" as const;\n", "/** Shared contracts for every Devthink target. */\nimport { packageversion } from \"./version.js\";\n\nexport const protocolversion = packageversion;\n\n/** Every reviewed action kind. Read kinds observe, interaction kinds move focus, sensitive kinds change page or browser state. */\nexport type actionkind =\n | \"observe\" | \"inspect\" | \"extract\" | \"wait\" | \"waitfor\" | \"waittext\"\n | \"readattribute\" | \"readstyle\" | \"readgeometry\" | \"readvalue\" | \"readtext\" | \"readhtml\"\n | \"countelements\" | \"readtable\" | \"readlinks\" | \"readimages\" | \"readmeta\" | \"readforms\"\n | \"readstorage\" | \"highlight\" | \"tablist\" | \"windowlist\" | \"tabsnapshot\"\n | \"focus\" | \"scroll\" | \"hover\" | \"clickdeep\" | \"rightclick\" | \"doubleclick\"\n | \"scrollpage\" | \"scrollby\" | \"scrollend\" | \"scrolltop\" | \"fullscreen\" | \"zoomset\"\n | \"click\" | \"type\" | \"navigate\" | \"select\" | \"presskey\" | \"drag\" | \"drop\" | \"upload\"\n | \"clear\" | \"check\" | \"uncheck\" | \"toggle\" | \"submit\" | \"reload\" | \"back\" | \"forward\"\n | \"writestorage\" | \"setattribute\" | \"removeattribute\" | \"evaluate\"\n | \"tabcreate\" | \"tabactivate\" | \"tabclose\" | \"tabreload\"\n | \"windowcreate\" | \"windowclose\" | \"windowresize\" | \"downloadfile\"\n | \"movepointer\" | \"clickpoint\" | \"shiftclick\" | \"clicktext\" | \"clickaria\" | \"clickname\"\n | \"resolvexpath\" | \"typetime\" | \"appendtext\" | \"setvalue\" | \"typeedit\"\n | \"keyhold\" | \"keyrelease\" | \"submitsearch\" | \"selectmulti\" | \"chooseradio\"\n | \"setslider\" | \"setdate\" | \"setcolor\" | \"expanddetails\" | \"dismissdialog\"\n | \"pierceshadow\" | \"enterframe\" | \"retryaction\"\n | \"mapclicks\" | \"verifyvisible\" | \"verifyenabled\"\n | \"a11ytree\" | \"readvisible\" | \"readertree\" | \"detectlists\" | \"detecttables\"\n | \"readjson\" | \"watchmutate\" | \"waitquiet\" | \"watchbanner\" | \"detectinfinitescroll\"\n | \"detectvirtual\" | \"detectlazy\" | \"readscrollpos\" | \"readlang\" | \"readoutline\"\n | \"countpages\" | \"listshadow\" | \"listframes\" | \"classifypage\" | \"fingerprintsection\"\n | \"diffsnapshots\" | \"readselection\" | \"watchfocus\" | \"detectsticky\" | \"detectscrolllock\"\n | \"readopengraph\" | \"detectlanguage\" | \"deriveselector\"\n | \"openlink\" | \"openprivate\" | \"reloadcache\" | \"stopnav\" | \"waitload\" | \"waiturl\"\n | \"followlink\" | \"spanav\" | \"spawait\" | \"rewritequery\" | \"setfragment\" | \"navlist\"\n | \"navprofile\" | \"detecthttp\" | \"readredirects\" | \"readfinalurl\" | \"handleauth\" | \"printpdf\"\n | \"prefetch\" | \"preconnect\" | \"deeplink\" | \"reopentab\" | \"trailaudit\" | \"pausenav\"\n | \"navintent\" | \"navrate\" | \"openclipboard\" | \"checksafe\" | \"batchopen\"\n | \"querytabs\" | \"duplicatetab\" | \"closepattern\" | \"pintab\" | \"mutetab\" | \"movetab\"\n | \"movetabwindow\" | \"grouptabs\" | \"colorgroup\" | \"collapsegroup\" | \"discardtab\"\n | \"reloadtabs\" | \"zoomin\" | \"zoomout\" | \"watchtab\" | \"switchtab\" | \"maximizewindow\"\n | \"minimizewindow\" | \"restorewindow\" | \"focuswindow\" | \"scratchwindow\" | \"incognitowindow\"\n | \"restoretab\" | \"savelayout\" | \"restorelayout\" | \"findclones\" | \"searchtabs\"\n | \"badgetab\" | \"attachmeta\" | \"listaudio\" | \"reopenrun\" | \"snapshotsession\"\n | \"fillform\" | \"filllabel\" | \"fillplaceholder\" | \"detectfields\" | \"generatevalues\"\n | \"saveprofiles\" | \"asksubmit\" | \"submitform\" | \"readerrors\" | \"retryform\"\n | \"runwizard\" | \"selectchain\" | \"picktypeahead\" | \"pickdate\" | \"attachfile\"\n | \"handoffcaptcha\" | \"fillcard\" | \"fillcode\" | \"consentpassword\" | \"skiphoneypot\"\n | \"detectlogin\" | \"detecttemplate\";\n\nexport type actionrisk = \"read\" | \"interaction\" | \"sensitive\";\nexport type planstate = \"draft\" | \"pending\" | \"approved\" | \"rejected\" | \"expired\" | \"completed\" | \"cancelled\";\nexport type auditkind = \"configure\" | \"session\" | \"observe\" | \"proposal\" | \"approval\" | \"action\" | \"error\" | \"stop\" | \"pause\" | \"resume\" | \"complete\" | \"capability\" | \"tab\" | \"window\" | \"download\" | \"pointer\" | \"dialog\" | \"hold\" | \"retry\" | \"observation\" | \"watch\" | \"diff\" | \"navigation\" | \"redirect\" | \"auth\" | \"prefetch\" | \"rate\" | \"group\" | \"layout\" | \"discard\" | \"badge\" | \"fill\" | \"submit\" | \"consent\" | \"handoff\";\n\n/** Observation mode classes: passive capture, watched lifetimes and diffing passes. */\nexport type observationmode = \"passive\" | \"watching\" | \"diffing\";\n\nexport interface toolstep {\n id: string;\n kind: actionkind;\n target?: string;\n value?: string;\n /** Reviewed JSON parameters such as modifiers, amounts or coordinates. */\n options?: string;\n summary: string;\n risk: actionrisk;\n}\n\nexport interface agentplan {\n id: string;\n objective: string;\n origin: string;\n steps: toolstep[];\n createdat: number;\n expiresat: number;\n state: planstate;\n approvedat?: number;\n completedat?: number;\n}\n\nexport interface agentsession {\n id: string;\n tabid: number;\n origin: string;\n startedat: number;\n expiresat: number;\n stoppedat?: number;\n pausedat?: number;\n /** Origins granted to this session; prepared for multi origin work. */\n grants?: string[];\n}\n\nexport interface endpointconfig {\n endpoint: string;\n origin: string;\n configuredat: number;\n}\n\nexport interface observation {\n /** Observation schema version for forward compatibility. */\n schemaversion: number;\n url: string;\n title: string;\n textpreview: string;\n textlength: number;\n forms: Array<{ label: string; type: string; name: string; options?: string[] }>;\n interactive: Array<{ selector: string; role: string; label: string }>;\n capturedat: number;\n /** Observation mode of this capture: passive, watching or diffing. */\n mode?: observationmode;\n /** Accessibility tree section captured by the page walker. */\n a11y?: a11ynode;\n /** Reader view article section extracted by the text density heuristic. */\n reader?: readerarticle;\n /** Repeated list patterns detected on the page. */\n listpattern?: listpattern[];\n /** Data table shapes detected on the page. */\n tableshape?: tableshape[];\n /** Snapshot diff section attached when two observation versions are compared. */\n diff?: snapshotdiff;\n}\n\nexport interface auditevent {\n id: string;\n kind: auditkind;\n at: number;\n summary: string;\n sessionid?: string;\n planid?: string;\n stepid?: string;\n}\n\nexport interface diagnosticreport {\n id: string;\n sessionid: string;\n origin: string;\n capturedat: number;\n tabid: number;\n title: string;\n textlength: number;\n interactivecount: number;\n formcount: number;\n bridgeavailable: boolean;\n}\n\n/** Live report of the optional browser capabilities the user has granted. */\nexport interface capabilityreport {\n tabs: boolean;\n downloads: boolean;\n clipboardread: boolean;\n clipboardwrite: boolean;\n reportedat: number;\n}\n\n/** Structured result of one executed step, kept with configurable retention. */\nexport interface stepoutcome {\n stepid: string;\n ok: boolean;\n summary: string;\n details?: Record<string, unknown>;\n at: number;\n}\n\n/** User chosen retention windows; an absent value keeps everything forever. */\nexport interface runsettings {\n auditretention?: number;\n outcomeretention?: number;\n /** Retention window for stored observation captures such as a11y trees and reader articles. */\n observationretention?: number;\n /** User configured ceiling on concurrent task tabs; an absent value never refuses a tab. */\n tasktabceiling?: number;\n /** True when the pinned control tab with the live task feed stays open. */\n controltab?: boolean;\n}\n\nexport interface proposalrequest {\n objective: string;\n session: agentsession;\n observation: observation;\n capabilities: capabilityreport;\n}\n\nexport interface planproposal {\n version: typeof protocolversion;\n plan: agentplan;\n}\n\nexport interface policyevaluation {\n allowed: boolean;\n reason?: string;\n}\n\n/** Tracks which reviewed steps of one plan have already executed locally. */\nexport interface planprogress {\n planid: string;\n completedsteps: string[];\n outcomes?: stepoutcome[];\n /** Tabs assigned to the running task so progress tracks work across its tabs. */\n tasktabs?: number[];\n /** Prior progress snapshots preserved when a new plan replaces the tracked one. */\n prior?: planprogress[];\n updatedat: number;\n}\n\n/** Modes that address one element during target resolution. */\nexport type targetmode = \"selector\" | \"text\" | \"aria\" | \"name\" | \"xpath\" | \"index\" | \"point\";\n\n/** Reviewed element reference resolved by the page bridge at preview and execution time. */\nexport interface targetref {\n mode: targetmode;\n selector?: string;\n text?: string;\n role?: string;\n name?: string;\n xpath?: string;\n index?: number;\n x?: number;\n y?: number;\n}\n\n/** One point on a reviewed pointer path. */\nexport interface pointref {\n x: number;\n y: number;\n}\n\n/** Reviewed pointer path between two points through optional waypoints. */\nexport interface pointpath {\n start: pointref;\n end: pointref;\n waypoints?: pointref[];\n duration?: number;\n}\n\n/** Reviewed pointer speed shape with an easing curve, peak velocity and a jitter window. */\nexport interface speedprofile {\n easing?: \"linear\" | \"easeinout\";\n peak?: number;\n jitter?: number;\n}\n\n/** One key held down across steps under a hold id, with tab and step provenance. */\nexport interface keyholdstate {\n holdid: string;\n key: string;\n modifiers?: string[];\n tabid?: number;\n stepid?: string;\n pressedat: number;\n releasedat?: number;\n}\n\n/** Reviewed answers for confirm, alert and prompt dialogs; prompts need a reviewed answer. */\nexport interface dialogpolicy {\n accept: boolean;\n answer?: string;\n}\n\n/** Ordered frame indexes that address targets inside same origin iframes. */\nexport type framepath = number[];\n\n/** Ordered host selectors that address targets across open shadow roots. */\nexport type shadowpath = string[];\n\n/** Reviewed retry bounds with an attempt count that carries no hardcoded ceiling. */\nexport interface retryrule {\n attempts: number;\n settle?: number;\n tolerance?: number;\n}\n\n/** One numbered clickable element of a clickablemap. */\nexport interface mapentry {\n number: number;\n selector: string;\n role: string;\n label: string;\n mode: targetmode;\n}\n\n/** Numbered map of every clickable element captured inside one observation version. */\nexport interface clickablemap {\n version: number;\n entries: mapentry[];\n builtat: number;\n}\n\n/** Matched element summary attached to step results and review envelopes. */\nexport interface resolvedtarget {\n mode: targetmode;\n selector: string;\n tag: string;\n label: string;\n geometry: { x: number; y: number; width: number; height: number };\n candidates?: string[];\n}\n\n/** One dialog answered by the reviewed dialog policy, kept for the audit trail. */\nexport interface dialogdecision {\n id: string;\n dialog: string;\n text: string;\n accept: boolean;\n answer?: string;\n sessionid?: string;\n at: number;\n}\n\n/** One retry execution record with the attempts made and the movement delta observed between them. */\nexport interface retryoutcome {\n stepid: string;\n attempts: number;\n movement: number;\n ok: boolean;\n at: number;\n}\n\n/** Resolution summary stored per target mode for later selector derivation. */\nexport interface resolutionsummary {\n stepid: string;\n mode: targetmode;\n selector: string;\n label: string;\n at: number;\n}\n\n/** One accessibility tree node with role, accessible name, states, value and child refs. */\nexport interface a11ynode {\n role: string;\n name: string;\n states: string[];\n value?: string;\n childcount: number;\n children: a11ynode[];\n}\n\n/** One reader view article with title, byline, blocks and text statistics. */\nexport interface readerarticle {\n title: string;\n byline: string;\n blocks: Array<{ kind: string; text: string; words: number }>;\n words: number;\n characters: number;\n}\n\n/** One detected repeated list with its shared item selector, repeat count and samples. */\nexport interface listpattern {\n container: string;\n itemselector: string;\n repeat: number;\n samples: string[];\n}\n\n/** One detected data table shape with header row, column specs and caption. */\nexport interface tableshape {\n selector: string;\n headers: string[];\n columns: Array<{ label: string; cells: number }>;\n rows: number;\n caption: string;\n}\n\n/** One embedded json state payload extracted from an inline script. */\nexport interface jsonstate {\n scripturl: string;\n rootpath: string;\n payload: unknown;\n}\n\n/** Reviewed watch registration with selector scopes, event kinds and a lifetime window. */\nexport interface mutationwatch {\n watchid?: string;\n scopes?: string[];\n events?: string[];\n lifetime: number;\n}\n\n/** Reviewed network quiet rule with an idle threshold, poll interval and timeout. */\nexport interface quietrule {\n idle: number;\n poll?: number;\n timeout?: number;\n}\n\n/** One dom mutation observed inside a reviewed watch, with a timestamp and target path. */\nexport interface mutationevent {\n watchid: string;\n event: string;\n targetpath: string;\n sessionid?: string;\n at: number;\n}\n\n/** One focus change observed inside a reviewed focus watch, with a timestamp and target path. */\nexport interface focusevent {\n watchid: string;\n kind: \"focus\" | \"blur\";\n targetpath: string;\n sessionid?: string;\n at: number;\n}\n\n/** One consent banner observed by a reviewed banner watch, with its controls. */\nexport interface bannerreport {\n kind: string;\n selector: string;\n text: string;\n controls: string[];\n sessionid?: string;\n at: number;\n}\n\n/** One node change inside a snapshot diff. */\nexport interface diffentry {\n kind: \"added\" | \"removed\" | \"changed\";\n selector: string;\n summary: string;\n}\n\n/** One snapshot diff between two stored observation versions. */\nexport interface snapshotdiff {\n baseversion: number;\n targetversion: number;\n added: diffentry[];\n removed: diffentry[];\n changed: diffentry[];\n at: number;\n}\n\n/** One derived selector candidate with its strategy and stability score. */\nexport interface selectorcandidate {\n selector: string;\n strategy: string;\n score: number;\n}\n\n/** One derived selector stored with its stability score for reuse. */\nexport interface derivedselector {\n stepid: string;\n selector: string;\n strategy: string;\n score: number;\n at: number;\n}\n\n/** One watch registration persisted so watches survive service worker restarts. */\nexport interface watchregistration {\n watchid: string;\n kind: actionkind;\n stepid: string;\n sessionid: string;\n origin: string;\n scopes: string[];\n events: string[];\n startedat: number;\n lifetime: number;\n closedat?: number;\n}\n\n/** One stored observation capture under its version. */\nexport interface observationrecord {\n version: number;\n observation: observation;\n}\n\n/** One stored accessibility tree capture. */\nexport interface a11ycapture {\n version: number;\n tree: a11ynode;\n capturedat: number;\n}\n\n/** One stored reader article capture. */\nexport interface readercapture {\n version: number;\n article: readerarticle;\n capturedat: number;\n}\n\n/** Live page signals refreshed after observation steps: language, template, scroll lock and banner state. */\nexport interface pagesignals {\n language?: string;\n template?: string;\n scrolllocked?: boolean;\n banner?: string;\n refreshedat: number;\n}\n\n/** One detected template class or section fingerprint stored per origin. */\nexport interface templateprofile {\n origin: string;\n template: string;\n fingerprint: string;\n section?: string;\n at: number;\n}\n\n/** Reviewed navigation target with its url, container, position and private flag. */\nexport interface navtarget {\n url: string;\n container: \"current\" | \"tab\" | \"window\" | \"private\";\n position?: \"adjacent\" | \"end\";\n private: boolean;\n}\n\n/** Reviewed per origin override of one wait profile. */\nexport interface waitoverride {\n origin: string;\n signals?: string[];\n idle?: number;\n timeout?: number;\n}\n\n/** Reviewed wait profile with load signals, thresholds and per origin overrides. */\nexport interface waitprofile {\n signals: string[];\n idle?: number;\n timeout?: number;\n overrides?: waitoverride[];\n}\n\n/** Reviewed url pattern with a match mode plus required query and fragment parts. */\nexport interface urlpattern {\n mode: \"exact\" | \"prefix\" | \"host\" | \"pattern\";\n url: string;\n query?: Record<string, string>;\n fragment?: string;\n}\n\n/** One redirect hop of a redirect chain with its url, status and timestamp. */\nexport interface redirecthop {\n url: string;\n status: number;\n at: number;\n}\n\n/** One observed redirect chain with hops, statuses and timing. */\nexport interface redirectchain {\n hops: redirecthop[];\n startedat: number;\n endedat: number;\n}\n\n/** One navigation trail entry with url, title, step ref and timestamp. */\nexport interface trailentry {\n url: string;\n title: string;\n stepid?: string;\n at: number;\n}\n\n/** Reviewed per domain navigation rate limit with a window and a user configured ceiling. */\nexport interface ratelimit {\n domain: string;\n window: number;\n ceiling: number;\n}\n\n/** Live navigation state of a tab: load phase, final url and redirect chain. */\nexport interface navstate {\n phase: \"idle\" | \"loading\" | \"interactive\" | \"complete\";\n finalurl?: string;\n redirects?: redirectchain;\n}\n\n/** One stored wait profile applied per origin with user configured values. */\nexport interface waitprofilerecord {\n origin: string;\n profile: waitprofile;\n at: number;\n}\n\n/** One stored navigation record with the redirect chain and final url of one navigation step. */\nexport interface navrecord {\n stepid: string;\n sessionid?: string;\n origin: string;\n finalurl: string;\n chain: redirectchain;\n at: number;\n}\n\n/** One recorded navigation intent detected from a plan, kept for audit review. */\nexport interface navintentrecord {\n id: string;\n intent: string;\n origin: string;\n sessionid?: string;\n stepid?: string;\n at: number;\n}\n\n/** One rate limit window state per domain with the reviewed limit and the hit count. */\nexport interface ratelimitstate {\n domain: string;\n limit: ratelimit;\n openedat: number;\n count: number;\n}\n\n/** One curated link of a batch open list with its safety verdict and review state. */\nexport interface curatedlink {\n url: string;\n verdict: \"safe\" | \"unsafe\" | \"unknown\";\n reasons: string[];\n}\n\n/** One curated link list stored with its review state before batch opening. */\nexport interface curatedlist {\n id: string;\n links: curatedlink[];\n reviewedat?: number;\n at: number;\n}\n\n/** Reviewed basic auth credentials for one origin, stored only after explicit review. */\nexport interface authrecord {\n origin: string;\n username: string;\n password: string;\n reviewedat: number;\n}\n\n/** One url safety verdict produced by a checksafe verification. */\nexport interface safetyverdict {\n url: string;\n safe: boolean;\n reasons: string[];\n at: number;\n}\n\n/** One task artifact routed into the artifact store by a printpdf step. */\nexport interface artifactrecord {\n id: string;\n kind: string;\n name: string;\n stepid: string;\n at: number;\n}\n\n/** Navigation control state: paused navigation while a consent prompt is open. */\nexport interface navcontrol {\n pausedat?: number;\n reason?: string;\n updatedat: number;\n}\n\n/** One recently closed tab remembered so a reopentab step can restore it. */\nexport interface recenttab {\n url: string;\n tabid: number;\n closedat: number;\n}\n\n/** Queued navigation targets of prefetch and batch open steps, shown in the popup badge. */\nexport interface navqueues {\n prefetch: number;\n batchopen: number;\n updatedat: number;\n}\n\n/** Reviewed tab query with url, title, id and pattern matchers resolved against the live tab set. */\nexport interface tabquery {\n url?: string;\n title?: string;\n id?: number;\n pattern?: string;\n}\n\n/** Reviewed tab group definition with name, color, member tabs and collapse state. */\nexport interface tabgroupspec {\n name: string;\n color: string;\n tabids: number[];\n collapsed: boolean;\n}\n\n/** One stored tab group definition with its color choice and member tabs. */\nexport interface tabgrouprecord {\n groupid: string;\n name: string;\n color: string;\n tabids: number[];\n collapsed: boolean;\n savedat: number;\n}\n\n/** Window bounds of one window state or saved layout. */\nexport interface windowbounds {\n left: number;\n top: number;\n width: number;\n height: number;\n}\n\n/** Live or saved window state with bounds, maximize state and profile kind. */\nexport interface windowstate {\n bounds: windowbounds;\n maximized: boolean;\n profile: \"normal\" | \"incognito\" | \"scratch\";\n}\n\n/** One tab position inside a saved layout, carrying its window and pin state. */\nexport interface layouttab {\n url: string;\n title: string;\n pinned: boolean;\n index: number;\n windowid: number;\n}\n\n/** One saved tab layout with name, tabs, groups, positions and window bounds. */\nexport interface tablayout {\n name: string;\n tabs: layouttab[];\n groups: tabgroupspec[];\n windows: Array<{ windowid: number; state: windowstate }>;\n savedat: number;\n}\n\n/** Per tab task metadata with task refs, provenance and free text labels. */\nexport interface tabmeta {\n tabid: number;\n taskrefs: string[];\n provenance: string;\n labels: string[];\n at: number;\n}\n\n/** One per tab task status badge set by a badgetab step or refreshed from live progress. */\nexport interface tabbadge {\n tabid: number;\n taskid: string;\n label: string;\n setat: number;\n}\n\n/** One tab report entry carrying audio state and metadata per tab. */\nexport interface tabreportentry {\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 meta?: tabmeta;\n}\n\n/** Tab report payload with matched tabs, groups and badges. */\nexport interface tabreport {\n matches: tabreportentry[];\n groups: tabgroupspec[];\n badges: tabbadge[];\n}\n\n/** One session snapshot of tabs and windows captured for later restore. */\nexport interface sessionsnapshot {\n id: string;\n sessionid?: string;\n layout: tablayout;\n capturedat: number;\n}\n\n/** One closed tab history entry kept for restoretab and reopenrun. */\nexport interface closedtab {\n url: string;\n title: string;\n tabid: number;\n windowid: number;\n closedat: number;\n}\n\n/** One tab event observed inside a reviewed watchtab registration. */\nexport interface tabwatchevent {\n watchid: string;\n event: \"title\" | \"activated\" | \"closed\";\n tabid: number;\n detail?: string;\n at: number;\n}\n\n/** Pinned control tab state carrying the live task feed. */\nexport interface controltabstate {\n tabid: number;\n enabled: boolean;\n updatedat: number;\n}\n\n/** Field kinds the form family recognizes across inputs, selects, checks and specialized payment fields. */\nexport type fieldkind = \"text\" | \"email\" | \"phone\" | \"date\" | \"number\" | \"select\" | \"check\" | \"radio\" | \"file\" | \"password\" | \"card\" | \"code\";\n\n/** Reviewed field match addressing one control by label, placeholder, aria label or name. */\nexport interface fieldmatch {\n mode: \"label\" | \"placeholder\" | \"arialabel\" | \"name\";\n label?: string;\n placeholder?: string;\n arialabel?: string;\n name?: string;\n}\n\n/** One reviewed form field entry pairing a field match with its kind and value. */\nexport interface formentry {\n match: fieldmatch;\n kind: fieldkind;\n value: string;\n}\n\n/** A reviewed structured form record with field entries, kinds and values. */\nexport interface formrecord {\n form?: string;\n entries: formentry[];\n}\n\n/** Reviewed value generation rules for one field kind with locale and seed choices. */\nexport interface valuegen {\n kind: fieldkind;\n locale?: string;\n seed?: number;\n}\n\n/** One saved form profile with a reviewed name, field entries and the origin grants it is bound to. */\nexport interface formprofile {\n name: string;\n fields: formentry[];\n grants: string[];\n savedat: number;\n}\n\n/** Live wizard state with the step index, the total steps and the per step completion flags. */\nexport interface wizardstate {\n index: number;\n steps: number;\n completed: boolean[];\n at: number;\n}\n\n/** One submission ticket with the form ref, the values hash and the consent ref of its asksubmit approval. */\nexport interface submitticket {\n id: string;\n form: string;\n valueshash: string;\n consentref: string;\n approved?: boolean;\n at: number;\n}\n\n/** One validation error message associated with a field ref. */\nexport interface fielderror {\n field: string;\n message: string;\n}\n\n/** One collected error report of a form, kept for correction loops. */\nexport interface errorreport {\n form: string;\n errors: fielderror[];\n at: number;\n}\n\n/** One captcha handoff record with its resolution state while the plan waits for the user. */\nexport interface captchahandoff {\n id: string;\n origin: string;\n resolved: boolean;\n openedat: number;\n resolvedat?: number;\n}\n\n/** One login or template detection stored per origin with the matched markers. */\nexport interface detectionrecord {\n origin: string;\n kind: \"login\" | \"signup\" | \"checkout\";\n markers: string[];\n at: number;\n}\n\n/** One typeahead pick recorded when a reviewed suggestion entry was chosen. */\nexport interface typeaheadpick {\n field: string;\n query: string;\n pick: string;\n at: number;\n}\n\n/** Form report payload with the detected fields, their kinds and the matched controls. */\nexport interface formreport {\n form: string;\n fields: Array<{ selector: string; label: string; kind: fieldkind; matched: boolean }>;\n}\n", "import { actionrisk, parseoptions, submitreviewgranted, validatestep } from \"./policy.js\";\nimport { protocolversion, type agentplan, type bannerreport, type clickablemap, type errorreport, type focusevent, type formreport, type keyholdstate, type mutationevent, type navstate, type observation, type pagesignals, type planproposal, type proposalrequest, type resolvedtarget, type safetyverdict, type selectorcandidate, type snapshotdiff, type stepoutcome, type tablayout, type tabreport, type toolstep, type trailentry, type typeaheadpick, type wizardstate } from \"./types.js\";\n\nfunction record(value: unknown): Record<string, unknown> {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) throw new Error(\"Protocol message must be an object.\");\n return value as Record<string, unknown>;\n}\n\nfunction text(value: unknown, field: string): string {\n if (typeof value !== \"string\" || !value.trim()) throw new Error(`${field} must be a non-empty string.`);\n return value.trim();\n}\n\n/**\n * Reviewed options grammar shared by every step kind.\n *\n * A step may carry a JSON `options` object with the following reviewed fields:\n * - `targetref`: element addressing without a css selector, with `mode` one of `selector`, `text`, `aria`, `name`, `xpath`, `index` or `point`; the text mode carries `text`, the aria mode carries `role` plus `name`, the name mode carries `name`, the xpath mode carries `xpath`, the index mode carries a one based clickable map `index`, and the point mode carries viewport `x` and `y` coordinates.\n * - `pointpath`: pointer travel between two points, with `start` and `end` points, optional `waypoints` and a `duration` in milliseconds.\n * - `speedprofile`: pointer speed shape with `easing` (`linear` or `easeinout`), a `peak` velocity in pixels per second and a `jitter` window in milliseconds.\n * - `framepath`: ordered frame indexes routing a step inside same origin iframes.\n * - `shadow`: ordered host selectors addressing a target across open shadow roots.\n * - `retryrule`: retry bounds with `attempts`, a `settle` window in milliseconds and a movement `tolerance` in pixels; attempts carry no code ceiling.\n * - `dialogpolicy`: dialog answers with an `accept` flag and a reviewed prompt `answer` string.\n * - wrapper steps (`retryaction`, `enterframe`) reference an inner step by `stepid` or inline with `kind`, `target`, `value` and an `options` object.\n * - control kinds add reviewed `delay`, `values`, `results`, `timeout`, `holdid` and `modifiers` fields.\n * - watch kinds (`watchmutate`, `watchbanner`, `watchfocus`) carry a reviewed `lifetime` window in milliseconds, optional selector `scopes`, optional event kind filters `events` and an optional `poll` interval; the lifetime window carries no code ceiling.\n * - `waitquiet` carries a reviewed `quietrule` with a positive `idle` threshold in milliseconds, an optional `poll` interval and an optional `timeout`; every value carries no code ceiling.\n * - `diffsnapshots` carries exactly two reviewed observation `versions` to compare.\n * - navigation kinds carry the navigation parameter grammar: `navtarget` with a `url`, a `container` (`current`, `tab`, `window` or `private`), a `position` (`adjacent` or `end`) and a `private` flag; `waitprofile` with non-empty load `signals`, optional `idle` and `timeout` thresholds and per origin `overrides`; and `urlpattern` with a `mode` (`exact`, `prefix`, `host` or `pattern`), a `url`, optional `query` parameter expectations and an optional `fragment`.\n * - `waiturl` and `spawait` carry a reviewed `urlpattern`, `timeout` and `poll`; `spanav` carries an optional `routepattern`, `followlink` an optional `fragment` flag, `rewritequery` reviewed `set` and `remove` query edits, `navlist`/`prefetch`/`batchopen` reviewed `urls` lists, `preconnect` reviewed `origins`, `navrate` a reviewed `ratelimit` with `domain`, `window` and `ceiling` (never capped in code), and `deeplink` a reviewed `app` pattern with `params`.\n * - observation kinds attach structured evidence to step details: a11y trees, reader articles, list patterns, table shapes, pagination estimates, watch event records, quiet probe samples, snapshot diffs and derived selector candidates with stability scores.\n * - navigation steps attach structured evidence to step details: load phases and ready states, final urls after redirects, redirect chains with statuses and timing, http error, offline and certificate interstitial states, safety verdicts and navlist entry completions.\n * - the tabs and windows command family adds its parameter grammar: `tabquery` with url, title, id and pattern matchers (at least one matcher required, patterns use `*` and `**` wildcards); `group` with a `name`, a Chromium tab group `color`, member `tabids` and a `collapsed` flag; `layout` names for `savelayout` and `restorelayout`; reviewed `pinned`, `muted`, `index`, `windowid`, `direction`, `step`, `bounds`, `label`, `labels`, `taskrefs`, `provenance` and `run` fields; `tabcreate` gains reviewed `background` and `window` options and `windowcreate` gains reviewed `left`, `top`, `width`, `height` and `state` options; `closepattern` requires the explicit `reviewed` flag before any tab closes.\n * - tab command steps attach structured evidence to step details: tab reports with matched tabs carrying audio state and metadata, group registries, badge states, layout snapshots, clone warnings, discard candidates and watchtab event records.\n * - the forms and data family adds its parameter grammar: `formrecord` with an optional `form` selector and non-empty `entries` of `{ match, kind, value }` where `match` is a `fieldmatch` with `mode` one of `label`, `placeholder`, `arialabel` or `name`; `valuegen` with a field `kind`, an optional `locale` and an optional numeric `seed`; `fields` lists of label or placeholder value pairs for filllabel and fillplaceholder; a reviewed `name` plus `formrecord` for saveprofiles; a reviewed `consentref` for submitform and consentpassword; a reviewed `backoff` rule with `wait` and `factor` plus an optional `attempts` for retryform with no code ceiling; a reviewed `child` selector, `pick` entry, `pause` and `timeout` for chains, typeaheads and card typing; reviewed card `segments`; and a reviewed `source` for fillcode; password entries inside form records are refused because passwords need the explicit consentpassword consent.\n * - form steps attach structured evidence to step details: form reports with detected fields, kinds and matched controls, error reports with field refs and messages, wizard states with step history, typeahead picks, honeypot flags, login detections with session link markers and signup or checkout template detections.\n *\n * Ambiguous text, aria or name resolutions are refused at execution time with the candidate list so the user can choose.\n */\n\n/** Validates agent output before it becomes a locally reviewable plan. Plans may carry any number of steps. */\nexport function parseproposal(value: unknown, origin: string): planproposal {\n const root = record(value);\n if (root.version !== protocolversion) throw new Error(\"Unsupported protocol version.\");\n const planinput = record(root.plan);\n const stepsinput = planinput.steps;\n if (!Array.isArray(stepsinput) || stepsinput.length === 0) throw new Error(\"A plan needs at least one step.\");\n const steps: toolstep[] = stepsinput.map((input, index) => {\n const candidate = record(input);\n const kind = text(candidate.kind, `step ${index + 1} kind`) as toolstep[\"kind\"];\n const step: toolstep = {\n id: typeof candidate.id === \"string\" ? candidate.id : crypto.randomUUID(),\n kind,\n summary: text(candidate.summary, `step ${index + 1} summary`),\n risk: actionrisk(kind),\n ...(typeof candidate.target === \"string\" ? { target: candidate.target } : {}),\n ...(typeof candidate.value === \"string\" ? { value: candidate.value } : {}),\n ...(typeof candidate.options === \"string\" ? { options: candidate.options } : {}),\n };\n const evaluation = validatestep(step, origin);\n if (!evaluation.allowed) throw new Error(evaluation.reason);\n return step;\n });\n for (const step of steps) {\n if (step.kind !== \"retryaction\" && step.kind !== \"enterframe\") continue;\n const options = parseoptions(step);\n if (typeof options.stepid === \"string\" && !steps.some(candidate => candidate.id === options.stepid)) throw new Error(\"A retry or frame wrapper references an unknown step id.\");\n }\n for (const step of steps) {\n if (step.kind !== \"submitform\" && step.kind !== \"retryform\") continue;\n const review = submitreviewgranted(steps, step.id);\n if (!review.allowed) throw new Error(review.reason);\n }\n const createdat = Date.now();\n const expiresat = typeof planinput.expiresat === \"number\" ? planinput.expiresat : createdat + 10 * 60 * 1000;\n const plan: agentplan = {\n id: typeof planinput.id === \"string\" ? planinput.id : crypto.randomUUID(),\n objective: text(planinput.objective, \"objective\"),\n origin,\n steps,\n createdat,\n expiresat,\n state: \"pending\",\n };\n if (plan.expiresat <= createdat) throw new Error(\"Plan expiry must be in the future.\");\n return { version: protocolversion, plan };\n}\n\n/** Shapes the only data that may be sent to a user-configured agent endpoint. */\nexport function requestbody(input: proposalrequest): string {\n return JSON.stringify({ version: protocolversion, objective: input.objective, session: input.session, observation: input.observation, capabilities: input.capabilities });\n}\n\n/** Wraps one executed step outcome in the versioned response envelope for callers, attaching the matched element summary for review. */\nexport function outcomeresponse(input: { outcome: stepoutcome; plan: agentplan; resolvedtarget?: resolvedtarget }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, outcome: input.outcome, ...(input.resolvedtarget ? { resolvedtarget: input.resolvedtarget } : {}) });\n}\n\n/** Wraps a clickable map payload with numbered entries in the versioned response envelope. */\nexport function mapresponse(input: { map: clickablemap; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, map: input.map });\n}\n\n/** Reports the keys currently held on one tab for the live context envelope, refreshed per step. */\nexport function heldkeysreport(input: { tabid: number; holds: keyholdstate[] }): { version: typeof protocolversion; tabid: number; heldkeys: keyholdstate[] } {\n return { version: protocolversion, tabid: input.tabid, heldkeys: input.holds };\n}\n\n/** Wraps one observation capture with its a11y, reader, listpattern, tableshape and diff sections in the versioned response envelope. */\nexport function observationresponse(input: { observation: observation; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, observation: input.observation });\n}\n\n/** Wraps mutation, focus and banner event records with their timestamps and target paths in the versioned response envelope. */\nexport function eventresponse(input: { events: Array<mutationevent | focusevent | bannerreport>; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, events: input.events });\n}\n\n/** Wraps one snapshot diff with its added, removed and changed nodes and its two observation versions in the versioned response envelope. */\nexport function diffresponse(input: { diff: snapshotdiff; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, diff: input.diff });\n}\n\n/** Reports the detected page language, template class, scroll lock and banner state in the live context envelope. */\nexport function signalsreport(input: { signals?: pagesignals }): { version: typeof protocolversion; language?: string; template?: string; scrolllocked?: boolean; banner?: string } {\n const signals = input.signals;\n return {\n version: protocolversion,\n ...(signals && signals.language !== undefined ? { language: signals.language } : {}),\n ...(signals && signals.template !== undefined ? { template: signals.template } : {}),\n ...(signals && signals.scrolllocked !== undefined ? { scrolllocked: signals.scrolllocked } : {}),\n ...(signals && signals.banner !== undefined ? { banner: signals.banner } : {}),\n };\n}\n\n/** Wraps derived selector candidates with their stability scores in the versioned response envelope. */\nexport function selectorresponse(input: { candidates: selectorcandidate[]; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, candidates: input.candidates });\n}\n\n/** Wraps the live navigation state with its load phase, final url and redirect chain in the versioned response envelope. */\nexport function navstateresponse(input: { navstate: navstate; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, navstate: input.navstate });\n}\n\n/** Carries the navigation trail of a session with its visited urls, titles and step refs in the session context envelope. */\nexport function trailreport(input: { sessionid?: string; trail: trailentry[] }): { version: typeof protocolversion; sessionid?: string; trail: trailentry[] } {\n return { version: protocolversion, ...(input.sessionid ? { sessionid: input.sessionid } : {}), trail: input.trail };\n}\n\n/** Wraps url safety verdicts with their reasons in the versioned response envelope for external link review. */\nexport function safetyresponse(input: { verdicts: safetyverdict[]; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, verdicts: input.verdicts });\n}\n\n/** Wraps one tab report with its matched tabs, groups and badges in the versioned response envelope. */\nexport function tabreportresponse(input: { report: tabreport; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, report: input.report });\n}\n\n/** Carries the saved tab layouts with their window bounds and group states in the session context envelope. */\nexport function layoutreport(input: { layouts: tablayout[] }): { version: typeof protocolversion; layouts: tablayout[] } {\n return { version: protocolversion, layouts: input.layouts };\n}\n\n/** Wraps one form report with the detected fields, their kinds and the matched controls in the versioned response envelope. */\nexport function formreportresponse(input: { report: formreport; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, report: input.report });\n}\n\n/** Wraps one collected error report with its field refs and messages in the versioned response envelope for correction loops. */\nexport function errorreportresponse(input: { report: errorreport; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, report: input.report });\n}\n\n/** Carries the wizard states with their step history and the recorded typeahead picks in the session context envelope. */\nexport function wizardreport(input: { sessionid?: string; wizards: wizardstate[]; picks: typeaheadpick[] }): { version: typeof protocolversion; sessionid?: string; wizards: wizardstate[]; picks: typeaheadpick[] } {\n return { version: protocolversion, ...(input.sessionid ? { sessionid: input.sessionid } : {}), wizards: input.wizards, picks: input.picks };\n}\n"],
|
|
5
|
-
"mappings": ";AAYO,IAAM,gBAAN,MAAoB;AAAA,EACzB,YAA6B,SAAwB;AAAxB;AAAA,EAAyB;AAAA,EAAzB;AAAA,EAE7B,MAAM,YAAiD;AAAE,WAAO,KAAK,QAAQ,IAAoB,QAAQ;AAAA,EAAG;AAAA,EAC5G,MAAM,UAAU,OAAsC;AAAE,WAAO,KAAK,QAAQ,IAAI,UAAU,KAAK;AAAA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AAY,EAAE,WAAW,MAAM,UAAU,IAAI,CAAC,GAAI,SAAS,MAAM,SAAS,OAAO,MAAM,MAAM;AAC5I;",
|
|
4
|
+
"sourcesContent": ["import type { a11ycapture, agentplan, agentsession, artifactinventoryentry, artifactrecord, auditevent, authrecord, bannerreport, capabilityreport, captchahandoff, capturecounter, clipboardconsentrecord, cleanuprule, cleanuprun, clipentry, clickablemap, closedtab, controltabstate, curatedlist, dataset, derivedselector, detectionrecord, diagnosticreport, dialogdecision, dialogpolicy, downloadrecord, endpointconfig, errorreport, exportedartifact, extractsession, focusevent, formprofile, keyholdstate, mimefilter, mutationevent, navcontrol, navintentrecord, navqueues, navrecord, netlogrecord, observationrecord, pagesignals, planprogress, provenancerecord, quarantineentry, ratelimitstate, readercapture, recenttab, resolutionsummary, retryoutcome, runsettings, safetyverdict, scanhookconfig, sessionsnapshot, sheetendpoint, snapshotdiff, stepoutcome, streamstate, submitticket, tabbadge, tabgrouprecord, tablayout, tabmeta, tabwatchevent, taskrules, templateprofile, trailentry, typeaheadpick, waitprofilerecord, watchregistration, wizardstate } from \"./types.js\";\n\n/** Provides a small storage seam that works in browser, tests and future adapters. */\nexport interface memoryadapter {\n get<T>(key: string): Promise<T | undefined>;\n set<T>(key: string, value: T): Promise<void>;\n}\n\n/**\n * Local memory for sessions, plans, audit evidence and interaction state.\n * Correlated rules for every stored record live in this one seam; each accessor is a one line storage delegation so future backends replace the adapter only.\n */\nexport class sessionmemory {\n constructor(private readonly adapter: memoryadapter) {}\n\n async getconfig(): Promise<endpointconfig | undefined> { return this.adapter.get<endpointconfig>(\"config\"); }\n async setconfig(value: endpointconfig): Promise<void> { return this.adapter.set(\"config\", value); }\n async getsession(): Promise<agentsession | undefined> { return this.adapter.get<agentsession>(\"session\"); }\n async setsession(value: agentsession): Promise<void> { return this.adapter.set(\"session\", value); }\n async getplan(): Promise<agentplan | undefined> { return this.adapter.get<agentplan>(\"plan\"); }\n async setplan(value: agentplan): Promise<void> { return this.adapter.set(\"plan\", value); }\n async getdiagnostic(): Promise<diagnosticreport | undefined> { return this.adapter.get<diagnosticreport>(\"diagnostic\"); }\n async setdiagnostic(value: diagnosticreport): Promise<void> { return this.adapter.set(\"diagnostic\", value); }\n async getprogress(): Promise<planprogress | undefined> { return this.adapter.get<planprogress>(\"progress\"); }\n async setprogress(value: planprogress): Promise<void> { return this.adapter.set(\"progress\", value); }\n async getcapabilities(): Promise<capabilityreport | undefined> { return this.adapter.get<capabilityreport>(\"capabilities\"); }\n async setcapabilities(value: capabilityreport): Promise<void> { return this.adapter.set(\"capabilities\", value); }\n async getsettings(): Promise<runsettings | undefined> { return this.adapter.get<runsettings>(\"settings\"); }\n async setsettings(value: runsettings): Promise<void> { return this.adapter.set(\"settings\", value); }\n async getaudit(): Promise<auditevent[]> { return (await this.adapter.get<auditevent[]>(\"audit\")) ?? []; }\n async getoutcomes(): Promise<stepoutcome[]> { return (await this.adapter.get<stepoutcome[]>(\"outcomes\")) ?? []; }\n\n /** Records one audit event; retention is a user setting and an absent setting keeps every event. */\n async addaudi(event: auditevent): Promise<void> {\n const records = await this.getaudit();\n const combined = [event, ...records];\n const retention = (await this.getsettings())?.auditretention;\n await this.adapter.set(\"audit\", retention === undefined ? combined : combined.slice(0, retention));\n }\n\n /** Records one step outcome; retention is a user setting and an absent setting keeps every outcome. */\n async addoutcome(outcome: stepoutcome): Promise<void> {\n const records = await this.getoutcomes();\n const combined = [outcome, ...records];\n const retention = (await this.getsettings())?.outcomeretention;\n await this.adapter.set(\"outcomes\", retention === undefined ? combined : combined.slice(0, retention));\n }\n\n /** Stores one clickable map under its observation version so every captured map stays available. */\n async setmap(map: clickablemap): Promise<void> { return this.adapter.set(`map${map.version}`, map); }\n\n /** Returns one stored clickable map by its observation version. */\n async getmap(version: number): Promise<clickablemap | undefined> { return this.adapter.get<clickablemap>(`map${version}`); }\n\n /** Advances and persists the observation version counter used to stamp clickable maps. */\n async nextobservationversion(): Promise<number> {\n const current = (await this.adapter.get<number>(\"observationversion\")) ?? 0;\n const next = current + 1;\n await this.adapter.set(\"observationversion\", next);\n return next;\n }\n\n /** Returns the latest observation version used to stamp a clickable map. */\n async getobservationversion(): Promise<number | undefined> { return this.adapter.get<number>(\"observationversion\"); }\n\n /** Returns the key hold registry, persisted so holds survive service worker restarts. */\n async getholds(): Promise<keyholdstate[]> { return (await this.adapter.get<keyholdstate[]>(\"holds\")) ?? []; }\n\n /** Replaces the key hold registry after one press or release transition. */\n async setholds(holds: keyholdstate[]): Promise<void> { return this.adapter.set(\"holds\", holds); }\n\n /** Returns every dialog decision recorded for the audit trail. */\n async getdialogs(): Promise<dialogdecision[]> { return (await this.adapter.get<dialogdecision[]>(\"dialogs\")) ?? []; }\n\n /** Records one dialog decision with the reviewed answer and the observed dialog text. */\n async adddialog(decision: dialogdecision): Promise<void> {\n const records = await this.getdialogs();\n await this.adapter.set(\"dialogs\", [decision, ...records]);\n }\n\n /** Returns every retry outcome recorded with attempts and movement deltas. */\n async getretries(): Promise<retryoutcome[]> { return (await this.adapter.get<retryoutcome[]>(\"retries\")) ?? []; }\n\n /** Records one retry outcome with the attempts made and the movement delta observed. */\n async addretry(outcome: retryoutcome): Promise<void> {\n const records = await this.getretries();\n await this.adapter.set(\"retries\", [outcome, ...records]);\n }\n\n /** Returns every resolution summary stored per target mode. */\n async getresolutions(): Promise<resolutionsummary[]> { return (await this.adapter.get<resolutionsummary[]>(\"resolutions\")) ?? []; }\n\n /** Records one resolution summary for later selector derivation. */\n async addresolution(summary: resolutionsummary): Promise<void> {\n const records = await this.getresolutions();\n await this.adapter.set(\"resolutions\", [summary, ...records]);\n }\n\n /** Returns the reviewed default dialog policy kept for the session auto handler. */\n async getdialogpolicy(): Promise<dialogpolicy | undefined> { return this.adapter.get<dialogpolicy>(\"dialogpolicy\"); }\n\n /** Stores the reviewed default dialog policy of the latest approved plan. */\n async setdialogpolicy(policy: dialogpolicy): Promise<void> { return this.adapter.set(\"dialogpolicy\", policy); }\n\n /** Stores one observation capture under its version so every observation version stays available. */\n async setobservation(record: observationrecord): Promise<void> { return this.adapter.set(`observation${record.version}`, record); }\n\n /** Returns one stored observation version. */\n async getobservation(version: number): Promise<observationrecord | undefined> { return this.adapter.get<observationrecord>(`observation${version}`); }\n\n /** Returns the observation retention window; an absent setting keeps every capture. */\n private async observationretention(): Promise<number | undefined> { return (await this.getsettings())?.observationretention; }\n\n /** Stores one accessibility tree capture; retention is a user setting and an absent setting keeps every tree. */\n async adda11ytree(capture: a11ycapture): Promise<void> {\n const records = await this.geta11ytrees();\n const combined = [capture, ...records];\n const retention = await this.observationretention();\n await this.adapter.set(\"a11ytrees\", retention === undefined ? combined : combined.slice(0, retention));\n }\n\n /** Returns every stored accessibility tree capture, newest first. */\n async geta11ytrees(): Promise<a11ycapture[]> { return (await this.adapter.get<a11ycapture[]>(\"a11ytrees\")) ?? []; }\n\n /** Stores one reader article capture; retention is a user setting and an absent setting keeps every article. */\n async addreaderarticle(capture: readercapture): Promise<void> {\n const records = await this.getreaderarticles();\n const combined = [capture, ...records];\n const retention = await this.observationretention();\n await this.adapter.set(\"readerarticles\", retention === undefined ? combined : combined.slice(0, retention));\n }\n\n /** Returns every stored reader article capture, newest first. */\n async getreaderarticles(): Promise<readercapture[]> { return (await this.adapter.get<readercapture[]>(\"readerarticles\")) ?? []; }\n\n /** Records one dom mutation observed inside a reviewed watch. */\n async addmutationevent(event: mutationevent): Promise<void> {\n const records = await this.getmutationevents();\n await this.adapter.set(\"mutationevents\", [event, ...records]);\n }\n\n /** Returns the mutation event stream of every reviewed watch. */\n async getmutationevents(): Promise<mutationevent[]> { return (await this.adapter.get<mutationevent[]>(\"mutationevents\")) ?? []; }\n\n /** Records one focus change observed inside a reviewed watch. */\n async addfocusevent(event: focusevent): Promise<void> {\n const records = await this.getfocusevents();\n await this.adapter.set(\"focusevents\", [event, ...records]);\n }\n\n /** Returns the focus event stream of every reviewed watch. */\n async getfocusevents(): Promise<focusevent[]> { return (await this.adapter.get<focusevent[]>(\"focusevents\")) ?? []; }\n\n /** Records one consent banner observed by a reviewed banner watch. */\n async addbanner(event: bannerreport): Promise<void> {\n const records = await this.getbanners();\n await this.adapter.set(\"banners\", [event, ...records]);\n }\n\n /** Returns every consent banner report observed so far. */\n async getbanners(): Promise<bannerreport[]> { return (await this.adapter.get<bannerreport[]>(\"banners\")) ?? []; }\n\n /** Records one snapshot diff between two observation versions. */\n async adddiff(diff: snapshotdiff): Promise<void> {\n const records = await this.getdiffs();\n await this.adapter.set(\"diffs\", [diff, ...records]);\n }\n\n /** Returns every stored snapshot diff, newest first. */\n async getdiffs(): Promise<snapshotdiff[]> { return (await this.adapter.get<snapshotdiff[]>(\"diffs\")) ?? []; }\n\n /** Records one derived selector with its stability score for reuse. */\n async addselector(selector: derivedselector): Promise<void> {\n const records = await this.getselectors();\n await this.adapter.set(\"selectors\", [selector, ...records]);\n }\n\n /** Returns every stored derived selector with its stability score, newest first. */\n async getselectors(): Promise<derivedselector[]> { return (await this.adapter.get<derivedselector[]>(\"selectors\")) ?? []; }\n\n /** Records one detected template class or section fingerprint for its origin. */\n async addtemplate(profile: templateprofile): Promise<void> {\n const records = await this.gettemplates();\n await this.adapter.set(\"templates\", [profile, ...records]);\n }\n\n /** Returns every stored template class and section fingerprint, newest first. */\n async gettemplates(): Promise<templateprofile[]> { return (await this.adapter.get<templateprofile[]>(\"templates\")) ?? []; }\n\n /** Records one watch registration so it survives service worker restarts. */\n async addwatch(watch: watchregistration): Promise<void> {\n const records = await this.getwatches();\n await this.adapter.set(\"watches\", [watch, ...records]);\n }\n\n /** Returns every watch registration, newest first, including closed windows. */\n async getwatches(): Promise<watchregistration[]> { return (await this.adapter.get<watchregistration[]>(\"watches\")) ?? []; }\n\n /** Closes one watch registration by watch id once its reviewed lifetime window ends. */\n async closewatch(watchid: string, closedat: number): Promise<void> {\n const records = await this.getwatches();\n await this.adapter.set(\"watches\", records.map(watch => watch.watchid === watchid && watch.closedat === undefined ? { ...watch, closedat } : watch));\n }\n\n /** Returns the live page signals of language, template, scroll lock and banner state. */\n async getsignals(): Promise<pagesignals | undefined> { return this.adapter.get<pagesignals>(\"signals\"); }\n\n /** Replaces the live page signals after an observation step refreshes them. */\n async setsignals(signals: pagesignals): Promise<void> { return this.adapter.set(\"signals\", signals); }\n\n /** Appends one navigation trail entry of a session with its url, title, step ref and timestamp. */\n async addtrailentry(sessionid: string, entry: trailentry): Promise<void> {\n const records = await this.gettrail(sessionid);\n await this.adapter.set(`trail${sessionid}`, [...records, entry]);\n }\n\n /** Returns the navigation trail of a session, oldest first. */\n async gettrail(sessionid: string): Promise<trailentry[]> { return (await this.adapter.get<trailentry[]>(`trail${sessionid}`)) ?? []; }\n\n /** Stores one wait profile for an origin with user configured values, replacing the previous profile of that origin. */\n async setwaitprofile(record: waitprofilerecord): Promise<void> {\n const records = (await this.getwaitprofiles()).filter(item => item.origin !== record.origin);\n await this.adapter.set(\"waitprofiles\", [...records, record]);\n }\n\n /** Returns every stored wait profile with its origin and user configured values, newest first. */\n async getwaitprofiles(): Promise<waitprofilerecord[]> { return (await this.adapter.get<waitprofilerecord[]>(\"waitprofiles\")) ?? []; }\n\n /** Records one navigation step with its redirect chain and final url. */\n async addnavrecord(record: navrecord): Promise<void> {\n const records = await this.getnavrecords();\n await this.adapter.set(\"navrecords\", [record, ...records]);\n }\n\n /** Returns every stored navigation record with redirect chains and final urls, newest first. */\n async getnavrecords(): Promise<navrecord[]> { return (await this.adapter.get<navrecord[]>(\"navrecords\")) ?? []; }\n\n /** Records one navigation intent detected from a plan for audit review. */\n async addnavintent(record: navintentrecord): Promise<void> {\n const records = await this.getnavintents();\n await this.adapter.set(\"navintents\", [record, ...records]);\n }\n\n /** Returns every stored navigation intent record, newest first. */\n async getnavintents(): Promise<navintentrecord[]> { return (await this.adapter.get<navintentrecord[]>(\"navintents\")) ?? []; }\n\n /** Replaces the rate limit window state of one domain. */\n async setratestate(state: ratelimitstate): Promise<void> {\n const records = (await this.getratestates()).filter(item => item.domain !== state.domain);\n await this.adapter.set(\"ratestates\", [...records, state]);\n }\n\n /** Returns every rate limit window state per domain. */\n async getratestates(): Promise<ratelimitstate[]> { return (await this.adapter.get<ratelimitstate[]>(\"ratestates\")) ?? []; }\n\n /** Records one curated link list with its review state before batch opening. */\n async addcurated(list: curatedlist): Promise<void> {\n const records = await this.getcurateds();\n await this.adapter.set(\"curated\", [list, ...records]);\n }\n\n /** Returns every stored curated link list, newest first. */\n async getcurateds(): Promise<curatedlist[]> { return (await this.adapter.get<curatedlist[]>(\"curated\")) ?? []; }\n\n /** Stores reviewed basic auth credentials for one origin, replacing the previous record of that origin. */\n async setauth(record: authrecord): Promise<void> {\n const records = (await this.getauths()).filter(item => item.origin !== record.origin);\n await this.adapter.set(\"auths\", [...records, record]);\n }\n\n /** Returns every stored reviewed basic auth record per origin. */\n async getauths(): Promise<authrecord[]> { return (await this.adapter.get<authrecord[]>(\"auths\")) ?? []; }\n\n /** Records one task artifact routed into the artifact store. */\n async addartifact(record: artifactrecord): Promise<void> {\n const records = await this.getartifacts();\n await this.adapter.set(\"artifacts\", [record, ...records]);\n }\n\n /** Returns every stored task artifact, newest first. */\n async getartifacts(): Promise<artifactrecord[]> { return (await this.adapter.get<artifactrecord[]>(\"artifacts\")) ?? []; }\n\n /** Returns the navigation control state of paused navigation. */\n async getnavcontrol(): Promise<navcontrol | undefined> { return this.adapter.get<navcontrol>(\"navcontrol\"); }\n\n /** Replaces the navigation control state after a pause or resume transition. */\n async setnavcontrol(control: navcontrol): Promise<void> { return this.adapter.set(\"navcontrol\", control); }\n\n /** Records one url safety verdict produced by a checksafe verification. */\n async addsafety(verdict: safetyverdict): Promise<void> {\n const records = await this.getsafeties();\n await this.adapter.set(\"safeties\", [verdict, ...records]);\n }\n\n /** Returns every stored url safety verdict, newest first. */\n async getsafeties(): Promise<safetyverdict[]> { return (await this.adapter.get<safetyverdict[]>(\"safeties\")) ?? []; }\n\n /** Records one recently closed tab so a reopentab step can restore it. */\n async addrecenttab(tab: recenttab): Promise<void> {\n const records = await this.getrecenttabs();\n await this.adapter.set(\"recenttabs\", [tab, ...records]);\n }\n\n /** Returns every recently closed tab, newest first. */\n async getrecenttabs(): Promise<recenttab[]> { return (await this.adapter.get<recenttab[]>(\"recenttabs\")) ?? []; }\n\n /** Returns the queued prefetch and batch open target counts shown in the popup badge. */\n async getnavqueues(): Promise<navqueues | undefined> { return this.adapter.get<navqueues>(\"navqueues\"); }\n\n /** Replaces the queued prefetch and batch open target counts. */\n async setnavqueues(queues: navqueues): Promise<void> { return this.adapter.set(\"navqueues\", queues); }\n\n /** Returns the last known navigation state of a tab, kept across service worker restarts. */\n async getnavstate(tabid: number): Promise<navrecord | undefined> { return this.adapter.get<navrecord>(`navstate${tabid}`); }\n\n /** Replaces the last known navigation state of a tab. */\n async setnavstate(tabid: number, state: navrecord): Promise<void> { return this.adapter.set(`navstate${tabid}`, state); }\n\n /** Stores one named tab layout with its window bounds and group states, replacing the previous layout of that name. */\n async setlayout(layout: tablayout): Promise<void> {\n const records = (await this.getlayouts()).filter(item => item.name !== layout.name);\n await this.adapter.set(\"layouts\", [layout, ...records]);\n }\n\n /** Returns one saved tab layout by name with its timestamp. */\n async getlayout(name: string): Promise<tablayout | undefined> { return (await this.getlayouts()).find(item => item.name === name); }\n\n /** Returns every saved tab layout with its window bounds and group states. */\n async getlayouts(): Promise<tablayout[]> { return (await this.adapter.get<tablayout[]>(\"layouts\")) ?? []; }\n\n /** Stores one tab group definition with its color choice and member tabs, replacing the previous definition of that name. */\n async settabgroup(group: tabgrouprecord): Promise<void> {\n const records = (await this.gettabgroups()).filter(item => item.name !== group.name);\n await this.adapter.set(\"tabgroups\", [...records, group]);\n }\n\n /** Returns every stored tab group definition with its color choice, newest first. */\n async gettabgroups(): Promise<tabgrouprecord[]> { return (await this.adapter.get<tabgrouprecord[]>(\"tabgroups\")) ?? []; }\n\n /** Records one tabmeta record with task provenance, replacing the previous metadata of that tab. */\n async settabmeta(meta: tabmeta): Promise<void> {\n const records = (await this.gettabmetas()).filter(item => item.tabid !== meta.tabid);\n await this.adapter.set(\"tabmetas\", [...records, meta]);\n }\n\n /** Returns every stored tabmeta record with task provenance. */\n async gettabmetas(): Promise<tabmeta[]> { return (await this.adapter.get<tabmeta[]>(\"tabmetas\")) ?? []; }\n\n /** Records one session snapshot of tabs and windows for later restore. */\n async addsnapshot(snapshot: sessionsnapshot): Promise<void> {\n const records = await this.getsnapshots();\n await this.adapter.set(\"snapshots\", [snapshot, ...records]);\n }\n\n /** Returns every stored session snapshot, newest first. */\n async getsnapshots(): Promise<sessionsnapshot[]> { return (await this.adapter.get<sessionsnapshot[]>(\"snapshots\")) ?? []; }\n\n /** Records one closed tab in the history kept for restoretab and reopenrun. */\n async addclosedtab(tab: closedtab): Promise<void> {\n const records = await this.getclosedtabs();\n await this.adapter.set(\"closedtabs\", [tab, ...records]);\n }\n\n /** Returns the closed tab history, newest first. */\n async getclosedtabs(): Promise<closedtab[]> { return (await this.adapter.get<closedtab[]>(\"closedtabs\")) ?? []; }\n\n /** Stores one badge state per task, replacing the previous badge of that task. */\n async setbadge(badge: tabbadge): Promise<void> {\n const records = (await this.getbadges()).filter(item => item.taskid !== badge.taskid);\n await this.adapter.set(\"badges\", [...records, badge]);\n }\n\n /** Returns every stored badge state per task. */\n async getbadges(): Promise<tabbadge[]> { return (await this.adapter.get<tabbadge[]>(\"badges\")) ?? []; }\n\n /** Records one tab event observed inside a reviewed watchtab registration. */\n async addtabwatchevent(event: tabwatchevent): Promise<void> {\n const records = await this.gettabwatchevents();\n await this.adapter.set(\"tabwatchevents\", [event, ...records]);\n }\n\n /** Returns the tab event stream of every reviewed watchtab registration, newest first. */\n async gettabwatchevents(): Promise<tabwatchevent[]> { return (await this.adapter.get<tabwatchevent[]>(\"tabwatchevents\")) ?? []; }\n\n /** Returns the ids of the scratch windows opened for split work. */\n async getscratchwindows(): Promise<number[]> { return (await this.adapter.get<number[]>(\"scratchwindows\")) ?? []; }\n\n /** Replaces the scratch window id list after one scratch window opens or closes. */\n async setscratchwindows(ids: number[]): Promise<void> { return this.adapter.set(\"scratchwindows\", ids); }\n\n /** Returns the pinned control tab state with the live task feed. */\n async getcontroltab(): Promise<controltabstate | undefined> { return this.adapter.get<controltabstate>(\"controltab\"); }\n\n /** Replaces the pinned control tab state. */\n async setcontroltab(state: controltabstate): Promise<void> { return this.adapter.set(\"controltab\", state); }\n\n /** Stores one saved form profile under its reviewed name, replacing the previous profile of that name. */\n async setprofile(profile: formprofile): Promise<void> {\n const records = (await this.getprofiles()).filter(item => item.name !== profile.name);\n await this.adapter.set(\"formprofiles\", [profile, ...records]);\n }\n\n /** Returns one saved form profile by its reviewed name. */\n async getprofile(name: string): Promise<formprofile | undefined> { return (await this.getprofiles()).find(item => item.name === name); }\n\n /** Returns every saved form profile with its origin grants, newest first. */\n async getprofiles(): Promise<formprofile[]> { return (await this.adapter.get<formprofile[]>(\"formprofiles\")) ?? []; }\n\n /** Removes one saved form profile by its reviewed name. */\n async removeprofile(name: string): Promise<void> {\n const records = (await this.getprofiles()).filter(item => item.name !== name);\n await this.adapter.set(\"formprofiles\", records);\n }\n\n /** Records one wizard state with its step history. */\n async addwizard(state: wizardstate): Promise<void> {\n const records = await this.getwizards();\n await this.adapter.set(\"wizards\", [state, ...records]);\n }\n\n /** Returns every stored wizard state with its step history, newest first. */\n async getwizards(): Promise<wizardstate[]> { return (await this.adapter.get<wizardstate[]>(\"wizards\")) ?? []; }\n\n /** Stores one submission ticket with its values hash, replacing the previous ticket of that id. */\n async setticket(ticket: submitticket): Promise<void> {\n const records = (await this.gettickets()).filter(item => item.id !== ticket.id);\n await this.adapter.set(\"submittickets\", [ticket, ...records]);\n }\n\n /** Returns every stored submission ticket with its values hash, newest first. */\n async gettickets(): Promise<submitticket[]> { return (await this.adapter.get<submitticket[]>(\"submittickets\")) ?? []; }\n\n /** Records one collected error report for correction loops. */\n async adderrorreport(report: errorreport): Promise<void> {\n const records = await this.geterrorreports();\n await this.adapter.set(\"errorreports\", [report, ...records]);\n }\n\n /** Returns every stored error report, newest first. */\n async geterrorreports(): Promise<errorreport[]> { return (await this.adapter.get<errorreport[]>(\"errorreports\")) ?? []; }\n\n /** Records one typeahead pick observed when a reviewed suggestion entry was chosen. */\n async addpick(pick: typeaheadpick): Promise<void> {\n const records = await this.getpicks();\n await this.adapter.set(\"typeaheadpicks\", [pick, ...records]);\n }\n\n /** Returns every recorded typeahead pick, newest first. */\n async getpicks(): Promise<typeaheadpick[]> { return (await this.adapter.get<typeaheadpick[]>(\"typeaheadpicks\")) ?? []; }\n\n /** Records one captcha handoff while the plan waits for the user. */\n async addcaptcha(handoff: captchahandoff): Promise<void> {\n const records = await this.getcaptchas();\n await this.adapter.set(\"captchas\", [handoff, ...records]);\n }\n\n /** Returns every captcha handoff record with its resolution state, newest first. */\n async getcaptchas(): Promise<captchahandoff[]> { return (await this.adapter.get<captchahandoff[]>(\"captchas\")) ?? []; }\n\n /** Resolves one captcha handoff by id once the user finished it. */\n async resolvecaptcha(id: string, resolvedat: number): Promise<void> {\n const records = await this.getcaptchas();\n await this.adapter.set(\"captchas\", records.map(handoff => handoff.id === id && !handoff.resolved ? { ...handoff, resolved: true, resolvedat } : handoff));\n }\n\n /** Records one login or template detection for its origin. */\n async adddetection(record: detectionrecord): Promise<void> {\n const records = await this.getdetections();\n await this.adapter.set(\"detections\", [record, ...records]);\n }\n\n /** Returns every stored login and template detection per origin, newest first. */\n async getdetections(): Promise<detectionrecord[]> { return (await this.adapter.get<detectionrecord[]>(\"detections\")) ?? []; }\n\n /** Stores the reviewed one time code behind the consent gate of an active session. */\n async setcodevalue(value: string): Promise<void> { return this.adapter.set(\"codevalue\", value); }\n\n /** Returns the reviewed one time code, if the user stored one behind the consent gate. */\n async getcodevalue(): Promise<string | undefined> { return this.adapter.get<string>(\"codevalue\"); }\n\n /** Stores one dataset with its column specs and rows, replacing the previous record of that id. */\n async setdataset(value: dataset): Promise<void> {\n await this.adapter.set(`dataset${value.id}`, value);\n const ids = ((await this.adapter.get<string[]>(\"datasets\")) ?? []).filter(id => id !== value.id);\n await this.adapter.set(\"datasets\", [value.id, ...ids]);\n }\n\n /** Returns one stored dataset by its id with its column specs and row count. */\n async getdataset(id: string): Promise<dataset | undefined> { return this.adapter.get<dataset>(`dataset${id}`); }\n\n /** Returns every stored dataset id, newest first. */\n async getdatasets(): Promise<dataset[]> {\n const ids = (await this.adapter.get<string[]>(\"datasets\")) ?? [];\n const records: dataset[] = [];\n for (const id of ids) {\n const record = await this.adapter.get<dataset>(`dataset${id}`);\n if (record) records.push(record);\n }\n return records;\n }\n\n /** Stores one imported csv dataset for fill loops beside the dataset store. */\n async addimport(value: dataset): Promise<void> {\n await this.setdataset(value);\n const ids = ((await this.adapter.get<string[]>(\"imports\")) ?? []).filter(id => id !== value.id);\n await this.adapter.set(\"imports\", [value.id, ...ids]);\n }\n\n /** Returns every imported csv dataset for fill loops, newest first. */\n async getimports(): Promise<dataset[]> {\n const ids = (await this.adapter.get<string[]>(\"imports\")) ?? [];\n const records: dataset[] = [];\n for (const id of ids) {\n const record = await this.adapter.get<dataset>(`dataset${id}`);\n if (record) records.push(record);\n }\n return records;\n }\n\n /** Stores one extraction session with its cursor and page history, replacing the previous session of that id. */\n async setextractsession(value: extractsession): Promise<void> {\n await this.adapter.set(`extract${value.id}`, value);\n const ids = ((await this.adapter.get<string[]>(\"extracts\")) ?? []).filter(id => id !== value.id);\n await this.adapter.set(\"extracts\", [value.id, ...ids]);\n }\n\n /** Returns every extraction session with its cursor and page history, newest first. */\n async getextractsessions(): Promise<extractsession[]> {\n const ids = (await this.adapter.get<string[]>(\"extracts\")) ?? [];\n const records: extractsession[] = [];\n for (const id of ids) {\n const record = await this.adapter.get<extractsession>(`extract${id}`);\n if (record) records.push(record);\n }\n return records;\n }\n\n /** Records one provenance record of an exported artifact. */\n async addprovenance(record: provenancerecord): Promise<void> {\n const records = await this.getprovenances();\n await this.adapter.set(\"provenances\", [record, ...records]);\n }\n\n /** Returns every provenance record per exported artifact, newest first. */\n async getprovenances(): Promise<provenancerecord[]> { return (await this.adapter.get<provenancerecord[]>(\"provenances\")) ?? []; }\n\n /** Stores the transform rules and dedupe keys of one task, replacing the previous record of that task. */\n async settaskrules(value: taskrules): Promise<void> {\n const records = ((await this.adapter.get<taskrules[]>(\"taskrules\")) ?? []).filter(item => item.taskid !== value.taskid);\n await this.adapter.set(\"taskrules\", [value, ...records]);\n }\n\n /** Returns the transform rules and dedupe keys per task, newest first. */\n async gettaskrules(): Promise<taskrules[]> { return (await this.adapter.get<taskrules[]>(\"taskrules\")) ?? []; }\n\n /** Stores one stream chunk state for resume, replacing the previous state of that dataset. */\n async setstream(state: streamstate): Promise<void> {\n const records = ((await this.adapter.get<streamstate[]>(\"streams\")) ?? []).filter(item => item.datasetid !== state.datasetid);\n await this.adapter.set(\"streams\", [state, ...records]);\n }\n\n /** Returns every stream chunk state persisted for resume, newest first. */\n async getstreams(): Promise<streamstate[]> { return (await this.adapter.get<streamstate[]>(\"streams\")) ?? []; }\n\n /** Stores one reviewed sheet endpoint config behind its origin grant, replacing the previous config of that origin. */\n async setsheetendpoint(config: sheetendpoint): Promise<void> {\n const records = ((await this.adapter.get<sheetendpoint[]>(\"sheetendpoints\")) ?? []).filter(item => item.origin !== config.origin);\n await this.adapter.set(\"sheetendpoints\", [config, ...records]);\n }\n\n /** Returns every reviewed sheet endpoint config, newest first. */\n async getsheetendpoints(): Promise<sheetendpoint[]> { return (await this.adapter.get<sheetendpoint[]>(\"sheetendpoints\")) ?? []; }\n\n /** Records one exported data artifact; artifact retention is a user setting and an absent setting keeps every artifact. */\n async addexport(artifact: exportedartifact): Promise<void> {\n const records = await this.getexports();\n const combined = [artifact, ...records.filter(item => item.id !== artifact.id)];\n const retention = (await this.getsettings())?.artifactretention;\n await this.adapter.set(\"exports\", retention === undefined ? combined : combined.slice(0, retention));\n }\n\n /** Returns every exported data artifact with its content and checksum, newest first. */\n async getexports(): Promise<exportedartifact[]> { return (await this.adapter.get<exportedartifact[]>(\"exports\")) ?? []; }\n\n /** Removes one exported data artifact by id and reports whether it existed. */\n async removeexport(id: string): Promise<boolean> {\n const records = await this.getexports();\n const remaining = records.filter(item => item.id !== id);\n await this.adapter.set(\"exports\", remaining);\n return remaining.length !== records.length;\n }\n\n /** Removes one run store artifact by id and reports whether it existed. */\n async removeartifact(id: string): Promise<boolean> {\n const records = await this.getartifacts();\n const remaining = records.filter(item => item.id !== id);\n await this.adapter.set(\"artifacts\", remaining);\n return remaining.length !== records.length;\n }\n\n /** Stores one batch download file record with its state, path and checksum, replacing the previous record of that id. */\n async setdownload(record: downloadrecord): Promise<void> {\n const records = ((await this.adapter.get<downloadrecord[]>(\"downloads\")) ?? []).filter(item => item.id !== record.id);\n await this.adapter.set(\"downloads\", [record, ...records]);\n }\n\n /** Returns every batch download file record with its state, path and checksum, newest first. */\n async getdownloads(): Promise<downloadrecord[]> { return (await this.adapter.get<downloadrecord[]>(\"downloads\")) ?? []; }\n\n /** Records one captured network log record; netlog retention is a user setting and an absent value keeps every record. */\n async addnetlog(record: netlogrecord): Promise<void> {\n const records = await this.getnetlog();\n const combined = [record, ...records];\n const retention = (await this.getsettings())?.netlogretention;\n await this.adapter.set(\"netlog\", retention === undefined ? combined : combined.slice(0, retention));\n }\n\n /** Returns the captured network log of the run with its step correlation, newest first. */\n async getnetlog(): Promise<netlogrecord[]> { return (await this.adapter.get<netlogrecord[]>(\"netlog\")) ?? []; }\n\n /** Stores one clipboard consent record with its prompt and origin, replacing the previous record of that id. */\n async setclipconsent(record: clipboardconsentrecord): Promise<void> {\n const records = ((await this.adapter.get<clipboardconsentrecord[]>(\"clipconsents\")) ?? []).filter(item => item.id !== record.id);\n await this.adapter.set(\"clipconsents\", [record, ...records]);\n }\n\n /** Returns every clipboard consent record with its prompt and origin, newest first. */\n async getclipconsents(): Promise<clipboardconsentrecord[]> { return (await this.adapter.get<clipboardconsentrecord[]>(\"clipconsents\")) ?? []; }\n\n /** Records one clipboard entry hash with its origin provenance; the payload text itself never persists. */\n async addclip(entry: clipentry): Promise<void> {\n const records = await this.getclips();\n await this.adapter.set(\"clips\", [entry, ...records]);\n }\n\n /** Returns every clipboard entry hash with its kind and origin provenance, newest first. */\n async getclips(): Promise<clipentry[]> { return (await this.adapter.get<clipentry[]>(\"clips\")) ?? []; }\n\n /** Stores one quarantine entry with its scan verdict, replacing the previous entry of that id. */\n async setquarantine(entry: quarantineentry): Promise<void> {\n const records = ((await this.adapter.get<quarantineentry[]>(\"quarantines\")) ?? []).filter(item => item.id !== entry.id);\n await this.adapter.set(\"quarantines\", [entry, ...records]);\n }\n\n /** Returns every quarantine entry with its scan verdict and release ref, newest first. */\n async getquarantines(): Promise<quarantineentry[]> { return (await this.adapter.get<quarantineentry[]>(\"quarantines\")) ?? []; }\n\n /** Stores the reviewed cleanup rule set of the run, replacing the previous set. */\n async setcleanuprules(rules: cleanuprule[]): Promise<void> { return this.adapter.set(\"cleanuprules\", rules); }\n\n /** Returns the reviewed cleanup rule set of the run. */\n async getcleanuprules(): Promise<cleanuprule[]> { return (await this.adapter.get<cleanuprule[]>(\"cleanuprules\")) ?? []; }\n\n /** Records one cleanup run in the run history. */\n async addcleanuprun(run: cleanuprun): Promise<void> {\n const records = await this.getcleanupruns();\n await this.adapter.set(\"cleanupruns\", [run, ...records]);\n }\n\n /** Returns every cleanup run history record with removed and kept counts, newest first. */\n async getcleanupruns(): Promise<cleanuprun[]> { return (await this.adapter.get<cleanuprun[]>(\"cleanupruns\")) ?? []; }\n\n /** Stores the capture naming counters of one task, replacing the previous counters of that task. */\n async setcapturecounter(counter: capturecounter): Promise<void> {\n const records = ((await this.adapter.get<capturecounter[]>(\"capturecounters\")) ?? []).filter(item => item.taskid !== counter.taskid);\n await this.adapter.set(\"capturecounters\", [counter, ...records]);\n }\n\n /** Returns every stored capture naming counter per task, newest first. */\n async getcapturecounters(): Promise<capturecounter[]> { return (await this.adapter.get<capturecounter[]>(\"capturecounters\")) ?? []; }\n\n /** Replaces the artifact inventory the cleanup sweeper plans against. */\n async setinventory(entries: artifactinventoryentry[]): Promise<void> { return this.adapter.set(\"inventory\", entries); }\n\n /** Returns the artifact inventory with sizes and ages for the cleanup sweeper. */\n async getinventory(): Promise<artifactinventoryentry[]> { return (await this.adapter.get<artifactinventoryentry[]>(\"inventory\")) ?? []; }\n\n /** Stores one user configured virus scanning hook, replacing the previous hook of that scanner name. */\n async setscanhook(config: scanhookconfig): Promise<void> {\n const records = ((await this.adapter.get<scanhookconfig[]>(\"scanhooks\")) ?? []).filter(item => item.scanner !== config.scanner);\n await this.adapter.set(\"scanhooks\", [config, ...records]);\n }\n\n /** Returns every configured virus scanning hook, newest first. */\n async getscanhooks(): Promise<scanhookconfig[]> { return (await this.adapter.get<scanhookconfig[]>(\"scanhooks\")) ?? []; }\n\n /** Stores the armed mime interception filters of the run, newest first. */\n async setmimefilters(filters: mimefilter[]): Promise<void> { return this.adapter.set(\"mimefilters\", filters); }\n\n /** Returns the armed mime interception filters of the run, newest first. */\n async getmimefilters(): Promise<mimefilter[]> { return (await this.adapter.get<mimefilter[]>(\"mimefilters\")) ?? []; }\n}\n\n/** Creates identifiers locally without a network dependency. */\nexport function randomid(): string {\n return crypto.randomUUID();\n}\n", "import type { actionkind, agentplan, agentsession, cleanuprule, downloadspec, endpointconfig, fieldkind, formprofile, mimefilter, observationmode, policyevaluation, quarantineentry, runsettings, safetyverdict, toolstep, transformrule } 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\", \"fillform\", \"filllabel\", \"fillplaceholder\", \"submitform\", \"retryform\", \"runwizard\", \"selectchain\", \"picktypeahead\", \"pickdate\", \"attachfile\", \"fillcard\", \"fillcode\", \"consentpassword\", \"exportcsv\", \"exportjson\", \"exportexcel\", \"copytable\", \"pushsheets\", \"streamdisk\", \"paginateextract\", \"resumeextract\", \"batchdownload\", \"pausedownload\", \"resumedownload\", \"interceptmime\", \"readclipboard\", \"writeclipboard\", \"copyscreen\", \"quarantinedownload\", \"scanvirus\", \"cleanupartifacts\"]);\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\", \"detectfields\", \"generatevalues\", \"saveprofiles\", \"asksubmit\", \"readerrors\", \"skiphoneypot\", \"detectlogin\", \"detecttemplate\", \"handoffcaptcha\", \"scrapetable\", \"importcsv\", \"looprows\", \"transformvalues\", \"deduperows\", \"mergepages\", \"stamplerows\", \"previewgrid\", \"logprovenance\", \"verifydownload\", \"exportnetlog\", \"namecaptures\"]);\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\", \"submitform\", \"retryform\", \"selectchain\", \"picktypeahead\", \"pickdate\", \"attachfile\", \"fillcode\", \"consentpassword\", \"scrapetable\", \"paginateextract\"]);\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\", \"asksubmit\", \"selectchain\", \"picktypeahead\", \"pickdate\", \"attachfile\", \"fillcode\", \"consentpassword\", \"pausedownload\", \"resumedownload\", \"verifydownload\", \"writeclipboard\", \"quarantinedownload\", \"scanvirus\"]);\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 formactions = new Set<actionkind>([\"fillform\", \"filllabel\", \"fillplaceholder\", \"detectfields\", \"generatevalues\", \"saveprofiles\", \"asksubmit\", \"submitform\", \"readerrors\", \"retryform\", \"runwizard\", \"selectchain\", \"picktypeahead\", \"pickdate\", \"attachfile\", \"handoffcaptcha\", \"fillcard\", \"fillcode\", \"consentpassword\", \"skiphoneypot\", \"detectlogin\", \"detecttemplate\"]);\n/** Extraction, transform, export and provenance kinds of the forms and data part two family. */\nconst datasetactions = new Set<actionkind>([\"scrapetable\", \"exportcsv\", \"exportjson\", \"exportexcel\", \"copytable\", \"pushsheets\", \"importcsv\", \"looprows\", \"transformvalues\", \"deduperows\", \"paginateextract\", \"mergepages\", \"stamplerows\", \"previewgrid\", \"streamdisk\", \"resumeextract\", \"logprovenance\"]);\n/** Export kinds that move extracted data out of local memory to disk, the clipboard or a reviewed sheet endpoint. */\nconst exportactions = new Set<actionkind>([\"exportcsv\", \"exportjson\", \"exportexcel\", \"copytable\", \"pushsheets\", \"streamdisk\"]);\n/** Files, clipboard and downloads kinds of the batch queue, interception, clipboard, quarantine, naming and cleanup family. */\nconst filesactions = new Set<actionkind>([\"batchdownload\", \"pausedownload\", \"resumedownload\", \"verifydownload\", \"interceptmime\", \"exportnetlog\", \"readclipboard\", \"writeclipboard\", \"copyscreen\", \"quarantinedownload\", \"scanvirus\", \"namecaptures\", \"cleanupartifacts\"]);\n/** Field kinds the form grammar accepts inside records, profiles and value rules. */\nconst fieldkinds: fieldkind[] = [\"text\", \"email\", \"phone\", \"date\", \"number\", \"select\", \"check\", \"radio\", \"file\", \"password\", \"card\", \"code\"];\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 === \"copytable\") return \"clipboardWrite\";\n if (kind === \"batchdownload\" || kind === \"pausedownload\" || kind === \"resumedownload\" || kind === \"verifydownload\" || kind === \"interceptmime\" || kind === \"quarantinedownload\" || kind === \"scanvirus\") return \"downloads\";\n if (kind === \"readclipboard\") return \"clipboardRead\";\n if (kind === \"writeclipboard\" || kind === \"copyscreen\") return \"clipboardWrite\";\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/** True when the kind belongs to the forms and data family. */\nexport function isformkind(kind: actionkind): boolean {\n return formactions.has(kind);\n}\n\n/** True when the kind belongs to the extraction, transform, export and provenance family. */\nexport function isdatasetkind(kind: actionkind): boolean {\n return datasetactions.has(kind);\n}\n\n/** True when the kind exports extracted data out of local memory to disk, the clipboard or a reviewed sheet endpoint. */\nexport function isexportkind(kind: actionkind): boolean {\n return exportactions.has(kind);\n}\n\n/** True when the kind belongs to the files, clipboard and downloads family. */\nexport function isfileskind(kind: actionkind): boolean {\n return filesactions.has(kind);\n}\n\n/** Refuses any export that would leave local memory while the session origin grants do not cover the active origin. */\nexport function exportgranted(session: agentsession | undefined, origin: string): policyevaluation {\n if (!origingranted(session, origin)) return { allowed: false, reason: `The export of extracted data from ${origin} needs the session origin grants before it leaves local memory.` };\n return { allowed: true };\n}\n\n/** Validates the reviewed fieldmatch grammar of one form field entry. */\nexport function validatefieldmatch(value: unknown): policyevaluation {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return { allowed: false, reason: \"A reviewed field match is required in options.\" };\n const match = value as Record<string, unknown>;\n if (match.mode !== \"label\" && match.mode !== \"placeholder\" && match.mode !== \"arialabel\" && match.mode !== \"name\") return { allowed: false, reason: \"The reviewed field match mode must be label, placeholder, arialabel or name.\" };\n const key = match.mode === \"label\" ? \"label\" : match.mode === \"placeholder\" ? \"placeholder\" : match.mode === \"arialabel\" ? \"arialabel\" : \"name\";\n if (!isnonempty(match[key])) return { allowed: false, reason: `The reviewed ${match.mode} field match needs a non-empty ${key}.` };\n return { allowed: true };\n}\n\n/** Validates a reviewed structured form record; password entries are refused because passwords need the explicit consentpassword consent. */\nexport function validateformrecord(value: unknown): policyevaluation {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return { allowed: false, reason: \"A reviewed form record with entries is required in options.\" };\n const record = value as Record<string, unknown>;\n if (record.form !== undefined && !isnonempty(record.form)) return { allowed: false, reason: \"The reviewed form record form selector must be a non-empty string.\" };\n if (!Array.isArray(record.entries) || record.entries.length === 0) return { allowed: false, reason: \"The reviewed form record needs a non-empty list of entries.\" };\n for (const item of record.entries) {\n if (!item || typeof item !== \"object\" || Array.isArray(item)) return { allowed: false, reason: \"Every reviewed form record entry must be an object.\" };\n const entry = item as Record<string, unknown>;\n const matchcheck = validatefieldmatch(entry.match);\n if (!matchcheck.allowed) return matchcheck;\n if (typeof entry.kind !== \"string\" || !fieldkinds.includes(entry.kind as fieldkind)) return { allowed: false, reason: \"Every reviewed form record entry needs a known field kind.\" };\n if (typeof entry.value !== \"string\") return { allowed: false, reason: \"Every reviewed form record entry needs a string value.\" };\n if (entry.kind === \"password\") return { allowed: false, reason: \"Password entries are refused inside form records; use consentpassword with a reviewed consent ref.\" };\n }\n return { allowed: true };\n}\n\n/** Validates the reviewed valuegen grammar of a generatevalues step. */\nexport function validatevaluegen(value: unknown): policyevaluation {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return { allowed: false, reason: \"A reviewed valuegen rule with a field kind is required in options.\" };\n const rule = value as Record<string, unknown>;\n if (typeof rule.kind !== \"string\" || !fieldkinds.includes(rule.kind as fieldkind)) return { allowed: false, reason: \"The reviewed valuegen kind must be a known field kind.\" };\n if (rule.locale !== undefined && !isnonempty(rule.locale)) return { allowed: false, reason: \"The reviewed valuegen locale must be a non-empty string.\" };\n if (rule.seed !== undefined && (typeof rule.seed !== \"number\" || !Number.isFinite(rule.seed))) return { allowed: false, reason: \"The reviewed valuegen seed must be a finite number.\" };\n return { allowed: true };\n}\n\n/** Validates a reviewed list of label or placeholder value pairs for filllabel and fillplaceholder steps. */\nfunction validatefieldpairs(options: Record<string, unknown>, mode: \"label\" | \"placeholder\"): policyevaluation {\n const pairs = options.fields;\n if (!Array.isArray(pairs) || pairs.length === 0) return { allowed: false, reason: \"A reviewed non-empty list of field pairs is required in options.\" };\n for (const item of pairs) {\n if (!item || typeof item !== \"object\" || Array.isArray(item)) return { allowed: false, reason: \"Every reviewed field pair must be an object.\" };\n const pair = item as Record<string, unknown>;\n if (!isnonempty(pair[mode])) return { allowed: false, reason: `Every reviewed field pair needs a non-empty ${mode}.` };\n if (typeof pair.value !== \"string\" || !pair.value.trim()) return { allowed: false, reason: \"Every reviewed field pair needs a non-empty value.\" };\n }\n return { allowed: true };\n}\n\n/** Validates the reviewed card segment grammar of a fillcard step. */\nfunction validatecardsegments(value: unknown): policyevaluation {\n if (!Array.isArray(value) || value.length === 0) return { allowed: false, reason: \"A reviewed non-empty list of card segments is required in options.\" };\n for (const item of value) {\n if (!item || typeof item !== \"object\" || Array.isArray(item)) return { allowed: false, reason: \"Every reviewed card segment must be an object.\" };\n const segment = item as Record<string, unknown>;\n const matchcheck = validatefieldmatch(segment.match);\n if (!matchcheck.allowed) return matchcheck;\n if (typeof segment.value !== \"string\" || !segment.value.trim()) return { allowed: false, reason: \"Every reviewed card segment needs a non-empty value.\" };\n }\n return { allowed: true };\n}\n\n/** Validates the reviewed forms and data parameter grammar of the form family. */\nfunction validateformgrammar(step: toolstep, options: Record<string, unknown>): policyevaluation {\n const kind = step.kind;\n if (kind === \"fillform\" || (kind === \"saveprofiles\" && options.formrecord !== undefined)) {\n const recordcheck = validateformrecord(options.formrecord);\n if (!recordcheck.allowed) return recordcheck;\n }\n if (kind === \"filllabel\" || kind === \"fillplaceholder\") {\n const paircheck = validatefieldpairs(options, kind === \"filllabel\" ? \"label\" : \"placeholder\");\n if (!paircheck.allowed) return paircheck;\n }\n if (kind === \"generatevalues\" && options.valuegen !== undefined) {\n const rulecheck = validatevaluegen(options.valuegen);\n if (!rulecheck.allowed) return rulecheck;\n }\n if (kind === \"saveprofiles\" && !isnonempty(options.name)) return { allowed: false, reason: \"A reviewed profile name is required in options.\" };\n if (kind === \"submitform\" && !isnonempty(options.consentref)) return { allowed: false, reason: \"A reviewed consent ref of an approved asksubmit ticket is required in options.\" };\n if (kind === \"retryform\") {\n const backoff = options.backoff;\n if (!backoff || typeof backoff !== \"object\" || Array.isArray(backoff)) return { allowed: false, reason: \"A reviewed backoff rule with wait and factor is required in options.\" };\n const rule = backoff as Record<string, unknown>;\n if (typeof rule.wait !== \"number\" || !Number.isFinite(rule.wait) || rule.wait <= 0) return { allowed: false, reason: \"The reviewed retry backoff wait must be a positive number of milliseconds with no code ceiling.\" };\n if (typeof rule.factor !== \"number\" || !Number.isFinite(rule.factor) || rule.factor < 1) return { allowed: false, reason: \"The reviewed retry backoff factor must be one or greater with no code ceiling.\" };\n if (options.attempts !== undefined && (typeof options.attempts !== \"number\" || !Number.isInteger(options.attempts) || options.attempts < 1)) return { allowed: false, reason: \"The reviewed retry attempts must be a positive integer with no code ceiling.\" };\n }\n if (kind === \"runwizard\" && options.steps !== undefined && (typeof options.steps !== \"number\" || !Number.isInteger(options.steps) || options.steps < 1)) return { allowed: false, reason: \"The reviewed wizard step count must be a positive integer with no code ceiling.\" };\n if (kind === \"selectchain\") {\n if (!isnonempty(options.child)) return { allowed: false, reason: \"A reviewed child selector of the dependent control is required in options.\" };\n if (!nonnegativeoption(options, \"wait\")) return { allowed: false, reason: \"The reviewed dependent wait must be zero or a positive number of milliseconds.\" };\n }\n if (kind === \"picktypeahead\") {\n if (!isnonempty(options.pick)) return { allowed: false, reason: \"A reviewed suggestion entry to pick is required in options.\" };\n if (!nonnegativeoption(options, \"timeout\")) return { allowed: false, reason: \"The reviewed typeahead timeout must be zero or a positive number of milliseconds.\" };\n }\n if (kind === \"pickdate\" && !/^\\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 (kind === \"fillcard\") {\n const segmentcheck = validatecardsegments(options.segments);\n if (!segmentcheck.allowed) return segmentcheck;\n if (!nonnegativeoption(options, \"pause\")) return { allowed: false, reason: \"The reviewed card typing pause must be zero or a positive number of milliseconds.\" };\n }\n if (kind === \"fillcode\" && !isnonempty(options.source)) return { allowed: false, reason: \"A reviewed one time code source is required in options.\" };\n if (kind === \"consentpassword\" && !isnonempty(options.consentref)) return { allowed: false, reason: \"A reviewed consent ref is required in options before any password is filled.\" };\n return { allowed: true };\n}\n\n/** Validates one reviewed transform rule: a supported expression, source columns and a target column. */\nexport function validatetransformrule(value: unknown): policyevaluation {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return { allowed: false, reason: \"A reviewed transform rule with an expression, sources and a target is required in options.\" };\n const rule = value as Record<string, unknown>;\n const expression = rule.expression;\n if (typeof expression !== \"string\" || !/^(trim|upper|lower|number|prefix|suffix|replace)(?::.+)?$/.test(expression)) return { allowed: false, reason: \"The reviewed transform expression must be trim, upper, lower, number, prefix, suffix or replace with an optional argument.\" };\n if (expression.startsWith(\"replace\") && !expression.slice(\"replace\".length).includes(\"=>\")) return { allowed: false, reason: \"The reviewed replace expression needs the from=>to separator.\" };\n if (expression.startsWith(\"replace\") && expression.slice(\"replace:\".length).split(\"=>\")[0] === \"\") return { allowed: false, reason: \"The reviewed replace expression needs a non-empty from part.\" };\n if (!Array.isArray(rule.sources) || rule.sources.length === 0 || !rule.sources.every(source => isnonempty(source))) return { allowed: false, reason: \"Every reviewed transform rule needs a non-empty list of source columns.\" };\n if (!isnonempty(rule.target)) return { allowed: false, reason: \"Every reviewed transform rule needs a non-empty target column.\" };\n return { allowed: true };\n}\n\n/** Validates a reviewed dataset id list in options. */\nfunction validatedatasetids(options: Record<string, unknown>, key: string): policyevaluation {\n const ids = options[key];\n if (!Array.isArray(ids) || ids.length === 0 || !ids.every(id => isnonempty(id))) return { allowed: false, reason: `A reviewed non-empty list of dataset ids is required in options as ${key}.` };\n return { allowed: true };\n}\n\n/** Validates the reviewed extraction, transform, export and provenance parameter grammar of the data family. */\nfunction validatedatagrammar(step: toolstep, options: Record<string, unknown>, origin: string): policyevaluation {\n const kind = step.kind;\n if (kind === \"scrapetable\") {\n if (options.name !== undefined && !isnonempty(options.name)) return { allowed: false, reason: \"The reviewed dataset name must be a non-empty string.\" };\n if (options.rowlimit !== undefined && (typeof options.rowlimit !== \"number\" || !Number.isInteger(options.rowlimit) || options.rowlimit < 1)) return { allowed: false, reason: \"The reviewed row limit must be a positive integer with no code ceiling.\" };\n }\n if (kind === \"paginateextract\") {\n if (!isnonempty(options.next)) return { allowed: false, reason: \"A reviewed next control selector is required in options.\" };\n if (options.pages !== undefined && (typeof options.pages !== \"number\" || !Number.isInteger(options.pages) || options.pages < 1)) return { allowed: false, reason: \"The reviewed page count must be a positive integer with no code ceiling.\" };\n if (!nonnegativeoption(options, \"wait\")) return { allowed: false, reason: \"The reviewed row freshness wait must be zero or a positive number of milliseconds.\" };\n }\n if (kind === \"exportcsv\" || kind === \"exportjson\" || kind === \"exportexcel\" || kind === \"copytable\" || kind === \"streamdisk\") {\n if (!isnonempty(options.dataset)) return { allowed: false, reason: \"A reviewed dataset id is required in options.\" };\n if (options.name !== undefined && !isnonempty(options.name)) return { allowed: false, reason: \"The reviewed artifact name must be a non-empty string.\" };\n }\n if (kind === \"exportcsv\" && options.delimiter !== undefined && (typeof options.delimiter !== \"string\" || options.delimiter.length !== 1)) return { allowed: false, reason: \"The reviewed csv delimiter must be a single character.\" };\n if (kind === \"streamdisk\" && (typeof options.chunk !== \"number\" || !Number.isInteger(options.chunk) || options.chunk < 1)) return { allowed: false, reason: \"The reviewed streaming chunk size must be a positive integer with no code ceiling.\" };\n if (kind === \"pushsheets\") {\n if (!isnonempty(options.dataset)) return { allowed: false, reason: \"A reviewed dataset id is required in options.\" };\n if (!isnonempty(options.sheet)) return { allowed: false, reason: \"A reviewed sheet endpoint url is required in options.\" };\n if (!ishttpsurl(options.sheet)) return { allowed: false, reason: \"The reviewed sheet endpoint url must use HTTPS.\" };\n if (options.reviewed !== true) return { allowed: false, reason: \"The sheet push needs the explicit reviewed flag before any data leaves local memory.\" };\n }\n if (kind === \"importcsv\") {\n if (typeof options.csv !== \"string\" || !options.csv.trim()) return { allowed: false, reason: \"Reviewed csv content is required in options.\" };\n if (options.name !== undefined && !isnonempty(options.name)) return { allowed: false, reason: \"The reviewed dataset name must be a non-empty string.\" };\n if (options.mapping !== undefined) {\n const mapping = options.mapping;\n if (!mapping || typeof mapping !== \"object\" || Array.isArray(mapping) || !Object.values(mapping).every(item => typeof item === \"string\")) return { allowed: false, reason: \"The reviewed csv column mapping must be an object of string values.\" };\n }\n }\n if (kind === \"looprows\") {\n if (!isnonempty(options.dataset)) return { allowed: false, reason: \"A reviewed dataset id is required in options.\" };\n if (options.variable !== undefined && !isnonempty(options.variable)) return { allowed: false, reason: \"The reviewed row variable name must be a non-empty string.\" };\n const inner = validateinnerstep(options, origin);\n if (!inner.allowed) return inner;\n }\n if (kind === \"transformvalues\") {\n if (!isnonempty(options.dataset)) return { allowed: false, reason: \"A reviewed dataset id is required in options.\" };\n const rules = options.rules;\n if (!Array.isArray(rules) || rules.length === 0) return { allowed: false, reason: \"A reviewed non-empty list of transform rules is required in options.\" };\n for (const item of rules) {\n const rulecheck = validatetransformrule(item);\n if (!rulecheck.allowed) return rulecheck;\n }\n }\n if (kind === \"deduperows\") {\n if (!isnonempty(options.dataset)) return { allowed: false, reason: \"A reviewed dataset id is required in options.\" };\n const keys = options.keys;\n if (!Array.isArray(keys) || keys.length === 0 || !keys.every(key => isnonempty(key))) return { allowed: false, reason: \"A reviewed non-empty list of dedupe column keys is required in options.\" };\n }\n if (kind === \"mergepages\") {\n const listcheck = validatedatasetids(options, \"datasets\");\n if (!listcheck.allowed) return listcheck;\n }\n if (kind === \"stamplerows\") {\n if (!isnonempty(options.dataset)) return { allowed: false, reason: \"A reviewed dataset id is required in options.\" };\n if (options.url !== undefined && !ishttpsurl(options.url)) return { allowed: false, reason: \"The reviewed source url must use HTTPS.\" };\n }\n if (kind === \"previewgrid\") {\n if (!isnonempty(options.dataset)) return { allowed: false, reason: \"A reviewed dataset id is required in options.\" };\n if (options.sample !== undefined && (typeof options.sample !== \"number\" || !Number.isInteger(options.sample) || options.sample < 1)) return { allowed: false, reason: \"The reviewed sample row count must be a positive integer with no code ceiling.\" };\n }\n if (kind === \"resumeextract\" && !isnonempty(options.session)) return { allowed: false, reason: \"A reviewed extract session id is required in options.\" };\n if (kind === \"logprovenance\" && !isnonempty(options.artifact)) return { allowed: false, reason: \"A reviewed artifact id or name is required in options.\" };\n return { allowed: true };\n}\n\n/** Validates a reviewed batch download specification: a non-empty HTTPS url list, an optional filename rule and an optional completion criterion. */\nexport function validatedownloadspec(value: unknown): policyevaluation {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return { allowed: false, reason: \"A reviewed downloadspec with a url list is required in options.\" };\n const spec = value as Record<string, unknown>;\n if (!Array.isArray(spec.urls) || spec.urls.length === 0 || !spec.urls.every(url => ishttpsurl(url))) return { allowed: false, reason: \"The reviewed downloadspec needs a non-empty list of HTTPS urls.\" };\n if (spec.filename !== undefined && !isnonempty(spec.filename)) return { allowed: false, reason: \"The reviewed downloadspec filename rule must be a non-empty string.\" };\n if (spec.complete !== undefined && spec.complete !== \"size\" && spec.complete !== \"checksum\") return { allowed: false, reason: \"The reviewed downloadspec completion criterion must be size or checksum.\" };\n return { allowed: true };\n}\n\n/** Validates a reviewed mime interception filter: include and exclude patterns plus the deny default for unlisted mime types. */\nexport function validatemimefilter(value: unknown): policyevaluation {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return { allowed: false, reason: \"A reviewed mimefilter with include and exclude patterns is required in options.\" };\n const filter = value as Record<string, unknown>;\n if (!Array.isArray(filter.include) || filter.include.length === 0 || !filter.include.every(pattern => isnonempty(pattern))) return { allowed: false, reason: \"The reviewed mimefilter needs a non-empty list of include patterns.\" };\n if (filter.exclude !== undefined && (!Array.isArray(filter.exclude) || !filter.exclude.every(pattern => isnonempty(pattern)))) return { allowed: false, reason: \"The reviewed mimefilter exclude patterns must be a list of non-empty strings.\" };\n if (filter.default !== \"deny\" && filter.default !== \"allow\") return { allowed: false, reason: \"The reviewed mimefilter needs the deny or allow default for unlisted mime types.\" };\n return { allowed: true };\n}\n\n/** Validates one reviewed cleanup rule: a positive age window with no code ceiling, an artifact kind and a keep policy. */\nexport function validatecleanuprule(value: unknown): policyevaluation {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) return { allowed: false, reason: \"A reviewed cleanuprule with an age, a kind and a keep policy is required.\" };\n const rule = value as Record<string, unknown>;\n if (typeof rule.age !== \"number\" || !Number.isFinite(rule.age) || rule.age <= 0) return { allowed: false, reason: \"The reviewed cleanup age window must be a positive number of milliseconds with no code ceiling.\" };\n if (!isnonempty(rule.kind)) return { allowed: false, reason: \"The reviewed cleanup rule needs a non-empty artifact kind, or any to match every kind.\" };\n if (rule.keep !== \"none\" && rule.keep !== \"latest\" && rule.keep !== \"all\") return { allowed: false, reason: \"The reviewed cleanup keep policy must be none, latest or all.\" };\n return { allowed: true };\n}\n\n/** Validates the reviewed files, clipboard and downloads parameter grammar; batch sizes, concurrent windows and cleanup ages stay user configured with no code ceilings. */\nfunction validatefilesgrammar(step: toolstep, options: Record<string, unknown>): policyevaluation {\n const kind = step.kind;\n if (kind === \"batchdownload\") {\n const speccheck = validatedownloadspec(options.downloadspec);\n if (!speccheck.allowed) return speccheck;\n if (options.concurrent !== undefined && (typeof options.concurrent !== \"number\" || !Number.isInteger(options.concurrent) || options.concurrent < 1)) return { allowed: false, reason: \"The reviewed concurrent download window must be a positive integer with no code ceiling.\" };\n }\n if (kind === \"pausedownload\" || kind === \"resumedownload\" || kind === \"verifydownload\" || kind === \"quarantinedownload\" || kind === \"scanvirus\") {\n if (!isnonempty(step.value)) return { allowed: false, reason: \"A reviewed download or quarantine reference is required.\" };\n if (kind === \"verifydownload\") {\n if (options.checksum !== undefined && !isnonempty(options.checksum)) return { allowed: false, reason: \"The reviewed expected checksum must be a non-empty string.\" };\n if (options.bytes !== undefined && (typeof options.bytes !== \"number\" || !Number.isFinite(options.bytes) || options.bytes < 0)) return { allowed: false, reason: \"The reviewed expected size must be zero or a positive number of bytes.\" };\n }\n if (kind === \"scanvirus\" && options.scanner !== undefined && !isnonempty(options.scanner)) return { allowed: false, reason: \"The reviewed scanner name must be a non-empty string.\" };\n if (kind === \"quarantinedownload\" && options.reason !== undefined && !isnonempty(options.reason)) return { allowed: false, reason: \"The reviewed quarantine reason must be a non-empty string.\" };\n }\n if (kind === \"interceptmime\") {\n const filtercheck = validatemimefilter(options.mimefilter);\n if (!filtercheck.allowed) return filtercheck;\n }\n if (kind === \"readclipboard\") {\n if (!isnonempty(options.consentref)) return { allowed: false, reason: \"A clipboard read requires a reviewed consent ref of an approved consent prompt in options.\" };\n if (options.prompt !== undefined && !isnonempty(options.prompt)) return { allowed: false, reason: \"The reviewed clipboard consent prompt must be a non-empty string.\" };\n }\n if (kind === \"exportnetlog\" && options.stepid !== undefined && !isnonempty(options.stepid)) return { allowed: false, reason: \"The reviewed netlog step filter must be a non-empty step id.\" };\n if (kind === \"namecaptures\") {\n if (!isnonempty(options.task)) return { allowed: false, reason: \"A reviewed task id is required in options for capture naming.\" };\n if (options.steps !== undefined && (!Array.isArray(options.steps) || options.steps.length === 0 || !options.steps.every(item => isnonempty(item)))) return { allowed: false, reason: \"The reviewed capture steps must be a non-empty list of step ids when present.\" };\n if (options.extension !== undefined && !isnonempty(options.extension)) return { allowed: false, reason: \"The reviewed capture extension must be a non-empty string.\" };\n }\n if (kind === \"cleanupartifacts\" && options.rules !== undefined) {\n const rules = options.rules;\n if (!Array.isArray(rules) || rules.length === 0) return { allowed: false, reason: \"The reviewed cleanup rules must be a non-empty list when present.\" };\n for (const item of rules) {\n const rulecheck = validatecleanuprule(item);\n if (!rulecheck.allowed) return rulecheck;\n }\n }\n return { allowed: true };\n}\n\n/** Requires an approved consent prompt before any clipboard read; every read consumes its own prompt. */\nexport function clipboardconsentgranted(step: toolstep): policyevaluation {\n let options: Record<string, unknown> = {};\n try { options = parseoptions(step); } catch { options = {}; }\n const consentref = options.consentref;\n if (typeof consentref !== \"string\" || !consentref.trim()) return { allowed: false, reason: \"A clipboard read requires a reviewed consent ref in options.\" };\n return { allowed: true };\n}\n\n/** Refuses to release any quarantined file before a clean scan verdict exists. */\nexport function quarantinereleasegranted(entry: quarantineentry): policyevaluation {\n if (entry.scan !== \"clean\") return { allowed: false, reason: `The quarantined file ${entry.path} cannot leave quarantine with the ${entry.scan} scan verdict; only a clean verdict releases it.` };\n return { allowed: true };\n}\n\n/** Refuses downloads and download interception that fall outside the session origin grants. */\nexport function downloadgranted(session: agentsession | undefined, url: string): policyevaluation {\n let origin = \"\";\n try { origin = new URL(url).origin; } catch { return { allowed: false, reason: \"The reviewed download URL is invalid.\" }; }\n if (!origingranted(session, origin)) return { allowed: false, reason: `The download from ${origin} leaves the session origin grants and needs a session grant first.` };\n return { allowed: true };\n}\n\n/** Masks a clipboard payload for every log line; the full text never persists anywhere. */\nexport function maskclipboard(payload: string): string {\n return `[clipboard payload of ${payload.length} character${payload.length === 1 ? \"\" : \"s\"}]`;\n}\n\n/** Requires an asksubmit review step before every form submission step. */\nexport function submitreviewgranted(steps: toolstep[], submitid: string): policyevaluation {\n const position = steps.findIndex(candidate => candidate.id === submitid);\n const asked = steps.some((candidate, index) => candidate.kind === \"asksubmit\" && (position === -1 || index < position));\n return asked ? { allowed: true } : { allowed: false, reason: \"Form submission requires an asksubmit review step before it.\" };\n}\n\n/** Requires a reviewed consent ref before any password field is filled. */\nexport function passwordconsentgranted(step: toolstep): policyevaluation {\n let options: Record<string, unknown> = {};\n try { options = parseoptions(step); } catch { options = {}; }\n const consentref = options.consentref;\n if (typeof consentref !== \"string\" || !consentref.trim()) return { allowed: false, reason: \"A password fill requires a reviewed consent ref in options.\" };\n return { allowed: true };\n}\n\n/** True when a numeric value passes the Luhn checksum used by card networks. */\nfunction luhnvalid(digits: string): boolean {\n let sum = 0;\n let double = false;\n for (let index = digits.length - 1; index >= 0; index -= 1) {\n let value = Number.parseInt(digits[index] ?? \"\", 10);\n if (!Number.isFinite(value)) return false;\n if (double) { value *= 2; if (value > 9) value -= 9; }\n sum += value;\n double = !double;\n }\n return sum % 10 === 0;\n}\n\n/** Refuses generated values that look like real card numbers or personal identifiers; test prefixed card values stay allowed. */\nexport function generatedvalueallowed(value: string): policyevaluation {\n const compact = value.replace(/[\\s-]/g, \"\");\n if (/^\\d{13,19}$/.test(compact) && luhnvalid(compact) && !compact.startsWith(\"4111\")) return { allowed: false, reason: \"The generated value looks like a real card number and is refused; generated card values use the 4111 test prefix.\" };\n if (/^\\d{3}-\\d{2}-\\d{4}$/.test(value.trim())) return { allowed: false, reason: \"The generated value looks like a personal identifier and is refused.\" };\n return { allowed: true };\n}\n\n/** Requires the origin grants of a saved profile to cover the origin before its values fill a page. */\nexport function profilegrantgranted(profile: formprofile, origin: string): policyevaluation {\n if (!profile.grants.includes(origin)) return { allowed: false, reason: `The saved profile ${profile.name} is not granted to ${origin}; add the origin to the profile grants first.` };\n return { allowed: true };\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\" || kind === \"looprows\") 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 (isformkind(step.kind)) {\n const formcheck = validateformgrammar(step, options);\n if (!formcheck.allowed) return formcheck;\n }\n if (isdatasetkind(step.kind)) {\n const datacheck = validatedatagrammar(step, options, origin);\n if (!datacheck.allowed) return datacheck;\n }\n if (isfileskind(step.kind)) {\n const filescheck = validatefilesgrammar(step, options);\n if (!filescheck.allowed) return filescheck;\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 (isexportkind(input.step.kind)) {\n const exportgate = exportgranted(input.session, input.origin);\n if (!exportgate.allowed) return exportgate;\n }\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 === \"submitform\" || input.step.kind === \"retryform\") {\n if (!input.plan) return { allowed: false, reason: \"Form submission requires an asksubmit review step before it.\" };\n const reviewgate = submitreviewgranted(input.plan.steps, input.step.id);\n if (!reviewgate.allowed) return reviewgate;\n }\n if (input.step.kind === \"consentpassword\") {\n const consentgate = passwordconsentgranted(input.step);\n if (!consentgate.allowed) return consentgate;\n }\n if (input.step.kind === \"readclipboard\") {\n const clipgate = clipboardconsentgranted(input.step);\n if (!clipgate.allowed) return clipgate;\n }\n if (input.step.kind === \"interceptmime\" && !origingranted(input.session, input.origin)) return { allowed: false, reason: \"The download interception is outside the session origin grants.\" };\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", "/** Canonical package version synchronized from package.json. */\nexport const packageversion = \"1.1.39\" as const;\n", "/** Shared contracts for every Devthink target. */\nimport { packageversion } from \"./version.js\";\n\nexport const protocolversion = packageversion;\n\n/** Every reviewed action kind. Read kinds observe, interaction kinds move focus, sensitive kinds change page or browser state. */\nexport type actionkind =\n | \"observe\" | \"inspect\" | \"extract\" | \"wait\" | \"waitfor\" | \"waittext\"\n | \"readattribute\" | \"readstyle\" | \"readgeometry\" | \"readvalue\" | \"readtext\" | \"readhtml\"\n | \"countelements\" | \"readtable\" | \"readlinks\" | \"readimages\" | \"readmeta\" | \"readforms\"\n | \"readstorage\" | \"highlight\" | \"tablist\" | \"windowlist\" | \"tabsnapshot\"\n | \"focus\" | \"scroll\" | \"hover\" | \"clickdeep\" | \"rightclick\" | \"doubleclick\"\n | \"scrollpage\" | \"scrollby\" | \"scrollend\" | \"scrolltop\" | \"fullscreen\" | \"zoomset\"\n | \"click\" | \"type\" | \"navigate\" | \"select\" | \"presskey\" | \"drag\" | \"drop\" | \"upload\"\n | \"clear\" | \"check\" | \"uncheck\" | \"toggle\" | \"submit\" | \"reload\" | \"back\" | \"forward\"\n | \"writestorage\" | \"setattribute\" | \"removeattribute\" | \"evaluate\"\n | \"tabcreate\" | \"tabactivate\" | \"tabclose\" | \"tabreload\"\n | \"windowcreate\" | \"windowclose\" | \"windowresize\" | \"downloadfile\"\n | \"movepointer\" | \"clickpoint\" | \"shiftclick\" | \"clicktext\" | \"clickaria\" | \"clickname\"\n | \"resolvexpath\" | \"typetime\" | \"appendtext\" | \"setvalue\" | \"typeedit\"\n | \"keyhold\" | \"keyrelease\" | \"submitsearch\" | \"selectmulti\" | \"chooseradio\"\n | \"setslider\" | \"setdate\" | \"setcolor\" | \"expanddetails\" | \"dismissdialog\"\n | \"pierceshadow\" | \"enterframe\" | \"retryaction\"\n | \"mapclicks\" | \"verifyvisible\" | \"verifyenabled\"\n | \"a11ytree\" | \"readvisible\" | \"readertree\" | \"detectlists\" | \"detecttables\"\n | \"readjson\" | \"watchmutate\" | \"waitquiet\" | \"watchbanner\" | \"detectinfinitescroll\"\n | \"detectvirtual\" | \"detectlazy\" | \"readscrollpos\" | \"readlang\" | \"readoutline\"\n | \"countpages\" | \"listshadow\" | \"listframes\" | \"classifypage\" | \"fingerprintsection\"\n | \"diffsnapshots\" | \"readselection\" | \"watchfocus\" | \"detectsticky\" | \"detectscrolllock\"\n | \"readopengraph\" | \"detectlanguage\" | \"deriveselector\"\n | \"openlink\" | \"openprivate\" | \"reloadcache\" | \"stopnav\" | \"waitload\" | \"waiturl\"\n | \"followlink\" | \"spanav\" | \"spawait\" | \"rewritequery\" | \"setfragment\" | \"navlist\"\n | \"navprofile\" | \"detecthttp\" | \"readredirects\" | \"readfinalurl\" | \"handleauth\" | \"printpdf\"\n | \"prefetch\" | \"preconnect\" | \"deeplink\" | \"reopentab\" | \"trailaudit\" | \"pausenav\"\n | \"navintent\" | \"navrate\" | \"openclipboard\" | \"checksafe\" | \"batchopen\"\n | \"querytabs\" | \"duplicatetab\" | \"closepattern\" | \"pintab\" | \"mutetab\" | \"movetab\"\n | \"movetabwindow\" | \"grouptabs\" | \"colorgroup\" | \"collapsegroup\" | \"discardtab\"\n | \"reloadtabs\" | \"zoomin\" | \"zoomout\" | \"watchtab\" | \"switchtab\" | \"maximizewindow\"\n | \"minimizewindow\" | \"restorewindow\" | \"focuswindow\" | \"scratchwindow\" | \"incognitowindow\"\n | \"restoretab\" | \"savelayout\" | \"restorelayout\" | \"findclones\" | \"searchtabs\"\n | \"badgetab\" | \"attachmeta\" | \"listaudio\" | \"reopenrun\" | \"snapshotsession\"\n | \"fillform\" | \"filllabel\" | \"fillplaceholder\" | \"detectfields\" | \"generatevalues\"\n | \"saveprofiles\" | \"asksubmit\" | \"submitform\" | \"readerrors\" | \"retryform\"\n | \"runwizard\" | \"selectchain\" | \"picktypeahead\" | \"pickdate\" | \"attachfile\"\n | \"handoffcaptcha\" | \"fillcard\" | \"fillcode\" | \"consentpassword\" | \"skiphoneypot\"\n | \"detectlogin\" | \"detecttemplate\"\n | \"scrapetable\" | \"exportcsv\" | \"exportjson\" | \"exportexcel\" | \"copytable\"\n | \"pushsheets\" | \"importcsv\" | \"looprows\" | \"transformvalues\" | \"deduperows\"\n | \"paginateextract\" | \"mergepages\" | \"stamplerows\" | \"previewgrid\"\n | \"streamdisk\" | \"resumeextract\" | \"logprovenance\"\n | \"batchdownload\" | \"pausedownload\" | \"resumedownload\" | \"verifydownload\" | \"interceptmime\"\n | \"exportnetlog\" | \"readclipboard\" | \"writeclipboard\" | \"copyscreen\" | \"quarantinedownload\"\n | \"scanvirus\" | \"namecaptures\" | \"cleanupartifacts\";\n\nexport type actionrisk = \"read\" | \"interaction\" | \"sensitive\";\nexport type planstate = \"draft\" | \"pending\" | \"approved\" | \"rejected\" | \"expired\" | \"completed\" | \"cancelled\";\nexport type auditkind = \"configure\" | \"session\" | \"observe\" | \"proposal\" | \"approval\" | \"action\" | \"error\" | \"stop\" | \"pause\" | \"resume\" | \"complete\" | \"capability\" | \"tab\" | \"window\" | \"download\" | \"pointer\" | \"dialog\" | \"hold\" | \"retry\" | \"observation\" | \"watch\" | \"diff\" | \"navigation\" | \"redirect\" | \"auth\" | \"prefetch\" | \"rate\" | \"group\" | \"layout\" | \"discard\" | \"badge\" | \"fill\" | \"submit\" | \"consent\" | \"handoff\" | \"scrape\" | \"export\" | \"stream\" | \"provenance\" | \"resume\" | \"intercept\" | \"clipboard\" | \"quarantine\" | \"cleanup\";\n\n/** Observation mode classes: passive capture, watched lifetimes and diffing passes. */\nexport type observationmode = \"passive\" | \"watching\" | \"diffing\";\n\nexport interface toolstep {\n id: string;\n kind: actionkind;\n target?: string;\n value?: string;\n /** Reviewed JSON parameters such as modifiers, amounts or coordinates. */\n options?: string;\n summary: string;\n risk: actionrisk;\n}\n\nexport interface agentplan {\n id: string;\n objective: string;\n origin: string;\n steps: toolstep[];\n createdat: number;\n expiresat: number;\n state: planstate;\n approvedat?: number;\n completedat?: number;\n}\n\nexport interface agentsession {\n id: string;\n tabid: number;\n origin: string;\n startedat: number;\n expiresat: number;\n stoppedat?: number;\n pausedat?: number;\n /** Origins granted to this session; prepared for multi origin work. */\n grants?: string[];\n}\n\nexport interface endpointconfig {\n endpoint: string;\n origin: string;\n configuredat: number;\n}\n\nexport interface observation {\n /** Observation schema version for forward compatibility. */\n schemaversion: number;\n url: string;\n title: string;\n textpreview: string;\n textlength: number;\n forms: Array<{ label: string; type: string; name: string; options?: string[] }>;\n interactive: Array<{ selector: string; role: string; label: string }>;\n capturedat: number;\n /** Observation mode of this capture: passive, watching or diffing. */\n mode?: observationmode;\n /** Accessibility tree section captured by the page walker. */\n a11y?: a11ynode;\n /** Reader view article section extracted by the text density heuristic. */\n reader?: readerarticle;\n /** Repeated list patterns detected on the page. */\n listpattern?: listpattern[];\n /** Data table shapes detected on the page. */\n tableshape?: tableshape[];\n /** Snapshot diff section attached when two observation versions are compared. */\n diff?: snapshotdiff;\n}\n\nexport interface auditevent {\n id: string;\n kind: auditkind;\n at: number;\n summary: string;\n sessionid?: string;\n planid?: string;\n stepid?: string;\n}\n\nexport interface diagnosticreport {\n id: string;\n sessionid: string;\n origin: string;\n capturedat: number;\n tabid: number;\n title: string;\n textlength: number;\n interactivecount: number;\n formcount: number;\n bridgeavailable: boolean;\n}\n\n/** Live report of the optional browser capabilities the user has granted. */\nexport interface capabilityreport {\n tabs: boolean;\n downloads: boolean;\n clipboardread: boolean;\n clipboardwrite: boolean;\n reportedat: number;\n}\n\n/** Structured result of one executed step, kept with configurable retention. */\nexport interface stepoutcome {\n stepid: string;\n ok: boolean;\n summary: string;\n details?: Record<string, unknown>;\n at: number;\n}\n\n/** User chosen retention windows; an absent value keeps everything forever. */\nexport interface runsettings {\n auditretention?: number;\n outcomeretention?: number;\n /** Retention window for stored observation captures such as a11y trees and reader articles. */\n observationretention?: number;\n /** User configured ceiling on concurrent task tabs; an absent value never refuses a tab. */\n tasktabceiling?: number;\n /** Retention window for exported data artifacts; an absent value keeps every artifact. */\n artifactretention?: number;\n /** Retention window for captured network log records; an absent value keeps every record. */\n netlogretention?: number;\n /** True when the pinned control tab with the live task feed stays open. */\n controltab?: boolean;\n}\n\nexport interface proposalrequest {\n objective: string;\n session: agentsession;\n observation: observation;\n capabilities: capabilityreport;\n}\n\nexport interface planproposal {\n version: typeof protocolversion;\n plan: agentplan;\n}\n\nexport interface policyevaluation {\n allowed: boolean;\n reason?: string;\n}\n\n/** Tracks which reviewed steps of one plan have already executed locally. */\nexport interface planprogress {\n planid: string;\n completedsteps: string[];\n outcomes?: stepoutcome[];\n /** Tabs assigned to the running task so progress tracks work across its tabs. */\n tasktabs?: number[];\n /** Prior progress snapshots preserved when a new plan replaces the tracked one. */\n prior?: planprogress[];\n updatedat: number;\n}\n\n/** Modes that address one element during target resolution. */\nexport type targetmode = \"selector\" | \"text\" | \"aria\" | \"name\" | \"xpath\" | \"index\" | \"point\";\n\n/** Reviewed element reference resolved by the page bridge at preview and execution time. */\nexport interface targetref {\n mode: targetmode;\n selector?: string;\n text?: string;\n role?: string;\n name?: string;\n xpath?: string;\n index?: number;\n x?: number;\n y?: number;\n}\n\n/** One point on a reviewed pointer path. */\nexport interface pointref {\n x: number;\n y: number;\n}\n\n/** Reviewed pointer path between two points through optional waypoints. */\nexport interface pointpath {\n start: pointref;\n end: pointref;\n waypoints?: pointref[];\n duration?: number;\n}\n\n/** Reviewed pointer speed shape with an easing curve, peak velocity and a jitter window. */\nexport interface speedprofile {\n easing?: \"linear\" | \"easeinout\";\n peak?: number;\n jitter?: number;\n}\n\n/** One key held down across steps under a hold id, with tab and step provenance. */\nexport interface keyholdstate {\n holdid: string;\n key: string;\n modifiers?: string[];\n tabid?: number;\n stepid?: string;\n pressedat: number;\n releasedat?: number;\n}\n\n/** Reviewed answers for confirm, alert and prompt dialogs; prompts need a reviewed answer. */\nexport interface dialogpolicy {\n accept: boolean;\n answer?: string;\n}\n\n/** Ordered frame indexes that address targets inside same origin iframes. */\nexport type framepath = number[];\n\n/** Ordered host selectors that address targets across open shadow roots. */\nexport type shadowpath = string[];\n\n/** Reviewed retry bounds with an attempt count that carries no hardcoded ceiling. */\nexport interface retryrule {\n attempts: number;\n settle?: number;\n tolerance?: number;\n}\n\n/** One numbered clickable element of a clickablemap. */\nexport interface mapentry {\n number: number;\n selector: string;\n role: string;\n label: string;\n mode: targetmode;\n}\n\n/** Numbered map of every clickable element captured inside one observation version. */\nexport interface clickablemap {\n version: number;\n entries: mapentry[];\n builtat: number;\n}\n\n/** Matched element summary attached to step results and review envelopes. */\nexport interface resolvedtarget {\n mode: targetmode;\n selector: string;\n tag: string;\n label: string;\n geometry: { x: number; y: number; width: number; height: number };\n candidates?: string[];\n}\n\n/** One dialog answered by the reviewed dialog policy, kept for the audit trail. */\nexport interface dialogdecision {\n id: string;\n dialog: string;\n text: string;\n accept: boolean;\n answer?: string;\n sessionid?: string;\n at: number;\n}\n\n/** One retry execution record with the attempts made and the movement delta observed between them. */\nexport interface retryoutcome {\n stepid: string;\n attempts: number;\n movement: number;\n ok: boolean;\n at: number;\n}\n\n/** Resolution summary stored per target mode for later selector derivation. */\nexport interface resolutionsummary {\n stepid: string;\n mode: targetmode;\n selector: string;\n label: string;\n at: number;\n}\n\n/** One accessibility tree node with role, accessible name, states, value and child refs. */\nexport interface a11ynode {\n role: string;\n name: string;\n states: string[];\n value?: string;\n childcount: number;\n children: a11ynode[];\n}\n\n/** One reader view article with title, byline, blocks and text statistics. */\nexport interface readerarticle {\n title: string;\n byline: string;\n blocks: Array<{ kind: string; text: string; words: number }>;\n words: number;\n characters: number;\n}\n\n/** One detected repeated list with its shared item selector, repeat count and samples. */\nexport interface listpattern {\n container: string;\n itemselector: string;\n repeat: number;\n samples: string[];\n}\n\n/** One detected data table shape with header row, column specs and caption. */\nexport interface tableshape {\n selector: string;\n headers: string[];\n columns: Array<{ label: string; cells: number }>;\n rows: number;\n caption: string;\n}\n\n/** One embedded json state payload extracted from an inline script. */\nexport interface jsonstate {\n scripturl: string;\n rootpath: string;\n payload: unknown;\n}\n\n/** Reviewed watch registration with selector scopes, event kinds and a lifetime window. */\nexport interface mutationwatch {\n watchid?: string;\n scopes?: string[];\n events?: string[];\n lifetime: number;\n}\n\n/** Reviewed network quiet rule with an idle threshold, poll interval and timeout. */\nexport interface quietrule {\n idle: number;\n poll?: number;\n timeout?: number;\n}\n\n/** One dom mutation observed inside a reviewed watch, with a timestamp and target path. */\nexport interface mutationevent {\n watchid: string;\n event: string;\n targetpath: string;\n sessionid?: string;\n at: number;\n}\n\n/** One focus change observed inside a reviewed focus watch, with a timestamp and target path. */\nexport interface focusevent {\n watchid: string;\n kind: \"focus\" | \"blur\";\n targetpath: string;\n sessionid?: string;\n at: number;\n}\n\n/** One consent banner observed by a reviewed banner watch, with its controls. */\nexport interface bannerreport {\n kind: string;\n selector: string;\n text: string;\n controls: string[];\n sessionid?: string;\n at: number;\n}\n\n/** One node change inside a snapshot diff. */\nexport interface diffentry {\n kind: \"added\" | \"removed\" | \"changed\";\n selector: string;\n summary: string;\n}\n\n/** One snapshot diff between two stored observation versions. */\nexport interface snapshotdiff {\n baseversion: number;\n targetversion: number;\n added: diffentry[];\n removed: diffentry[];\n changed: diffentry[];\n at: number;\n}\n\n/** One derived selector candidate with its strategy and stability score. */\nexport interface selectorcandidate {\n selector: string;\n strategy: string;\n score: number;\n}\n\n/** One derived selector stored with its stability score for reuse. */\nexport interface derivedselector {\n stepid: string;\n selector: string;\n strategy: string;\n score: number;\n at: number;\n}\n\n/** One watch registration persisted so watches survive service worker restarts. */\nexport interface watchregistration {\n watchid: string;\n kind: actionkind;\n stepid: string;\n sessionid: string;\n origin: string;\n scopes: string[];\n events: string[];\n startedat: number;\n lifetime: number;\n closedat?: number;\n}\n\n/** One stored observation capture under its version. */\nexport interface observationrecord {\n version: number;\n observation: observation;\n}\n\n/** One stored accessibility tree capture. */\nexport interface a11ycapture {\n version: number;\n tree: a11ynode;\n capturedat: number;\n}\n\n/** One stored reader article capture. */\nexport interface readercapture {\n version: number;\n article: readerarticle;\n capturedat: number;\n}\n\n/** Live page signals refreshed after observation steps: language, template, scroll lock and banner state. */\nexport interface pagesignals {\n language?: string;\n template?: string;\n scrolllocked?: boolean;\n banner?: string;\n refreshedat: number;\n}\n\n/** One detected template class or section fingerprint stored per origin. */\nexport interface templateprofile {\n origin: string;\n template: string;\n fingerprint: string;\n section?: string;\n at: number;\n}\n\n/** Reviewed navigation target with its url, container, position and private flag. */\nexport interface navtarget {\n url: string;\n container: \"current\" | \"tab\" | \"window\" | \"private\";\n position?: \"adjacent\" | \"end\";\n private: boolean;\n}\n\n/** Reviewed per origin override of one wait profile. */\nexport interface waitoverride {\n origin: string;\n signals?: string[];\n idle?: number;\n timeout?: number;\n}\n\n/** Reviewed wait profile with load signals, thresholds and per origin overrides. */\nexport interface waitprofile {\n signals: string[];\n idle?: number;\n timeout?: number;\n overrides?: waitoverride[];\n}\n\n/** Reviewed url pattern with a match mode plus required query and fragment parts. */\nexport interface urlpattern {\n mode: \"exact\" | \"prefix\" | \"host\" | \"pattern\";\n url: string;\n query?: Record<string, string>;\n fragment?: string;\n}\n\n/** One redirect hop of a redirect chain with its url, status and timestamp. */\nexport interface redirecthop {\n url: string;\n status: number;\n at: number;\n}\n\n/** One observed redirect chain with hops, statuses and timing. */\nexport interface redirectchain {\n hops: redirecthop[];\n startedat: number;\n endedat: number;\n}\n\n/** One navigation trail entry with url, title, step ref and timestamp. */\nexport interface trailentry {\n url: string;\n title: string;\n stepid?: string;\n at: number;\n}\n\n/** Reviewed per domain navigation rate limit with a window and a user configured ceiling. */\nexport interface ratelimit {\n domain: string;\n window: number;\n ceiling: number;\n}\n\n/** Live navigation state of a tab: load phase, final url and redirect chain. */\nexport interface navstate {\n phase: \"idle\" | \"loading\" | \"interactive\" | \"complete\";\n finalurl?: string;\n redirects?: redirectchain;\n}\n\n/** One stored wait profile applied per origin with user configured values. */\nexport interface waitprofilerecord {\n origin: string;\n profile: waitprofile;\n at: number;\n}\n\n/** One stored navigation record with the redirect chain and final url of one navigation step. */\nexport interface navrecord {\n stepid: string;\n sessionid?: string;\n origin: string;\n finalurl: string;\n chain: redirectchain;\n at: number;\n}\n\n/** One recorded navigation intent detected from a plan, kept for audit review. */\nexport interface navintentrecord {\n id: string;\n intent: string;\n origin: string;\n sessionid?: string;\n stepid?: string;\n at: number;\n}\n\n/** One rate limit window state per domain with the reviewed limit and the hit count. */\nexport interface ratelimitstate {\n domain: string;\n limit: ratelimit;\n openedat: number;\n count: number;\n}\n\n/** One curated link of a batch open list with its safety verdict and review state. */\nexport interface curatedlink {\n url: string;\n verdict: \"safe\" | \"unsafe\" | \"unknown\";\n reasons: string[];\n}\n\n/** One curated link list stored with its review state before batch opening. */\nexport interface curatedlist {\n id: string;\n links: curatedlink[];\n reviewedat?: number;\n at: number;\n}\n\n/** Reviewed basic auth credentials for one origin, stored only after explicit review. */\nexport interface authrecord {\n origin: string;\n username: string;\n password: string;\n reviewedat: number;\n}\n\n/** One url safety verdict produced by a checksafe verification. */\nexport interface safetyverdict {\n url: string;\n safe: boolean;\n reasons: string[];\n at: number;\n}\n\n/** One task artifact routed into the artifact store by a printpdf step. */\nexport interface artifactrecord {\n id: string;\n kind: string;\n name: string;\n stepid: string;\n at: number;\n}\n\n/** Navigation control state: paused navigation while a consent prompt is open. */\nexport interface navcontrol {\n pausedat?: number;\n reason?: string;\n updatedat: number;\n}\n\n/** One recently closed tab remembered so a reopentab step can restore it. */\nexport interface recenttab {\n url: string;\n tabid: number;\n closedat: number;\n}\n\n/** Queued navigation targets of prefetch and batch open steps, shown in the popup badge. */\nexport interface navqueues {\n prefetch: number;\n batchopen: number;\n updatedat: number;\n}\n\n/** Reviewed tab query with url, title, id and pattern matchers resolved against the live tab set. */\nexport interface tabquery {\n url?: string;\n title?: string;\n id?: number;\n pattern?: string;\n}\n\n/** Reviewed tab group definition with name, color, member tabs and collapse state. */\nexport interface tabgroupspec {\n name: string;\n color: string;\n tabids: number[];\n collapsed: boolean;\n}\n\n/** One stored tab group definition with its color choice and member tabs. */\nexport interface tabgrouprecord {\n groupid: string;\n name: string;\n color: string;\n tabids: number[];\n collapsed: boolean;\n savedat: number;\n}\n\n/** Window bounds of one window state or saved layout. */\nexport interface windowbounds {\n left: number;\n top: number;\n width: number;\n height: number;\n}\n\n/** Live or saved window state with bounds, maximize state and profile kind. */\nexport interface windowstate {\n bounds: windowbounds;\n maximized: boolean;\n profile: \"normal\" | \"incognito\" | \"scratch\";\n}\n\n/** One tab position inside a saved layout, carrying its window and pin state. */\nexport interface layouttab {\n url: string;\n title: string;\n pinned: boolean;\n index: number;\n windowid: number;\n}\n\n/** One saved tab layout with name, tabs, groups, positions and window bounds. */\nexport interface tablayout {\n name: string;\n tabs: layouttab[];\n groups: tabgroupspec[];\n windows: Array<{ windowid: number; state: windowstate }>;\n savedat: number;\n}\n\n/** Per tab task metadata with task refs, provenance and free text labels. */\nexport interface tabmeta {\n tabid: number;\n taskrefs: string[];\n provenance: string;\n labels: string[];\n at: number;\n}\n\n/** One per tab task status badge set by a badgetab step or refreshed from live progress. */\nexport interface tabbadge {\n tabid: number;\n taskid: string;\n label: string;\n setat: number;\n}\n\n/** One tab report entry carrying audio state and metadata per tab. */\nexport interface tabreportentry {\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 meta?: tabmeta;\n}\n\n/** Tab report payload with matched tabs, groups and badges. */\nexport interface tabreport {\n matches: tabreportentry[];\n groups: tabgroupspec[];\n badges: tabbadge[];\n}\n\n/** One session snapshot of tabs and windows captured for later restore. */\nexport interface sessionsnapshot {\n id: string;\n sessionid?: string;\n layout: tablayout;\n capturedat: number;\n}\n\n/** One closed tab history entry kept for restoretab and reopenrun. */\nexport interface closedtab {\n url: string;\n title: string;\n tabid: number;\n windowid: number;\n closedat: number;\n}\n\n/** One tab event observed inside a reviewed watchtab registration. */\nexport interface tabwatchevent {\n watchid: string;\n event: \"title\" | \"activated\" | \"closed\";\n tabid: number;\n detail?: string;\n at: number;\n}\n\n/** Pinned control tab state carrying the live task feed. */\nexport interface controltabstate {\n tabid: number;\n enabled: boolean;\n updatedat: number;\n}\n\n/** Field kinds the form family recognizes across inputs, selects, checks and specialized payment fields. */\nexport type fieldkind = \"text\" | \"email\" | \"phone\" | \"date\" | \"number\" | \"select\" | \"check\" | \"radio\" | \"file\" | \"password\" | \"card\" | \"code\";\n\n/** Reviewed field match addressing one control by label, placeholder, aria label or name. */\nexport interface fieldmatch {\n mode: \"label\" | \"placeholder\" | \"arialabel\" | \"name\";\n label?: string;\n placeholder?: string;\n arialabel?: string;\n name?: string;\n}\n\n/** One reviewed form field entry pairing a field match with its kind and value. */\nexport interface formentry {\n match: fieldmatch;\n kind: fieldkind;\n value: string;\n}\n\n/** A reviewed structured form record with field entries, kinds and values. */\nexport interface formrecord {\n form?: string;\n entries: formentry[];\n}\n\n/** Reviewed value generation rules for one field kind with locale and seed choices. */\nexport interface valuegen {\n kind: fieldkind;\n locale?: string;\n seed?: number;\n}\n\n/** One saved form profile with a reviewed name, field entries and the origin grants it is bound to. */\nexport interface formprofile {\n name: string;\n fields: formentry[];\n grants: string[];\n savedat: number;\n}\n\n/** Live wizard state with the step index, the total steps and the per step completion flags. */\nexport interface wizardstate {\n index: number;\n steps: number;\n completed: boolean[];\n at: number;\n}\n\n/** One submission ticket with the form ref, the values hash and the consent ref of its asksubmit approval. */\nexport interface submitticket {\n id: string;\n form: string;\n valueshash: string;\n consentref: string;\n approved?: boolean;\n at: number;\n}\n\n/** One validation error message associated with a field ref. */\nexport interface fielderror {\n field: string;\n message: string;\n}\n\n/** One collected error report of a form, kept for correction loops. */\nexport interface errorreport {\n form: string;\n errors: fielderror[];\n at: number;\n}\n\n/** One captcha handoff record with its resolution state while the plan waits for the user. */\nexport interface captchahandoff {\n id: string;\n origin: string;\n resolved: boolean;\n openedat: number;\n resolvedat?: number;\n}\n\n/** One login or template detection stored per origin with the matched markers. */\nexport interface detectionrecord {\n origin: string;\n kind: \"login\" | \"signup\" | \"checkout\";\n markers: string[];\n at: number;\n}\n\n/** One typeahead pick recorded when a reviewed suggestion entry was chosen. */\nexport interface typeaheadpick {\n field: string;\n query: string;\n pick: string;\n at: number;\n}\n\n/** Form report payload with the detected fields, their kinds and the matched controls. */\nexport interface formreport {\n form: string;\n fields: Array<{ selector: string; label: string; kind: fieldkind; matched: boolean }>;\n}\n\n/** One scraped or imported dataset column with a stable key, its label, its value kind and the normalized name. */\nexport interface columnspec {\n key: string;\n label: string;\n kind: \"text\" | \"number\";\n normalized: string;\n}\n\n/** One dataset row keyed by column keys. */\nexport type datasetrow = Record<string, string>;\n\n/** One source reference attaching a row index to its url, timestamp and step ref. */\nexport interface sourceref {\n row: number;\n url: string;\n at: number;\n stepid?: string;\n}\n\n/** One structured dataset with column specs, rows and source refs; row counts stay user configured with no code ceiling. */\nexport interface dataset {\n id: string;\n name: string;\n columns: columnspec[];\n rows: datasetrow[];\n sources: sourceref[];\n at: number;\n}\n\n/** One reviewed transform rule applying an expression to source columns and writing the target column. */\nexport interface transformrule {\n expression: string;\n sources: string[];\n target: string;\n}\n\n/** One extraction session tracking visited pages, collected rows and the resume cursor. */\nexport interface extractsession {\n id: string;\n datasetid: string;\n name: string;\n target: string;\n next: string;\n planned: number;\n pages: string[];\n rows: number;\n cursor: number;\n done?: boolean;\n startedat: number;\n updatedat: number;\n}\n\n/** One provenance record of an exported artifact with its url, timestamp, step ref, row range and checksum. */\nexport interface provenancerecord {\n artifact: string;\n name: string;\n url: string;\n stepid: string;\n rowstart: number;\n rowend: number;\n checksum: string;\n at: number;\n}\n\n/** One exported data artifact kept in the task artifact store with its content and checksum. */\nexport interface exportedartifact {\n id: string;\n kind: \"csv\" | \"json\" | \"excel\";\n name: string;\n stepid: string;\n rowcount: number;\n content: string;\n checksum: string;\n at: number;\n}\n\n/** One streaming export state with chunk and written row counters persisted for resume. */\nexport interface streamstate {\n datasetid: string;\n name: string;\n chunk: number;\n chunks: number;\n written: number;\n done?: boolean;\n at: number;\n}\n\n/** One reviewed sheet endpoint configuration stored behind its origin grant. */\nexport interface sheetendpoint {\n endpoint: string;\n origin: string;\n configuredat: number;\n}\n\n/** Transform rules and dedupe keys remembered per task between extraction and export. */\nexport interface taskrules {\n taskid: string;\n transforms: transformrule[];\n dedupekeys: string[];\n at: number;\n}\n\n/** One reviewed batch download specification with its url list, filename rule and completion criteria. */\nexport interface downloadspec {\n urls: string[];\n filename?: string;\n complete?: \"size\" | \"checksum\";\n}\n\n/** Per file states of the batch download queue. */\nexport type downloadstate = \"queued\" | \"running\" | \"paused\" | \"complete\" | \"failed\";\n\n/** One batch download file record with its state, resolved path and checksum; concurrent windows stay user configured with no code ceiling. */\nexport interface downloadrecord {\n id: string;\n url: string;\n filename: string;\n state: downloadstate;\n downloadid?: number;\n path?: string;\n bytes?: number;\n checksum?: string;\n at: number;\n updatedat: number;\n}\n\n/** Reviewed mime interception filter with include and exclude patterns and a deny default for unlisted mime types. */\nexport interface mimefilter {\n include: string[];\n exclude: string[];\n default: \"deny\" | \"allow\";\n}\n\n/** One captured network log record with url, method, status, timing and step correlation through its request id. */\nexport interface netlogrecord {\n url: string;\n method: string;\n status: number;\n timing: number;\n requestid?: string;\n stepid: string;\n at: number;\n /** Captured header names; exported netlogs always carry their values redacted. */\n headers?: Record<string, string>;\n}\n\n/** One clipboard entry with its kind, payload hash and origin provenance; the payload text never persists. */\nexport interface clipentry {\n kind: \"read\" | \"write\" | \"screen\";\n hash: string;\n length: number;\n origin: string;\n stepid: string;\n at: number;\n}\n\n/** Verdicts of the configured virus scanning hooks. */\nexport type scanverdict = \"pending\" | \"clean\" | \"flagged\" | \"error\";\n\n/** One quarantined download kept outside the downloads folder with its reason, scan state and release ref. */\nexport interface quarantineentry {\n id: string;\n path: string;\n reason: string;\n scan: scanverdict;\n release?: string;\n at: number;\n updatedat: number;\n}\n\n/** One consistent capture filename stamped from task, step and sequence parts. */\nexport interface capturename {\n task: string;\n step: string;\n sequence: number;\n}\n\n/** One reviewed artifact cleanup rule with an age window, an artifact kind and a keep policy. */\nexport interface cleanuprule {\n age: number;\n kind: string;\n keep: \"none\" | \"latest\" | \"all\";\n}\n\n/** One clipboard consent record with its prompt, origin and single use approval state; every clipboard read needs its own approved prompt. */\nexport interface clipboardconsentrecord {\n id: string;\n prompt: string;\n origin: string;\n stepid: string;\n approved?: boolean;\n usedat?: number;\n at: number;\n}\n\n/** One user configured virus scanning hook endpoint stored behind its origin grant. */\nexport interface scanhookconfig {\n scanner: string;\n endpoint: string;\n origin: string;\n configuredat: number;\n}\n\n/** One stored capture naming counter per task and step base. */\nexport interface capturecounter {\n taskid: string;\n counters: Record<string, number>;\n at: number;\n}\n\n/** One artifact inventory entry for the cleanup sweeper with its size and capture time. */\nexport interface artifactinventoryentry {\n id: string;\n kind: string;\n name: string;\n size: number;\n at: number;\n}\n\n/** One cleanup run history record with the applied rule count and the removed and kept artifact counts. */\nexport interface cleanuprun {\n id: string;\n rules: number;\n removed: number;\n kept: number;\n at: number;\n}\n", "import { actionrisk, parseoptions, submitreviewgranted, validatestep } from \"./policy.js\";\nimport { protocolversion, type agentplan, type bannerreport, type clickablemap, type dataset, type downloadrecord, type errorreport, type extractsession, type focusevent, type formreport, type keyholdstate, type mutationevent, type navstate, type netlogrecord, type observation, type pagesignals, type planproposal, type proposalrequest, type provenancerecord, type quarantineentry, type resolvedtarget, type safetyverdict, type selectorcandidate, type snapshotdiff, type stepoutcome, type tablayout, type tabreport, type toolstep, type trailentry, type transformrule, type typeaheadpick, type wizardstate } from \"./types.js\";\n\nfunction record(value: unknown): Record<string, unknown> {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) throw new Error(\"Protocol message must be an object.\");\n return value as Record<string, unknown>;\n}\n\nfunction text(value: unknown, field: string): string {\n if (typeof value !== \"string\" || !value.trim()) throw new Error(`${field} must be a non-empty string.`);\n return value.trim();\n}\n\n/**\n * Reviewed options grammar shared by every step kind.\n *\n * A step may carry a JSON `options` object with the following reviewed fields:\n * - `targetref`: element addressing without a css selector, with `mode` one of `selector`, `text`, `aria`, `name`, `xpath`, `index` or `point`; the text mode carries `text`, the aria mode carries `role` plus `name`, the name mode carries `name`, the xpath mode carries `xpath`, the index mode carries a one based clickable map `index`, and the point mode carries viewport `x` and `y` coordinates.\n * - `pointpath`: pointer travel between two points, with `start` and `end` points, optional `waypoints` and a `duration` in milliseconds.\n * - `speedprofile`: pointer speed shape with `easing` (`linear` or `easeinout`), a `peak` velocity in pixels per second and a `jitter` window in milliseconds.\n * - `framepath`: ordered frame indexes routing a step inside same origin iframes.\n * - `shadow`: ordered host selectors addressing a target across open shadow roots.\n * - `retryrule`: retry bounds with `attempts`, a `settle` window in milliseconds and a movement `tolerance` in pixels; attempts carry no code ceiling.\n * - `dialogpolicy`: dialog answers with an `accept` flag and a reviewed prompt `answer` string.\n * - wrapper steps (`retryaction`, `enterframe`) reference an inner step by `stepid` or inline with `kind`, `target`, `value` and an `options` object.\n * - control kinds add reviewed `delay`, `values`, `results`, `timeout`, `holdid` and `modifiers` fields.\n * - watch kinds (`watchmutate`, `watchbanner`, `watchfocus`) carry a reviewed `lifetime` window in milliseconds, optional selector `scopes`, optional event kind filters `events` and an optional `poll` interval; the lifetime window carries no code ceiling.\n * - `waitquiet` carries a reviewed `quietrule` with a positive `idle` threshold in milliseconds, an optional `poll` interval and an optional `timeout`; every value carries no code ceiling.\n * - `diffsnapshots` carries exactly two reviewed observation `versions` to compare.\n * - navigation kinds carry the navigation parameter grammar: `navtarget` with a `url`, a `container` (`current`, `tab`, `window` or `private`), a `position` (`adjacent` or `end`) and a `private` flag; `waitprofile` with non-empty load `signals`, optional `idle` and `timeout` thresholds and per origin `overrides`; and `urlpattern` with a `mode` (`exact`, `prefix`, `host` or `pattern`), a `url`, optional `query` parameter expectations and an optional `fragment`.\n * - `waiturl` and `spawait` carry a reviewed `urlpattern`, `timeout` and `poll`; `spanav` carries an optional `routepattern`, `followlink` an optional `fragment` flag, `rewritequery` reviewed `set` and `remove` query edits, `navlist`/`prefetch`/`batchopen` reviewed `urls` lists, `preconnect` reviewed `origins`, `navrate` a reviewed `ratelimit` with `domain`, `window` and `ceiling` (never capped in code), and `deeplink` a reviewed `app` pattern with `params`.\n * - observation kinds attach structured evidence to step details: a11y trees, reader articles, list patterns, table shapes, pagination estimates, watch event records, quiet probe samples, snapshot diffs and derived selector candidates with stability scores.\n * - navigation steps attach structured evidence to step details: load phases and ready states, final urls after redirects, redirect chains with statuses and timing, http error, offline and certificate interstitial states, safety verdicts and navlist entry completions.\n * - the tabs and windows command family adds its parameter grammar: `tabquery` with url, title, id and pattern matchers (at least one matcher required, patterns use `*` and `**` wildcards); `group` with a `name`, a Chromium tab group `color`, member `tabids` and a `collapsed` flag; `layout` names for `savelayout` and `restorelayout`; reviewed `pinned`, `muted`, `index`, `windowid`, `direction`, `step`, `bounds`, `label`, `labels`, `taskrefs`, `provenance` and `run` fields; `tabcreate` gains reviewed `background` and `window` options and `windowcreate` gains reviewed `left`, `top`, `width`, `height` and `state` options; `closepattern` requires the explicit `reviewed` flag before any tab closes.\n * - tab command steps attach structured evidence to step details: tab reports with matched tabs carrying audio state and metadata, group registries, badge states, layout snapshots, clone warnings, discard candidates and watchtab event records.\n * - the forms and data family adds its parameter grammar: `formrecord` with an optional `form` selector and non-empty `entries` of `{ match, kind, value }` where `match` is a `fieldmatch` with `mode` one of `label`, `placeholder`, `arialabel` or `name`; `valuegen` with a field `kind`, an optional `locale` and an optional numeric `seed`; `fields` lists of label or placeholder value pairs for filllabel and fillplaceholder; a reviewed `name` plus `formrecord` for saveprofiles; a reviewed `consentref` for submitform and consentpassword; a reviewed `backoff` rule with `wait` and `factor` plus an optional `attempts` for retryform with no code ceiling; a reviewed `child` selector, `pick` entry, `pause` and `timeout` for chains, typeaheads and card typing; reviewed card `segments`; and a reviewed `source` for fillcode; password entries inside form records are refused because passwords need the explicit consentpassword consent.\n * - form steps attach structured evidence to step details: form reports with detected fields, kinds and matched controls, error reports with field refs and messages, wizard states with step history, typeahead picks, honeypot flags, login detections with session link markers and signup or checkout template detections.\n * - the forms and data part two family adds its parameter grammar: `scrapetable` and `paginateextract` carry an optional dataset `name`, an optional positive integer `rowlimit` (never capped in code), a reviewed `next` control selector, an optional positive integer `pages` count (never capped in code) and an optional `wait` row freshness window; the export kinds (`exportcsv`, `exportjson`, `exportexcel`, `copytable`, `streamdisk`, `pushsheets`) carry a reviewed `dataset` id, an optional artifact `name`, an optional single character csv `delimiter`, a reviewed positive integer streaming `chunk` size (never capped in code) and, for sheet pushes, a reviewed HTTPS `sheet` endpoint plus the explicit `reviewed` flag; `importcsv` carries reviewed `csv` text with an optional `name` and a `mapping` object of csv headers to target keys; `looprows` carries a reviewed `dataset` id, an optional row `variable` name and a wrapped inner step by `stepid` or inline; `transformvalues` carries reviewed `rules` of `{ expression, sources, target }` where the expression is `trim`, `upper`, `lower`, `number`, `prefix:x`, `suffix:x` or `replace:from=>to`; `deduperows` carries reviewed dedupe `keys`; `mergepages` carries a reviewed `datasets` id list; `stamplerows` carries a reviewed `dataset` id with an optional `url`; `previewgrid` carries a reviewed `dataset` id with an optional `sample` row count (never capped in code); `resumeextract` carries a reviewed `session` id; and `logprovenance` carries a reviewed `artifact` id or name.\n * - data steps attach structured evidence to step details: scraped grids with normalized column specs, span filled rows and nested child datasets, pagination page counts with remaining next controls, dataset previews with sampled rows, dedupe removed counts, transform error lists, stream chunk states and provenance records with checksums and row ranges.\n * - the files, clipboard and downloads family adds its parameter grammar: `batchdownload` carries a reviewed `downloadspec` with a non-empty `urls` list, an optional `filename` rule and an optional `complete` criterion (`size` or `checksum`) plus an optional positive integer `concurrent` window (never capped in code); `pausedownload`, `resumedownload`, `verifydownload`, `quarantinedownload` and `scanvirus` carry a reviewed download or quarantine reference with optional `checksum`, `bytes`, `scanner` and `reason` fields; `interceptmime` carries a reviewed `mimefilter` with non-empty `include` patterns, optional `exclude` patterns and the `deny` or `allow` default for unlisted mime types; `readclipboard` carries a reviewed `consentref` plus an optional `prompt`; `exportnetlog` carries an optional `stepid` filter; `namecaptures` carries a reviewed `task` with optional `steps` and `extension`; and `cleanupartifacts` carries reviewed `rules` of `{ age, kind, keep }` where the age window carries no code ceiling and the keep policy is `none`, `latest` or `all`.\n * - files steps attach structured evidence to step details: batch download reports with per file states, resolved paths and checksums, verification match results, netlog records correlated with steps through request ids, clipboard entries with payload hashes and origin provenance (the payload text never appears), quarantine entries with scan verdicts and release refs, capture names stamped from task, step and sequence parts, and cleanup run outcomes with removed and kept counts.\n *\n * Ambiguous text, aria or name resolutions are refused at execution time with the candidate list so the user can choose.\n */\n\n/** Validates agent output before it becomes a locally reviewable plan. Plans may carry any number of steps. */\nexport function parseproposal(value: unknown, origin: string): planproposal {\n const root = record(value);\n if (root.version !== protocolversion) throw new Error(\"Unsupported protocol version.\");\n const planinput = record(root.plan);\n const stepsinput = planinput.steps;\n if (!Array.isArray(stepsinput) || stepsinput.length === 0) throw new Error(\"A plan needs at least one step.\");\n const steps: toolstep[] = stepsinput.map((input, index) => {\n const candidate = record(input);\n const kind = text(candidate.kind, `step ${index + 1} kind`) as toolstep[\"kind\"];\n const step: toolstep = {\n id: typeof candidate.id === \"string\" ? candidate.id : crypto.randomUUID(),\n kind,\n summary: text(candidate.summary, `step ${index + 1} summary`),\n risk: actionrisk(kind),\n ...(typeof candidate.target === \"string\" ? { target: candidate.target } : {}),\n ...(typeof candidate.value === \"string\" ? { value: candidate.value } : {}),\n ...(typeof candidate.options === \"string\" ? { options: candidate.options } : {}),\n };\n const evaluation = validatestep(step, origin);\n if (!evaluation.allowed) throw new Error(evaluation.reason);\n return step;\n });\n for (const step of steps) {\n if (step.kind !== \"retryaction\" && step.kind !== \"enterframe\" && step.kind !== \"looprows\") continue;\n const options = parseoptions(step);\n if (typeof options.stepid === \"string\" && !steps.some(candidate => candidate.id === options.stepid)) throw new Error(\"A retry, frame or loop wrapper references an unknown step id.\");\n }\n for (const step of steps) {\n if (step.kind !== \"submitform\" && step.kind !== \"retryform\") continue;\n const review = submitreviewgranted(steps, step.id);\n if (!review.allowed) throw new Error(review.reason);\n }\n const createdat = Date.now();\n const expiresat = typeof planinput.expiresat === \"number\" ? planinput.expiresat : createdat + 10 * 60 * 1000;\n const plan: agentplan = {\n id: typeof planinput.id === \"string\" ? planinput.id : crypto.randomUUID(),\n objective: text(planinput.objective, \"objective\"),\n origin,\n steps,\n createdat,\n expiresat,\n state: \"pending\",\n };\n if (plan.expiresat <= createdat) throw new Error(\"Plan expiry must be in the future.\");\n return { version: protocolversion, plan };\n}\n\n/** Shapes the only data that may be sent to a user-configured agent endpoint. */\nexport function requestbody(input: proposalrequest): string {\n return JSON.stringify({ version: protocolversion, objective: input.objective, session: input.session, observation: input.observation, capabilities: input.capabilities });\n}\n\n/** Wraps one executed step outcome in the versioned response envelope for callers, attaching the matched element summary for review. */\nexport function outcomeresponse(input: { outcome: stepoutcome; plan: agentplan; resolvedtarget?: resolvedtarget }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, outcome: input.outcome, ...(input.resolvedtarget ? { resolvedtarget: input.resolvedtarget } : {}) });\n}\n\n/** Wraps a clickable map payload with numbered entries in the versioned response envelope. */\nexport function mapresponse(input: { map: clickablemap; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, map: input.map });\n}\n\n/** Reports the keys currently held on one tab for the live context envelope, refreshed per step. */\nexport function heldkeysreport(input: { tabid: number; holds: keyholdstate[] }): { version: typeof protocolversion; tabid: number; heldkeys: keyholdstate[] } {\n return { version: protocolversion, tabid: input.tabid, heldkeys: input.holds };\n}\n\n/** Wraps one observation capture with its a11y, reader, listpattern, tableshape and diff sections in the versioned response envelope. */\nexport function observationresponse(input: { observation: observation; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, observation: input.observation });\n}\n\n/** Wraps mutation, focus and banner event records with their timestamps and target paths in the versioned response envelope. */\nexport function eventresponse(input: { events: Array<mutationevent | focusevent | bannerreport>; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, events: input.events });\n}\n\n/** Wraps one snapshot diff with its added, removed and changed nodes and its two observation versions in the versioned response envelope. */\nexport function diffresponse(input: { diff: snapshotdiff; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, diff: input.diff });\n}\n\n/** Reports the detected page language, template class, scroll lock and banner state in the live context envelope. */\nexport function signalsreport(input: { signals?: pagesignals }): { version: typeof protocolversion; language?: string; template?: string; scrolllocked?: boolean; banner?: string } {\n const signals = input.signals;\n return {\n version: protocolversion,\n ...(signals && signals.language !== undefined ? { language: signals.language } : {}),\n ...(signals && signals.template !== undefined ? { template: signals.template } : {}),\n ...(signals && signals.scrolllocked !== undefined ? { scrolllocked: signals.scrolllocked } : {}),\n ...(signals && signals.banner !== undefined ? { banner: signals.banner } : {}),\n };\n}\n\n/** Wraps derived selector candidates with their stability scores in the versioned response envelope. */\nexport function selectorresponse(input: { candidates: selectorcandidate[]; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, candidates: input.candidates });\n}\n\n/** Wraps the live navigation state with its load phase, final url and redirect chain in the versioned response envelope. */\nexport function navstateresponse(input: { navstate: navstate; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, navstate: input.navstate });\n}\n\n/** Carries the navigation trail of a session with its visited urls, titles and step refs in the session context envelope. */\nexport function trailreport(input: { sessionid?: string; trail: trailentry[] }): { version: typeof protocolversion; sessionid?: string; trail: trailentry[] } {\n return { version: protocolversion, ...(input.sessionid ? { sessionid: input.sessionid } : {}), trail: input.trail };\n}\n\n/** Wraps url safety verdicts with their reasons in the versioned response envelope for external link review. */\nexport function safetyresponse(input: { verdicts: safetyverdict[]; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, verdicts: input.verdicts });\n}\n\n/** Wraps one tab report with its matched tabs, groups and badges in the versioned response envelope. */\nexport function tabreportresponse(input: { report: tabreport; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, report: input.report });\n}\n\n/** Carries the saved tab layouts with their window bounds and group states in the session context envelope. */\nexport function layoutreport(input: { layouts: tablayout[] }): { version: typeof protocolversion; layouts: tablayout[] } {\n return { version: protocolversion, layouts: input.layouts };\n}\n\n/** Wraps one form report with the detected fields, their kinds and the matched controls in the versioned response envelope. */\nexport function formreportresponse(input: { report: formreport; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, report: input.report });\n}\n\n/** Wraps one collected error report with its field refs and messages in the versioned response envelope for correction loops. */\nexport function errorreportresponse(input: { report: errorreport; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, report: input.report });\n}\n\n/** Carries the wizard states with their step history and the recorded typeahead picks in the session context envelope. */\nexport function wizardreport(input: { sessionid?: string; wizards: wizardstate[]; picks: typeaheadpick[] }): { version: typeof protocolversion; sessionid?: string; wizards: wizardstate[]; picks: typeaheadpick[] } {\n return { version: protocolversion, ...(input.sessionid ? { sessionid: input.sessionid } : {}), wizards: input.wizards, picks: input.picks };\n}\n\n/** Wraps one dataset payload with its column specs and a sampled row list in the versioned response envelope. */\nexport function datasetresponse(input: { dataset: dataset; plan: agentplan; sample?: number }): string {\n const sample = Math.max(0, Math.floor(input.sample ?? 10));\n const payload = { ...input.dataset, rows: input.dataset.rows.slice(0, sample), totalrows: input.dataset.rows.length };\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, dataset: payload });\n}\n\n/** Carries the extraction progress with visited page counts, collected row counts and resume cursors in the session context envelope. */\nexport function extractionreport(input: { sessions: extractsession[] }): { version: typeof protocolversion; sessions: extractsession[] } {\n return { version: protocolversion, sessions: input.sessions };\n}\n\n/** Reports the provenance records of every exported artifact with its source url, step ref, row range and checksum in the session context envelope. */\nexport function provenancereport(input: { records: provenancerecord[] }): { version: typeof protocolversion; records: provenancerecord[] } {\n return { version: protocolversion, records: input.records };\n}\n\n/** Documents the reviewed transform rule grammar shared by transformvalues steps and the task rules store. */\nexport function transformgrammar(rules: transformrule[]): string {\n return JSON.stringify({ rules: rules.map(rule => ({ expression: rule.expression, sources: rule.sources, target: rule.target })) });\n}\n\n/** Wraps the batch download queue with per file states, resolved paths and checksums in the versioned response envelope. */\nexport function downloadreport(input: { downloads: downloadrecord[]; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, downloads: input.downloads });\n}\n\n/** Carries the captured network log records with their step correlation through request ids in the session context envelope. */\nexport function netlogreport(input: { records: netlogrecord[] }): { version: typeof protocolversion; records: netlogrecord[] } {\n return { version: protocolversion, records: input.records };\n}\n\n/** Carries the quarantine entries with their scan verdicts and release refs in the session context envelope. */\nexport function quarantinereport(input: { entries: quarantineentry[] }): { version: typeof protocolversion; entries: quarantineentry[] } {\n return { version: protocolversion, entries: input.entries };\n}\n"],
|
|
5
|
+
"mappings": ";AAYO,IAAM,gBAAN,MAAoB;AAAA,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