Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

7.1 KB
Raw Blame
// Code generated by tygo. DO NOT EDIT.

//////////
// source: headers.go

/**
 * The X-PinchTab-* wire headers that form the CLI/MCP-to-server contract. They
 * live here, the leaf both clients and the server import, so a one-character
 * drift on one side is a compile error rather than a silent no-op. Request-side
 * tags travel in the body instead, because the strip middleware drops inbound
 * X-PinchTab-* headers from public clients; these are the response headers
 * (Vocab, Tab-Id) and the source tag the trusted hops set.
 */
export const HeaderVocab = "X-PinchTab-Vocab";
/**
 * The X-PinchTab-* wire headers that form the CLI/MCP-to-server contract. They
 * live here, the leaf both clients and the server import, so a one-character
 * drift on one side is a compile error rather than a silent no-op. Request-side
 * tags travel in the body instead, because the strip middleware drops inbound
 * X-PinchTab-* headers from public clients; these are the response headers
 * (Vocab, Tab-Id) and the source tag the trusted hops set.
 */
export const HeaderTabID = "X-PinchTab-Tab-Id";
/**
 * The X-PinchTab-* wire headers that form the CLI/MCP-to-server contract. They
 * live here, the leaf both clients and the server import, so a one-character
 * drift on one side is a compile error rather than a silent no-op. Request-side
 * tags travel in the body instead, because the strip middleware drops inbound
 * X-PinchTab-* headers from public clients; these are the response headers
 * (Vocab, Tab-Id) and the source tag the trusted hops set.
 */
export const HeaderSource = "X-PinchTab-Source";

//////////
// source: health.go

export const HealthStatusOK = "ok";
export const HealthStatusDegraded = "degraded";
/**
 * ModeDashboard is the /health "mode" the front-door dashboard server reports. A
 * bridge or instance server reports no mode, so a reader comparing against this
 * const treats those as non-dashboard rather than by accident — and a rename
 * stays one edit instead of a literal scattered across producers and readers.
 */
export const ModeDashboard = "dashboard";

//////////
// source: types.go
/*
Package types contains shared API types for the dashboard.
These types are exported to TypeScript via tygo.
*/

/**
 * Matches internal/bridge/api.go ProfileInfo
 */
export interface Profile {
  id?: string;
  name: string;
  path?: string;
  pathExists?: boolean;
  created: string;
  lastUsed: string;
  diskUsage: number /* int64 */;
  sizeMB?: number /* float64 */;
  running: boolean;
  temporary?: boolean;
  quarantined?: boolean;
  source?: string;
  chromeProfileName?: string;
  accountEmail?: string;
  accountName?: string;
  hasAccount?: boolean;
  useWhen?: string;
  description?: string;
}
export interface SecurityPolicy {
  allowedDomains?: string[];
}
/**
 * Matches internal/bridge/api.go Instance
 */
export interface Instance {
  id: string;
  profileId: string;
  profileName: string;
  port: string; // Note: string not int
  url?: string;
  mode: string;
  headless: boolean;
  status: string; // starting/running/stopping/stopped/error
  startTime: string;
  error?: string;
  attached: boolean; // True if attached rather than locally launched
  attachType?: string;
  cdpUrl?: string; // CDP WebSocket URL (for CDP-attached instances)
  securityPolicy?: SecurityPolicy;
  browser?: string;
  /**
   * FallbackFrom/FallbackReason are reserved for a future phase (always
   * empty in P2.4a).
   */
  fallbackFrom?: string;
  fallbackReason?: string;
  crashes?: CrashSummary;
  responsiveness: string; // responsive/unresponsive/unknown
}
export interface CrashEvent {
  time: string;
  targetId?: string;
  tabId?: string;
  url?: string;
  reason: string;
  lastError?: string;
  instanceId?: string;
}
export interface CrashSummary {
  total: number /* uint64 */;
  recent: CrashEvent[];
}
export interface Agent {
  id: string;
  name?: string;
  connectedAt: string;
  lastActivity?: string;
  requestCount: number /* int */;
}
export interface AgentDetail {
  agent: Agent;
  events: ActivityEvent[];
}
export interface ActivityEvent {
  id: string;
  agentId: string;
  channel: string; // "tool_call" or "progress"
  type: string; // navigate/snapshot/action/screenshot/other
  method: string;
  path: string;
  message?: string; // human-readable (progress channel)
  progress?: number /* int */; // 0-100 numeric progress
  total?: number /* int */; // total steps
  timestamp: string;
  details?: { [key: string]: any };
}
export interface RouteAttempt {
  provider: string;
  accepted: boolean;
  reason?: string;
}
export interface RouteMetadata {
  requestedProvider: string;
  usedProvider: string;
  escalated: boolean;
  reason?: string;
  quality?: number /* int */;
  fallbackAttempts?: number /* int */;
  attempts?: RouteAttempt[];
}
export interface ActivityLogEvent {
  timestamp: string;
  source: string;
  requestId?: string;
  sessionId?: string;
  agentId?: string;
  method: string;
  path: string;
  status: number /* int */;
  durationMs: number /* int64 */;
  remoteAddr?: string;
  instanceId?: string;
  profileId?: string;
  profileName?: string;
  tabId?: string;
  url?: string;
  action?: string;
  route?: RouteMetadata;
  ref?: string;
  code?: string;
  error?: string;
}
export interface ActivityLogResponse {
  events: ActivityLogEvent[];
  count: number /* int */;
}
export interface ScreencastSettings {
  fps: number /* int */;
  quality: number /* int */;
  maxWidth: number /* int */;
}
export interface BrowserSettings {
  blockImages: boolean;
  blockMedia: boolean;
  noAnimations: boolean;
}
export interface Settings {
  screencast: ScreencastSettings;
  stealth: string; // light/medium/full
  browser: BrowserSettings;
  monitoring: MonitoringSettings;
  agents: AgentSettings;
}
export interface AgentSettings {
  reasoningMode: string; // "tool_calls" (default), "progress", "both"
}
export interface MonitoringSettings {
  memoryMetrics: boolean; // Enable per-tab memory aggregation (can be heavy)
  pollInterval: number /* int */; // Poll interval in seconds (default 30)
}
export interface ServerInfo {
  version: string;
  uptime: number /* int64 */;
  profiles: number /* int */;
  instances: number /* int */;
  agents: number /* int */;
}
export interface CreateProfileRequest {
  name: string;
  description?: string;
  useWhen?: string;
}
export interface CreateProfileResponse {
  status: string;
  id: string;
  name: string;
}
export interface InstanceTab {
  id: string;
  instanceId: string;
  url: string;
  title: string;
}
export interface InstanceMetrics {
  instanceId: string;
  profileName: string;
  memoryMB: number /* float64 */;
  renderers: number /* int */;
  page?: PageMetrics;
  unreadableTargets: number /* int */;
}
export interface PageMetrics {
  targets: number /* int */;
  jsHeapUsedMB: number /* float64 */;
  jsHeapTotalMB: number /* float64 */;
  documents: number /* int */;
  frames: number /* int */;
  nodes: number /* int */;
  jsEventListeners: number /* int */;
}
export interface LaunchInstanceRequest {
  profileId?: string; // profile ID (prof_XXXXXXXX) or existing profile name
  mode?: string; // "headed" or empty for headless
  port?: string; // port number as string
  browser?: string; // browser override (chrome, cloak, ghost-chrome)
}