tools

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DevToolAPIDocs = struct {
	Categories []APICategory
	Functions  []APIFunction
}{
	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)"},
		{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: []APIFunction{

		{
			Name:        "log",
			Category:    "logging",
			Description: "Send a custom log message to the proxy server",
			Signature:   "log(message, level?, data?)",
			Parameters:  []string{"message: string - The log message", "level: string - Log level: debug, info, warn, error (default: info)", "data: object - Optional additional data"},
			Returns:     "void",
			Example:     `__devtool.log("User clicked button", "info", {buttonId: "submit"})`,
		},
		{
			Name:        "debug",
			Category:    "logging",
			Description: "Send a debug-level log message",
			Signature:   "debug(message, data?)",
			Parameters:  []string{"message: string - The log message", "data: object - Optional additional data"},
			Returns:     "void",
			Example:     `__devtool.debug("Component rendered", {props: {id: 1}})`,
		},
		{
			Name:        "info",
			Category:    "logging",
			Description: "Send an info-level log message",
			Signature:   "info(message, data?)",
			Parameters:  []string{"message: string - The log message", "data: object - Optional additional data"},
			Returns:     "void",
			Example:     `__devtool.info("Page loaded successfully")`,
		},
		{
			Name:        "warn",
			Category:    "logging",
			Description: "Send a warning-level log message",
			Signature:   "warn(message, data?)",
			Parameters:  []string{"message: string - The log message", "data: object - Optional additional data"},
			Returns:     "void",
			Example:     `__devtool.warn("Deprecated API used", {api: "oldMethod"})`,
		},
		{
			Name:        "error",
			Category:    "logging",
			Description: "Send an error-level log message",
			Signature:   "error(message, data?)",
			Parameters:  []string{"message: string - The log message", "data: object - Optional additional data"},
			Returns:     "void",
			Example:     `__devtool.error("Failed to load data", {status: 500})`,
		},

		{
			Name:        "screenshot",
			Category:    "screenshot",
			Description: "Capture a screenshot of the page or a specific element",
			Signature:   "screenshot(name?, selector?)",
			Parameters:  []string{"name: string - Screenshot name (default: screenshot_<timestamp>)", "selector: string - CSS selector for element to capture (default: body)"},
			Returns:     "Promise<{name, width, height, selector}>",
			Example:     `await __devtool.screenshot("homepage")\nawait __devtool.screenshot("header", "#main-header")`,
		},

		{
			Name:        "getElementInfo",
			Category:    "inspection",
			Description: "Get comprehensive information about an element",
			Signature:   "getElementInfo(selector)",
			Parameters:  []string{"selector: string|Element - CSS selector or DOM element"},
			Returns:     "{tag, id, classes, attributes, text, html, dimensions, position}",
			Example:     `__devtool.getElementInfo("#submit-btn")`,
		},
		{
			Name:        "getPosition",
			Category:    "inspection",
			Description: "Get element position (bounding rect)",
			Signature:   "getPosition(selector)",
			Parameters:  []string{"selector: string|Element - CSS selector or DOM element"},
			Returns:     "{top, right, bottom, left, width, height, x, y}",
			Example:     `__devtool.getPosition(".modal")`,
		},
		{
			Name:        "getComputed",
			Category:    "inspection",
			Description: "Get computed CSS styles for an element",
			Signature:   "getComputed(selector, properties?)",
			Parameters:  []string{"selector: string|Element - CSS selector or DOM element", "properties: string[] - Specific properties to get (default: common properties)"},
			Returns:     "{property: value, ...}",
			Example:     `__devtool.getComputed("#header", ["display", "position", "z-index"])`,
		},
		{
			Name:        "getBox",
			Category:    "inspection",
			Description: "Get box model dimensions (content, padding, border, margin)",
			Signature:   "getBox(selector)",
			Parameters:  []string{"selector: string|Element - CSS selector or DOM element"},
			Returns:     "{content, padding, border, margin} with {top, right, bottom, left}",
			Example:     `__devtool.getBox(".container")`,
		},
		{
			Name:        "getLayout",
			Category:    "inspection",
			Description: "Get layout information (display, position, flexbox/grid)",
			Signature:   "getLayout(selector)",
			Parameters:  []string{"selector: string|Element - CSS selector or DOM element"},
			Returns:     "{display, position, float, flexbox?, grid?}",
			Example:     `__devtool.getLayout(".flex-container")`,
		},
		{
			Name:        "getContainer",
			Category:    "inspection",
			Description: "Get containing block and scroll container",
			Signature:   "getContainer(selector)",
			Parameters:  []string{"selector: string|Element - CSS selector or DOM element"},
			Returns:     "{containingBlock, scrollContainer, offsetParent}",
			Example:     `__devtool.getContainer(".absolute-element")`,
		},
		{
			Name:        "getStacking",
			Category:    "inspection",
			Description: "Get stacking context information (z-index, creates context)",
			Signature:   "getStacking(selector)",
			Parameters:  []string{"selector: string|Element - CSS selector or DOM element"},
			Returns:     "{zIndex, createsContext, reason?, parentContext}",
			Example:     `__devtool.getStacking(".modal-overlay")`,
		},
		{
			Name:        "getTransform",
			Category:    "inspection",
			Description: "Get CSS transform information",
			Signature:   "getTransform(selector)",
			Parameters:  []string{"selector: string|Element - CSS selector or DOM element"},
			Returns:     "{transform, transformOrigin, matrix}",
			Example:     `__devtool.getTransform(".rotated-element")`,
		},
		{
			Name:        "getOverflow",
			Category:    "inspection",
			Description: "Get overflow and scroll information",
			Signature:   "getOverflow(selector)",
			Parameters:  []string{"selector: string|Element - CSS selector or DOM element"},
			Returns:     "{overflow, overflowX, overflowY, scrollWidth, scrollHeight, isScrollable}",
			Example:     `__devtool.getOverflow(".scrollable-panel")`,
		},

		{
			Name:        "walkChildren",
			Category:    "tree",
			Description: "Get all child elements with optional filtering",
			Signature:   "walkChildren(selector, options?)",
			Parameters:  []string{"selector: string|Element - CSS selector or DOM element", "options: {maxDepth?, filter?} - Walk options"},
			Returns:     "[{element, depth, path}, ...]",
			Example:     `__devtool.walkChildren("#container", {maxDepth: 2})`,
		},
		{
			Name:        "walkParents",
			Category:    "tree",
			Description: "Get all parent elements up to document",
			Signature:   "walkParents(selector)",
			Parameters:  []string{"selector: string|Element - CSS selector or DOM element"},
			Returns:     "[{element, depth}, ...]",
			Example:     `__devtool.walkParents(".nested-element")`,
		},
		{
			Name:        "findAncestor",
			Category:    "tree",
			Description: "Find the closest ancestor matching a condition",
			Signature:   "findAncestor(selector, condition)",
			Parameters:  []string{"selector: string|Element - Starting element", "condition: string|function - CSS selector or predicate function"},
			Returns:     "Element|null",
			Example:     `__devtool.findAncestor(".button", "[data-modal]")`,
		},

		{
			Name:        "isVisible",
			Category:    "visual",
			Description: "Check if an element is visible (not hidden by CSS)",
			Signature:   "isVisible(selector)",
			Parameters:  []string{"selector: string|Element - CSS selector or DOM element"},
			Returns:     "{visible: boolean, reasons?: string[]}",
			Example:     `__devtool.isVisible(".dropdown-menu")`,
		},
		{
			Name:        "isInViewport",
			Category:    "visual",
			Description: "Check if an element is within the viewport",
			Signature:   "isInViewport(selector, threshold?)",
			Parameters:  []string{"selector: string|Element - CSS selector or DOM element", "threshold: number - Percentage visible required (default: 0)"},
			Returns:     "{inViewport: boolean, percentVisible: number, position}",
			Example:     `__devtool.isInViewport("#footer", 0.5)`,
		},
		{
			Name:        "checkOverlap",
			Category:    "visual",
			Description: "Check if two elements overlap",
			Signature:   "checkOverlap(selector1, selector2)",
			Parameters:  []string{"selector1: string|Element - First element", "selector2: string|Element - Second element"},
			Returns:     "{overlaps: boolean, intersection?: {x, y, width, height}}",
			Example:     `__devtool.checkOverlap(".modal", ".tooltip")`,
		},

		{
			Name:        "findOverflows",
			Category:    "layout",
			Description: "Find elements causing horizontal overflow",
			Signature:   "findOverflows()",
			Parameters:  []string{},
			Returns:     "[{element, overflow, width, parentWidth}, ...]",
			Example:     `__devtool.findOverflows()`,
		},
		{
			Name:        "findStackingContexts",
			Category:    "layout",
			Description: "Find all stacking contexts in the document",
			Signature:   "findStackingContexts()",
			Parameters:  []string{},
			Returns:     "[{element, zIndex, reason}, ...]",
			Example:     `__devtool.findStackingContexts()`,
		},
		{
			Name:        "findOffscreen",
			Category:    "layout",
			Description: "Find elements positioned outside the viewport",
			Signature:   "findOffscreen()",
			Parameters:  []string{},
			Returns:     "[{element, position, distance}, ...]",
			Example:     `__devtool.findOffscreen()`,
		},

		{
			Name:        "highlight",
			Category:    "overlay",
			Description: "Highlight an element with a colored overlay",
			Signature:   "highlight(selector, options?)",
			Parameters:  []string{"selector: string|Element - CSS selector or DOM element", "options: {color?, label?, duration?} - Highlight options"},
			Returns:     "string - Overlay ID for removal",
			Example:     `__devtool.highlight("#form", {color: "blue", label: "Main Form"})`,
		},
		{
			Name:        "removeHighlight",
			Category:    "overlay",
			Description: "Remove a specific highlight overlay",
			Signature:   "removeHighlight(id)",
			Parameters:  []string{"id: string - Overlay ID returned by highlight()"},
			Returns:     "void",
			Example:     `__devtool.removeHighlight("overlay-123")`,
		},
		{
			Name:        "clearAllOverlays",
			Category:    "overlay",
			Description: "Remove all highlight overlays",
			Signature:   "clearAllOverlays()",
			Parameters:  []string{},
			Returns:     "void",
			Example:     `__devtool.clearAllOverlays()`,
		},

		{
			Name:        "selectElement",
			Category:    "interactive",
			Description: "Enter interactive mode to select an element by clicking",
			Signature:   "selectElement()",
			Parameters:  []string{},
			Returns:     "Promise<Element> - The selected element",
			Example:     `const el = await __devtool.selectElement()`,
		},
		{
			Name:        "waitForElement",
			Category:    "interactive",
			Description: "Wait for an element to appear in the DOM",
			Signature:   "waitForElement(selector, timeout?)",
			Parameters:  []string{"selector: string - CSS selector", "timeout: number - Max wait time in ms (default: 5000)"},
			Returns:     "Promise<Element>",
			Example:     `const modal = await __devtool.waitForElement(".modal-open")`,
		},
		{
			Name:        "ask",
			Category:    "interactive",
			Description: "Display a prompt dialog and wait for user input",
			Signature:   "ask(question, options?)",
			Parameters:  []string{"question: string - Question to display", "options: {choices?, default?} - Dialog options"},
			Returns:     "Promise<string> - User's answer",
			Example:     `const answer = await __devtool.ask("What color?", {choices: ["red", "blue"]})`,
		},
		{
			Name:        "measureBetween",
			Category:    "interactive",
			Description: "Measure distance between two elements",
			Signature:   "measureBetween(selector1, selector2)",
			Parameters:  []string{"selector1: string|Element - First element", "selector2: string|Element - Second element"},
			Returns:     "{horizontal, vertical, diagonal}",
			Example:     `__devtool.measureBetween(".header", ".footer")`,
		},

		{
			Name:        "captureDOM",
			Category:    "capture",
			Description: "Capture serialized DOM snapshot",
			Signature:   "captureDOM(selector?)",
			Parameters:  []string{"selector: string - Root element selector (default: body)"},
			Returns:     "{html, text, elementCount, timestamp}",
			Example:     `__devtool.captureDOM("#main-content")`,
		},
		{
			Name:        "captureStyles",
			Category:    "capture",
			Description: "Capture all stylesheets and computed styles",
			Signature:   "captureStyles()",
			Parameters:  []string{},
			Returns:     "{stylesheets: [...], inlineStyles: [...]}",
			Example:     `__devtool.captureStyles()`,
		},
		{
			Name:        "captureState",
			Category:    "capture",
			Description: "Capture comprehensive page state",
			Signature:   "captureState()",
			Parameters:  []string{},
			Returns:     "{url, title, viewport, scroll, forms, localStorage, sessionStorage}",
			Example:     `__devtool.captureState()`,
		},
		{
			Name:        "captureNetwork",
			Category:    "capture",
			Description: "Get performance timing and resource information",
			Signature:   "captureNetwork()",
			Parameters:  []string{},
			Returns:     "{timing, resources: [...], paintTiming}",
			Example:     `__devtool.captureNetwork()`,
		},

		{
			Name:        "getA11yInfo",
			Category:    "accessibility",
			Description: "Get accessibility information for an element",
			Signature:   "getA11yInfo(selector)",
			Parameters:  []string{"selector: string|Element - CSS selector or DOM element"},
			Returns:     "{role, name, description, state, properties}",
			Example:     `__devtool.getA11yInfo("#submit-button")`,
		},
		{
			Name:        "getContrast",
			Category:    "accessibility",
			Description: "Calculate color contrast ratio for text",
			Signature:   "getContrast(selector)",
			Parameters:  []string{"selector: string|Element - CSS selector or DOM element"},
			Returns:     "{ratio, foreground, background, passesAA, passesAAA}",
			Example:     `__devtool.getContrast(".body-text")`,
		},
		{
			Name:        "getTabOrder",
			Category:    "accessibility",
			Description: "Get focusable elements in tab order",
			Signature:   "getTabOrder()",
			Parameters:  []string{},
			Returns:     "[{element, tabIndex, natural}, ...]",
			Example:     `__devtool.getTabOrder()`,
		},
		{
			Name:        "getScreenReaderText",
			Category:    "accessibility",
			Description: "Get text as a screen reader would announce it",
			Signature:   "getScreenReaderText(selector)",
			Parameters:  []string{"selector: string|Element - CSS selector or DOM element"},
			Returns:     "string",
			Example:     `__devtool.getScreenReaderText("#nav-menu")`,
		},
		{
			Name:        "auditAccessibility",
			Category:    "accessibility",
			Description: "Run accessibility audit on the page",
			Signature:   "auditAccessibility()",
			Parameters:  []string{},
			Returns:     "{issues: [...], summary: {critical, serious, moderate, minor}}",
			Example:     `__devtool.auditAccessibility()`,
		},

		{
			Name:        "auditDOMComplexity",
			Category:    "audit",
			Description: "Analyze DOM complexity and depth",
			Signature:   "auditDOMComplexity()",
			Parameters:  []string{},
			Returns:     "{elementCount, maxDepth, avgDepth, deepElements, widest}",
			Example:     `__devtool.auditDOMComplexity()`,
		},
		{
			Name:        "auditCSS",
			Category:    "audit",
			Description: "Analyze CSS usage and potential issues",
			Signature:   "auditCSS()",
			Parameters:  []string{},
			Returns:     "{unusedRules, duplicates, specificity, importantCount}",
			Example:     `__devtool.auditCSS()`,
		},
		{
			Name:        "auditSecurity",
			Category:    "audit",
			Description: "Check for common security issues",
			Signature:   "auditSecurity()",
			Parameters:  []string{},
			Returns:     "{issues: [...], summary}",
			Example:     `__devtool.auditSecurity()`,
		},
		{
			Name:        "auditPageQuality",
			Category:    "audit",
			Description: "Comprehensive page quality audit",
			Signature:   "auditPageQuality()",
			Parameters:  []string{},
			Returns:     "{dom, css, accessibility, security, performance}",
			Example:     `__devtool.auditPageQuality()`,
		},

		{
			Name:        "interactions.getHistory",
			Category:    "interactions",
			Description: "Get recent interaction history",
			Signature:   "interactions.getHistory(count?)",
			Parameters:  []string{"count: number - Number of interactions to return (default: 50)"},
			Returns:     "[{event_type, target, position?, timestamp}, ...]",
			Example:     `__devtool.interactions.getHistory(10)`,
		},
		{
			Name:        "interactions.getLastClick",
			Category:    "interactions",
			Description: "Get the most recent click event",
			Signature:   "interactions.getLastClick()",
			Parameters:  []string{},
			Returns:     "{event_type, target, position, timestamp}|null",
			Example:     `__devtool.interactions.getLastClick()`,
		},
		{
			Name:        "interactions.getClicksOn",
			Category:    "interactions",
			Description: "Get all clicks on elements matching selector",
			Signature:   "interactions.getClicksOn(selector)",
			Parameters:  []string{"selector: string - Selector pattern to match in target"},
			Returns:     "[{event_type, target, position, timestamp}, ...]",
			Example:     `__devtool.interactions.getClicksOn("button")`,
		},
		{
			Name:        "interactions.getMouseTrail",
			Category:    "interactions",
			Description: "Get mouse movement samples around a timestamp",
			Signature:   "interactions.getMouseTrail(timestamp, windowMs?)",
			Parameters:  []string{"timestamp: number - Center timestamp", "windowMs: number - Time window in ms (default: 5000)"},
			Returns:     "[{position, wall_time, interaction_time}, ...]",
			Example:     `__devtool.interactions.getMouseTrail(Date.now() - 1000)`,
		},
		{
			Name:        "interactions.getLastClickContext",
			Category:    "interactions",
			Description: "Get last click with surrounding mouse trail",
			Signature:   "interactions.getLastClickContext(trailMs?)",
			Parameters:  []string{"trailMs: number - Trail window in ms (default: 2000)"},
			Returns:     "{click, mouseTrail}|null",
			Example:     `__devtool.interactions.getLastClickContext()`,
		},
		{
			Name:        "interactions.clear",
			Category:    "interactions",
			Description: "Clear interaction history",
			Signature:   "interactions.clear()",
			Parameters:  []string{},
			Returns:     "void",
			Example:     `__devtool.interactions.clear()`,
		},

		{
			Name:        "mutations.getHistory",
			Category:    "mutations",
			Description: "Get recent mutation history",
			Signature:   "mutations.getHistory(count?)",
			Parameters:  []string{"count: number - Number of mutations to return (default: 50)"},
			Returns:     "[{mutation_type, target, added?, removed?, attribute?, timestamp}, ...]",
			Example:     `__devtool.mutations.getHistory(20)`,
		},
		{
			Name:        "mutations.getAdded",
			Category:    "mutations",
			Description: "Get elements added to DOM since timestamp",
			Signature:   "mutations.getAdded(since?)",
			Parameters:  []string{"since: number - Timestamp filter (default: 0)"},
			Returns:     "[{mutation_type: 'added', target, added, timestamp}, ...]",
			Example:     `__devtool.mutations.getAdded(Date.now() - 5000)`,
		},
		{
			Name:        "mutations.getRemoved",
			Category:    "mutations",
			Description: "Get elements removed from DOM since timestamp",
			Signature:   "mutations.getRemoved(since?)",
			Parameters:  []string{"since: number - Timestamp filter (default: 0)"},
			Returns:     "[{mutation_type: 'removed', target, removed, timestamp}, ...]",
			Example:     `__devtool.mutations.getRemoved(Date.now() - 5000)`,
		},
		{
			Name:        "mutations.getModified",
			Category:    "mutations",
			Description: "Get attribute changes since timestamp",
			Signature:   "mutations.getModified(since?)",
			Parameters:  []string{"since: number - Timestamp filter (default: 0)"},
			Returns:     "[{mutation_type: 'attributes', target, attribute, timestamp}, ...]",
			Example:     `__devtool.mutations.getModified(Date.now() - 5000)`,
		},
		{
			Name:        "mutations.highlightRecent",
			Category:    "mutations",
			Description: "Visually highlight recently added elements",
			Signature:   "mutations.highlightRecent(duration?)",
			Parameters:  []string{"duration: number - How far back to look in ms (default: 5000)"},
			Returns:     "void",
			Example:     `__devtool.mutations.highlightRecent(3000)`,
		},
		{
			Name:        "mutations.clear",
			Category:    "mutations",
			Description: "Clear mutation history",
			Signature:   "mutations.clear()",
			Parameters:  []string{},
			Returns:     "void",
			Example:     `__devtool.mutations.clear()`,
		},
		{
			Name:        "mutations.pause",
			Category:    "mutations",
			Description: "Pause mutation tracking",
			Signature:   "mutations.pause()",
			Parameters:  []string{},
			Returns:     "void",
			Example:     `__devtool.mutations.pause()`,
		},
		{
			Name:        "mutations.resume",
			Category:    "mutations",
			Description: "Resume mutation tracking",
			Signature:   "mutations.resume()",
			Parameters:  []string{},
			Returns:     "void",
			Example:     `__devtool.mutations.resume()`,
		},

		{
			Name:        "indicator.show",
			Category:    "indicator",
			Description: "Show the floating indicator",
			Signature:   "indicator.show()",
			Parameters:  []string{},
			Returns:     "void",
			Example:     `__devtool.indicator.show()`,
		},
		{
			Name:        "indicator.hide",
			Category:    "indicator",
			Description: "Hide the floating indicator",
			Signature:   "indicator.hide()",
			Parameters:  []string{},
			Returns:     "void",
			Example:     `__devtool.indicator.hide()`,
		},
		{
			Name:        "indicator.toggle",
			Category:    "indicator",
			Description: "Toggle the floating indicator visibility",
			Signature:   "indicator.toggle()",
			Parameters:  []string{},
			Returns:     "void",
			Example:     `__devtool.indicator.toggle()`,
		},
		{
			Name:        "indicator.togglePanel",
			Category:    "indicator",
			Description: "Toggle the indicator's expanded panel",
			Signature:   "indicator.togglePanel()",
			Parameters:  []string{},
			Returns:     "void",
			Example:     `__devtool.indicator.togglePanel()`,
		},
		{
			Name:        "indicator.destroy",
			Category:    "indicator",
			Description: "Remove the floating indicator completely",
			Signature:   "indicator.destroy()",
			Parameters:  []string{},
			Returns:     "void",
			Example:     `__devtool.indicator.destroy()`,
		},

		{
			Name:        "sketch.open",
			Category:    "sketch",
			Description: "Open sketch mode for wireframing",
			Signature:   "sketch.open()",
			Parameters:  []string{},
			Returns:     "void",
			Example:     `__devtool.sketch.open()`,
		},
		{
			Name:        "sketch.close",
			Category:    "sketch",
			Description: "Close sketch mode",
			Signature:   "sketch.close()",
			Parameters:  []string{},
			Returns:     "void",
			Example:     `__devtool.sketch.close()`,
		},
		{
			Name:        "sketch.toggle",
			Category:    "sketch",
			Description: "Toggle sketch mode on/off",
			Signature:   "sketch.toggle()",
			Parameters:  []string{},
			Returns:     "void",
			Example:     `__devtool.sketch.toggle()`,
		},
		{
			Name:        "sketch.setTool",
			Category:    "sketch",
			Description: "Set the active drawing tool",
			Signature:   "sketch.setTool(tool)",
			Parameters:  []string{"tool: string - Tool name: select, rectangle, ellipse, line, arrow, freedraw, text, note, button, input, image, eraser"},
			Returns:     "void",
			Example:     `__devtool.sketch.setTool("rectangle")`,
		},
		{
			Name:        "sketch.save",
			Category:    "sketch",
			Description: "Save sketch and send to proxy server",
			Signature:   "sketch.save()",
			Parameters:  []string{},
			Returns:     "void",
			Example:     `__devtool.sketch.save()`,
		},
		{
			Name:        "sketch.toJSON",
			Category:    "sketch",
			Description: "Export sketch data as JSON",
			Signature:   "sketch.toJSON()",
			Parameters:  []string{},
			Returns:     "object - Serialized sketch data",
			Example:     `const data = __devtool.sketch.toJSON()`,
		},
		{
			Name:        "sketch.fromJSON",
			Category:    "sketch",
			Description: "Load sketch data from JSON",
			Signature:   "sketch.fromJSON(data)",
			Parameters:  []string{"data: object - Sketch data from toJSON()"},
			Returns:     "void",
			Example:     `__devtool.sketch.fromJSON(savedData)`,
		},
		{
			Name:        "sketch.toDataURL",
			Category:    "sketch",
			Description: "Export sketch as PNG data URL",
			Signature:   "sketch.toDataURL()",
			Parameters:  []string{},
			Returns:     "string - PNG data URL",
			Example:     `const png = __devtool.sketch.toDataURL()`,
		},
		{
			Name:        "sketch.undo",
			Category:    "sketch",
			Description: "Undo last sketch action",
			Signature:   "sketch.undo()",
			Parameters:  []string{},
			Returns:     "void",
			Example:     `__devtool.sketch.undo()`,
		},
		{
			Name:        "sketch.redo",
			Category:    "sketch",
			Description: "Redo previously undone action",
			Signature:   "sketch.redo()",
			Parameters:  []string{},
			Returns:     "void",
			Example:     `__devtool.sketch.redo()`,
		},
		{
			Name:        "sketch.clear",
			Category:    "sketch",
			Description: "Clear all sketch elements",
			Signature:   "sketch.clear()",
			Parameters:  []string{},
			Returns:     "void",
			Example:     `__devtool.sketch.clear()`,
		},

		{
			Name:        "content.extractLinks",
			Category:    "content",
			Description: "Extract all links from the page with context (navigation, footer, etc.)",
			Signature:   "content.extractLinks(options?)",
			Parameters:  []string{"options.internal: boolean - Only internal links", "options.external: boolean - Only external links", "options.includeAnchors: boolean - Include anchor-only links", "options.selector: string - Limit to links within selector"},
			Returns:     "{url, internal[], external[], anchors[], mailto[], tel[], other[], stats}",
			Example:     `__devtool.content.extractLinks({internal: true})`,
		},
		{
			Name:        "content.extractNavigation",
			Category:    "content",
			Description: "Extract navigation structure from the page (nav elements, header, footer, breadcrumbs)",
			Signature:   "content.extractNavigation()",
			Parameters:  []string{},
			Returns:     "{url, navElements[], header, footer, breadcrumbs, sidebar}",
			Example:     `__devtool.content.extractNavigation()`,
		},
		{
			Name:        "content.extractContent",
			Category:    "content",
			Description: "Extract page content as markdown",
			Signature:   "content.extractContent(options?)",
			Parameters:  []string{"options.selector: string - Selector for main content (auto-detected if not provided)", "options.includeImages: boolean - Include image references (default: true)", "options.includeLinks: boolean - Include link URLs (default: true)", "options.maxLength: number - Maximum content length (default: 50000)"},
			Returns:     "{url, title, selector, markdown, meta, headings[], wordCount, truncated}",
			Example:     `__devtool.content.extractContent({selector: "article"})`,
		},
		{
			Name:        "content.extractHeadings",
			Category:    "content",
			Description: "Extract heading hierarchy for page outline",
			Signature:   "content.extractHeadings(scope?)",
			Parameters:  []string{"scope: Element - Optional scope element (default: document)"},
			Returns:     "[{level, text, id}]",
			Example:     `__devtool.content.extractHeadings()`,
		},
		{
			Name:        "content.buildSitemap",
			Category:    "content",
			Description: "Build sitemap structure from internal links on the page",
			Signature:   "content.buildSitemap(options?)",
			Parameters:  []string{"options.maxDepth: number - Maximum URL depth to include (default: 5)"},
			Returns:     "{url, baseUrl, pages{}, tree{}, stats}",
			Example:     `__devtool.content.buildSitemap()`,
		},
		{
			Name:        "content.extractStructuredData",
			Category:    "content",
			Description: "Extract structured data (JSON-LD, Open Graph, Twitter Cards)",
			Signature:   "content.extractStructuredData()",
			Parameters:  []string{},
			Returns:     "{url, jsonLd[], openGraph{}, twitter{}, microdata[]}",
			Example:     `__devtool.content.extractStructuredData()`,
		},

		{
			Name:        "isConnected",
			Category:    "connection",
			Description: "Check if WebSocket is connected to proxy server",
			Signature:   "isConnected()",
			Parameters:  []string{},
			Returns:     "boolean",
			Example:     `if (__devtool.isConnected()) { ... }`,
		},
		{
			Name:        "getStatus",
			Category:    "connection",
			Description: "Get detailed WebSocket connection status",
			Signature:   "getStatus()",
			Parameters:  []string{},
			Returns:     "string - connecting, connected, closing, closed, not_initialized, unknown",
			Example:     `console.log(__devtool.getStatus())`,
		},

		{
			Name:        "inspect",
			Category:    "inspection",
			Description: "Get comprehensive inspection of an element (combines multiple inspection calls)",
			Signature:   "inspect(selector)",
			Parameters:  []string{"selector: string|Element - CSS selector or DOM element"},
			Returns:     "{info, position, box, layout, stacking, container, visibility, viewport}",
			Example:     `__devtool.inspect("#main-form")`,
		},
		{
			Name:        "diagnoseLayout",
			Category:    "layout",
			Description: "Run comprehensive layout diagnostics",
			Signature:   "diagnoseLayout(selector?)",
			Parameters:  []string{"selector: string - Optional element to focus analysis on"},
			Returns:     "{overflows, stackingContexts, offscreen, element?}",
			Example:     `__devtool.diagnoseLayout()`,
		},
	},
}

