local-browser-bridge 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/README.md +724 -0
- package/dist/package.json +61 -0
- package/dist/src/browser/chrome.d.ts +19 -0
- package/dist/src/browser/chrome.js +778 -0
- package/dist/src/browser/index.d.ts +3 -0
- package/dist/src/browser/index.js +25 -0
- package/dist/src/browser/safari.d.ts +41 -0
- package/dist/src/browser/safari.js +827 -0
- package/dist/src/browser-attach-ux-helper.d.ts +39 -0
- package/dist/src/browser-attach-ux-helper.js +157 -0
- package/dist/src/capabilities.d.ts +3 -0
- package/dist/src/capabilities.js +182 -0
- package/dist/src/chrome-relay-error-helper.d.ts +19 -0
- package/dist/src/chrome-relay-error-helper.js +78 -0
- package/dist/src/chrome-relay-helper-cli.d.ts +2 -0
- package/dist/src/chrome-relay-helper-cli.js +97 -0
- package/dist/src/chrome-relay-helper.d.ts +29 -0
- package/dist/src/chrome-relay-helper.js +151 -0
- package/dist/src/chrome-relay-state.d.ts +23 -0
- package/dist/src/chrome-relay-state.js +108 -0
- package/dist/src/claude-code.d.ts +20 -0
- package/dist/src/claude-code.js +66 -0
- package/dist/src/cli-reference-adapter.d.ts +13 -0
- package/dist/src/cli-reference-adapter.js +48 -0
- package/dist/src/cli.d.ts +3 -0
- package/dist/src/cli.js +200 -0
- package/dist/src/codex.d.ts +17 -0
- package/dist/src/codex.js +25 -0
- package/dist/src/connection-ux.d.ts +61 -0
- package/dist/src/connection-ux.js +256 -0
- package/dist/src/errors.d.ts +12 -0
- package/dist/src/errors.js +58 -0
- package/dist/src/http-reference-adapter.d.ts +34 -0
- package/dist/src/http-reference-adapter.js +61 -0
- package/dist/src/http.d.ts +3 -0
- package/dist/src/http.js +161 -0
- package/dist/src/index.d.ts +17 -0
- package/dist/src/index.js +43 -0
- package/dist/src/mcp-stdio.d.ts +2 -0
- package/dist/src/mcp-stdio.js +10 -0
- package/dist/src/mcp.d.ts +25 -0
- package/dist/src/mcp.js +483 -0
- package/dist/src/reference-adapter.d.ts +32 -0
- package/dist/src/reference-adapter.js +42 -0
- package/dist/src/service/attach-service.d.ts +28 -0
- package/dist/src/service/attach-service.js +272 -0
- package/dist/src/session-metadata.d.ts +4 -0
- package/dist/src/session-metadata.js +88 -0
- package/dist/src/store/session-store.d.ts +14 -0
- package/dist/src/store/session-store.js +52 -0
- package/dist/src/target.d.ts +9 -0
- package/dist/src/target.js +61 -0
- package/dist/src/types.d.ts +397 -0
- package/dist/src/types.js +2 -0
- package/dist/tests/attach-service.test.d.ts +1 -0
- package/dist/tests/attach-service.test.js +1367 -0
- package/dist/tests/browser-attach-ux-helper.test.d.ts +1 -0
- package/dist/tests/browser-attach-ux-helper.test.js +139 -0
- package/dist/tests/chrome-relay-error-helper.test.d.ts +1 -0
- package/dist/tests/chrome-relay-error-helper.test.js +67 -0
- package/dist/tests/chrome-relay-helper.test.d.ts +1 -0
- package/dist/tests/chrome-relay-helper.test.js +142 -0
- package/dist/tests/chrome-relay-state-schema.test.d.ts +1 -0
- package/dist/tests/chrome-relay-state-schema.test.js +96 -0
- package/dist/tests/claude-code-wrapper.test.d.ts +1 -0
- package/dist/tests/claude-code-wrapper.test.js +170 -0
- package/dist/tests/codex.test.d.ts +1 -0
- package/dist/tests/codex.test.js +210 -0
- package/dist/tests/demo-client-smoke.test.d.ts +1 -0
- package/dist/tests/demo-client-smoke.test.js +405 -0
- package/dist/tests/docs-fixtures.test.d.ts +1 -0
- package/dist/tests/docs-fixtures.test.js +255 -0
- package/dist/tests/doctor-connect-wrapper.test.d.ts +1 -0
- package/dist/tests/doctor-connect-wrapper.test.js +62 -0
- package/dist/tests/fixtures/doctor-connect-cli-stub.d.ts +1 -0
- package/dist/tests/fixtures/doctor-connect-cli-stub.js +93 -0
- package/dist/tests/fixtures/public-root-cli-stub.d.ts +210 -0
- package/dist/tests/fixtures/public-root-cli-stub.js +143 -0
- package/dist/tests/fixtures/public-root-consumer.js +67 -0
- package/dist/tests/mcp.test.d.ts +1 -0
- package/dist/tests/mcp.test.js +345 -0
- package/dist/tests/public-consumer-helpers.test.d.ts +1 -0
- package/dist/tests/public-consumer-helpers.test.js +33 -0
- package/dist/tests/public-package-git-consumption.test.d.ts +1 -0
- package/dist/tests/public-package-git-consumption.test.js +56 -0
- package/dist/tests/public-root-consumer-smoke.test.d.ts +1 -0
- package/dist/tests/public-root-consumer-smoke.test.js +214 -0
- package/dist/tests/reference-adapter.test.d.ts +1 -0
- package/dist/tests/reference-adapter.test.js +220 -0
- package/dist/tests/transport-reference-adapters.test.d.ts +1 -0
- package/dist/tests/transport-reference-adapters.test.js +214 -0
- package/package.json +61 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBrowserAdapter = getBrowserAdapter;
|
|
4
|
+
exports.normalizeBrowser = normalizeBrowser;
|
|
5
|
+
const errors_1 = require("../errors");
|
|
6
|
+
const chrome_1 = require("./chrome");
|
|
7
|
+
const safari_1 = require("./safari");
|
|
8
|
+
function getBrowserAdapter(browser) {
|
|
9
|
+
if (browser === "safari") {
|
|
10
|
+
return new safari_1.SafariAdapter();
|
|
11
|
+
}
|
|
12
|
+
if (browser === "chrome") {
|
|
13
|
+
return new chrome_1.ChromeAdapter();
|
|
14
|
+
}
|
|
15
|
+
throw new errors_1.AppError(`Unsupported browser: ${browser}`, 400, "unsupported_browser");
|
|
16
|
+
}
|
|
17
|
+
function normalizeBrowser(browser) {
|
|
18
|
+
if (!browser || browser === "safari") {
|
|
19
|
+
return "safari";
|
|
20
|
+
}
|
|
21
|
+
if (browser === "chrome" || browser === "chromium") {
|
|
22
|
+
return "chrome";
|
|
23
|
+
}
|
|
24
|
+
throw new errors_1.AppError(`Unsupported browser: ${browser}`, 400, "unsupported_browser");
|
|
25
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AppError } from "../errors";
|
|
2
|
+
import type { BrowserDiagnostics, BrowserAdapter, BrowserSessionAction, BrowserTabTarget, SessionActionResult, TabMetadata } from "../types";
|
|
3
|
+
type SafariOperation = "inspect" | "activate" | "navigate" | "screenshot";
|
|
4
|
+
type SafariInspectableTabRecord = Omit<TabMetadata, "attachedAt" | "identity">;
|
|
5
|
+
type SafariInspectionSnapshot = {
|
|
6
|
+
tabs: SafariInspectableTabRecord[];
|
|
7
|
+
windowCount: number;
|
|
8
|
+
inspectableWindowCount: number;
|
|
9
|
+
tabCount: number;
|
|
10
|
+
};
|
|
11
|
+
type SafariWindowBounds = {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
reorderedWindowToFront: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare function parseSafariInspectionSnapshot(raw: string): SafariInspectionSnapshot;
|
|
19
|
+
export declare function isValidSafariWindowBounds(bounds: Partial<SafariWindowBounds> | null | undefined): bounds is SafariWindowBounds;
|
|
20
|
+
export declare function buildSafariPreflight(args: {
|
|
21
|
+
osascriptAvailable: boolean;
|
|
22
|
+
screencaptureAvailable: boolean;
|
|
23
|
+
applicationAvailable: boolean;
|
|
24
|
+
safariRunning: boolean;
|
|
25
|
+
screenRecordingPermissionGranted?: boolean;
|
|
26
|
+
windowCount?: number;
|
|
27
|
+
inspectableWindowCount?: number;
|
|
28
|
+
tabCount?: number;
|
|
29
|
+
probeError?: unknown;
|
|
30
|
+
}): NonNullable<BrowserDiagnostics["preflight"]>;
|
|
31
|
+
export declare function classifySafariRuntimeError(operation: SafariOperation, error: unknown): AppError;
|
|
32
|
+
export declare function classifySafariTabResolutionError(target: BrowserTabTarget, snapshot: SafariInspectionSnapshot): AppError;
|
|
33
|
+
export declare class SafariAdapter implements BrowserAdapter {
|
|
34
|
+
readonly browser: "safari";
|
|
35
|
+
private inspectTabs;
|
|
36
|
+
listTabs(): Promise<TabMetadata[]>;
|
|
37
|
+
resolveTab(target: BrowserTabTarget): Promise<TabMetadata>;
|
|
38
|
+
performSessionAction(action: BrowserSessionAction): Promise<SessionActionResult>;
|
|
39
|
+
getDiagnostics(): Promise<BrowserDiagnostics>;
|
|
40
|
+
}
|
|
41
|
+
export {};
|