MCPcopy Create free account
hub / github.com/Kilo-Org/cloud / createDebuggerApi

Function createDebuggerApi

apps/extension/src/shared/tab-debugger.test.ts:18–50  ·  view source on GitHub ↗
({
  sendCommand,
  targets,
}: {
  sendCommand?: ChromeDebuggerApi['sendCommand'];
  targets?: ChromeDebuggerTargetInfo[];
} = {})

Source from the content-addressed store, hash-verified

16 getViewportScreenshotWithTabsApi,
17 isInspectablePageUrl,
18 isTabDebuggerRequest,
19 isTabDebuggerResponse,
20 listInspectableTabs,
21 listInspectableTabsWithTabsApi,
22} from './tab-debugger';
23import type {
24 BrowserScriptingApi,
25 BrowserTabsApi,
26 ChromeDebuggerApi,
27 ChromeDebuggerTargetInfo,
28} from './tab-debugger';
29
30const createDebuggerApi = ({
31 sendCommand,
32 targets,
33}: {
34 sendCommand?: ChromeDebuggerApi['sendCommand'];
35 targets?: ChromeDebuggerTargetInfo[];
36} = {}): ChromeDebuggerApi & { calls: string[] } => {
37 const calls: string[] = [];
38
39 return {
40 attach: target => {
41 calls.push(`attach:${target.tabId}`);
42 },
43 calls,
44 detach: target => {
45 calls.push(`detach:${target.tabId}`);
46 },
47 getTargets: () =>
48 targets ?? [
49 { tabId: 1, title: 'Kilo', type: 'page', url: 'https://app.kilo.ai/' },
50 { tabId: 2, title: 'Chrome settings', type: 'page', url: 'chrome://settings' },
51 { title: 'Extension worker', type: 'service_worker', url: 'chrome-extension://id/bg.js' },
52 { tabId: 3, title: 'Local app', type: 'page', url: 'http://localhost:3001/' },
53 { tabId: 4, title: 'Local image', type: 'page', url: 'file:///tmp/kilo-image.png' },

Callers 1

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected