pi-browser-harness 0.2.0 → 0.3.1

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/src/protocol.ts DELETED
@@ -1,77 +0,0 @@
1
- /**
2
- * Protocol types for pi-browser-harness.
3
- *
4
- * Defines the shape of CDP communication and browser state.
5
- * No socket transport — the daemon talks CDP directly over WebSocket.
6
- */
7
-
8
- // ── CDP Event ────────────────────────────────────────────────────────────────
9
-
10
- export interface CDPEvent {
11
- method: string;
12
- params: unknown;
13
- session_id?: string;
14
- }
15
-
16
- // ── Dialog ───────────────────────────────────────────────────────────────────
17
-
18
- export interface DialogInfo {
19
- type: "alert" | "confirm" | "prompt" | "beforeunload";
20
- message: string;
21
- defaultPrompt?: string;
22
- }
23
-
24
- // ── Tab ──────────────────────────────────────────────────────────────────────
25
-
26
- export interface TabInfo {
27
- targetId: string;
28
- title: string;
29
- url: string;
30
- }
31
-
32
- // ── Page State ───────────────────────────────────────────────────────────────
33
-
34
- export interface PageInfo {
35
- url: string;
36
- title: string;
37
- width: number;
38
- height: number;
39
- scrollX: number;
40
- scrollY: number;
41
- pageWidth: number;
42
- pageHeight: number;
43
- }
44
-
45
- export type PageInfoResult = PageInfo | { dialog: DialogInfo };
46
-
47
- // ── Daemon Status ────────────────────────────────────────────────────────────
48
-
49
- export interface DaemonStatus {
50
- alive: boolean;
51
- sessionId: string | null;
52
- pid: number | null; // deprecated — always null (no subprocess)
53
- namespace: string;
54
- socketPath: string; // deprecated — always "" (no socket)
55
- remoteBrowserId?: string;
56
- }
57
-
58
- // ── Remote Config ────────────────────────────────────────────────────────────
59
-
60
- export interface RemoteConfig {
61
- cdpUrl: string;
62
- browserId: string;
63
- }
64
-
65
- // ── Internal URL prefixes to filter ──────────────────────────────────────────
66
-
67
- const INTERNAL_PREFIXES = [
68
- "chrome://",
69
- "chrome-untrusted://",
70
- "devtools://",
71
- "chrome-extension://",
72
- "about:",
73
- ];
74
-
75
- export function isInternalUrl(url: string): boolean {
76
- return INTERNAL_PREFIXES.some((p) => url.startsWith(p));
77
- }
package/src/renderers.ts DELETED
@@ -1,21 +0,0 @@
1
- /**
2
- * TUI renderers for pi-browser-harness.
3
- *
4
- * Registers custom message renderers and tool renderCall/renderResult
5
- * for browser tools.
6
- */
7
-
8
- import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
9
- import { Text } from "@mariozechner/pi-tui";
10
-
11
- export function registerRenderers(pi: ExtensionAPI): void {
12
- // Register a message renderer for screenshot notifications
13
- pi.registerMessageRenderer("browser-screenshot", (message, _options, theme) => {
14
- const path = (message as { details?: { path?: string } }).details?.path || "unknown";
15
- return new Text(
16
- theme.fg("accent", `📸 Screenshot: ${path}`),
17
- 0,
18
- 0,
19
- );
20
- });
21
- }