hypha-debugger 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/debugger.d.ts +42 -0
- package/dist/hypha-debugger.js +2400 -0
- package/dist/hypha-debugger.js.map +1 -0
- package/dist/hypha-debugger.min.js +2 -0
- package/dist/hypha-debugger.min.js.map +1 -0
- package/dist/hypha-debugger.mjs +2374 -0
- package/dist/hypha-debugger.mjs.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/services/dom.d.ts +156 -0
- package/dist/services/execute.d.ts +31 -0
- package/dist/services/info.d.ts +45 -0
- package/dist/services/navigate.d.ts +65 -0
- package/dist/services/react.d.ts +37 -0
- package/dist/services/screenshot.d.ts +51 -0
- package/dist/ui/overlay.d.ts +28 -0
- package/dist/ui/styles.d.ts +4 -0
- package/dist/utils/env.d.ts +28 -0
- package/package.json +61 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export declare function takeScreenshot(options?: {
|
|
2
|
+
selector?: string;
|
|
3
|
+
format?: "png" | "jpeg";
|
|
4
|
+
quality?: number;
|
|
5
|
+
scale?: number;
|
|
6
|
+
max_width?: number;
|
|
7
|
+
max_height?: number;
|
|
8
|
+
}): Promise<{
|
|
9
|
+
data: string;
|
|
10
|
+
format: string;
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
} | {
|
|
14
|
+
error: string;
|
|
15
|
+
}>;
|
|
16
|
+
export declare namespace takeScreenshot {
|
|
17
|
+
var __schema__: {
|
|
18
|
+
name: string;
|
|
19
|
+
description: string;
|
|
20
|
+
parameters: {
|
|
21
|
+
type: string;
|
|
22
|
+
properties: {
|
|
23
|
+
selector: {
|
|
24
|
+
type: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
format: {
|
|
28
|
+
type: string;
|
|
29
|
+
enum: string[];
|
|
30
|
+
description: string;
|
|
31
|
+
};
|
|
32
|
+
quality: {
|
|
33
|
+
type: string;
|
|
34
|
+
description: string;
|
|
35
|
+
};
|
|
36
|
+
scale: {
|
|
37
|
+
type: string;
|
|
38
|
+
description: string;
|
|
39
|
+
};
|
|
40
|
+
max_width: {
|
|
41
|
+
type: string;
|
|
42
|
+
description: string;
|
|
43
|
+
};
|
|
44
|
+
max_height: {
|
|
45
|
+
type: string;
|
|
46
|
+
description: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface OverlayOptions {
|
|
2
|
+
position?: {
|
|
3
|
+
x: number;
|
|
4
|
+
y: number;
|
|
5
|
+
};
|
|
6
|
+
}
|
|
7
|
+
export declare class DebugOverlay {
|
|
8
|
+
private host;
|
|
9
|
+
private shadow;
|
|
10
|
+
private icon;
|
|
11
|
+
private panel;
|
|
12
|
+
private statusDot;
|
|
13
|
+
private logContainer;
|
|
14
|
+
private infoBody;
|
|
15
|
+
private isOpen;
|
|
16
|
+
private isDragging;
|
|
17
|
+
private dragOffset;
|
|
18
|
+
private maxLogEntries;
|
|
19
|
+
constructor(options?: OverlayOptions);
|
|
20
|
+
private setupDrag;
|
|
21
|
+
toggle(): void;
|
|
22
|
+
setStatus(status: "connected" | "disconnected" | "error"): void;
|
|
23
|
+
setInfo(info: Record<string, string>): void;
|
|
24
|
+
/** Show the service URL with a copy button. */
|
|
25
|
+
setServiceUrl(url: string, token: string): void;
|
|
26
|
+
addLog(message: string, type?: "call" | "result" | "error"): void;
|
|
27
|
+
destroy(): void;
|
|
28
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scoped CSS for the debug overlay, injected into Shadow DOM.
|
|
3
|
+
*/
|
|
4
|
+
export declare const overlayStyles = "\n :host {\n all: initial;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n }\n\n * {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n }\n\n .debugger-icon {\n width: 40px;\n height: 40px;\n border-radius: 50%;\n background: #4a90d9;\n color: white;\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);\n transition: transform 0.15s, background 0.15s;\n user-select: none;\n font-size: 18px;\n line-height: 1;\n }\n\n .debugger-icon:hover {\n transform: scale(1.1);\n background: #357abd;\n }\n\n .debugger-icon.connected {\n background: #27ae60;\n }\n\n .debugger-icon.error {\n background: #e74c3c;\n }\n\n .debugger-panel {\n display: none;\n width: 320px;\n max-height: 420px;\n background: #1e1e2e;\n color: #cdd6f4;\n border-radius: 8px;\n border: 1px solid #45475a;\n box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);\n overflow: hidden;\n flex-direction: column;\n position: absolute;\n bottom: 50px;\n right: 0;\n font-size: 13px;\n }\n\n .debugger-panel.open {\n display: flex;\n }\n\n .panel-header {\n background: #313244;\n padding: 8px 12px;\n display: flex;\n align-items: center;\n justify-content: space-between;\n cursor: default;\n border-bottom: 1px solid #45475a;\n font-weight: 600;\n font-size: 12px;\n letter-spacing: 0.3px;\n text-transform: uppercase;\n color: #a6adc8;\n }\n\n .panel-header .title {\n display: flex;\n align-items: center;\n gap: 6px;\n }\n\n .panel-header .close-btn {\n cursor: pointer;\n color: #6c7086;\n font-size: 16px;\n line-height: 1;\n padding: 2px 4px;\n border-radius: 3px;\n }\n\n .panel-header .close-btn:hover {\n color: #cdd6f4;\n background: #45475a;\n }\n\n .status-dot {\n width: 8px;\n height: 8px;\n border-radius: 50%;\n display: inline-block;\n background: #6c7086;\n }\n\n .status-dot.connected {\n background: #a6e3a1;\n }\n\n .status-dot.error {\n background: #f38ba8;\n }\n\n .panel-body {\n padding: 10px 12px;\n overflow-y: auto;\n flex: 1;\n max-height: 340px;\n }\n\n .info-row {\n display: flex;\n justify-content: space-between;\n padding: 4px 0;\n border-bottom: 1px solid #313244;\n font-size: 12px;\n }\n\n .info-row .label {\n color: #6c7086;\n }\n\n .info-row .value {\n color: #cdd6f4;\n text-align: right;\n word-break: break-all;\n max-width: 180px;\n font-family: 'SF Mono', Monaco, Consolas, monospace;\n font-size: 11px;\n }\n\n .url-section {\n margin-top: 8px;\n padding-top: 6px;\n border-top: 1px solid #313244;\n }\n\n .url-label {\n font-size: 11px;\n color: #6c7086;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n margin-bottom: 3px;\n }\n\n .url-row {\n display: flex;\n align-items: center;\n gap: 4px;\n background: #313244;\n border-radius: 3px;\n padding: 4px 6px;\n }\n\n .url-text {\n flex: 1;\n font-family: 'SF Mono', Monaco, Consolas, monospace;\n font-size: 10px;\n color: #89b4fa;\n word-break: break-all;\n overflow: hidden;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n }\n\n .copy-btn {\n background: #45475a;\n color: #cdd6f4;\n border: none;\n border-radius: 3px;\n padding: 2px 8px;\n font-size: 10px;\n cursor: pointer;\n white-space: nowrap;\n flex-shrink: 0;\n }\n\n .copy-btn:hover {\n background: #585b70;\n }\n\n .log-section {\n margin-top: 8px;\n }\n\n .log-title {\n font-size: 11px;\n color: #6c7086;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n margin-bottom: 4px;\n }\n\n .log-entry {\n font-family: 'SF Mono', Monaco, Consolas, monospace;\n font-size: 11px;\n padding: 3px 6px;\n border-radius: 3px;\n background: #313244;\n margin-bottom: 2px;\n color: #a6adc8;\n word-break: break-all;\n }\n\n .log-entry.call {\n border-left: 2px solid #89b4fa;\n }\n\n .log-entry.result {\n border-left: 2px solid #a6e3a1;\n }\n\n .log-entry.error {\n border-left: 2px solid #f38ba8;\n color: #f38ba8;\n }\n";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment detection and page metadata collection.
|
|
3
|
+
*/
|
|
4
|
+
export interface PageInfo {
|
|
5
|
+
url: string;
|
|
6
|
+
title: string;
|
|
7
|
+
viewport: {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
document_size: {
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
15
|
+
user_agent: string;
|
|
16
|
+
timestamp: string;
|
|
17
|
+
cookies_enabled: boolean;
|
|
18
|
+
language: string;
|
|
19
|
+
platform: string;
|
|
20
|
+
online: boolean;
|
|
21
|
+
performance: {
|
|
22
|
+
load_time_ms: number | null;
|
|
23
|
+
dom_content_loaded_ms: number | null;
|
|
24
|
+
};
|
|
25
|
+
frameworks: string[];
|
|
26
|
+
}
|
|
27
|
+
export declare function detectFrameworks(): string[];
|
|
28
|
+
export declare function collectPageInfo(): PageInfo;
|
package/package.json
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hypha-debugger",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Injectable debugger for web pages and AI agents, powered by Hypha RPC",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/hypha-debugger.js",
|
|
7
|
+
"module": "dist/hypha-debugger.mjs",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/hypha-debugger.mjs",
|
|
12
|
+
"require": "./dist/hypha-debugger.js",
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "rollup -c && tsc --declaration --emitDeclarationOnly --outDir dist",
|
|
21
|
+
"dev": "rollup -c -w",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"test:watch": "vitest",
|
|
24
|
+
"lint": "tsc --noEmit"
|
|
25
|
+
},
|
|
26
|
+
"keywords": [
|
|
27
|
+
"debugger",
|
|
28
|
+
"hypha",
|
|
29
|
+
"rpc",
|
|
30
|
+
"dom",
|
|
31
|
+
"inspector",
|
|
32
|
+
"ai-agent",
|
|
33
|
+
"remote-debugging",
|
|
34
|
+
"web-automation"
|
|
35
|
+
],
|
|
36
|
+
"author": "Amun AI AB",
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/amun-ai/hypha-debugger.git"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://github.com/amun-ai/hypha-debugger",
|
|
43
|
+
"peerDependencies": {
|
|
44
|
+
"hypha-rpc": ">=0.20.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
48
|
+
"@rollup/plugin-commonjs": "^28.0.0",
|
|
49
|
+
"@rollup/plugin-typescript": "^12.0.0",
|
|
50
|
+
"@rollup/plugin-terser": "^0.4.0",
|
|
51
|
+
"rollup": "^4.0.0",
|
|
52
|
+
"typescript": "^5.5.0",
|
|
53
|
+
"tslib": "^2.7.0",
|
|
54
|
+
"vitest": "^2.0.0",
|
|
55
|
+
"happy-dom": "^15.0.0"
|
|
56
|
+
},
|
|
57
|
+
"dependencies": {
|
|
58
|
+
"html-to-image": "^1.11.0",
|
|
59
|
+
"hypha-rpc": "^0.20.97"
|
|
60
|
+
}
|
|
61
|
+
}
|