tools

package
v0.13.32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package tools exposes agnt's functionality as MCP tools for AI agents. Each tool is registered with an MCP server via RegisterDaemonTools().

Tools communicate with the daemon over IPC (socket/pipe) using the daemon.Client. DaemonTools manages the connection lifecycle, session attachment, and auto-start configuration.

Handler functions are organized by domain in daemon_*.go files. Converter and formatting functions live in converters.go.

Index

Constants

View Source
const ChannelCapabilityName = "claude/channel"

ChannelCapabilityName is the experimental capability key used to declare support for the claude/channel push-based event protocol.

View Source
const ChannelInstructions = `` /* 683-byte string literal not displayed */

ChannelInstructions is appended to the standard MCP Instructions when channel mode is active. It tells the AI agent how to interpret incoming channel events.

View Source
const (
	// ChannelNotificationMethod is the MCP notification method for channel events.
	ChannelNotificationMethod = "notifications/claude/channel"
)
View Source
const ProxyToolDescription = `` /* 2475-byte string literal not displayed */

ProxyToolDescription is the shared description for the proxy MCP tool. Both daemon_tools.go and proxy_tools.go reference this constant so the description stays in sync across both registration paths.

Variables

View Source
var DevToolAPIDocs = devToolAPIDocs{
	Categories: []APICategory{
		{Name: "logging", Description: "Send custom log messages to the proxy server"},
		{Name: "screenshot", Description: "Capture screenshots of the page or elements"},
		{Name: "inspection", Description: "Get detailed information about DOM elements"},
		{Name: "tree", Description: "Walk and navigate the DOM tree"},
		{Name: "visual", Description: "Check visibility and viewport state"},
		{Name: "layout", Description: "Diagnose layout issues (overflow, stacking, offscreen; diagnoseLayoutIssues = cause→symptom traps)"},
		{Name: "overlay", Description: "Highlight elements visually on the page"},
		{Name: "interactive", Description: "Interactive element selection and measurement"},
		{Name: "capture", Description: "Capture page state, styles, and network info"},
		{Name: "accessibility", Description: "Accessibility auditing and information"},
		{Name: "audit", Description: "Page quality audits (DOM complexity, CSS, security)"},
		{Name: "interactions", Description: "Track and query user interactions (clicks, keyboard, scroll)"},
		{Name: "mutations", Description: "Track and query DOM mutations (added, removed, modified)"},
		{Name: "indicator", Description: "Control the floating indicator bug"},
		{Name: "sketch", Description: "Wireframing and annotation mode"},
		{Name: "content", Description: "Content extraction, navigation, sitemaps, and markdown conversion"},
		{Name: "connection", Description: "WebSocket connection status"},
	},
	Functions: DevToolAPIFunctions,
}

DevToolAPIDocs contains the full API documentation. Functions is sourced from the generated DevToolAPIFunctions; Categories is authored here.

View Source
var DevToolAPIFunctions = []APIFunction{}/* 117 elements not displayed */

DevToolAPIFunctions is the canonical catalog of __devtool.* public functions, extracted from JSDoc blocks in internal/proxy/scripts/*.js.

Functions

func ChannelServerOptions added in v0.12.44

func ChannelServerOptions(opts *mcp.ServerOptions, cfg *config.ChannelConfig) *mcp.ServerOptions

ChannelServerOptions returns a ServerOptions with channel-specific modifications applied. When channel is disabled (cfg is nil or not enabled), it returns opts unchanged -- preserving byte-for-byte identical default behavior. When channel is enabled, it sets the Experimental capabilities map and appends channel instructions.

func GetAPIOverview

func GetAPIOverview() string

GetAPIOverview returns a high-level overview of all API categories and functions.

func GetFunctionDescription

func GetFunctionDescription(name string) (string, bool)

GetFunctionDescription returns detailed documentation for a specific function.

func ListFunctionNames

func ListFunctionNames() []string

ListFunctionNames returns all function names for auto-completion.

func RegisterAPIAuditTool added in v0.13.20

func RegisterAPIAuditTool(server *mcp.Server, dt *DaemonTools)

RegisterAPIAuditTool registers the api_audit tool.

func RegisterAutomationTool added in v0.11.1

func RegisterAutomationTool(server *mcp.Server, dt *DaemonTools)

RegisterAutomationTool registers the automation MCP tool with the server.

func RegisterBrowserTool added in v0.11.1

func RegisterBrowserTool(server *mcp.Server, dt *DaemonTools)

RegisterBrowserTool registers the browser MCP tool with the server.

func RegisterChannelReplyTool added in v0.12.44

func RegisterChannelReplyTool(server *mcp.Server, dt *DaemonTools)

RegisterChannelReplyTool registers the channel_reply MCP tool. The tool is only registered when channel is enabled and reply-tool is on. dt must be non-nil.

func RegisterDaemonManagementTool

func RegisterDaemonManagementTool(server *mcp.Server, dt *DaemonTools)

RegisterDaemonManagementTool adds the daemon management tool to the server.

func RegisterDaemonTools

func RegisterDaemonTools(server *mcp.Server, dt *DaemonTools)

RegisterDaemonTools adds all MCP tools that communicate with the daemon.

func RegisterErrorQueueTool added in v0.13.9

func RegisterErrorQueueTool(server *mcp.Server, dt *DaemonTools)

func RegisterGetIncidentsTool added in v0.13.0

func RegisterGetIncidentsTool(server *mcp.Server, dt *DaemonTools)

RegisterGetIncidentsTool registers the get_incidents MCP tool.

func RegisterLoadingAuditTool added in v0.13.20

func RegisterLoadingAuditTool(server *mcp.Server, dt *DaemonTools)

RegisterLoadingAuditTool registers the loading_audit tool.

func RegisterReplaytestTool added in v0.13.20

func RegisterReplaytestTool(server *mcp.Server, lic *license.Manager)

RegisterReplaytestTool registers the replaytest MCP tool. The license manager gates the record/stop/refine/replay/explore actions on the advanced_testing capability; list/show are free.

func RegisterResponsiveAuditTool added in v0.12.0

func RegisterResponsiveAuditTool(server *mcp.Server, dt *DaemonTools)

RegisterResponsiveAuditTool registers the responsive_audit tool.

func RegisterSessionTool added in v0.7.0

func RegisterSessionTool(server *mcp.Server, dt *DaemonTools)

RegisterSessionTool adds the session MCP tool to the server.

func RegisterSnapshotTools

func RegisterSnapshotTools(server *mcp.Server, manager *snapshot.Manager, dt *DaemonTools)

RegisterSnapshotTools registers snapshot-related MCP tools. When dt is non-nil, the screenshot action is enabled and routed through the daemon's proxy exec path.

func RegisterStoreTool added in v0.8.0

func RegisterStoreTool(server *mcp.Server, dt *DaemonTools)

RegisterStoreTool registers the store MCP tool with the server.

func RegisterTunnelTool

func RegisterTunnelTool(server *mcp.Server, dt *DaemonTools)

RegisterTunnelTool registers the tunnel MCP tool with the server.

func RegisterWalkthroughTool added in v0.13.24

func RegisterWalkthroughTool(server *mcp.Server, dt *DaemonTools)

RegisterWalkthroughTool registers the walkthrough MCP tool. Requires daemon mode (dt non-nil); all actions are driven through the proxy exec path against the chrome-frame walkthrough host.

func ScanForHints added in v0.12.44

func ScanForHints(js string) []string

ScanForHints scans js for raw DOM patterns that duplicate __devtool helpers. Returns a slice of advisory hint messages; empty slice means no hints.

Types

type APIAuditInput added in v0.13.20

type APIAuditInput struct {
	ProxyID string `json:"proxy_id,omitempty" jsonschema:"Proxy ID to run audit on (preferred)"`
	ID      string `json:"id,omitempty" jsonschema:"Alias for proxy_id"`
	Target  string `` /* 167-byte string literal not displayed */
	FrameID string `` /* 127-byte string literal not displayed */
	Raw     bool   `json:"raw,omitempty" jsonschema:"Return full JSON instead of compact text"`
}

APIAuditInput defines input for the api_audit tool.

type APIAuditOutput added in v0.13.20

type APIAuditOutput struct {
	Summary string `json:"summary"`
	Raw     any    `json:"raw,omitempty"`
}

APIAuditOutput defines output for the api_audit tool.

type APICategory

type APICategory struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

APICategory describes a category of functions.

type APIFunction

type APIFunction struct {
	Name        string   `json:"name"`
	Category    string   `json:"category"`
	Description string   `json:"description"`
	Signature   string   `json:"signature"`
	Parameters  []string `json:"parameters,omitempty"`
	Returns     string   `json:"returns"`
	Example     string   `json:"example"`
}

APIFunction describes a single function in the __devtool API.

type APISearchMatch added in v0.12.44

type APISearchMatch struct {
	Name        string `json:"name"`
	Signature   string `json:"signature"`
	Category    string `json:"category"`
	Description string `json:"description"`
}

APISearchMatch is a compact entry returned by SearchAPIFunctions — just enough for the caller to decide which function to describe next without blowing the response budget on full parameter lists and examples.

type APISearchResult added in v0.12.44

type APISearchResult struct {
	Matches   []APISearchMatch `json:"matches"`
	Count     int              `json:"count"`
	Truncated bool             `json:"truncated"`
}

APISearchResult is the response shape for the proxy exec search action.

func SearchAPIFunctions added in v0.12.44

func SearchAPIFunctions(query, category string) APISearchResult

SearchAPIFunctions filters DevToolAPIFunctions by a case-insensitive substring query across name, description, and signature, with an optional category filter (exact, case-insensitive). Results are ranked by match tier (exact > prefix > substring-in-name > substring-elsewhere) then alphabetically by name, and capped at maxAPISearchResults. An empty query with a category returns everything in that category (still capped). Returns an empty Matches slice (not nil) when nothing matches.

type AutomationEntry added in v0.11.1

type AutomationEntry struct {
	ID       string `json:"id"`
	State    string `json:"state"`
	URL      string `json:"url,omitempty"`
	Headless bool   `json:"headless"`
	ProxyURL string `json:"proxy_url,omitempty"`
	Path     string `json:"path,omitempty"`
	Error    string `json:"error,omitempty"`
}

AutomationEntry represents an automation session in a list response.

type AutomationInput added in v0.11.1

type AutomationInput struct {
	Action    string  `json:"action" jsonschema:"Action: start, stop, status, list, screenshot, navigate, evaluate"`
	ID        string  `json:"id,omitempty" jsonschema:"Session ID (optional for start, required for stop/status)"`
	URL       string  `json:"url,omitempty" jsonschema:"URL to open (for start/navigate actions)"`
	ProxyID   string  `json:"proxy_id,omitempty" jsonschema:"Proxy to route through (for start action)"`
	Headless  *bool   `json:"headless,omitempty" jsonschema:"Run in headless mode (default: true)"`
	Global    bool    `json:"global,omitempty" jsonschema:"For list: include sessions from all directories"`
	Type      string  `json:"type,omitempty" jsonschema:"Screenshot type: viewport, fullpage, element, clip"`
	Label     string  `json:"label,omitempty" jsonschema:"Label for screenshot filename"`
	Selector  string  `json:"selector,omitempty" jsonschema:"CSS selector for element screenshot"`
	Viewport  string  `json:"viewport,omitempty" jsonschema:"Viewport preset: desktop, mobile, tablet"`
	X         float64 `json:"x,omitempty" jsonschema:"Clip X coordinate"`
	Y         float64 `json:"y,omitempty" jsonschema:"Clip Y coordinate"`
	Width     float64 `json:"width,omitempty" jsonschema:"Clip width"`
	Height    float64 `json:"height,omitempty" jsonschema:"Clip height"`
	Script    string  `json:"script,omitempty" jsonschema:"JavaScript to evaluate"`
	SessionID string  `json:"session_id,omitempty" jsonschema:"Session ID for screenshot/navigate/evaluate"`
}

AutomationInput represents input for the automation tool.

type AutomationOutput added in v0.11.1

type AutomationOutput struct {
	ID        string            `json:"id,omitempty"`
	State     string            `json:"state,omitempty"`
	URL       string            `json:"url,omitempty"`
	Headless  bool              `json:"headless,omitempty"`
	ProxyURL  string            `json:"proxy_url,omitempty"`
	Path      string            `json:"path,omitempty"`
	StartedAt string            `json:"started_at,omitempty"`
	Error     string            `json:"error,omitempty"`
	Success   bool              `json:"success,omitempty"`
	Message   string            `json:"message,omitempty"`
	Count     int               `json:"count"`
	Sessions  []AutomationEntry `json:"sessions,omitempty"`
	// Screenshot fields
	ScreenshotPath string `json:"screenshot_path,omitempty"`
	Filename       string `json:"filename,omitempty"`
	ScreenWidth    int64  `json:"screen_width,omitempty"`
	ScreenHeight   int64  `json:"screen_height,omitempty"`
	ViewportName   string `json:"viewport_name,omitempty"`
	Timestamp      string `json:"timestamp,omitempty"`
	// Evaluate fields
	Result interface{} `json:"result,omitempty"`
}

AutomationOutput represents output from the automation tool.

type BrowserEntry added in v0.11.1

type BrowserEntry struct {
	ID       string `json:"id"`
	State    string `json:"state"`
	PID      int    `json:"pid,omitempty"`
	URL      string `json:"url,omitempty"`
	Headless bool   `json:"headless"`
	ProxyURL string `json:"proxy_url,omitempty"`
	Path     string `json:"path,omitempty"`
	Error    string `json:"error,omitempty"`
}

BrowserEntry represents a browser in a list response.

type BrowserInput added in v0.11.1

type BrowserInput struct {
	Action     string `json:"action" jsonschema:"Action: start, stop, status, list"`
	ID         string `json:"id,omitempty" jsonschema:"Browser ID (optional for start, required for stop/status)"`
	URL        string `json:"url,omitempty" jsonschema:"URL to open (required for start unless proxy_id is provided)"`
	ProxyID    string `json:"proxy_id,omitempty" jsonschema:"Proxy to use - auto-starts proxy if not found and URL is provided"`
	Headless   *bool  `json:"headless,omitempty" jsonschema:"Run in headless mode (default: true)"`
	BinaryPath string `json:"binary_path,omitempty" jsonschema:"Optional path to Chrome binary (auto-detected if empty)"`
	Global     bool   `json:"global,omitempty" jsonschema:"For list: include browsers from all directories (default: false)"`
}

BrowserInput represents input for the browser tool.

type BrowserOutput added in v0.11.1

type BrowserOutput struct {
	ID           string         `json:"id,omitempty"`
	State        string         `json:"state,omitempty"`
	PID          int            `json:"pid,omitempty"`
	URL          string         `json:"url,omitempty"`
	Headless     bool           `json:"headless,omitempty"`
	ProxyStarted bool           `json:"proxy_started,omitempty"` // True if proxy was auto-started
	ProxyURL     string         `json:"proxy_url,omitempty"`
	BinaryPath   string         `json:"binary_path,omitempty"`
	Path         string         `json:"path,omitempty"`
	StartedAt    string         `json:"started_at,omitempty"`
	Error        string         `json:"error,omitempty"`
	Success      bool           `json:"success,omitempty"`
	Message      string         `json:"message,omitempty"`
	Count        int            `json:"count"`
	Browsers     []BrowserEntry `json:"browsers,omitempty"`
}

BrowserOutput represents output from the browser tool.

type BuildError added in v0.13.5

type BuildError = classify.BuildError

BuildError aliases the classify type. The parser bank (tsc / eslint / vite / webpack / go / rust / pytest / jest / gotest) lives in internal/classify — the single source of truth shared with the overlay AlertScanner. Only the agent-facing compact renderer (formatBuildErrorCompact) is tools-specific and stays here.

type ChannelReplyInput added in v0.12.44

type ChannelReplyInput struct {
	Content  string `json:"content" jsonschema:"Message body to send to the developer (markdown OK)"`
	ProxyID  string `json:"proxy_id,omitempty" jsonschema:"Target a specific proxy (preferred); omit to fan out to all active proxies"`
	ID       string `json:"id,omitempty" jsonschema:"Alias for proxy_id"`
	Severity string `json:"severity,omitempty" jsonschema:"Toast styling: one of info, success, warning, error (default: info)"`
	Title    string `json:"title,omitempty" jsonschema:"Toast title"`
}

ChannelReplyInput is the input for the channel_reply tool.

type ChannelReplyOutput added in v0.12.44

type ChannelReplyOutput struct {
	Delivered int    `json:"delivered"`
	Message   string `json:"message"`
}

ChannelReplyOutput is the output for the channel_reply tool.

type ChannelSessionHandle added in v0.12.44

type ChannelSessionHandle struct {
	// contains filtered or unexported fields
}

ChannelSessionHandle manages the lifecycle of a daemon session registered by agnt mcp in channel mode. Call Close to unregister the session and stop the heartbeat. The handle owns the heartbeat goroutine's cancel function so Close() signals the goroutine via context cancellation — no shared stop-channel field on DaemonTools, no Close-vs-Init race.

func (*ChannelSessionHandle) Close added in v0.12.44

func (h *ChannelSessionHandle) Close()

Close unregisters the channel session from the daemon and stops the heartbeat goroutine. stopOnce guarantees the ctx cancel + daemon unregister pair fire exactly once, even under concurrent Close calls.

type ChannelSink added in v0.12.44

type ChannelSink struct {
	// contains filtered or unexported fields
}

ChannelSink bridges daemon StreamSink events to MCP channel notifications. It extracts message/severity/location from LogEntry union types, sanitizes meta keys, deduplicates within a configurable window, and filters by severity.

func NewChannelSink added in v0.12.44

func NewChannelSink(cfg *config.ChannelConfig, notify NotifyFunc) *ChannelSink

NewChannelSink creates a channel sink with the given config and notify function.

func (*ChannelSink) HandleEntry added in v0.12.44

func (s *ChannelSink) HandleEntry(ctx context.Context, entry proxy.LogEntry)

HandleEntry processes a single LogEntry and emits a channel notification if it passes severity filtering and deduplication.

func (*ChannelSink) SetNowFunc added in v0.12.44

func (s *ChannelSink) SetNowFunc(fn func() time.Time)

SetNowFunc overrides the clock function (for tests).

type ChaosConfigInput

type ChaosConfigInput struct {
	Enabled     bool             `json:"enabled"`
	Rules       []ChaosRuleInput `json:"rules,omitempty"`
	GlobalOdds  float64          `json:"global_odds,omitempty"`  // 0.0-1.0
	Seed        int64            `json:"seed,omitempty"`         // For reproducible chaos
	LoggingMode int              `json:"logging_mode,omitempty"` // 0=silent, 1=testing, 2=coordinated
}

ChaosConfigInput defines input for full chaos configuration.

type ChaosRuleInput

type ChaosRuleInput struct {
	ID          string   `json:"id"`
	Name        string   `json:"name,omitempty"`
	Type        string   `json:"type"` // latency, out_of_order, slow_drip, disconnect, http_error, truncate, etc.
	Enabled     bool     `json:"enabled"`
	URLPattern  string   `json:"url_pattern,omitempty"`
	Methods     []string `json:"methods,omitempty"`
	Probability float64  `json:"probability,omitempty"` // 0.0-1.0, default 1.0

	// Latency config
	MinLatencyMs int `json:"min_latency_ms,omitempty"`
	MaxLatencyMs int `json:"max_latency_ms,omitempty"`
	JitterMs     int `json:"jitter_ms,omitempty"`

	// Slow-drip config
	BytesPerMs int `json:"bytes_per_ms,omitempty"`
	ChunkSize  int `json:"chunk_size,omitempty"`

	// Connection drop config
	DropAfterPercent float64 `json:"drop_after_percent,omitempty"`
	DropAfterBytes   int64   `json:"drop_after_bytes,omitempty"`

	// Error injection config
	ErrorCodes   []int  `json:"error_codes,omitempty"`
	ErrorMessage string `json:"error_message,omitempty"`

	// Truncation config
	TruncatePercent float64 `json:"truncate_percent,omitempty"`

	// Out-of-order config
	ReorderMinRequests int `json:"reorder_min_requests,omitempty"`
	ReorderMaxWaitMs   int `json:"reorder_max_wait_ms,omitempty"`

	// Stale config
	StaleDelayMs int64 `json:"stale_delay_ms,omitempty"`
}

ChaosRuleInput defines input for a single chaos rule.

type ChaosRuleOutput

type ChaosRuleOutput struct {
	ID           string   `json:"id"`
	Name         string   `json:"name,omitempty"`
	Type         string   `json:"type"`
	Enabled      bool     `json:"enabled"`
	URLPattern   string   `json:"url_pattern,omitempty"`
	Methods      []string `json:"methods,omitempty"`
	Probability  float64  `json:"probability"`
	TimesApplied int64    `json:"times_applied"`
}

ChaosRuleOutput represents a chaos rule in the output.

type ChaosStatsOutput

type ChaosStatsOutput struct {
	TotalRequests   int64            `json:"total_requests"`
	AffectedCount   int64            `json:"affected_count"`
	LatencyInjected int64            `json:"latency_injected_ms"`
	ErrorsInjected  int64            `json:"errors_injected"`
	DropsInjected   int64            `json:"drops_injected"`
	TruncatedCount  int64            `json:"truncated_count"`
	ReorderedCount  int64            `json:"reordered_count"`
	RuleStats       map[string]int64 `json:"rule_stats,omitempty"`
}

ChaosStatsOutput holds chaos engine statistics.

type CompactError added in v0.7.12

type CompactError struct {
	Message      string `json:"message"`
	Type         string `json:"type,omitempty"`
	URL          string `json:"url,omitempty"`
	Location     string `json:"location,omitempty"`      // "file.js:123:45" format
	StackPreview string `json:"stack_preview,omitempty"` // First 3 lines of stack trace
	Timestamp    string `json:"timestamp,omitempty"`
}

CompactError represents a frontend error with truncated verbose fields. Used when detail: ["errors"] is specified to avoid token overflow.

type CompactHTTPRequest added in v0.7.12

type CompactHTTPRequest struct {
	Method     string    `json:"method"`
	URL        string    `json:"url"`
	StatusCode int       `json:"status_code"`
	Duration   int64     `json:"duration_ms"`
	Timestamp  time.Time `json:"timestamp,omitempty"`
	Error      string    `json:"error,omitempty"`
}

CompactHTTPRequest represents a compact HTTP request/response.

type CompactInteraction added in v0.7.12

type CompactInteraction struct {
	Type      string    `json:"type"`
	Target    string    `json:"target,omitempty"` // CSS selector or element description
	Timestamp time.Time `json:"timestamp,omitempty"`
}

CompactInteraction represents a compact user interaction.

type CompactLogEntry added in v0.7.12

type CompactLogEntry struct {
	Type      string    `json:"type"`
	Message   string    `json:"message,omitempty"`
	Timestamp time.Time `json:"timestamp,omitempty"`
}

CompactLogEntry represents a compact log entry for other types.

type CompactMutation added in v0.7.12

type CompactMutation struct {
	Type      string    `json:"type"` // added, removed, modified
	Target    string    `json:"target,omitempty"`
	Count     int       `json:"count,omitempty"` // Number of nodes affected
	Timestamp time.Time `json:"timestamp,omitempty"`
}

CompactMutation represents a compact DOM mutation.

type CompactPerformance added in v0.7.12

type CompactPerformance struct {
	URL              string    `json:"url"`
	LoadTimeMs       int64     `json:"load_time_ms"`
	FirstPaintMs     int64     `json:"first_paint_ms,omitempty"`
	DOMContentLoaded int64     `json:"dom_content_loaded_ms,omitempty"`
	Timestamp        time.Time `json:"timestamp,omitempty"`
}

CompactPerformance represents compact performance metrics.

type CurrentPageInput

type CurrentPageInput struct {
	ProxyID   string   `json:"proxy_id,omitempty" jsonschema:"Proxy ID to query pages from (preferred)"`
	ID        string   `json:"id,omitempty" jsonschema:"Alias for proxy_id"`
	Action    string   `` /* 333-byte string literal not displayed */
	SessionID string   `json:"session_id,omitempty" jsonschema:"Specific session ID (required for get/summary action)"`
	Detail    []string `` /* 130-byte string literal not displayed */
	Limit     int      `json:"limit,omitempty" jsonschema:"For summary: max items per detailed section (default: 5, max: 100)"`
	Raw       bool     `json:"raw,omitempty" jsonschema:"For get: return full arrays with all details instead of compact format (default: false)"`
}

CurrentPageInput defines input for the currentpage tool.

type CurrentPageOutput

type CurrentPageOutput struct {
	// For list
	Sessions []PageSessionOutput `json:"sessions,omitempty"`
	Count    int                 `json:"count"`
	Hint     string              `json:"hint,omitempty"`

	// For get
	Session *PageSessionOutput `json:"session,omitempty"`

	// For summary
	Summary *PageSummaryOutput `json:"summary,omitempty"`

	// For triage
	Triage *PageTriageOutput `json:"triage,omitempty"`

	// For layout
	Layout *PageLayoutOutput `json:"layout,omitempty"`

	// For clear
	Success bool   `json:"success,omitempty"`
	Message string `json:"message,omitempty"`
}

CurrentPageOutput defines output for currentpage tool.

type DaemonInput

type DaemonInput struct {
	Action string `json:"action" jsonschema:"Action: status, info, start, stop, restart, stop_all, restart_all, startup_log, doctor"`
	Global bool   `` /* 143-byte string literal not displayed */
}

DaemonInput defines input for the daemon management tool.

type DaemonOutput

type DaemonOutput struct {
	// For status
	Running    bool   `json:"running"`
	SocketPath string `json:"socket_path,omitempty"`

	// For info
	Version     string       `json:"version,omitempty"`
	Uptime      string       `json:"uptime,omitempty"`
	ClientCount int64        `json:"client_count,omitempty"`
	ProcessInfo *ProcessInfo `json:"process_info,omitempty"`
	ProxyInfo   *ProxyInfo   `json:"proxy_info,omitempty"`

	// For stop_all/restart_all
	ProcessesStopped int `json:"processes_stopped,omitempty"`
	ProxiesStopped   int `json:"proxies_stopped,omitempty"`
	ProcessesStarted int `json:"processes_started,omitempty"`
	ProxiesStarted   int `json:"proxies_started,omitempty"`
	ProcessesFailed  int `json:"processes_failed,omitempty"`
	ProxiesFailed    int `json:"proxies_failed,omitempty"`

	// For all actions
	Success bool   `json:"success,omitempty"`
	Message string `json:"message,omitempty"`
}

DaemonOutput defines output for daemon management.

type DaemonTools

type DaemonTools struct {
	// contains filtered or unexported fields
}

DaemonTools wraps a daemon client for MCP tool handlers.

func NewDaemonTools

func NewDaemonTools(config daemon.AutoStartConfig, version string) *DaemonTools

NewDaemonTools creates a new daemon tools wrapper with auto-start and version checking. The version parameter should be the current binary version (e.g., "0.6.5").

func (*DaemonTools) ChannelSessionCode added in v0.12.44

func (dt *DaemonTools) ChannelSessionCode() string

ChannelSessionCode returns the session code for the active channel session, or empty string if none is registered.

func (*DaemonTools) Close

func (dt *DaemonTools) Close() error

Close closes the daemon client connection.

func (*DaemonTools) RegisterChannelSession added in v0.12.44

func (dt *DaemonTools) RegisterChannelSession(ctx context.Context, cfg *config.ChannelConfig, projectPath string) *ChannelSessionHandle

RegisterChannelSession registers a daemon session for the MCP process when running in channel mode. In channel mode there is no PTY child, so SessionPGID is 0 (pgid cleanup is a no-op; managed processes still clean up normally via the daemon's ProcessManager). Returns a handle that must be closed on shutdown to unregister the session and stop the heartbeat. Returns nil if channel mode is disabled.

func (*DaemonTools) RunAutostart added in v0.12.44

func (dt *DaemonTools) RunAutostart(projectDir string) (map[string]interface{}, error)

RunAutostart triggers a non-interactive autostart for the given project directory via the daemon. Used by the MCP InitializedHandler in channel mode. Returns the raw autostart result map from the daemon.

func (*DaemonTools) SessionCode added in v0.7.12

func (dt *DaemonTools) SessionCode() string

SessionCode returns the current attached session code.

func (*DaemonTools) SetNoAutoAttach added in v0.7.12

func (dt *DaemonTools) SetNoAutoAttach(noAttach bool)

SetNoAutoAttach disables automatic session attachment on connect. Call this before any tool calls if you want to operate globally.

func (*DaemonTools) SetSessionCode added in v0.7.12

func (dt *DaemonTools) SetSessionCode(code string)

SetSessionCode sets the session code directly (useful for testing or explicit attachment).

func (*DaemonTools) StartChannelSink added in v0.12.44

func (dt *DaemonTools) StartChannelSink(server *mcp.Server, cfg *config.ChannelConfig, projectPath string) context.CancelFunc

StartChannelSink starts a goroutine that subscribes to daemon StreamEvents and forwards matching entries as MCP channel notifications. Returns a cancel function to stop the sink. No-op and returns nil if channel is not enabled. projectPath scopes the subscription to proxies for that project directory; pass "" to receive events from all proxies (legacy behavior).

func (*DaemonTools) StartIncidentDigestSink added in v0.13.16

func (dt *DaemonTools) StartIncidentDigestSink(server *mcp.Server) context.CancelFunc

StartIncidentDigestSink subscribes a always-on goroutine to the daemon event stream filtered to incident_digest entries and forwards each as an MCP Log notification to all connected sessions. Unlike the channel sink, this is not gated on channel mode: it is the universal push path that surfaces the unified inbox's periodic digest to the agent. Returns a cancel function to stop it.

type DetectInput

type DetectInput struct {
	Path string `json:"path,omitempty" jsonschema:"Directory path (defaults to current dir)"`
	Raw  bool   `json:"raw,omitempty" jsonschema:"Return structured JSON only, skip the compact text rendering"`
}

DetectInput defines input for the detect tool.

type DetectOutput

type DetectOutput struct {
	Type           string            `json:"type"`
	Name           string            `json:"name"`
	Framework      string            `json:"framework,omitempty"`
	Scripts        []DetectScript    `json:"scripts"`
	ScriptNames    []string          `json:"script_names"`
	PackageManager string            `json:"package_manager,omitempty"`
	Metadata       map[string]string `json:"metadata,omitempty"`
	Summary        string            `json:"summary,omitempty"`
}

DetectOutput defines output for detect.

`Scripts` is the new structured form; `ScriptNames` is kept as a plain string list for backward compatibility with callers that just wanted names.

type DetectScript added in v0.13.5

type DetectScript struct {
	Name          string   `json:"name"`
	Command       string   `json:"command"`
	ProcRun       string   `json:"proc_run"`
	ProcWait      string   `json:"proc_wait"`
	LikelySignals []string `json:"likely_signals"`
}

DetectScript is a single script in DetectOutput, augmented with ready-to-use `proc run` / `proc wait` invocations and signal hints so agents don't have to hand-construct them.

type ErrorQueueInput added in v0.13.9

type ErrorQueueInput struct {
	Message     string `json:"message" jsonschema:"Error or failure text to add to the queue"`
	Source      string `json:"source,omitempty" jsonschema:"Source identifier, e.g. github-actions, buildkite, deploy, ci"`
	Severity    string `json:"severity,omitempty" jsonschema:"Severity: one of error, warning, info (default: error)"`
	Category    string `json:"category,omitempty" jsonschema:"Category for grouping (default: external)"`
	Description string `json:"description,omitempty" jsonschema:"Short description shown in get_errors"`
	ProjectPath string `json:"project_path,omitempty" jsonschema:"Project path for get_errors filtering (default: current directory)"`
}

type ErrorQueueOutput added in v0.13.9

type ErrorQueueOutput struct {
	Queued      bool   `json:"queued"`
	Source      string `json:"source"`
	Severity    string `json:"severity"`
	ProjectPath string `json:"project_path"`
}

type ErrorSummary added in v0.7.0

type ErrorSummary struct {
	Message string `json:"message"`
	Type    string `json:"type,omitempty"`
	Count   int    `json:"count"`
}

ErrorSummary represents a deduplicated error with occurrence count.

type FrameworkDiagnostic added in v0.13.28

type FrameworkDiagnostic struct {
	Category  string `json:"category"`            // e.g. "hydration-mismatch"
	Framework string `json:"framework,omitempty"` // react, next, vue, svelte, solid
	Count     int    `json:"count"`               // occurrences in this session
	Sample    string `json:"sample,omitempty"`    // the matched message (truncated)
	Fix       string `json:"fix"`                 // correct remediation direction
	Avoid     string `json:"avoid,omitempty"`     // the common wrong fix to steer away from
}

FrameworkDiagnostic is a recognized framework runtime message lifted out of the raw error stream and annotated with the correct remediation direction and the common wrong fix to avoid.

The report this serves: agents are "programming with a blindfold on" for front-end bugs because the decisive evidence lives in runtime state, not source — and they reliably pattern-match to plausible-but-wrong fixes (add a dependency to a deps array → infinite loop, suppress hydration warnings, bump z-index, add 'use client' everywhere). When a captured console message carries a known signature, we name the bug class and steer the fix.

type GetErrorsInput added in v0.12.0

type GetErrorsInput struct {
	ProcessID       string `json:"process_id,omitempty" jsonschema:"Filter to specific process"`
	ProxyID         string `json:"proxy_id,omitempty" jsonschema:"Filter to specific proxy (default: all active proxies)"`
	Since           string `json:"since,omitempty" jsonschema:"Override recency filter (RFC3339 or duration like '5m')"`
	IncludeWarnings *bool  `json:"include_warnings,omitempty" jsonschema:"Include warnings (default: true)"`
	Limit           int    `json:"limit,omitempty" jsonschema:"Max errors to return (default: 25)"`
	Raw             bool   `json:"raw,omitempty" jsonschema:"Return full JSON with all fields"`
	Global          bool   `` /* 142-byte string literal not displayed */
}

GetErrorsInput is the input for the get_errors tool.

type GetErrorsOutput added in v0.12.0

type GetErrorsOutput struct {
	ErrorCount   int    `json:"error_count"`
	WarningCount int    `json:"warning_count"`
	Summary      string `json:"summary,omitempty"`
	// CollectionWarnings surfaces per-source query failures so a partial
	// collection is not silently reported as a clean "0 errors". Each entry
	// names the source that failed (alert store, startup log, proxy list, or a
	// specific proxy's log). Empty when every source answered.
	CollectionWarnings []string `` /* 154-byte string literal not displayed */
}

GetErrorsOutput is the output for the get_errors tool.

type GetIncidentsInput added in v0.13.0

type GetIncidentsInput struct {
	Severity     []string `json:"severity,omitempty"      jsonschema:"Filter by severity: critical/error/warning/info (default: all)"`
	Since        string   `json:"since,omitempty"         jsonschema:"Cursor from prior pull (RFC3339 timestamp) or duration like '5m'"`
	Fingerprints []string `json:"fingerprints,omitempty"  jsonschema:"Retrieve specific incident fingerprints"`
	Sources      []string `` /* 195-byte string literal not displayed */
	ProxyID      string   `json:"proxy_id,omitempty"      jsonschema:"Filter to specific proxy"`
	ProcessID    string   `json:"process_id,omitempty"    jsonschema:"Filter to specific process"`
	Detail       string   `json:"detail,omitempty"        jsonschema:"'summary' (default) or 'full' to hydrate full payload from blob store"`
	MarkRead     bool     `json:"mark_read,omitempty"     jsonschema:"Advance cursor and mark returned incidents as read"`
	Limit        int      `json:"limit,omitempty"         jsonschema:"Max incidents to return (default: 20, max: 100)"`
	Raw          bool     `json:"raw,omitempty"           jsonschema:"Return full JSON instead of compact text"`
}

GetIncidentsInput is the input schema for the get_incidents tool.

type GetIncidentsOutput added in v0.13.0

type GetIncidentsOutput struct {
	Incidents  []incidentView `json:"incidents"`
	InboxAfter inboxStats     `json:"inbox_after"`
	Cursor     string         `json:"replay_cursor,omitempty"`
	NextTools  []toolHint     `json:"next_tools,omitempty"`
	NextSkills []string       `json:"next_skills,omitempty"`
	Truncated  bool           `json:"truncated"`
	// PipelineEnabled reports whether the caller's session actually has the
	// incident pipeline wired. False + zero incidents means "pipeline off",
	// not "clean inbox" — distinct states the agent must not conflate.
	PipelineEnabled bool `json:"pipeline_enabled"`
}

GetIncidentsOutput is the output for the get_incidents tool.

type GroupProcessInput added in v0.13.5

type GroupProcessInput struct {
	ID          string            `json:"id" jsonschema:"Process ID (required, unique within the group)"`
	Run         string            `json:"run,omitempty" jsonschema:"Shell command string (mutually exclusive with command)"`
	Command     string            `json:"command,omitempty" jsonschema:"Executable (mutually exclusive with run)"`
	Args        []string          `json:"args,omitempty" jsonschema:"Args appended to command"`
	Cwd         string            `json:"cwd,omitempty" jsonschema:"Working directory (defaults to project path)"`
	Env         map[string]string `json:"env,omitempty" jsonschema:"Extra env vars merged into the process environment"`
	URLMatchers []string          `json:"url_matchers,omitempty" jsonschema:"Custom URL detection patterns"`
	AutoRestart bool              `json:"auto_restart,omitempty" jsonschema:"Restart automatically on crash"`
	DependsOn   []string          `json:"depends_on,omitempty" jsonschema:"Process IDs this process must wait on before launching"`
}

GroupProcessInput defines a single process inside a run_group action.

type GroupProcessResult added in v0.13.5

type GroupProcessResult struct {
	ProcessID  string   `json:"process_id"`
	State      string   `json:"state"` // "starting", "pending", "failed"
	WaitingFor []string `json:"waiting_for,omitempty"`
	Error      string   `json:"error,omitempty"`
}

GroupProcessResult is the per-process outcome reported by a run_group.

type LayoutFinding added in v0.13.28

type LayoutFinding struct {
	Check         string `json:"check"`
	Severity      string `json:"severity"`
	Selector      string `json:"selector"`
	Cause         string `json:"cause,omitempty"`
	CauseProperty string `json:"cause_property,omitempty"`
	Detail        string `json:"detail,omitempty"`
	Fix           string `json:"fix,omitempty"`
	Avoid         string `json:"avoid,omitempty"`
}

LayoutFinding is one cause→symptom layout diagnostic from the browser's __devtool.diagnoseLayoutIssues(): the symptom (selector), the offending ancestor (cause), and the correct fix plus the common wrong fix to avoid.

type LoadingAuditInput added in v0.13.20

type LoadingAuditInput struct {
	ProxyID string `json:"proxy_id,omitempty" jsonschema:"Proxy ID to run audit on (preferred)"`
	ID      string `json:"id,omitempty" jsonschema:"Alias for proxy_id"`
	Target  string `` /* 167-byte string literal not displayed */
	FrameID string `` /* 127-byte string literal not displayed */
	Raw     bool   `json:"raw,omitempty" jsonschema:"Return full JSON instead of compact text"`
}

LoadingAuditInput defines input for the loading_audit tool.

type LoadingAuditOutput added in v0.13.20

type LoadingAuditOutput struct {
	Summary string `json:"summary"`
	Raw     any    `json:"raw,omitempty"`
}

LoadingAuditOutput defines output for the loading_audit tool.

type LogEntryOutput

type LogEntryOutput struct {
	Type      string    `json:"type"`
	Timestamp time.Time `json:"timestamp"`
	Data      string    `json:"data"`
}

LogEntryOutput represents a log entry in the output.

type LogStatsOutput

type LogStatsOutput struct {
	TotalEntries     int64 `json:"total_entries"`
	AvailableEntries int64 `json:"available_entries"`
	MaxSize          int64 `json:"max_size"`
	Dropped          int64 `json:"dropped"`
}

LogStatsOutput holds logger statistics.

type NotifyFunc added in v0.12.44

type NotifyFunc func(ctx context.Context, method string, params any) error

NotifyFunc sends a notification with the given method and params. In production this wraps ServerSession.Notify; in tests it captures calls.

type PageLayoutOutput added in v0.13.28

type PageLayoutOutput struct {
	Findings []LayoutFinding `json:"findings,omitempty"`
	Count    int             `json:"count"`
	Scanned  int             `json:"scanned"`
	Capped   bool            `json:"capped,omitempty"`
	ByCheck  map[string]int  `json:"by_check,omitempty"`
	Hint     string          `json:"hint,omitempty"`
}

PageLayoutOutput is the currentpage action:"layout" result — a live CSS/layout diagnosis of the open page (stacking/containing-block/clip/click traps).

type PageSessionOutput

type PageSessionOutput struct {
	ID             string                   `json:"id"`
	URL            string                   `json:"url"`
	PageTitle      string                   `json:"page_title,omitempty"`
	StartTime      time.Time                `json:"start_time"`
	LastActivity   time.Time                `json:"last_activity"`
	Active         bool                     `json:"active"`
	ResourceCount  int                      `json:"resource_count"`
	ErrorCount     int                      `json:"error_count"`
	HasPerformance bool                     `json:"has_performance"`
	LoadTime       int64                    `json:"load_time_ms,omitempty"`
	Resources      []string                 `json:"resources,omitempty"` // URLs of resources
	Errors         []map[string]interface{} `json:"errors,omitempty"`

	// Interaction tracking
	InteractionCount int                      `json:"interaction_count"`
	Interactions     []map[string]interface{} `json:"interactions,omitempty"` // Detailed view only

	// Mutation tracking
	MutationCount int                      `json:"mutation_count"`
	Mutations     []map[string]interface{} `json:"mutations,omitempty"` // Detailed view only
}

PageSessionOutput represents a page session in the output.

func (PageSessionOutput) MarshalJSON

func (o PageSessionOutput) MarshalJSON() ([]byte, error)

type PageSummaryOutput added in v0.7.0

type PageSummaryOutput struct {
	ID           string    `json:"id"`
	URL          string    `json:"url"`
	PageTitle    string    `json:"page_title,omitempty"`
	StartTime    time.Time `json:"start_time"`
	LastActivity time.Time `json:"last_activity"`
	Active       bool      `json:"active"`

	// Resource summary
	ResourceCount    int            `json:"resource_count"`
	ResourcesByType  map[string]int `json:"resources_by_type,omitempty"` // e.g., {"js": 5, "css": 3, "img": 10}
	TotalPayloadSize int64          `json:"total_payload_size,omitempty"`
	Resources        []string       `json:"resources,omitempty"` // Full list when detail=["resources"]

	// Error summary
	ErrorCount   int            `json:"error_count"`
	UniqueErrors []ErrorSummary `json:"unique_errors,omitempty"`  // Deduplicated errors with counts
	ErrorsByType map[string]int `json:"errors_by_type,omitempty"` // e.g., {"ReferenceError": 3}
	Errors       []CompactError `json:"errors,omitempty"`         // Compact error list when detail=["errors"]

	// Performance
	LoadTimeMs       int64 `json:"load_time_ms,omitempty"`
	FirstPaintMs     int64 `json:"first_paint_ms,omitempty"`
	DOMContentLoaded int64 `json:"dom_content_loaded_ms,omitempty"`

	// Interaction summary
	InteractionCount   int                      `json:"interaction_count"`
	InteractionsByType map[string]int           `json:"interactions_by_type,omitempty"` // e.g., {"click": 5, "scroll": 10}
	RecentInteractions []map[string]interface{} `json:"recent_interactions,omitempty"`  // Last N (default 5)
	Interactions       []map[string]interface{} `json:"interactions,omitempty"`         // Full list when detail=["interactions"]

	// Mutation summary
	MutationCount   int                      `json:"mutation_count"`
	MutationsByType map[string]int           `json:"mutations_by_type,omitempty"` // e.g., {"added": 10, "modified": 5}
	RecentMutations []map[string]interface{} `json:"recent_mutations,omitempty"`  // Last N (default 5)
	Mutations       []map[string]interface{} `json:"mutations,omitempty"`         // Full list when detail=["mutations"]

	// Page dimensions (if available from client)
	PageHeight     int `json:"page_height,omitempty"`
	PageWidth      int `json:"page_width,omitempty"`
	ViewportHeight int `json:"viewport_height,omitempty"`
	ViewportWidth  int `json:"viewport_width,omitempty"`

	// Detail info
	DetailSections []string `json:"detail_sections,omitempty"` // Which sections have full detail
	DetailLimit    int      `json:"detail_limit,omitempty"`    // Limit applied to detailed sections
}

PageSummaryOutput provides a compact summary of a large page without blowing context.

type PageTriageOutput added in v0.13.28

type PageTriageOutput struct {
	ID         string `json:"id"`
	URL        string `json:"url"`
	PageTitle  string `json:"page_title,omitempty"`
	Active     bool   `json:"active"`
	LoadTimeMs int64  `json:"load_time_ms,omitempty"`

	ErrorCount int            `json:"error_count"`
	TopErrors  []ErrorSummary `json:"top_errors,omitempty"`

	// FrameworkDiagnostics lifts recognized React/Next/Vue/Svelte/Solid runtime
	// messages out of the raw error stream and names the bug class with the
	// correct fix — the runtime-only signals an agent is otherwise blind to.
	FrameworkDiagnostics []FrameworkDiagnostic `json:"framework_diagnostics,omitempty"`

	InteractionCount int            `json:"interaction_count"`
	LastActions      []TriageAction `json:"last_actions,omitempty"`

	MutationCount   int            `json:"mutation_count"`
	MutationsByType map[string]int `json:"mutations_by_type,omitempty"`

	ResourceCount   int              `json:"resource_count"`
	FailedResources []TriageResource `json:"failed_resources,omitempty"`

	Performance *TriagePerf `json:"performance,omitempty"`

	// AfterLastAction correlates signals that occurred after the most recent
	// interaction — the "did my click break something" surface.
	AfterLastAction *TriageConsequence `json:"after_last_action,omitempty"`

	NextTools []string `json:"next_tools,omitempty"`
	Hint      string   `json:"hint,omitempty"`
}

PageTriageOutput is the at-a-glance triage view of a single page session: the top few signals across every category, plus a correlation of what happened AFTER the user's last action. It answers "the thing I just did on this screen isn't working — what's going on?" in one call, then points at the deeper tools for remediation.

type Pagination added in v0.12.9

type Pagination struct {
	Count          int  `json:"count"`
	TotalAvailable int  `json:"total_available"`
	Limit          int  `json:"limit"`
	Filtered       bool `json:"filtered,omitempty"`
}

Pagination provides context for list/query results. Count, TotalAvailable, and Limit never use omitempty so zero values are visible.

func NewPagination added in v0.12.9

func NewPagination(count, totalAvailable, limit int, filtered bool) Pagination

NewPagination creates a Pagination with all fields set.

type ProcEntry

type ProcEntry struct {
	ID          string `json:"id"`
	Command     string `json:"command"`
	State       string `json:"state"`
	Summary     string `json:"summary"`
	Runtime     string `json:"runtime"`
	ProjectPath string `json:"project_path,omitempty"`
	ScriptName  string `json:"script_name,omitempty"`
	// Role classification — what kind of process this is and what it produces.
	Role       string   `json:"role,omitempty"`
	Produces   []string `json:"produces,omitempty"`
	OutputHint string   `json:"output_hint,omitempty"`
	// Last known death record — see ProcOutput for field semantics.
	LastExitAt     string `json:"last_exit_at,omitempty"`
	LastExitCode   *int   `json:"last_exit_code,omitempty"`
	LastExitReason string `json:"last_exit_reason,omitempty"`
	LastUptime     string `json:"last_uptime,omitempty"`
	LastStderrTail string `json:"last_stderr_tail,omitempty"`
	// WaitingFor is populated for processes still gated on declared deps.
	WaitingFor []string `json:"waiting_for,omitempty"`
}

ProcEntry is a process in the list.

type ProcInput

type ProcInput struct {
	Action    string `` /* 175-byte string literal not displayed */
	ProcessID string `` /* 126-byte string literal not displayed */
	// Multi-stream output: when set on action="output", the handler fans
	// out a per-process fetch and returns interleaved (or NDJSON) lines
	// tagged with process_id. Wins over the singular ProcessID.
	ProcessIDs []string `json:"process_ids,omitempty" jsonschema:"For output: list of process IDs to pull from in one call (interleaved output)"`
	// Extract: signal names to scan for in the output ("url","error",
	// "warning","ready","port"). Returned in MultiStream[*].Signals.
	Extract []string `json:"extract,omitempty" jsonschema:"For output: signal names to extract (url, error, warning, ready, port)"`
	// Wait action: signal name(s) to wait on. `Signal` is a single name
	// for back-compat; `Signals` is the multi-name "first wins" form.
	Signal    string   `json:"signal,omitempty" jsonschema:"For wait: signal name to wait on (ready, error, warning, url, port)"`
	Signals   []string `json:"signals,omitempty" jsonschema:"For wait: signal names to wait on — first match wins"`
	TimeoutMs int      `json:"timeout,omitempty" jsonschema:"For wait: max ms to wait (default 30000)"`
	PollMs    int      `json:"poll_ms,omitempty" jsonschema:"For wait: poll interval in ms (default 200)"`
	// Script actions
	ScriptName string `json:"script_name,omitempty" jsonschema:"Script name (required for script_output/script_history)"`
	// Output filters
	Stream string `json:"stream,omitempty" jsonschema:"stdout, stderr, or combined (default)"`
	Tail   int    `json:"tail,omitempty" jsonschema:"Last N lines only"`
	Head   int    `json:"head,omitempty" jsonschema:"First N lines only"`
	Grep   string `json:"grep,omitempty" jsonschema:"Filter lines matching regex pattern"`
	GrepV  bool   `json:"grep_v,omitempty" jsonschema:"Invert grep (exclude matching lines)"`
	// Find options
	What string `` /* 140-byte string literal not displayed */
	// Stop options
	Force bool `json:"force,omitempty" jsonschema:"For stop: force kill immediately"`
	// Cleanup options
	Port int `json:"port,omitempty" jsonschema:"Port number (required for cleanup_port)"`
	// Directory filtering
	Global bool `json:"global,omitempty" jsonschema:"For list: include processes from all directories (default: false)"`
	// Auto-restart options
	AutoRestartEnable bool `json:"auto_restart_enable,omitempty" jsonschema:"For autorestart: enable (true) or disable (false)"`
	MaxRestarts       int  `json:"max_restarts,omitempty" jsonschema:"For autorestart: max restarts per minute (default: 5, 0=unlimited)"`
	OnlyOnError       bool `json:"only_on_error,omitempty" jsonschema:"For autorestart: only restart on non-zero exit code"`
	// Snapshot options
	Raw bool `json:"raw,omitempty" jsonschema:"For snapshot: return structured JSON only, skip the compact text rendering"`

	// run / run_group action fields. The `run` action launches a single
	// admin-aware process (visible in SCRIPT LIST) with optional
	// dependency gating; `run_group` launches multiple processes with
	// declared deps in topologically sorted order.
	ID               string              `` /* 151-byte string literal not displayed */
	Run              string              `json:"run,omitempty" jsonschema:"For run: shell command string (mutually exclusive with command)"`
	Command          string              `json:"command,omitempty" jsonschema:"For run: executable (mutually exclusive with run)"`
	Args             []string            `json:"args,omitempty" jsonschema:"For run: command args"`
	Cwd              string              `json:"cwd,omitempty" jsonschema:"For run: working directory"`
	Env              map[string]string   `json:"env,omitempty" jsonschema:"For run: env vars merged into the process"`
	URLMatchers      []string            `json:"url_matchers,omitempty" jsonschema:"For run: custom URL detection patterns"`
	AutoRestart      bool                `json:"auto_restart,omitempty" jsonschema:"For run: restart on crash"`
	Path             string              `json:"path,omitempty" jsonschema:"For run/run_group: project directory (defaults to cwd)"`
	DependsOn        []string            `json:"depends_on,omitempty" jsonschema:"For run: process IDs this process must wait on before launching"`
	DependsOnTimeout int                 `` /* 132-byte string literal not displayed */
	Processes        []GroupProcessInput `json:"processes,omitempty" jsonschema:"For run_group: list of processes to launch with topo-sorted dep ordering"`
}

ProcInput defines input for the proc tool.

type ProcOutput

type ProcOutput struct {
	// For status
	ProcessID string `json:"process_id,omitempty"`
	State     string `json:"state,omitempty"`
	Summary   string `json:"summary,omitempty"`
	ExitCode  int    `json:"exit_code,omitempty"`
	Runtime   string `json:"runtime,omitempty"`
	// Role classification — what kind of process this is and what it produces.
	// Role values: "build-watch", "dev-server", "test-runner", "script", "unknown"
	// Produces values: "build-output", "test-results", "logs", "hot-reload"
	Role       string   `json:"role,omitempty"`
	Produces   []string `json:"produces,omitempty"`
	OutputHint string   `json:"output_hint,omitempty"` // advisory: how to query this process output
	// Last known death record — populated when the process has exited
	// (cleanly or via crash/signal) within the retention window. Lets the
	// agent tell "never started" from "started and died at T".
	LastExitAt     string `json:"last_exit_at,omitempty"`
	LastExitCode   *int   `json:"last_exit_code,omitempty"`
	LastExitReason string `json:"last_exit_reason,omitempty"` // "stopped" | "crash" | "signal"
	LastUptime     string `json:"last_uptime,omitempty"`
	LastStderrTail string `json:"last_stderr_tail,omitempty"`
	// For output
	Output    string `json:"output,omitempty"`
	Lines     int    `json:"lines,omitempty"`
	Truncated bool   `json:"truncated,omitempty"`
	// For list
	Count       int         `json:"count"`
	Processes   []ProcEntry `json:"processes,omitempty"`
	ProjectPath string      `json:"project_path,omitempty"`
	SessionCode string      `json:"session_code,omitempty"`
	Global      bool        `json:"global,omitempty"`
	// For stop
	Success bool `json:"success,omitempty"`
	// For cleanup_port
	KilledPIDs []int  `json:"killed_pids,omitempty"`
	Message    string `json:"message,omitempty"`
	// For snapshot — unified dev-environment status. Populated only by
	// proc {action: "snapshot"}; nil for every other action.
	Snapshot *SnapshotData `json:"snapshot,omitempty"`
	// Partial-failure notices from a multi-source collection (currently
	// snapshot). A snapshot assembled while one of its sources errored is
	// incomplete, and a raw consumer that only reads Snapshot would otherwise
	// read the gap as "nothing wrong". Mirrored into Output for text callers.
	Warnings []string `json:"warnings,omitempty"`
	// For multi-stream `proc output` (when process_ids is set) — per-process
	// rows with extracted signals. Each row holds the line slice for that
	// process and an optional signals payload (when `extract` was requested).
	// nil for the single-process variant of `proc output`.
	MultiStream []processStream `json:"multi_stream,omitempty"`
	// For single-stream `proc output` with extract — top-level signals
	// scanned from the fetched output. nil when extract not requested.
	Signals *SignalSet `json:"signals,omitempty"`
	// For `proc wait` — populated when action="wait". nil otherwise.
	Wait *WaitResult `json:"wait,omitempty"`
	// For run / run_group: dependency-gated launch state. WaitingFor lists
	// the unresolved dep names while the process is in pending state.
	WaitingFor    []string             `json:"waiting_for,omitempty"`
	GroupResults  []GroupProcessResult `json:"group_results,omitempty"`
	FailureReason string               `json:"failure_reason,omitempty"` // e.g. "dependency_timeout:db"
}

ProcOutput defines output for proc.

type ProcessInfo

type ProcessInfo struct {
	Active       int64 `json:"active"`
	TotalStarted int64 `json:"total_started"`
	TotalFailed  int64 `json:"total_failed"`
}

ProcessInfo holds process manager statistics.

type ProcessRole added in v0.12.48

type ProcessRole struct {
	Role       string   // "build-watch", "dev-server", "test-runner", "script", "unknown"
	Produces   []string // "build-output", "test-results", "logs", "hot-reload"
	OutputHint string   // advisory message for querying output
}

type ProxyEntry

type ProxyEntry struct {
	ID            string `json:"id"`
	TargetURL     string `json:"target_url"`
	ListenAddr    string `json:"listen_addr"`
	BindAddress   string `json:"bind_address,omitempty"`
	PublicURL     string `json:"public_url,omitempty"`
	Path          string `json:"path,omitempty"`
	Running       bool   `json:"running"`
	Uptime        string `json:"uptime"`
	TotalRequests int64  `json:"total_requests"`
	TunnelURL     string `json:"tunnel_url,omitempty"`
	TunnelRunning bool   `json:"tunnel_running,omitempty"`

	// Readiness-gate fields: populated when the proxy is waiting on
	// declared `wait-for` dependencies. State is
	// "waiting_for_dependencies" while gating, "running" otherwise.
	State     string   `json:"state,omitempty"`
	WaitingOn []string `json:"waiting_on,omitempty"`
}

ProxyEntry represents a proxy in the list.

type ProxyInfo

type ProxyInfo struct {
	Active       int64 `json:"active"`
	TotalStarted int64 `json:"total_started"`
}

ProxyInfo holds proxy manager statistics.

type ProxyInput

type ProxyInput struct {
	Action        string `json:"action" jsonschema:"Action: start, stop, restart, status, list, exec, navigate, resize, toast, chaos"`
	ID            string `json:"id,omitempty" jsonschema:"Proxy ID (required for start/stop/status/exec/toast/chaos)"`
	TargetURL     string `json:"target_url,omitempty" jsonschema:"Target URL to proxy (required for start)"`
	Port          int    `` /* 126-byte string literal not displayed */
	MaxLogSize    int    `json:"max_log_size,omitempty" jsonschema:"Maximum log entries (default: 1000)"`
	BindAddress   string `` /* 150-byte string literal not displayed */
	AllowExternal bool   `` /* 141-byte string literal not displayed */
	PublicURL     string `` /* 159-byte string literal not displayed */
	SkipTLSVerify bool   `` /* 180-byte string literal not displayed */
	Code          string `json:"code,omitempty" jsonschema:"JavaScript code to execute (required for exec)"`
	FrameID       string `` /* 198-byte string literal not displayed */
	Target        string `` /* 288-byte string literal not displayed */
	Direction     string `` /* 142-byte string literal not displayed */
	Width         int    `` /* 237-byte string literal not displayed */
	Height        int    `json:"height,omitempty" jsonschema:"For resize: content-frame viewport height in px (0 = full height)."`
	Global        bool   `json:"global,omitempty" jsonschema:"For list: include proxies from all directories (default: false)"`
	Help          bool   `json:"help,omitempty" jsonschema:"For exec: show __devtool API overview instead of executing code"`
	Describe      string `` /* 140-byte string literal not displayed */
	Search        string `` /* 218-byte string literal not displayed */
	Category      string `` /* 156-byte string literal not displayed */
	Hints         *bool  `` /* 152-byte string literal not displayed */
	ToastType     string `json:"toast_type,omitempty" jsonschema:"For toast: notification type (success, error, warning, info). Default: info"`
	ToastTitle    string `json:"toast_title,omitempty" jsonschema:"For toast: notification title (optional)"`
	ToastMessage  string `json:"toast_message,omitempty" jsonschema:"For toast: notification message (required for toast)"`
	ToastDuration int    `json:"toast_duration,omitempty" jsonschema:"For toast: duration in milliseconds (0 for default)"`
	// Tunnel configuration (for start action)
	Tunnel        string   `` /* 129-byte string literal not displayed */
	TunnelArgs    []string `json:"tunnel_args,omitempty" jsonschema:"Additional arguments for tunnel command"`
	TunnelToken   string   `json:"tunnel_token,omitempty" jsonschema:"Authentication token for tunnel (e.g., ngrok authtoken)"`
	TunnelRegion  string   `json:"tunnel_region,omitempty" jsonschema:"Tunnel region (optional)"`
	TunnelCommand string   `json:"tunnel_command,omitempty" jsonschema:"Custom tunnel command (when tunnel is 'custom'). Use {{PORT}} as placeholder."`

	// Chaos-related fields
	ChaosOperation string            `` /* 142-byte string literal not displayed */
	ChaosPreset    string            `` /* 160-byte string literal not displayed */
	ChaosRules     []ChaosRuleInput  `json:"chaos_rules,omitempty" jsonschema:"For chaos set: array of chaos rules to configure"`
	ChaosRule      *ChaosRuleInput   `json:"chaos_rule,omitempty" jsonschema:"For chaos add_rule: single rule to add"`
	ChaosRuleID    string            `json:"chaos_rule_id,omitempty" jsonschema:"For chaos remove_rule: ID of rule to remove"`
	ChaosConfig    *ChaosConfigInput `json:"chaos_config,omitempty" jsonschema:"For chaos set: full chaos configuration"`
}

ProxyInput defines input for the proxy tool.

type ProxyLogInput

type ProxyLogInput struct {
	ProxyID          string   `json:"proxy_id,omitempty" jsonschema:"Proxy ID to query logs from (preferred)"`
	ID               string   `json:"id,omitempty" jsonschema:"Alias for proxy_id"`
	Action           string   `json:"action,omitempty" jsonschema:"Action: query (default), summary, clear, stats"`
	Types            []string `` /* 180-byte string literal not displayed */
	Methods          []string `json:"methods,omitempty" jsonschema:"HTTP methods to filter (e.g., GET, POST)"`
	URLPattern       string   `json:"url_pattern,omitempty" jsonschema:"URL pattern to match (substring)"`
	StatusCodes      []int    `json:"status_codes,omitempty" jsonschema:"HTTP status codes to filter"`
	Limit            int      `` /* 132-byte string literal not displayed */
	Since            string   `json:"since,omitempty" jsonschema:"Start time filter (RFC3339 or duration like '5m')"`
	Until            string   `json:"until,omitempty" jsonschema:"End time filter (RFC3339)"`
	Raw              bool     `json:"raw,omitempty" jsonschema:"Return full JSON dumps instead of compact format"`
	ErrorsOnly       bool     `json:"errors_only,omitempty" jsonschema:"Filter to errors only (HTTP 4xx/5xx, JS errors, diagnostics)"`
	DiagnosticLevels []string `json:"diagnostic_levels,omitempty" jsonschema:"Diagnostic levels to include: error, warning, info"`
	Detail           []string `` /* 145-byte string literal not displayed */
}

ProxyLogInput defines input for the proxylog tool.

type ProxyLogOutput

type ProxyLogOutput struct {
	// For query
	Entries    []LogEntryOutput `json:"entries,omitempty"`
	Pagination *Pagination      `json:"pagination,omitempty"`

	// For summary
	Summary *ProxyLogSummary `json:"summary,omitempty"`

	// For stats
	Stats *LogStatsOutput `json:"stats,omitempty"`

	// For clear
	Success bool   `json:"success,omitempty"`
	Message string `json:"message,omitempty"`
}

ProxyLogOutput defines output for proxylog tool.

type ProxyLogSummary added in v0.7.12

type ProxyLogSummary struct {
	TotalEntries  int            `json:"total_entries"`
	EntriesByType map[string]int `json:"entries_by_type"` // e.g., {"error": 150, "http": 300}
	TimeRange     TimeRange      `json:"time_range,omitempty"`

	// Error summary
	ErrorCount   int            `json:"error_count"`
	UniqueErrors []ErrorSummary `json:"unique_errors,omitempty"`  // Top 10 deduplicated errors
	ErrorsByType map[string]int `json:"errors_by_type,omitempty"` // e.g., {"ReferenceError": 3}
	Errors       []CompactError `json:"errors,omitempty"`         // Full list when detail includes "errors"
	RecentErrors []CompactError `json:"recent_errors,omitempty"`  // Last 5 errors (when detail not specified)

	// HTTP summary
	HTTPCount    int                  `json:"http_count"`
	HTTPByStatus map[string]int       `json:"http_by_status,omitempty"` // e.g., {"2xx": 100, "4xx": 5}
	HTTPByMethod map[string]int       `json:"http_by_method,omitempty"` // e.g., {"GET": 80, "POST": 20}
	HTTPRequests []CompactHTTPRequest `json:"http_requests,omitempty"`  // Full list when detail includes "http"
	RecentHTTP   []CompactHTTPRequest `json:"recent_http,omitempty"`    // Last 5 requests (when detail not specified)

	// Performance summary
	PerformanceCount  int                  `json:"performance_count"`
	AvgLoadTime       int64                `json:"avg_load_time_ms,omitempty"`
	Performance       []CompactPerformance `json:"performance,omitempty"`        // Full list when detail includes "performance"
	RecentPerformance []CompactPerformance `json:"recent_performance,omitempty"` // Last 5 (when detail not specified)

	// Interaction summary
	InteractionCount   int                  `json:"interaction_count"`
	InteractionsByType map[string]int       `json:"interactions_by_type,omitempty"` // e.g., {"click": 50, "scroll": 100}
	Interactions       []CompactInteraction `json:"interactions,omitempty"`         // Full list when detail includes "interactions"
	RecentInteractions []CompactInteraction `json:"recent_interactions,omitempty"`  // Last 5 (when detail not specified)

	// Mutation summary
	MutationCount   int               `json:"mutation_count"`
	MutationsByType map[string]int    `json:"mutations_by_type,omitempty"` // e.g., {"added": 10, "modified": 5}
	Mutations       []CompactMutation `json:"mutations,omitempty"`         // Full list when detail includes "mutations"
	RecentMutations []CompactMutation `json:"recent_mutations,omitempty"`  // Last 5 (when detail not specified)

	// Other log types (custom, panel_message, sketch, etc.)
	OtherCount int               `json:"other_count,omitempty"`
	OtherTypes map[string]int    `json:"other_types,omitempty"` // Counts for custom, panel_message, sketch, etc.
	Other      []CompactLogEntry `json:"other,omitempty"`       // Full list when detail includes "other"

	// Detail info
	DetailSections []string `json:"detail_sections,omitempty"` // Which sections have full detail
	DetailLimit    int      `json:"detail_limit,omitempty"`    // Limit applied to detailed sections
}

ProxyLogSummary provides a compact summary of proxy logs.

type ProxyOutput

type ProxyOutput struct {
	// For start
	ID          string `json:"id,omitempty"`
	TargetURL   string `json:"target_url,omitempty"`
	ListenAddr  string `json:"listen_addr,omitempty"`
	BindAddress string `json:"bind_address,omitempty"`
	PublicURL   string `json:"public_url,omitempty"`
	TunnelURL   string `json:"tunnel_url,omitempty"` // Public tunnel URL if tunnel is configured

	// For status
	Running       bool            `json:"running,omitempty"`
	Uptime        string          `json:"uptime,omitempty"`
	TotalRequests int64           `json:"total_requests,omitempty"`
	LogStats      *LogStatsOutput `json:"log_stats,omitempty"`
	Tunnel        *TunnelStatus   `json:"tunnel,omitempty"` // Tunnel status if configured

	// Readiness-gate state: when a proxy declares `wait-for`, it
	// binds immediately but does not forward until every listed
	// script signals ready. State is "waiting_for_dependencies"
	// while gating, "running" once the gate opens.
	State     string   `json:"state,omitempty"`
	WaitingOn []string `json:"waiting_on,omitempty"`

	// For list
	Count       int          `json:"count"`
	Proxies     []ProxyEntry `json:"proxies,omitempty"`
	ProjectPath string       `json:"project_path,omitempty"`
	SessionCode string       `json:"session_code,omitempty"`
	Global      bool         `json:"global,omitempty"`

	// For stop/exec
	Success     bool   `json:"success,omitempty"`
	Message     string `json:"message,omitempty"`
	ExecutionID string `json:"execution_id,omitempty"` // For exec action

	// For exec search
	SearchResult *APISearchResult `json:"search_result,omitempty"`

	// For exec: advisory hints when raw DOM patterns duplicate __devtool helpers
	ExecHints []string `json:"hints,omitempty"`

	// For chaos
	ChaosEnabled bool              `json:"chaos_enabled,omitempty"`
	ChaosStats   *ChaosStatsOutput `json:"chaos_stats,omitempty"`
	ChaosRules   []ChaosRuleOutput `json:"chaos_rules,omitempty"`
	ChaosPresets []string          `json:"chaos_presets,omitempty"`
}

ProxyOutput defines output for proxy tool.

type ReplaytestInput added in v0.13.20

type ReplaytestInput struct {
	Action        string `` /* 182-byte string literal not displayed */
	Name          string `json:"name,omitempty" jsonschema:"Scenario name to record, show, refine, or replay."`
	ProxyID       string `json:"proxy_id,omitempty" jsonschema:"Proxy id the scenario records or replays against."`
	Preset        string `` /* 166-byte string literal not displayed */
	ExploreAgents int    `` /* 127-byte string literal not displayed */
	Directory     string `` /* 128-byte string literal not displayed */
}

ReplaytestInput drives the replaytest MCP tool. Action selects the operation; the remaining fields supply per-action parameters.

type ReplaytestOutput added in v0.13.20

type ReplaytestOutput struct {
	Scenarios []string         `json:"scenarios,omitempty"`
	Seeds     []ReplaytestSeed `json:"seeds,omitempty"`
	Report    string           `json:"report,omitempty"`
	Message   string           `json:"message,omitempty"`
	Success   bool             `json:"success"`
}

ReplaytestOutput is the structured result of a replaytest operation.

type ReplaytestSeed added in v0.13.20

type ReplaytestSeed struct {
	Index int    `json:"index"`
	Route string `json:"route"`
}

ReplaytestSeed is one exploration seed in the computed breadth partition. The calling agent fans these out to browser-debugger subagents itself — a Go MCP server cannot spawn Claude subagents in-process.

type ResponsiveAuditInput added in v0.12.0

type ResponsiveAuditInput struct {
	ProxyID   string          `json:"proxy_id,omitempty" jsonschema:"Proxy ID to run audit on (preferred)"`
	ID        string          `json:"id,omitempty" jsonschema:"Alias for proxy_id"`
	Target    string          `` /* 167-byte string literal not displayed */
	FrameID   string          `` /* 127-byte string literal not displayed */
	Viewports []ViewportInput `json:"viewports,omitempty" jsonschema:"Custom viewports to test (default: mobile/tablet/desktop)"`
	Checks    []string        `json:"checks,omitempty" jsonschema:"Checks to run: layout, overflow, a11y (default: all)"`
	Timeout   int             `json:"timeout,omitempty" jsonschema:"Load timeout per viewport in ms (default: 10000)"`
	Raw       bool            `json:"raw,omitempty" jsonschema:"Return full JSON instead of compact text"`
}

ResponsiveAuditInput defines input for the responsive_audit tool.

type ResponsiveAuditOutput added in v0.12.0

type ResponsiveAuditOutput struct {
	Summary string `json:"summary"`
	Raw     any    `json:"raw,omitempty"`
}

ResponsiveAuditOutput defines output for the responsive_audit tool.

type RunInput

type RunInput struct {
	Path          string   `json:"path,omitempty" jsonschema:"Project directory (defaults to current dir)"`
	ScriptName    string   `json:"script_name,omitempty" jsonschema:"Script name from detect (e.g. test, lint, build)"`
	Raw           bool     `json:"raw,omitempty" jsonschema:"Raw mode: use command and args directly"`
	Command       string   `json:"command,omitempty" jsonschema:"Raw mode: executable to run"`
	Args          []string `json:"args,omitempty" jsonschema:"Extra args (appended in script mode, used directly in raw mode)"`
	ID            string   `json:"id,omitempty" jsonschema:"Process ID (auto-generated if empty)"`
	Mode          RunMode  `json:"mode,omitempty" jsonschema:"Execution mode: background (default), foreground, foreground-raw"`
	NoAutoRestart bool     `` /* 133-byte string literal not displayed */
	// Dependency-ordered start: hold the process in pending state until
	// each named dependency reaches a ready signal (URL detected or port
	// bound). On dependency timeout the process transitions to failed
	// with reason "dependency_timeout:<name>". Default per-dep timeout
	// is 30s; override via DependsOnTimeout (seconds).
	DependsOn        []string `json:"depends_on,omitempty" jsonschema:"Process IDs this process must wait on before launching"`
	DependsOnTimeout int      `json:"depends_on_timeout,omitempty" jsonschema:"Per-process dep-wait timeout in seconds (default 30, negative for unbounded)"`
}

RunInput defines input for the run tool.

type RunMode

type RunMode string

RunMode specifies how the run tool executes and returns results.

const (
	// RunModeBackground starts process in background, returns process_id for tracking (default)
	RunModeBackground RunMode = "background"
	// RunModeForeground waits for completion, returns exit code (output via proc)
	RunModeForeground RunMode = "foreground"
	// RunModeForegroundRaw waits for completion, returns exit code and full output
	RunModeForegroundRaw RunMode = "foreground-raw"
)

type RunOutput

type RunOutput struct {
	ProcessID string `json:"process_id"`
	PID       int    `json:"pid"`
	Command   string `json:"command"`
	// Foreground mode fields
	ExitCode int    `json:"exit_code,omitempty"`
	State    string `json:"state,omitempty"`
	Runtime  string `json:"runtime,omitempty"`
	// Foreground-raw mode fields
	Stdout string `json:"stdout,omitempty"`
	Stderr string `json:"stderr,omitempty"`
	// Hint surfaces a follow-up suggestion (e.g. start a proxy for browser
	// debugging when a web/dev server was launched). Empty when not applicable.
	Hint string `json:"hint,omitempty"`
}

RunOutput defines output for run.

type SessionEntry added in v0.7.0

type SessionEntry struct {
	Code        string    `json:"code"`
	OverlayPath string    `json:"overlay_path,omitempty"`
	ProjectPath string    `json:"project_path,omitempty"`
	Command     string    `json:"command,omitempty"`
	Args        []string  `json:"args,omitempty"`
	StartedAt   time.Time `json:"started_at,omitempty"`
	Status      string    `json:"status,omitempty"`
	LastSeen    time.Time `json:"last_seen,omitempty"`
}

SessionEntry represents a session in the list.

type SessionInput added in v0.7.0

type SessionInput struct {
	Action   string `json:"action" jsonschema:"Action: list, send, schedule, tasks, cancel, get"`
	Code     string `json:"code,omitempty" jsonschema:"Session code (required for send, schedule, get)"`
	Message  string `json:"message,omitempty" jsonschema:"Message to send or schedule (required for send, schedule)"`
	Duration string `json:"duration,omitempty" jsonschema:"Duration for scheduling (e.g. '5m', '1h30m') (required for schedule)"`
	TaskID   string `json:"task_id,omitempty" jsonschema:"Task ID (required for cancel)"`
	Global   bool   `json:"global,omitempty" jsonschema:"For list/tasks: include sessions/tasks from all directories (default: false)"`
}

SessionInput defines input for the session tool.

type SessionOutput added in v0.7.0

type SessionOutput struct {
	// For list
	Sessions []SessionEntry `json:"sessions,omitempty"`
	Count    int            `json:"count"`

	// For get
	Session *SessionEntry `json:"session,omitempty"`

	// For tasks
	Tasks []TaskEntry `json:"tasks,omitempty"`

	// For send/schedule
	Success bool   `json:"success,omitempty"`
	Message string `json:"message,omitempty"`
	TaskID  string `json:"task_id,omitempty"`

	// For schedule
	DeliverAt *time.Time `json:"deliver_at,omitempty"`

	// Directory filtering info
	Directory string `json:"directory,omitempty"`
	Global    bool   `json:"global,omitempty"`
}

SessionOutput defines output for the session tool.

type SignalSet added in v0.13.5

type SignalSet struct {
	URLs        []string     `json:"urls,omitempty"`
	Errors      []string     `json:"errors,omitempty"`
	BuildErrors []BuildError `json:"build_errors,omitempty"`
	Warnings    []string     `json:"warnings,omitempty"`
	Ports       []int        `json:"ports,omitempty"`
	Ready       bool         `json:"ready,omitempty"`
	ReadyLine   string       `json:"ready_line,omitempty"`
}

SignalSet is the structured signal payload returned by `proc output` when the caller passes `extract: [...]`. Each field is independent — a caller asking only for "url" gets URLs populated and everything else at zero-value. The wait action consumes the same struct to decide whether a signal has appeared yet.

ReadyLine is the line that triggered Ready=true (so the wait action can surface "what matched" in its result without re-scanning).

BuildErrors holds *structured* parses of the same lines that populate Errors. The two fields coexist by design: Errors is the raw line-level fallback (no regression when a tool's output doesn't match any parser), BuildErrors is the token-efficient structured form the agent reads first. See parseBuildErrors() in build_error_parsers.go.

type SnapshotData added in v0.13.5

type SnapshotData struct {
	Processes     []SnapshotProcess `json:"processes"`
	Proxies       []SnapshotProxy   `json:"proxies"`
	Errors        []SnapshotError   `json:"errors"`
	URLs          []SnapshotURL     `json:"urls"`
	SuggestedNext []string          `json:"suggested_next"`
}

SnapshotData is the unified dev-environment status payload returned by proc {action: "snapshot"}. It merges proc list, proxy list, and error data into a single response so an agent can answer "what's running, is it healthy, what URLs do I have?" with one call instead of four.

Field shape mirrors the task spec exactly so the contract is testable against the documented JSON.

type SnapshotError added in v0.13.5

type SnapshotError struct {
	Source    string `json:"source"`               // "process:<id>" or "browser:js" etc — verbatim from the unified error
	ProcessID string `json:"process_id,omitempty"` // extracted from source when source is "process:<id>"
	Severity  string `json:"severity"`
	Message   string `json:"message"`
	File      string `json:"file,omitempty"`
	Line      string `json:"line,omitempty"`
}

SnapshotError is a single error attributed to either a process or proxy. FilePath/Line are extracted from the unified error's Location field when available so callers don't have to re-parse "file:line:col" strings.

type SnapshotInput

type SnapshotInput struct {
	Action        string                 `json:"action" jsonschema:"Action: baseline, compare, list, delete, get, screenshot"`
	Name          string                 `` /* 130-byte string literal not displayed */
	Baseline      string                 `json:"baseline,omitempty" jsonschema:"Baseline name to compare against (for compare action)"`
	Pages         []snapshot.PageCapture `` /* 162-byte string literal not displayed */
	DiffThreshold float64                `json:"diff_threshold,omitempty" jsonschema:"Diff sensitivity threshold 0.0-1.0 (default: 0.01)"`
	// screenshot action — captures the current page of a running proxy
	ProxyID  string `json:"proxy_id,omitempty" jsonschema:"For screenshot: proxy ID whose current page to capture (preferred)"`
	ID       string `json:"id,omitempty" jsonschema:"Alias for proxy_id (for screenshot action)"`
	Target   string `` /* 155-byte string literal not displayed */
	FrameID  string `` /* 130-byte string literal not displayed */
	Selector string `json:"selector,omitempty" jsonschema:"For screenshot: CSS selector to capture (default: full viewport)"`
	FullPage bool   `json:"full_page,omitempty" jsonschema:"For screenshot: capture full scrollable page (default: viewport only)"`
}

SnapshotInput defines input for the snapshot tool

type SnapshotOutput

type SnapshotOutput struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
	Data    string `json:"data,omitempty"`
}

