@probebrowser/sdk
v2.3.0
Published
Trace SDK - Full-power AI debugging SDK with 142 debugging tools
Maintainers
Readme
@trace/sdk
AI-Powered Web Debugging SDK with 79 Debugging Tools
Full-power debugging SDK that provides programmatic access to all 79 debugging tools from the Trace engine. Connect to any web page, collect debugging data, and get AI-powered analysis.
Installation
npm install @trace/sdkQuick Start
import { Trace, createTrace } from '@trace/sdk';
// Create and connect
const trace = await createTrace('https://example.com', {
apiKey: 'your-api-key',
headless: true
});
// Ask the AI to debug
const result = await trace.query('Why is my page slow?');
console.log(result.analysis);
// Or get quick health check
const health = await trace.healthCheck();
console.log(`Healthy: ${health.healthy}, Issues: ${health.issues}`);
// Cleanup
await trace.disconnect();79 Debugging Tools
The SDK provides access to all 79 debugging tools across 8 categories:
Console (6 tools)
get_console_logs- Get all console messagesget_console_errors- Get error messages onlyget_error_groups- Get errors grouped by typeget_exception_details- Get detailed exception infoclear_console- Clear console storeget_log_count- Get message counts by level
Network (10 tools)
get_network_requests- Get all network requestsget_network_failed- Get failed requests onlyget_network_summary- Get summary statisticsget_request_details- Get specific request detailsget_cached_requests- Get cached requestsget_request_timing- Get timing breakdownget_request_body- Get request bodyget_response_body- Get response bodyget_redirect_chain- Get redirect historyreplay_request- Re-execute a request
DOM (16 tools)
inspect_element- Inspect DOM elementget_element_styles- Get computed stylesget_element_box_model- Get box model infoquery_selector- Query DOM selectorsget_dom_tree- Get DOM structureget_element_attributes- Get element attributesget_element_events- Get event listenersanalyze_visibility- Check visibilityget_element_accessibility- Get ARIA infocheck_accessibility- Full a11y checkhighlight_element- Highlight in pagescroll_to_element- Scroll element into viewget_element_screenshot- Screenshot elementget_computed_style- Get specific stylesget_element_hierarchy- Get ancestors/descendantsmeasure_element- Get measurements
Debugger (24 tools)
get_debug_state- Get debugger stateset_breakpoint- Set breakpointremove_breakpoint- Remove breakpointget_breakpoints- List all breakpointsset_conditional_breakpoint- Set conditionalset_logpoint- Set logpointpause_execution- Pause scriptresume_execution- Resume executionstep_over- Step overstep_into- Step intostep_out- Step outget_call_stack- Get call stackget_scope_variables- Get variables in scopeget_variable_value- Get specific variableset_variable_value- Modify variableevaluate_expression- Evaluate codeevaluate_on_frame- Evaluate in frame contextget_this_object- Getthisbindingadd_watch- Add watch expressionremove_watch- Remove watchget_watches- Get all watchesenable_debugger- Enable debuggerdisable_debugger- Disable debuggerget_possible_breakpoints- Get valid locations
Source (8 tools)
get_scripts- Get all loaded scriptsget_script_source- Get script contentsearch_scripts- Search in scriptsget_script_parsed- Get parsed infoset_script_source- Live edit sourceblackbox_script- Blackbox scriptunblackbox_script- Unblackbox scriptget_script_coverage- Get coverage data
Performance (4 tools)
get_performance_metrics- Get timing metricsstart_performance_profile- Start profilingstop_performance_profile- Stop and get profileget_heap_snapshot- Get memory snapshot
Timeline (5 tools)
get_timeline_events- Get timeline eventsstart_timeline- Start recordingstop_timeline- Stop recordingget_event_listeners_timeline- Get event timelinetake_timeline_snapshot- Take snapshot
Tracing (3 tools)
start_trace- Start tracestop_trace- Stop traceget_trace_events- Get trace events
API Reference
Trace Class
const trace = new Trace({
apiUrl?: string; // API endpoint (default: https://dev-intelli-api.azurewebsites.net)
apiKey?: string; // API key for authentication
headless?: boolean; // Run headless (default: true)
verbose?: boolean; // Enable verbose logging
});Connection
// Connect to a URL
await trace.connect('https://example.com');
// Navigate to new URL
await trace.navigate('https://example.com/page');
// Reload page
await trace.reload();
// Disconnect
await trace.disconnect();AI Queries
// Ask anything
const result = await trace.query('What is causing the memory leak?');
// Quick debug scan
const debug = await trace.debug();
// Analyze performance
const perf = await trace.performance();Direct Tool Access
// Run any tool directly
const errors = await trace.tool('get_console_errors', {});
const element = await trace.tool('inspect_element', { selector: '#my-button' });
const metrics = await trace.tool('get_performance_metrics', {});Convenience Methods
// Console
const errors = await trace.getConsoleErrors();
const groups = await trace.getErrorGroups();
// Network
const failed = await trace.getNetworkFailed();
const summary = await trace.getNetworkSummary();
// DOM
const element = await trace.inspectElement('#button');
const visibility = await trace.analyzeVisibility('#modal');
const a11y = await trace.checkAccessibility();
// Debugger
await trace.setBreakpoint('script.js', 42);
const stack = await trace.getCallStack();
const vars = await trace.getScopeVariables();
// Performance
const metrics = await trace.getPerformanceMetrics();
// Page interaction
await trace.click('#button');
await trace.type('#input', 'hello');
const result = await trace.evaluate('document.title');
await trace.screenshot('page.png');Health Check
const health = await trace.healthCheck();
// { healthy: true, issues: 0, critical: 0 }Examples
Debug a failing page
import { createTrace } from '@trace/sdk';
const trace = await createTrace('https://myapp.com');
// Ask AI to investigate
const result = await trace.query('Why are there console errors?');
console.log('Summary:', result.analysis.summary);
for (const issue of result.analysis.issues) {
console.log(`[${issue.severity}] ${issue.title}`);
console.log(` Fix: ${issue.fix}`);
}
await trace.disconnect();Monitor errors
import { createTrace } from '@trace/sdk';
const trace = await createTrace('https://myapp.com');
// Watch for 30 seconds
const interval = setInterval(async () => {
const errors = await trace.getConsoleErrors();
const failed = await trace.getNetworkFailed();
console.log(`Errors: ${errors.length}, Failed: ${failed.length}`);
}, 5000);
setTimeout(async () => {
clearInterval(interval);
await trace.disconnect();
}, 30000);Debug with breakpoints
import { createTrace } from '@trace/sdk';
const trace = await createTrace('https://myapp.com');
// Set breakpoint
await trace.setBreakpoint('app.js', 100);
// Trigger action
await trace.click('#submit-button');
// When paused, inspect
const stack = await trace.getCallStack();
const vars = await trace.getScopeVariables();
console.log('Call stack:', stack);
console.log('Variables:', vars);
await trace.disconnect();License
MIT