DevToolAPIDocs contains the full API documentation.

Functions

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 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 RegisterProcessTools

func RegisterProcessTools(server *mcp.Server, pm *process.ProcessManager)

RegisterProcessTools adds process-related MCP tools to the server.

func RegisterProjectTools

func RegisterProjectTools(server *mcp.Server)

RegisterProjectTools adds project-related MCP tools to the server.

func RegisterProxyTools

func RegisterProxyTools(server *mcp.Server, pm *proxy.ProxyManager)

RegisterProxyTools adds proxy-related MCP tools to the server.

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)

RegisterSnapshotTools registers snapshot-related MCP tools

func RegisterTunnelTool

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

RegisterTunnelTool registers the tunnel MCP tool with the server.

Types

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 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 CurrentPageInput

type CurrentPageInput struct {
	ProxyID   string   `json:"proxy_id" jsonschema:"Proxy ID to query pages from"`
	Action    string   `json:"action,omitempty" jsonschema:"Action: list, get, summary, clear (default: list)"`
	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)"`
}

CurrentPageInput defines input for the currentpage tool.

type CurrentPageOutput

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

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

	// For summary
	Summary *PageSummaryOutput `json:"summary,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"`
}

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 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) Close

func (dt *DaemonTools) Close() error

Close closes the daemon client connection.