SnapshotOutput defines output for the snapshot tool

type SnapshotProcess added in v0.13.5

type SnapshotProcess struct {
	ID         string   `json:"id"`
	State      string   `json:"state"`
	UptimeMs   int64    `json:"uptime_ms"`
	URLs       []string `json:"urls,omitempty"`
	ErrorCount int      `json:"error_count"`
	LastError  string   `json:"last_error,omitempty"`
	Command    string   `json:"command,omitempty"`
}

SnapshotProcess is the per-process row returned in a snapshot. State values follow the ProcessManager state machine (running, stopped, failed, starting). UptimeMs is preferred over a string so callers can do arithmetic; the formatted string lives only in the compact text output. URLs come from the daemon's URLTracker; ErrorCount comes from the unified error pipeline (same source as get_errors).

type SnapshotProxy added in v0.13.5

type SnapshotProxy struct {
	ID           string `json:"id"`
	Target       string `json:"target"`
	ListenAddr   string `json:"listen_addr"`
	RequestCount int64  `json:"request_count"`
	ErrorCount   int    `json:"error_count"`
	Running      bool   `json:"running"`
	State        string `json:"state,omitempty"`
}

SnapshotProxy is the per-proxy row returned in a snapshot.

type SnapshotURL added in v0.13.5

type SnapshotURL struct {
	ProcessID string `json:"process_id"`
	URL       string `json:"url"`
}

