Skip to content

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.

1004 B
Raw Blame
import type { z } from 'zod';
import type { ToolGroupName } from './groups';

export interface Action<Input extends z.ZodType = z.ZodType, Output = unknown> {
  readonly name: string;
  readonly description: string;
  readonly input: Input;
  readonly execute: (input: z.output<Input>) => Output | Promise<Output>;
  /** Needs Chrome's debugger, which Firefox has no counterpart for, so a Firefox build leaves it off the list it offers. */
  readonly chromiumOnly?: true;
  /** A less common capability, taught by its group's guide; ungrouped actions are the core every run is offered. */
  readonly group?: ToolGroupName;
}

export type AnyAction = Action<any, any>;

export function defineAction<Input extends z.ZodType, Output>(
  action: Action<Input, Output>,
): Action<Input, Output> {
  return Object.freeze(action);
}

export class ActionError extends Error {
  constructor(
    message: string,
    readonly code = 'ACTION_FAILED',
  ) {
    super(message);
    this.name = 'ActionError';
  }
}