@wenathlan/extension 1.1.30 → 1.1.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../../memory.ts", "../../policy.ts", "../../version.ts", "../../types.ts", "../../protocol.ts", "../background.ts"],
4
- "sourcesContent": ["import type { agentplan, agentsession, auditevent, diagnosticreport, endpointconfig } 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\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 getaudit(): Promise<auditevent[]> { return (await this.adapter.get<auditevent[]>(\"audit\")) ?? []; }\n async addaudi(event: auditevent): Promise<void> {\n const records = await this.getaudit();\n await this.adapter.set(\"audit\", [event, ...records].slice(0, 100));\n }\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, policyevaluation, toolstep } from \"./types.js\";\n\nconst sensitiveactions = new Set<actionkind>([\"click\", \"type\", \"navigate\"]);\nconst allowedactions = new Set<actionkind>([\"observe\", \"inspect\", \"focus\", \"click\", \"type\", \"navigate\"]);\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/** Defines action risk from a 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 kind === \"focus\" ? \"interaction\" : \"read\";\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 if ((step.kind === \"click\" || step.kind === \"focus\" || step.kind === \"inspect\" || step.kind === \"type\") && !step.target?.trim()) return { allowed: false, reason: \"A page target is required.\" };\n if (step.kind === \"navigate\") {\n if (!step.value) return { allowed: false, reason: \"A navigation URL is required.\" };\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 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 }): policyevaluation {\n const now = input.now ?? Date.now();\n if (!input.session || input.session.stoppedat) return { allowed: false, reason: \"No active browser session exists.\" };\n if (input.session.expiresat <= now) return { allowed: false, reason: \"The browser session has expired.\" };\n if (input.session.tabid !== input.tabid || input.session.origin !== input.origin) return { allowed: false, reason: \"The action is outside the approved tab or origin.\" };\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 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 if (!input.session || input.session.stoppedat) return { allowed: false, reason: \"No active browser session exists.\" };\n if (input.session.expiresat <= now) return { allowed: false, reason: \"The browser session has expired.\" };\n if (input.session.tabid !== input.tabid || input.session.origin !== input.origin) return { allowed: false, reason: \"The preview is outside the approved tab or origin.\" };\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 if (![\"focus\", \"inspect\", \"click\", \"type\"].includes(input.step.kind)) 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.30\" as const;\n", "/** Shared contracts for every Devthink target. */\nimport { packageversion } from \"./version.js\";\n\nexport const protocolversion = packageversion;\n\nexport type actionkind = \"observe\" | \"inspect\" | \"focus\" | \"click\" | \"type\" | \"navigate\";\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\";\n\nexport interface toolstep {\n id: string;\n kind: actionkind;\n target?: string;\n value?: 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}\n\nexport interface agentsession {\n id: string;\n tabid: number;\n origin: string;\n startedat: number;\n expiresat: number;\n stoppedat?: number;\n}\n\nexport interface endpointconfig {\n endpoint: string;\n origin: string;\n configuredat: number;\n}\n\nexport interface observation {\n url: string;\n title: string;\n textpreview: string;\n textlength: number;\n forms: Array<{ label: string; type: string; name: string }>;\n interactive: Array<{ selector: string; role: string; label: string }>;\n capturedat: number;\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\nexport interface proposalrequest {\n objective: string;\n session: agentsession;\n observation: observation;\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", "import { actionrisk, validatestep } from \"./policy.js\";\nimport { protocolversion, type agentplan, type planproposal, type proposalrequest, type toolstep } 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/** Validates agent output before it becomes a locally reviewable plan. */\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 || stepsinput.length > 20) throw new Error(\"A plan needs between one and twenty steps.\");\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 };\n const evaluation = validatestep(step, origin);\n if (!evaluation.allowed) throw new Error(evaluation.reason);\n return step;\n });\n const createdat = Date.now();\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: Math.min(typeof planinput.expiresat === \"number\" ? planinput.expiresat : createdat + 10 * 60 * 1000, createdat + 30 * 60 * 1000),\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 });\n}\n", "import { randomid, sessionmemory } from \"../memory.js\";\nimport { canexecute, canpreview, hostpattern, normalizeendpoint } from \"../policy.js\";\nimport { parseproposal, requestbody } from \"../protocol.js\";\nimport type { agentplan, agentsession, auditevent, diagnosticreport, observation, toolstep } from \"../types.js\";\n\nconst sessionduration = 15 * 60 * 1000;\n\nconst chromestorage = {\n async get<T>(key: string): Promise<T | undefined> { return (await chrome.storage.local.get(key))[key] as T | undefined; },\n async set<T>(key: string, value: T): Promise<void> { await chrome.storage.local.set({ [key]: value }); },\n};\nconst memory = new sessionmemory(chromestorage);\n\nfunction extensionpage(sender: chrome.runtime.MessageSender): boolean {\n return sender.id === chrome.runtime.id && Boolean(sender.url?.startsWith(chrome.runtime.getURL(\"\")));\n}\n\nasync function audit(kind: auditevent[\"kind\"], summary: string, extra: Partial<auditevent> = {}): Promise<void> {\n await memory.addaudi({ id: randomid(), kind, at: Date.now(), summary, ...extra });\n}\n\nasync function activecontext(): Promise<{ tab: chrome.tabs.Tab; origin: string }> {\n const [tab] = await chrome.tabs.query({ active: true, lastFocusedWindow: true });\n if (!tab?.id || !tab.url) throw new Error(\"No active web tab is available.\");\n const origin = new URL(tab.url).origin;\n if (!origin.startsWith(\"https://\")) throw new Error(\"Devthink can work with HTTPS pages only.\");\n return { tab, origin };\n}\n\nasync function snapshot(tabid: number): Promise<observation> {\n await chrome.scripting.executeScript({ target: { tabId: tabid }, files: [\"pagebridge.js\"] });\n const result = await chrome.scripting.executeScript({ target: { tabId: tabid }, func: () => {\n const bridge = (globalThis as typeof globalThis & { devthinkbridge?: { capturesnapshot: () => observation } }).devthinkbridge;\n if (!bridge) throw new Error(\"Devthink page bridge is unavailable.\");\n return bridge.capturesnapshot();\n } });\n const value = result[0]?.result;\n if (!value) throw new Error(\"The page did not return an observation.\");\n return value as observation;\n}\n\nasync function startsession(): Promise<agentsession> {\n const { tab, origin } = await activecontext();\n const session: agentsession = { id: randomid(), tabid: tab.id as number, origin, startedat: Date.now(), expiresat: Date.now() + sessionduration };\n await memory.setsession(session);\n await audit(\"session\", `Session started for ${origin}.`, { sessionid: session.id });\n return session;\n}\n\nasync function diagnostic(): Promise<diagnosticreport> {\n const session = await memory.getsession();\n const { tab, origin } = await activecontext();\n if (!session || session.stoppedat || session.expiresat <= Date.now() || session.tabid !== tab.id || session.origin !== origin) throw new Error(\"Start a current session for this active tab before diagnostics.\");\n const observation = await snapshot(session.tabid);\n const report: diagnosticreport = { id: randomid(), sessionid: session.id, origin, capturedat: Date.now(), tabid: session.tabid, title: observation.title, textlength: observation.textlength, interactivecount: observation.interactive.length, formcount: observation.forms.length, bridgeavailable: true };\n await memory.setdiagnostic(report);\n await audit(\"observe\", \"Structured diagnostics captured for the approved active tab.\", { sessionid: session.id });\n return report;\n}\n\nfunction localplan(objective: string, session: agentsession): agentplan {\n const now = Date.now();\n return { id: randomid(), objective, origin: session.origin, steps: [{ id: randomid(), kind: \"observe\", summary: \"Capture a bounded semantic snapshot of the approved active tab.\", risk: \"read\" }], createdat: now, expiresat: now + sessionduration, state: \"pending\" };\n}\n\nasync function propose(objective: string, remote: boolean): Promise<agentplan> {\n if (!objective.trim()) throw new Error(\"An objective is required.\");\n const session = await memory.getsession();\n if (!session || session.stoppedat || session.expiresat <= Date.now()) throw new Error(\"Start a current browser session before requesting a plan.\");\n const { tab, origin } = await activecontext();\n if (session.tabid !== tab.id || session.origin !== origin) throw new Error(\"The selected tab or origin no longer matches the approved session.\");\n const observation = await snapshot(session.tabid);\n const config = await memory.getconfig();\n let plan = localplan(objective.trim(), session);\n if (remote) {\n if (!config) throw new Error(\"Configure an approved HTTPS endpoint before requesting a remote proposal.\");\n const response = await fetch(config.endpoint, { method: \"POST\", headers: { \"content-type\": \"application/json\" }, credentials: \"omit\", body: requestbody({ objective: objective.trim(), session, observation }) });\n if (!response.ok) throw new Error(`Proposal endpoint returned ${response.status}.`);\n plan = parseproposal(await response.json(), session.origin).plan;\n }\n await memory.setplan(plan);\n await audit(\"proposal\", `Plan proposed with ${plan.steps.length} reviewed step${plan.steps.length === 1 ? \"\" : \"s\"}.`, { sessionid: session.id, planid: plan.id });\n return plan;\n}\n\nasync function executestep(stepid: string): Promise<{ ok: boolean; summary: string }> {\n const session = await memory.getsession();\n const plan = await memory.getplan();\n const { tab, origin } = await activecontext();\n const step = plan?.steps.find(candidate => candidate.id === stepid);\n if (!step) throw new Error(\"Reviewed step was not found.\");\n const gate = canexecute({ session, plan, step, tabid: tab.id as number, origin });\n if (!gate.allowed) throw new Error(gate.reason);\n const fresh = await snapshot(tab.id as number);\n if (step.target && !fresh.interactive.some(item => item.selector === step.target)) throw new Error(\"The page changed and the target must be reviewed again.\");\n const result = await chrome.scripting.executeScript({ target: { tabId: tab.id as number }, func: (action: toolstep, expectedorigin: string) => {\n const bridge = (globalThis as typeof globalThis & { devthinkbridge?: { performstep: (input: toolstep, origin: string) => { ok: boolean; summary: string } } }).devthinkbridge;\n if (!bridge) throw new Error(\"Devthink page bridge is unavailable.\");\n return bridge.performstep(action, expectedorigin);\n }, args: [step, origin] });\n const output = result[0]?.result as { ok: boolean; summary: string } | undefined;\n const summary = output?.summary ?? \"The page action returned no result.\";\n await audit(output?.ok ? \"action\" : \"error\", summary, { ...(session ? { sessionid: session.id } : {}), ...(plan ? { planid: plan.id } : {}), stepid });\n return output ?? { ok: false, summary };\n}\n\n/** Highlights a reviewed target without clicking, typing, navigating or transmitting page data. */\nasync function previewstep(stepid: string): Promise<{ ok: boolean; summary: string }> {\n const session = await memory.getsession();\n const plan = await memory.getplan();\n const { tab, origin } = await activecontext();\n const step = plan?.steps.find(candidate => candidate.id === stepid);\n if (!step) throw new Error(\"Reviewed step was not found.\");\n const gate = canpreview({ session, plan, step, tabid: tab.id as number, origin });\n if (!gate.allowed) throw new Error(gate.reason);\n const fresh = await snapshot(tab.id as number);\n if (!step.target || !fresh.interactive.some(item => item.selector === step.target)) throw new Error(\"The page changed and the target must be reviewed again.\");\n const result = await chrome.scripting.executeScript({ target: { tabId: tab.id as number }, func: (target: string, expectedorigin: string) => {\n const bridge = (globalThis as typeof globalThis & { devthinkbridge?: { previewtarget: (selector: string, origin: string) => { ok: boolean; summary: string } } }).devthinkbridge;\n if (!bridge) throw new Error(\"Devthink page bridge is unavailable.\");\n return bridge.previewtarget(target, expectedorigin);\n }, args: [step.target, origin] });\n const output = result[0]?.result as { ok: boolean; summary: string } | undefined;\n const summary = output?.summary ?? \"The target preview returned no result.\";\n await audit(output?.ok ? \"observe\" : \"error\", summary, { ...(session ? { sessionid: session.id } : {}), ...(plan ? { planid: plan.id } : {}), stepid });\n return output ?? { ok: false, summary };\n}\n\nasync function handlerequest(message: unknown, sender: chrome.runtime.MessageSender): Promise<unknown> {\n if (!extensionpage(sender)) throw new Error(\"Requests are accepted only from Devthink extension pages.\");\n const input = message as { kind?: string; endpoint?: string; objective?: string; stepid?: string };\n switch (input.kind) {\n case \"configure\": {\n const config = normalizeendpoint(input.endpoint ?? \"\");\n const granted = await chrome.permissions.contains({ origins: [hostpattern(config.origin)] });\n if (!granted) throw new Error(\"The endpoint origin has not received optional permission.\");\n await memory.setconfig(config);\n await audit(\"configure\", `Configured user-selected endpoint ${config.origin}.`);\n return config;\n }\n case \"startsession\": return startsession();\n case \"context\": return { config: await memory.getconfig(), session: await memory.getsession(), plan: await memory.getplan(), diagnostic: await memory.getdiagnostic(), audit: await memory.getaudit() };\n case \"diagnostic\": return diagnostic();\n case \"proposelocal\": return propose(input.objective ?? \"\", false);\n case \"proposeremote\": return propose(input.objective ?? \"\", true);\n case \"approve\": {\n const plan = await memory.getplan();\n if (!plan || plan.state !== \"pending\") throw new Error(\"Only a pending plan can be approved.\");\n const approved = { ...plan, state: \"approved\" as const, approvedat: Date.now() };\n await memory.setplan(approved);\n const current = await memory.getsession();\n await audit(\"approval\", \"The user approved the reviewed plan.\", { ...(current ? { sessionid: current.id } : {}), planid: approved.id });\n return approved;\n }\n case \"reject\": {\n const plan = await memory.getplan();\n if (!plan) throw new Error(\"No plan is available to reject.\");\n const rejected = { ...plan, state: \"rejected\" as const };\n await memory.setplan(rejected);\n const current = await memory.getsession();\n await audit(\"approval\", \"The user rejected the plan.\", { ...(current ? { sessionid: current.id } : {}), planid: rejected.id });\n return rejected;\n }\n case \"preview\": return previewstep(input.stepid ?? \"\");\n case \"execute\": return executestep(input.stepid ?? \"\");\n case \"stop\": {\n const session = await memory.getsession();\n if (session) await memory.setsession({ ...session, stoppedat: Date.now() });\n const plan = await memory.getplan();\n if (plan && [\"pending\", \"approved\"].includes(plan.state)) await memory.setplan({ ...plan, state: \"cancelled\" });\n await audit(\"stop\", \"The user stopped the browser session.\", { ...(session ? { sessionid: session.id } : {}), ...(plan ? { planid: plan.id } : {}) });\n return { stopped: true };\n }\n default: throw new Error(\"Unknown Devthink request.\");\n }\n}\n\nchrome.runtime.onMessage.addListener((message, sender, sendresponse) => {\n handlerequest(message, sender).then(value => sendresponse({ ok: true, value })).catch(error => sendresponse({ ok: false, error: error instanceof Error ? error.message : String(error) }));\n return true;\n});\n\nchrome.runtime.onConnect.addListener(port => {\n if (port.name !== \"devthinksidepanel\" || port.sender?.id !== chrome.runtime.id || !port.sender.url?.startsWith(chrome.runtime.getURL(\"\"))) return port.disconnect();\n port.onMessage.addListener(message => { handlerequest(message, port.sender ?? {}).then(value => port.postMessage({ ok: true, value })).catch(error => port.postMessage({ ok: false, error: error instanceof Error ? error.message : String(error) })); });\n});\n"],
5
- "mappings": ";AAQO,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,EAAG;AAAA,EAClG,MAAM,aAAgD;AAAE,WAAO,KAAK,QAAQ,IAAkB,SAAS;AAAA,EAAG;AAAA,EAC1G,MAAM,WAAW,OAAoC;AAAE,WAAO,KAAK,QAAQ,IAAI,WAAW,KAAK;AAAA,EAAG;AAAA,EAClG,MAAM,UAA0C;AAAE,WAAO,KAAK,QAAQ,IAAe,MAAM;AAAA,EAAG;AAAA,EAC9F,MAAM,QAAQ,OAAiC;AAAE,WAAO,KAAK,QAAQ,IAAI,QAAQ,KAAK;AAAA,EAAG;AAAA,EACzF,MAAM,gBAAuD;AAAE,WAAO,KAAK,QAAQ,IAAsB,YAAY;AAAA,EAAG;AAAA,EACxH,MAAM,cAAc,OAAwC;AAAE,WAAO,KAAK,QAAQ,IAAI,cAAc,KAAK;AAAA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,UAAU,YAAY,UAAQ;AAC3C,MAAI,KAAK,SAAS,uBAAuB,KAAK,QAAQ,OAAO,OAAO,QAAQ,MAAM,CAAC,KAAK,OAAO,KAAK,WAAW,OAAO,QAAQ,OAAO,EAAE,CAAC,EAAG,QAAO,KAAK,WAAW;AAClK,OAAK,UAAU,YAAY,aAAW;AAAE,kBAAc,SAAS,KAAK,UAAU,CAAC,CAAC,EAAE,KAAK,WAAS,KAAK,YAAY,EAAE,IAAI,MAAM,MAAM,CAAC,CAAC,EAAE,MAAM,WAAS,KAAK,YAAY,EAAE,IAAI,OAAO,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,EAAE,CAAC,CAAC;AAAA,EAAG,CAAC;AAC1P,CAAC;",
6
- "names": []
3
+ "sources": ["../../memory.ts", "../../policy.ts", "../../progress.ts", "../../version.ts", "../../types.ts", "../../protocol.ts", "../browsertabs.ts", "../background.ts"],
4
+ "sourcesContent": ["import type { agentplan, agentsession, auditevent, capabilityreport, diagnosticreport, endpointconfig, planprogress, runsettings, stepoutcome } 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\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\n/** Creates identifiers locally without a network dependency. */\nexport function randomid(): string {\n return crypto.randomUUID();\n}\n", "import type { actionkind, agentplan, agentsession, endpointconfig, policyevaluation, 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\"]);\nconst interactionactions = new Set<actionkind>([\"focus\", \"scroll\", \"hover\", \"clickdeep\", \"rightclick\", \"doubleclick\", \"scrollpage\", \"scrollby\", \"scrollend\", \"scrolltop\", \"fullscreen\", \"zoomset\"]);\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\"]);\nconst allowedactions = new Set<actionkind>([...sensitiveactions, ...interactionactions, ...readactions]);\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\"]);\nconst valueactions = new Set<actionkind>([\"presskey\", \"drag\", \"drop\", \"upload\", \"readattribute\", \"removeattribute\", \"waittext\", \"evaluate\", \"zoomset\", \"tabactivate\", \"tabclose\", \"tabreload\", \"windowclose\", \"windowresize\", \"tabcreate\", \"windowcreate\", \"downloadfile\"]);\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/** 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/** 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 return 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/** 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 if (targetactions.has(step.kind) && !step.target?.trim()) 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 let options: Record<string, unknown>;\n try { options = parseoptions(step); } catch { return { allowed: false, reason: \"Step options must be a JSON object.\" }; }\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 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 }): 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 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 if (!targetactions.has(input.step.kind)) return { allowed: false, reason: \"Only a target-based action can be previewed.\" };\n return validatestep(input.step, input.origin);\n}\n", "import type { agentplan, planprogress, stepoutcome } from \"./types.js\";\n\n/**\n * Execution-progress logics for reviewed plans.\n * Every correlated rule for step completion, outcome history, deduplication and plan closure lives in this file.\n */\n\n/** Returns a fresh progress record for a plan that has not executed any step yet. */\nexport function emptyprogress(planid: string, now: number): planprogress {\n return { planid, completedsteps: [], updatedat: now };\n}\n\n/** Records one successfully executed step; repeated executions of the same step stay deduplicated. */\nexport function recordstep(progress: planprogress | undefined, planid: string, stepid: string, now: number): planprogress {\n const base = progress && progress.planid === planid ? progress : emptyprogress(planid, now);\n if (base.completedsteps.includes(stepid)) return { ...base, updatedat: now };\n return { planid, completedsteps: [...base.completedsteps, stepid], updatedat: now };\n}\n\n/** Records one structured step outcome beside the completion log; outcomes are never truncated. */\nexport function recordoutcome(progress: planprogress | undefined, planid: string, outcome: stepoutcome, now: number): planprogress {\n const base = progress && progress.planid === planid ? progress : emptyprogress(planid, now);\n return { ...base, outcomes: [...(base.outcomes ?? []), outcome], updatedat: now };\n}\n\n/** True only when every step of the plan has a recorded, successful execution. */\nexport function iscomplete(progress: planprogress | undefined, plan: agentplan): boolean {\n if (!progress || progress.planid !== plan.id) return false;\n const required = plan.steps.map(step => step.id);\n return required.length > 0 && required.every(id => progress.completedsteps.includes(id));\n}\n\n/** Clears progress whenever a different plan replaces the tracked one while preserving prior history snapshots. */\nexport function resetforplan(progress: planprogress | undefined, plan: agentplan, now: number): planprogress {\n if (progress && progress.planid === plan.id) return progress;\n if (!progress) return emptyprogress(plan.id, now);\n const snapshot: planprogress = { planid: progress.planid, completedsteps: progress.completedsteps, ...(progress.outcomes ? { outcomes: progress.outcomes } : {}), updatedat: progress.updatedat };\n return { planid: plan.id, completedsteps: [], outcomes: [], prior: [...(progress.prior ?? []), snapshot], updatedat: now };\n}\n", "/** Canonical package version synchronized from package.json. */\nexport const packageversion = \"1.1.32\" 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\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\";\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}\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}\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 /** Prior progress snapshots preserved when a new plan replaces the tracked one. */\n prior?: planprogress[];\n updatedat: number;\n}\n", "import { actionrisk, parseoptions, validatestep } from \"./policy.js\";\nimport { protocolversion, type agentplan, type planproposal, type proposalrequest, type stepoutcome, type toolstep } 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/** 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 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. */\nexport function outcomeresponse(input: { outcome: stepoutcome; plan: agentplan }): string {\n return JSON.stringify({ version: protocolversion, planid: input.plan.id, planstate: input.plan.state, outcome: input.outcome });\n}\n", "import type { capabilityreport, toolstep } from \"../types.js\";\n\n/**\n * Browser-level command surface for reviewed steps.\n * Every correlated rule for tab, window, zoom, snapshot and download actions plus capability negotiation lives in this file.\n */\n\nexport type browserresult = { ok: boolean; summary: string; details?: Record<string, unknown> };\n\nconst browserkinds: ReadonlySet<string> = new Set([\"tablist\", \"tabcreate\", \"tabactivate\", \"tabclose\", \"tabreload\", \"tabsnapshot\", \"windowlist\", \"windowcreate\", \"windowclose\", \"zoomset\", \"windowresize\", \"downloadfile\"]);\n\n/** True when the kind executes against browser-level surfaces instead of the page. */\nexport function isbrowserkind(kind: string): boolean {\n return browserkinds.has(kind);\n}\n\n/** Builds the live capability report from the optional permissions the user granted. */\nexport async function readcapabilities(): Promise<capabilityreport> {\n const [tabs, downloads, clipboardread, clipboardwrite] = await Promise.all([\n chrome.permissions.contains({ permissions: [\"tabs\"] }),\n chrome.permissions.contains({ permissions: [\"downloads\"] }),\n chrome.permissions.contains({ permissions: [\"clipboardRead\"] }),\n chrome.permissions.contains({ permissions: [\"clipboardWrite\"] }),\n ]);\n return { tabs, downloads, clipboardread, clipboardwrite, reportedat: Date.now() };\n}\n\nfunction stepoptions(step: toolstep): Record<string, unknown> {\n if (!step.options) return {};\n try {\n const parsed = JSON.parse(step.options);\n return parsed && typeof parsed === \"object\" && !Array.isArray(parsed) ? (parsed as Record<string, unknown>) : {};\n } catch { return {}; }\n}\n\nfunction tabid(step: toolstep): number {\n return Number.parseInt(step.value ?? \"\", 10);\n}\n\n/** Executes one reviewed browser-level action kind against the live browser. */\nexport async function runbrowseraction(step: toolstep, sessiontabid: number, windowid: number): Promise<browserresult> {\n const options = stepoptions(step);\n switch (step.kind) {\n case \"tablist\": {\n const tabs = await chrome.tabs.query({});\n return { ok: true, summary: `Listed ${tabs.length} open tab${tabs.length === 1 ? \"\" : \"s\"}.`, details: { tabs: tabs.map(tab => ({ id: tab.id ?? 0, index: tab.index, title: tab.title ?? \"\", url: tab.url ?? \"\", active: tab.active, pinned: tab.pinned, audible: tab.audible ?? false })) } };\n }\n case \"tabcreate\": {\n const created = await chrome.tabs.create({ url: step.value, active: options.active !== false, pinned: options.pinned === true });\n return { ok: true, summary: `Opened a new tab for ${step.value}.`, details: { tabid: created?.id ?? 0 } };\n }\n case \"tabactivate\": {\n await chrome.tabs.update(tabid(step), { active: true });\n return { ok: true, summary: `Activated tab ${tabid(step)}.` };\n }\n case \"tabclose\": {\n await chrome.tabs.remove(tabid(step));\n return { ok: true, summary: `Closed tab ${tabid(step)}.` };\n }\n case \"tabreload\": {\n await chrome.tabs.reload(tabid(step), { bypassCache: options.bypasscache === true });\n return { ok: true, summary: `Reloaded tab ${tabid(step)}.` };\n }\n case \"tabsnapshot\": {\n const shot = await chrome.tabs.captureVisibleTab(windowid, { format: \"png\" });\n return { ok: true, summary: \"Captured the visible area of the active tab.\", details: { shot } };\n }\n case \"windowlist\": {\n const windows = await chrome.windows.getAll();\n return { ok: true, summary: `Listed ${windows.length} open window${windows.length === 1 ? \"\" : \"s\"}.`, details: { windows: windows.map(item => ({ id: item.id ?? 0, type: item.type, state: item.state ?? \"\", focused: item.focused })) } };\n }\n case \"windowcreate\": {\n const created = await chrome.windows.create({ url: step.value ?? \"about:blank\", ...(typeof options.width === \"number\" ? { width: options.width } : {}), ...(typeof options.height === \"number\" ? { height: options.height } : {}) });\n return { ok: true, summary: `Opened a new window for ${step.value}.`, details: { windowid: created?.id ?? 0 } };\n }\n case \"windowclose\": {\n await chrome.windows.remove(tabid(step));\n return { ok: true, summary: `Closed window ${tabid(step)}.` };\n }\n case \"zoomset\": {\n const zoom = Number(step.value);\n await chrome.tabs.setZoom(sessiontabid, zoom);\n return { ok: true, summary: `Set the tab zoom to ${zoom}.` };\n }\n case \"windowresize\": {\n await chrome.windows.update(tabid(step), { width: options.width as number, height: options.height as number });\n return { ok: true, summary: `Resized window ${tabid(step)}.` };\n }\n case \"downloadfile\": {\n const downloadid = await chrome.downloads.download({ url: step.value ?? \"\" });\n return { ok: true, summary: `Started the download of ${step.value}.`, details: { downloadid } };\n }\n default: return { ok: false, summary: \"Unsupported browser action.\" };\n }\n}\n", "import { randomid, sessionmemory } from \"../memory.js\";\nimport { canexecute, canpreview, hostpattern, normalizeendpoint, requiredcapability } from \"../policy.js\";\nimport { iscomplete, recordoutcome, recordstep, resetforplan } from \"../progress.js\";\nimport { parseproposal, requestbody } from \"../protocol.js\";\nimport type { agentplan, agentsession, auditevent, capabilityreport, diagnosticreport, observation, stepoutcome, toolstep } from \"../types.js\";\nimport { isbrowserkind, readcapabilities, runbrowseraction } from \"./browsertabs.js\";\n\nconst sessionduration = 15 * 60 * 1000;\nconst freshcheckkinds: ReadonlySet<string> = new Set([\"focus\", \"inspect\", \"click\", \"type\", \"scroll\", \"select\", \"hover\"]);\n\nconst chromestorage = {\n async get<T>(key: string): Promise<T | undefined> { return (await chrome.storage.local.get(key))[key] as T | undefined; },\n async set<T>(key: string, value: T): Promise<void> { await chrome.storage.local.set({ [key]: value }); },\n};\nconst memory = new sessionmemory(chromestorage);\n\nfunction extensionpage(sender: chrome.runtime.MessageSender): boolean {\n return sender.id === chrome.runtime.id && Boolean(sender.url?.startsWith(chrome.runtime.getURL(\"\")));\n}\n\nasync function audit(kind: auditevent[\"kind\"], summary: string, extra: Partial<auditevent> = {}): Promise<void> {\n await memory.addaudi({ id: randomid(), kind, at: Date.now(), summary, ...extra });\n}\n\n/** Refreshes and persists the capability report negotiated through the permissions api. */\nasync function refreshcapabilities(): Promise<capabilityreport> {\n const report = await readcapabilities();\n await memory.setcapabilities(report);\n return report;\n}\n\nasync function activecontext(): Promise<{ tab: chrome.tabs.Tab; origin: string }> {\n const [tab] = await chrome.tabs.query({ active: true, lastFocusedWindow: true });\n if (!tab?.id || !tab.url) throw new Error(\"No active web tab is available.\");\n const origin = new URL(tab.url).origin;\n if (!origin.startsWith(\"https://\")) throw new Error(\"Devthink can work with HTTPS pages only.\");\n return { tab, origin };\n}\n\nasync function snapshot(tabid: number): Promise<observation> {\n await chrome.scripting.executeScript({ target: { tabId: tabid }, files: [\"pagebridge.js\"] });\n const result = await chrome.scripting.executeScript({ target: { tabId: tabid }, func: () => {\n const bridge = (globalThis as typeof globalThis & { devthinkbridge?: { capturesnapshot: () => observation } }).devthinkbridge;\n if (!bridge) throw new Error(\"Devthink page bridge is unavailable.\");\n return bridge.capturesnapshot();\n } });\n const value = result[0]?.result;\n if (!value) throw new Error(\"The page did not return an observation.\");\n return value as observation;\n}\n\nasync function startsession(): Promise<agentsession> {\n const { tab, origin } = await activecontext();\n const session: agentsession = { id: randomid(), tabid: tab.id as number, origin, startedat: Date.now(), expiresat: Date.now() + sessionduration, grants: [origin] };\n await memory.setsession(session);\n await audit(\"session\", `Session started for ${origin}.`, { sessionid: session.id });\n return session;\n}\n\nasync function diagnostic(): Promise<diagnosticreport> {\n const session = await memory.getsession();\n const { tab, origin } = await activecontext();\n if (!session || session.stoppedat || session.expiresat <= Date.now() || session.tabid !== tab.id || session.origin !== origin) throw new Error(\"Start a current session for this active tab before diagnostics.\");\n const observation = await snapshot(session.tabid);\n const report: diagnosticreport = { id: randomid(), sessionid: session.id, origin, capturedat: Date.now(), tabid: session.tabid, title: observation.title, textlength: observation.textlength, interactivecount: observation.interactive.length, formcount: observation.forms.length, bridgeavailable: true };\n await memory.setdiagnostic(report);\n await audit(\"observe\", \"Structured diagnostics captured for the approved active tab.\", { sessionid: session.id });\n return report;\n}\n\nfunction localplan(objective: string, session: agentsession): agentplan {\n const now = Date.now();\n return { id: randomid(), objective, origin: session.origin, steps: [{ id: randomid(), kind: \"observe\", summary: \"Capture a complete semantic snapshot of the approved active tab.\", risk: \"read\" }], createdat: now, expiresat: now + sessionduration, state: \"pending\" };\n}\n\nasync function propose(objective: string, remote: boolean): Promise<agentplan> {\n if (!objective.trim()) throw new Error(\"An objective is required.\");\n const session = await memory.getsession();\n if (!session || session.stoppedat || session.expiresat <= Date.now()) throw new Error(\"Start a current browser session before requesting a plan.\");\n const { tab, origin } = await activecontext();\n if (session.tabid !== tab.id || session.origin !== origin) throw new Error(\"The selected tab or origin no longer matches the approved session.\");\n const observation = await snapshot(session.tabid);\n const capabilities = await refreshcapabilities();\n const config = await memory.getconfig();\n let plan = localplan(objective.trim(), session);\n if (remote) {\n if (!config) throw new Error(\"Configure an approved HTTPS endpoint before requesting a remote proposal.\");\n const response = await fetch(config.endpoint, { method: \"POST\", headers: { \"content-type\": \"application/json\" }, credentials: \"omit\", body: requestbody({ objective: objective.trim(), session, observation, capabilities }) });\n if (!response.ok) throw new Error(`Proposal endpoint returned ${response.status}.`);\n plan = parseproposal(await response.json(), session.origin).plan;\n }\n await memory.setplan(plan);\n await memory.setprogress(resetforplan(await memory.getprogress(), plan, Date.now()));\n await audit(\"proposal\", `Plan proposed with ${plan.steps.length} reviewed step${plan.steps.length === 1 ? \"\" : \"s\"}.`, { sessionid: session.id, planid: plan.id });\n return plan;\n}\n\nfunction browserauditkind(step: toolstep): auditevent[\"kind\"] {\n if (step.kind === \"downloadfile\") return \"download\";\n if (step.kind.startsWith(\"window\")) return \"window\";\n return \"tab\";\n}\n\nasync function executestep(stepid: string): Promise<{ ok: boolean; summary: string; details?: Record<string, unknown> }> {\n const session = await memory.getsession();\n const plan = await memory.getplan();\n const { tab, origin } = await activecontext();\n const step = plan?.steps.find(candidate => candidate.id === stepid);\n if (!step) throw new Error(\"Reviewed step was not found.\");\n const gate = canexecute({ session, plan, step, tabid: tab.id as number, origin });\n if (!gate.allowed) throw new Error(gate.reason);\n let output: { ok: boolean; summary: string; details?: Record<string, unknown> } | undefined;\n if (isbrowserkind(step.kind)) {\n const capability = requiredcapability(step.kind);\n if (capability) {\n const granted = await chrome.permissions.contains({ permissions: [capability] } as chrome.permissions.Permissions);\n if (!granted) throw new Error(`The ${capability} capability has not been granted; request it from the review panel.`);\n }\n output = await runbrowseraction(step, tab.id as number, tab.windowId ?? chrome.windows.WINDOW_ID_CURRENT);\n } else {\n if (step.target && freshcheckkinds.has(step.kind)) {\n const fresh = await snapshot(tab.id as number);\n if (!fresh.interactive.some(item => item.selector === step.target)) throw new Error(\"The page changed and the target must be reviewed again.\");\n }\n const result = await chrome.scripting.executeScript({ target: { tabId: tab.id as number }, func: (action: toolstep, expectedorigin: string) => {\n const bridge = (globalThis as typeof globalThis & { devthinkbridge?: { performstep: (input: toolstep, origin: string) => { ok: boolean; summary: string; details?: Record<string, unknown> } | Promise<{ ok: boolean; summary: string; details?: Record<string, unknown> }> } }).devthinkbridge;\n if (!bridge) throw new Error(\"Devthink page bridge is unavailable.\");\n return bridge.performstep(action, expectedorigin);\n }, args: [step, origin] });\n output = result[0]?.result as { ok: boolean; summary: string; details?: Record<string, unknown> } | undefined;\n }\n const summary = output?.summary ?? \"The page action returned no result.\";\n const outcome: stepoutcome = { stepid, ok: Boolean(output?.ok), summary, ...(output?.details ? { details: output.details } : {}), at: Date.now() };\n const auditkind = isbrowserkind(step.kind) ? browserauditkind(step) : output?.ok ? \"action\" : \"error\";\n await audit(auditkind, summary, { ...(session ? { sessionid: session.id } : {}), ...(plan ? { planid: plan.id } : {}), stepid });\n await memory.addoutcome(outcome);\n if (output?.ok && plan) {\n const completed = recordstep(await memory.getprogress(), plan.id, stepid, Date.now());\n const tracked = recordoutcome(completed, plan.id, outcome, Date.now());\n await memory.setprogress(tracked);\n if (iscomplete(tracked, plan) && plan.state === \"approved\") {\n const done = { ...plan, state: \"completed\" as const, completedat: Date.now() };\n await memory.setplan(done);\n await audit(\"complete\", \"Every reviewed step of the approved plan has executed.\", { ...(session ? { sessionid: session.id } : {}), planid: done.id });\n }\n }\n return output ?? { ok: false, summary };\n}\n\n/** Highlights a reviewed target without clicking, typing, navigating or transmitting page data. */\nasync function previewstep(stepid: string): Promise<{ ok: boolean; summary: string }> {\n const session = await memory.getsession();\n const plan = await memory.getplan();\n const { tab, origin } = await activecontext();\n const step = plan?.steps.find(candidate => candidate.id === stepid);\n if (!step) throw new Error(\"Reviewed step was not found.\");\n const gate = canpreview({ session, plan, step, tabid: tab.id as number, origin });\n if (!gate.allowed) throw new Error(gate.reason);\n if (!step.target) throw new Error(\"Only a target-based step can be previewed.\");\n const result = await chrome.scripting.executeScript({ target: { tabId: tab.id as number }, func: (target: string, expectedorigin: string) => {\n const bridge = (globalThis as typeof globalThis & { devthinkbridge?: { previewtarget: (selector: string, origin: string) => { ok: boolean; summary: string } } }).devthinkbridge;\n if (!bridge) throw new Error(\"Devthink page bridge is unavailable.\");\n return bridge.previewtarget(target, expectedorigin);\n }, args: [step.target, origin] });\n const output = result[0]?.result as { ok: boolean; summary: string } | undefined;\n const summary = output?.summary ?? \"The target preview returned no result.\";\n await audit(output?.ok ? \"observe\" : \"error\", summary, { ...(session ? { sessionid: session.id } : {}), ...(plan ? { planid: plan.id } : {}), stepid });\n return output ?? { ok: false, summary };\n}\n\nasync function pausesession(): Promise<agentsession> {\n const session = await memory.getsession();\n if (!session || session.stoppedat) throw new Error(\"No active browser session exists.\");\n if (session.expiresat <= Date.now()) throw new Error(\"The browser session has expired.\");\n if (session.pausedat) throw new Error(\"The browser session is already paused.\");\n const paused = { ...session, pausedat: Date.now() };\n await memory.setsession(paused);\n await audit(\"pause\", \"The user paused the browser session; no action or preview can run.\", { sessionid: session.id });\n return paused;\n}\n\nasync function resumesession(): Promise<agentsession> {\n const session = await memory.getsession();\n if (!session || session.stoppedat) throw new Error(\"No active browser session exists.\");\n if (session.expiresat <= Date.now()) throw new Error(\"The browser session has expired and cannot be resumed.\");\n if (!session.pausedat) throw new Error(\"The browser session is not paused.\");\n const resumed: agentsession = { id: session.id, tabid: session.tabid, origin: session.origin, startedat: session.startedat, expiresat: session.expiresat, ...(session.grants ? { grants: session.grants } : {}) };\n await memory.setsession(resumed);\n await audit(\"resume\", \"The user resumed the browser session; reviewed actions can run again.\", { sessionid: session.id });\n return resumed;\n}\n\nasync function grantcapability(permission: string): Promise<capabilityreport> {\n if (![\"tabs\", \"downloads\", \"clipboardRead\", \"clipboardWrite\"].includes(permission)) throw new Error(\"Unknown capability.\");\n const granted = await chrome.permissions.request({ permissions: [permission] } as chrome.permissions.Permissions);\n if (!granted) throw new Error(\"The capability grant was declined.\");\n await audit(\"capability\", `Capability ${permission} granted by the user.`);\n return refreshcapabilities();\n}\n\nasync function handlerequest(message: unknown, sender: chrome.runtime.MessageSender): Promise<unknown> {\n if (!extensionpage(sender)) throw new Error(\"Requests are accepted only from Devthink extension pages.\");\n const input = message as { kind?: string; endpoint?: string; objective?: string; stepid?: string; permission?: string };\n switch (input.kind) {\n case \"configure\": {\n const config = normalizeendpoint(input.endpoint ?? \"\");\n const granted = await chrome.permissions.contains({ origins: [hostpattern(config.origin)] });\n if (!granted) throw new Error(\"The endpoint origin has not received optional permission.\");\n await memory.setconfig(config);\n await audit(\"configure\", `Configured user-selected endpoint ${config.origin}.`);\n return config;\n }\n case \"startsession\": return startsession();\n case \"context\": {\n const plan = await memory.getplan();\n const progress = await memory.getprogress();\n return { config: await memory.getconfig(), session: await memory.getsession(), plan, progress: plan && progress?.planid === plan.id ? progress : undefined, diagnostic: await memory.getdiagnostic(), audit: await memory.getaudit(), capabilities: await refreshcapabilities(), outcomes: await memory.getoutcomes() };\n }\n case \"capabilities\": return refreshcapabilities();\n case \"grantcapability\": return grantcapability(input.permission ?? \"\");\n case \"diagnostic\": return diagnostic();\n case \"proposelocal\": return propose(input.objective ?? \"\", false);\n case \"proposeremote\": return propose(input.objective ?? \"\", true);\n case \"approve\": {\n const plan = await memory.getplan();\n if (!plan || plan.state !== \"pending\") throw new Error(\"Only a pending plan can be approved.\");\n const approved = { ...plan, state: \"approved\" as const, approvedat: Date.now() };\n await memory.setplan(approved);\n const current = await memory.getsession();\n await audit(\"approval\", \"The user approved the reviewed plan.\", { ...(current ? { sessionid: current.id } : {}), planid: approved.id });\n return approved;\n }\n case \"reject\": {\n const plan = await memory.getplan();\n if (!plan) throw new Error(\"No plan is available to reject.\");\n const rejected = { ...plan, state: \"rejected\" as const };\n await memory.setplan(rejected);\n const current = await memory.getsession();\n await audit(\"approval\", \"The user rejected the plan.\", { ...(current ? { sessionid: current.id } : {}), planid: rejected.id });\n return rejected;\n }\n case \"preview\": return previewstep(input.stepid ?? \"\");\n case \"execute\": return executestep(input.stepid ?? \"\");\n case \"pausesession\": return pausesession();\n case \"resumesession\": return resumesession();\n case \"stop\": {\n const session = await memory.getsession();\n if (session) await memory.setsession({ ...session, stoppedat: Date.now() });\n const plan = await memory.getplan();\n if (plan && [\"pending\", \"approved\"].includes(plan.state)) await memory.setplan({ ...plan, state: \"cancelled\" });\n await audit(\"stop\", \"The user stopped the browser session.\", { ...(session ? { sessionid: session.id } : {}), ...(plan ? { planid: plan.id } : {}) });\n return { stopped: true };\n }\n default: throw new Error(\"Unknown Devthink request.\");\n }\n}\n\nchrome.runtime.onMessage.addListener((message, sender, sendresponse) => {\n handlerequest(message, sender).then(value => sendresponse({ ok: true, value })).catch(error => sendresponse({ ok: false, error: error instanceof Error ? error.message : String(error) }));\n return true;\n});\n\nchrome.runtime.onConnect.addListener(port => {\n if (port.name !== \"devthinksidepanel\" || port.sender?.id !== chrome.runtime.id || !port.sender.url?.startsWith(chrome.runtime.getURL(\"\"))) return port.disconnect();\n port.onMessage.addListener(message => { handlerequest(message, port.sender ?? {}).then(value => port.postMessage({ ok: true, value })).catch(error => port.postMessage({ ok: false, error: error instanceof Error ? error.message : String(error) })); });\n});\n"],
5
+ "mappings": ";AAQO,IAAM,gBAAN,MAAoB;AAAA,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0isRYUrqM+M72vKxHk9zUIYYn/LGPvottKBYi2GLr0PHSeC2UE+Shmq7vcFIXj6hDjvD4kLJ5sKoUllEcZ1TPuBcnHUQ9ndKA5iktXDQOIJCUJmi7a0YJ2PGg7fvpYfT9k0ai/qZ+pIoRfoOEwE01bPoDn7NjeYnNQIDAQAB",
4
4
  "name": "Devthink",
5
- "version": "1.1.30",
5
+ "version": "1.1.32",
6
6
  "description": "A consent-first bridge for reviewed browser-agent tasks.",
7
7
  "permissions": [
8
8
  "activeTab",
@@ -10,6 +10,12 @@
10
10
  "scripting",
11
11
  "sidePanel"
12
12
  ],
13
+ "optional_permissions": [
14
+ "tabs",
15
+ "downloads",
16
+ "clipboardRead",
17
+ "clipboardWrite"
18
+ ],
13
19
  "optional_host_permissions": [
14
20
  "https://*/*"
15
21
  ],