SnapshotURL is a discovered dev-server URL bound to its process.

type StoreEntryOutput added in v0.8.0

type StoreEntryOutput struct {
	Value     interface{}    `json:"value"`
	Type      string         `json:"type"`
	CreatedAt string         `json:"created_at"`
	UpdatedAt string         `json:"updated_at"`
	Metadata  map[string]any `json:"metadata,omitempty"`
}

StoreEntryOutput represents a single store entry.

type StoreInput added in v0.8.0

type StoreInput struct {
	Action   string         `json:"action" jsonschema:"Action: get, set, delete, list, clear, get_all"`
	Scope    string         `json:"scope,omitempty" jsonschema:"Scope: global, folder, page"`
	ScopeKey string         `json:"scope_key,omitempty" jsonschema:"Scope key (URL for page, path for folder, empty for global)"`
	Key      string         `json:"key,omitempty" jsonschema:"Key (required for get, set, delete)"`
	Value    interface{}    `json:"value,omitempty" jsonschema:"Value to store (required for set)"`
	Metadata map[string]any `json:"metadata,omitempty" jsonschema:"Optional metadata"`
}

StoreInput represents input for the store tool.

type StoreOutput added in v0.8.0

type StoreOutput struct {
	Success bool                         `json:"success"`
	Entry   *StoreEntryOutput            `json:"entry,omitempty"`
	Entries map[string]*StoreEntryOutput `json:"entries,omitempty"`
	Keys    []string                     `json:"keys,omitempty"`
	Count   int                          `json:"count"`
	Message string                       `json:"message,omitempty"`
	Error   string                       `json:"error,omitempty"`
}