type DetectInput

type DetectInput struct {
	Path string `json:"path,omitempty" jsonschema:"Directory path (defaults to current dir)"`
}

DetectInput defines input for the detect tool.

type DetectOutput

type DetectOutput struct {
	Type           string            `json:"type"`
	Name           string            `json:"name"`
	Scripts        []string          `json:"scripts"`
	PackageManager string            `json:"package_manager,omitempty"`
	Metadata       map[string]string `json:"metadata,omitempty"`
}

DetectOutput defines output for detect.

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 LogEntryOutput

type LogEntryOutput struct {
	Type      string                 `json:"type"`
	Timestamp time.Time              `json:"timestamp"`
	Data      map[string]interface{} `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 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)

MarshalJSON custom marshaler for proper JSON serialization

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       []map[string]interface{} `json:"errors,omitempty"`         // Full 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 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"`
}

ProcEntry is a process in the list.

type ProcInput

type ProcInput struct {
	Action    string `json:"action" jsonschema:"Action: status, output, stop, list, cleanup_port"`
	ProcessID string `json:"process_id,omitempty" jsonschema:"Process ID (required for status/output/stop)"`
	// 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)"`
	// 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)"`
}

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"`
	// For output
	Output    string `json:"output,omitempty"`
	Lines     int    `json:"lines,omitempty"`
	Truncated bool   `json:"truncated,omitempty"`
	// For list
	Count     int         `json:"count,omitempty"`
	Processes []ProcEntry `json:"processes,omitempty"`
	Directory string      `json:"directory,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"`
}

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 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"`
}

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, status, list, exec, 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 */
	PublicURL     string `` /* 159-byte string literal not displayed */
	VerifyTLS     bool   `` /* 160-byte string literal not displayed */
	Code          string `json:"code,omitempty" jsonschema:"JavaScript code to execute (required for exec)"`
	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 */
	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" jsonschema:"Proxy ID to query logs from"`
	Action      string   `json:"action,omitempty" jsonschema:"Action: query, clear, stats (default: query)"`
	Types       []string `json:"types,omitempty" jsonschema:"Filter by type: http, error, performance"`
	Methods     []string `json:"methods,omitempty" jsonschema:"Filter by HTTP method: GET, POST, etc."`
	URLPattern  string   `json:"url_pattern,omitempty" jsonschema:"URL substring to match"`
	StatusCodes []int    `json:"status_codes,omitempty" jsonschema:"Filter by HTTP status code"`
	Since       string   `json:"since,omitempty" jsonschema:"Start time (RFC3339 or duration like '5m')"`
	Until       string   `json:"until,omitempty" jsonschema:"End time (RFC3339)"`
	Limit       int      `json:"limit,omitempty" jsonschema:"Maximum results (default: 100)"`
}

