An agentic browser harness: an AI side panel & orb in your own logged-in Chrome, Edge, Arc, Brave or even Firefox run by the agent/subscription you already use (Claude Code, Codex, Antigravity). Free, open source, no API key. Also an MCP server.
TypeScript agentic-browseragentic-browsingagy-cliaiai-agentai-browser-extensionai-toolsbrave-extensionbrowser-agentbrowser-automationbrowser-extensionbrowser-usebrowserskillchrome-extensionclaude-codecodexfirefox-addonmcp-servernanobrowserweb-automation
feat(actions): register the actions and add the dispatch envelope
Shahriarb815eb035092
diff --git a/lib/actions/dispatch.ts b/lib/actions/dispatch.tsnew file mode 100644index 0000000..32a4379--- /dev/null+++ b/lib/actions/dispatch.ts@@ -0,0 +1,21 @@+import { z } from 'zod';+import { ActionError } from './core';+import { failure, success, type ActionResult } from './protocol';+import { actions } from './registry';++/** Validate and run a named action in the current context. */+export async function dispatch(name: string, input: unknown): Promise<ActionResult> {+ const action = actions.get(name);+ if (!action) return failure('UNKNOWN_ACTION', `No action named "${name}"`);++ const parsed = action.input.safeParse(input ?? {});+ if (!parsed.success) return failure('INVALID_INPUT', z.prettifyError(parsed.error));++ try {+ return success(await action.execute(parsed.data));+ } catch (error) {+ return error instanceof ActionError+ ? failure(error.code, error.message)+ : failure('ACTION_FAILED', error instanceof Error ? error.message : String(error));+ }+}diff --git a/lib/actions/registry.ts b/lib/actions/registry.tsnew file mode 100644index 0000000..bad3703--- /dev/null+++ b/lib/actions/registry.ts@@ -0,0 +1,55 @@+import { z } from 'zod';+import type { AnyAction } from './core';+import type { ToolDescriptor } from './manifest';+import { attachFile } from './page/attach-file';+import { clickElement } from './page/click-element';+import { extractText } from './page/extract-text';+import { fillInput } from './page/fill-input';+import { focusInput } from './page/focus-input';+import { getPageInfo } from './page/get-page-info';+import { highlightElement } from './page/highlight-element';+import { hoverElement } from './page/hover-element';+import { listFiles } from './page/list-files';+import { navigate } from './page/navigate';+import { pressKey } from './page/press-key';+import { screenshot } from './page/screenshot';+import { scrollTo } from './page/scroll-to';+import { selectOption } from './page/select-option';+import { selectText } from './page/select-text';+import { submitForm } from './page/submit-form';+import { waitForElement } from './page/wait-for-element';++/** Every capability the extension can perform against a page, keyed by name. */+export const actions: ReadonlyMap<string, AnyAction> = new Map(+ (+ [+ getPageInfo,+ scrollTo,+ clickElement,+ hoverElement,+ focusInput,+ fillInput,+ selectOption,+ selectText,+ extractText,+ pressKey,+ submitForm,+ waitForElement,+ highlightElement,+ navigate,+ screenshot,+ listFiles,+ attachFile,+ ] as AnyAction[]+ ).map((action) => [action.name, action]),+);++/** Serializable manifest of all actions — the source for MCP tool definitions. */+export function describeActions(): ToolDescriptor[] {+ return [...actions.values()].map(({ name, description, input }) => ({+ name,+ description,+ // io: 'input' describes what a caller must SEND: defaulted fields stay optional, matching dispatch.+ inputSchema: z.toJSONSchema(input, { io: 'input' }),+ }));+}