StoreOutput represents output from the store tool.

type TaskEntry added in v0.7.0

type TaskEntry struct {
	ID          string    `json:"id"`
	SessionCode string    `json:"session_code"`
	Message     string    `json:"message"`
	DeliverAt   time.Time `json:"deliver_at"`
	CreatedAt   time.Time `json:"created_at"`
	ProjectPath string    `json:"project_path,omitempty"`
	Status      string    `json:"status"`
	Attempts    int       `json:"attempts,omitempty"`
	LastError   string    `json:"last_error,omitempty"`
}

TaskEntry represents a scheduled task in the list.

type TimeRange added in v0.7.12

type TimeRange struct {
	Start time.Time `json:"start"`
	End   time.Time `json:"end"`
}

TimeRange represents a time range for logs.

type TriageAction added in v0.13.28

type TriageAction struct {
	EventType string `json:"event_type"`
	Selector  string `json:"selector,omitempty"`
	Value     string `json:"value,omitempty"`
}

TriageAction is one recent user interaction, newest first.

type TriageConsequence added in v0.13.28

type TriageConsequence struct {
	Action         string `json:"action"`          // e.g. "click #submit"
	ErrorsSince    int    `json:"errors_since"`    // errors after that action
	MutationsSince int    `json:"mutations_since"` // DOM mutations after that action
	SampleError    string `json:"sample_error,omitempty"`
}