ProxyLogInput defines input for the proxylog tool.

type ProxyLogOutput

type ProxyLogOutput struct {
	// For query
	Entries []LogEntryOutput `json:"entries,omitempty"`
	Count   int              `json:"count,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 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

	// For list
	Count     int          `json:"count,omitempty"`
	Proxies   []ProxyEntry `json:"proxies,omitempty"`
	Directory string       `json:"directory,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 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 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"`
}

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"`
}

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,omitempty"`

	// 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 SnapshotInput

type SnapshotInput struct {
	Action        string                 `json:"action" jsonschema:"Action: baseline, compare, list, delete, get"`
	Name          string                 `json:"name,omitempty" jsonschema:"Baseline name (required for baseline/compare/delete/get)"`
	Baseline      string                 `json:"baseline,omitempty" jsonschema:"Baseline name to compare against (for compare action)"`
	Pages         []snapshot.PageCapture `json:"pages,omitempty" jsonschema:"Pages to capture (array of {url viewport screenshot_data})"`
	DiffThreshold float64                `json:"diff_threshold,omitempty" jsonschema:"Diff sensitivity threshold 0.0-1.0 (default: 0.01)"`
}

SnapshotInput defines input for the snapshot tool

type SnapshotOutput

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

SnapshotOutput defines output for the snapshot 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 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"`
	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' or 'ngrok' (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"`
}

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,omitempty"`
	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.

Jump to

Keyboard shortcuts

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