TriageConsequence summarizes what happened after the user's last action.

type TriagePerf added in v0.13.28

type TriagePerf struct {
	LoadMs int64 `json:"load_ms,omitempty"`
	FCPMs  int64 `json:"fcp_ms,omitempty"`
	DCLMs  int64 `json:"dcl_ms,omitempty"`
}

TriagePerf is the headline performance numbers.

type TriageResource added in v0.13.28

type TriageResource struct {
	URL    string `json:"url"`
	Status int    `json:"status"`
}

TriageResource is a failed sub-resource (HTTP status >= 400).

type TunnelEntry

type TunnelEntry struct {
	ID        string `json:"id,omitempty"`
	Provider  string `json:"provider"`
	State     string `json:"state"`
	PublicURL string `json:"public_url,omitempty"`
	LocalAddr string `json:"local_addr"`
	Path      string `json:"path,omitempty"`
	Error     string `json:"error,omitempty"`
}

TunnelEntry represents a tunnel in a list response.

type TunnelInput

type TunnelInput struct {
	Action     string `json:"action" jsonschema:"Action: start, stop, status, list"`
	ID         string `json:"id,omitempty" jsonschema:"Tunnel ID (required for start/stop/status)"`
	Provider   string `json:"provider,omitempty" jsonschema:"Tunnel provider: 'cloudflare', 'ngrok', or 'tailscale' (required for start)"`
	LocalPort  int    `json:"local_port,omitempty" jsonschema:"Local port to tunnel (required for start)"`
	LocalHost  string `json:"local_host,omitempty" jsonschema:"Local host (default: localhost)"`
	BinaryPath string `json:"binary_path,omitempty" jsonschema:"Optional path to tunnel binary"`
	ProxyID    string `json:"proxy_id,omitempty" jsonschema:"Optional proxy ID to auto-configure with the tunnel's public URL"`
	Global     bool   `json:"global,omitempty" jsonschema:"For list: include tunnels from all directories (default: false)"`
}

TunnelInput represents input for the tunnel tool.

type TunnelOutput

type TunnelOutput struct {
	ID        string        `json:"id,omitempty"`
	Provider  string        `json:"provider,omitempty"`
	State     string        `json:"state,omitempty"`
	PublicURL string        `json:"public_url,omitempty"`
	LocalAddr string        `json:"local_addr,omitempty"`
	Error     string        `json:"error,omitempty"`
	Success   bool          `json:"success,omitempty"`
	Message   string        `json:"message,omitempty"`
	Count     int           `json:"count"`
	Tunnels   []TunnelEntry `json:"tunnels,omitempty"`
}

TunnelOutput represents output from the tunnel tool.

type TunnelStatus

type TunnelStatus struct {
	Running bool   `json:"running"`
	URL     string `json:"url,omitempty"`
}

TunnelStatus represents tunnel status information.

type ViewportInput added in v0.12.0

type ViewportInput struct {
	Name   string `json:"name" jsonschema:"Viewport name (e.g., 'mobile', 'tablet', 'desktop')"`
	Width  int    `json:"width" jsonschema:"Viewport width in pixels"`
	Height int    `json:"height" jsonschema:"Viewport height in pixels"`
}

ViewportInput defines a viewport for testing.

type WaitResult added in v0.13.5

type WaitResult struct {
	Signal      string `json:"signal,omitempty"`
	MatchedLine string `json:"matched_line,omitempty"`
	ElapsedMs   int64  `json:"elapsed_ms"`
	TimedOut    bool   `json:"timeout,omitempty"`
}

WaitResult is the payload returned by the `proc wait` action. Mirrors the shape from the task spec exactly so the wire format is testable.

TimedOut is true when the wait budget elapsed without a signal match; when true the other fields are zero-valued. Per the spec, timeout is not an error — the agent decides what to do (give up, increase the timeout, switch tactics).

type WalkthroughInput added in v0.13.24

type WalkthroughInput struct {
	Action  string `json:"action" jsonschema:"Action: load, start, stop, next, prev, play, pause, status, list"`
	ProxyID string `json:"proxy_id,omitempty" jsonschema:"Target proxy ID (preferred)"`
	ID      string `json:"id,omitempty" jsonschema:"Alias for proxy_id"`
	// Script is the walkthrough definition (for load/start). JSON object:
	// {id, title, steps:[{title, body, target?, advance:{type,...}}]}.
	// advance.type is one of: auto ({ms}), click-target (needs target), or
	// wait ({when: url-contains|element-present|element-visible, value}).
	Script   any    `` /* 148-byte string literal not displayed */
	ScriptID string `json:"script_id,omitempty" jsonschema:"For start: id of an already-loaded script to run"`
	Mode     string `json:"mode,omitempty" jsonschema:"For start: auto (auto-play, default) or manual (user steps with next/prev)"`
}

WalkthroughInput defines input for the walkthrough tool.

The walkthrough tool lets a coding agent run a live demo of work just completed: it drives a floating, scrolling step list in the browser overlay that narrates state, highlights app elements, and advances by timer, by the user clicking the highlighted element, or by an app-state condition.

type WalkthroughOutput added in v0.13.24

type WalkthroughOutput struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
	// Result carries the browser-side return value (status/list payloads).
	Result string `json:"result,omitempty"`
}

WalkthroughOutput defines output for the walkthrough tool.

type WatchInput added in v0.12.36

type WatchInput struct {
	Target    string `json:"target,omitempty" jsonschema:"What to watch: errors, interactions, process, or all (default: all)"`
	ProxyID   string `json:"proxy_id,omitempty" jsonschema:"Proxy ID to filter (used with errors and interactions targets)"`
	ProcessID string `json:"process_id,omitempty" jsonschema:"Process ID to filter (required for process target unless process_ids is set)"`
	// Multi-target arrays. When set, these win over the singular variants
	// and are passed to `agnt monitor` as comma-joined --process / --proxy
	// values so a single monitor invocation covers the whole set.
	ProxyIDs   []string `json:"proxy_ids,omitempty" jsonschema:"Multiple proxy IDs to filter — emitted as comma-joined --proxy"`
	ProcessIDs []string `json:"process_ids,omitempty" jsonschema:"Multiple process IDs to filter — emitted as comma-joined --process"`
}

WatchInput is the input for the watch tool.

type WatchOutput added in v0.12.36

type WatchOutput struct {
	Command     string `json:"command"`
	Description string `json:"description"`
}

WatchOutput is the output for the watch tool.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL