omowright 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/README.md +43 -29
- package/TOOLS.md +9 -8
- package/dist/agent-tabs.d.ts +56 -0
- package/dist/aria-hidden.d.ts +1 -0
- package/dist/aside/cli-binary.d.ts +7 -0
- package/dist/aside/cli-contract.d.ts +9 -0
- package/dist/aside/errors.d.ts +8 -0
- package/dist/aside/line-transport.d.ts +11 -0
- package/dist/aside/mcp-transport.d.ts +11 -0
- package/dist/aside/onboard.d.ts +76 -0
- package/dist/aside/session-types.d.ts +68 -0
- package/dist/aside/session.d.ts +20 -0
- package/{bin/omowright-cloak.mjs → dist/bin/omowright-cloak.js} +28 -31
- package/dist/bridge-schemas.d.ts +326 -0
- package/dist/bridge-transport.d.ts +144 -0
- package/dist/browser-context.d.ts +4024 -0
- package/dist/browser-process.d.ts +10 -0
- package/dist/bsk/browser-signals.d.ts +23 -0
- package/dist/bsk/browsers.d.ts +46 -0
- package/dist/bsk/connect.d.ts +23 -0
- package/dist/bsk/daemon-info.d.ts +16 -0
- package/dist/bsk/external-extension.d.ts +74 -0
- package/dist/bsk/identify-browser.d.ts +48 -0
- package/dist/bsk/install-cli.d.ts +37 -0
- package/dist/bsk/ipc-client.d.ts +45 -0
- package/dist/bsk/onboard.d.ts +96 -0
- package/dist/bsk/reply-fields.d.ts +3 -0
- package/dist/bsk/screenshot.d.ts +24 -0
- package/dist/bsk/session.d.ts +142 -0
- package/dist/bsk/snapshot.d.ts +16 -0
- package/dist/bsk/targets.d.ts +20 -0
- package/dist/captcha-wait.d.ts +17 -0
- package/dist/captcha.d.ts +46 -0
- package/dist/cdp-errors.d.ts +38 -0
- package/dist/cdp-methods.d.ts +10 -0
- package/dist/cdp-protocol.d.ts +459 -0
- package/dist/chrome-profile.d.ts +77 -0
- package/dist/chrome.d.ts +130 -0
- package/dist/cloak-profile.d.ts +43 -0
- package/dist/connection.d.ts +4024 -0
- package/dist/console-events.d.ts +22 -0
- package/dist/cookies.d.ts +42 -0
- package/dist/core.d.ts +10810 -0
- package/dist/cua.d.ts +56 -0
- package/dist/dialog-policy.d.ts +43 -0
- package/dist/ego/bindings.d.ts +68 -0
- package/dist/ego/cdp-client.d.ts +28 -0
- package/dist/ego/client.d.ts +8 -0
- package/dist/ego/errors.d.ts +7 -0
- package/dist/emulate.d.ts +62 -0
- package/dist/engines.d.ts +59 -0
- package/dist/events.d.ts +93 -0
- package/dist/frames-snapshot.d.ts +58 -0
- package/dist/har.d.ts +88 -0
- package/dist/human-handoff.d.ts +30 -0
- package/{src/index.js → dist/index.d.ts} +12 -55
- package/dist/index.js +39478 -0
- package/dist/injected.d.ts +1 -0
- package/dist/instance-lock.d.ts +5 -0
- package/dist/instances.d.ts +45 -0
- package/dist/internal-capability.d.ts +1 -0
- package/dist/launch-endpoint.d.ts +34 -0
- package/dist/layers.d.ts +31 -0
- package/dist/llm.d.ts +1349 -0
- package/dist/lock-backend-win32-xbcm60vz.js +57 -0
- package/dist/lock-backend-win32.d.ts +3 -0
- package/dist/lock-backend.d.ts +6 -0
- package/dist/native-host-win32.d.ts +38 -0
- package/dist/network-events.d.ts +66 -0
- package/dist/network-snoop.d.ts +56 -0
- package/dist/nul-frames.d.ts +4 -0
- package/dist/open-shadow-query.d.ts +1 -0
- package/dist/owner-only.d.ts +15 -0
- package/dist/page-bundle.js +1597 -0
- package/dist/page-events.d.ts +25 -0
- package/dist/page-routes.d.ts +30 -0
- package/dist/page-setup.d.ts +55 -0
- package/dist/pipe.d.ts +71 -0
- package/dist/process-start-time.d.ts +2 -0
- package/dist/read-property.d.ts +2 -0
- package/dist/routes.d.ts +60 -0
- package/dist/running-browser.d.ts +39 -0
- package/dist/scroll-collect.d.ts +36 -0
- package/dist/serial-emitter.d.ts +5 -0
- package/dist/shared-connections.d.ts +11 -0
- package/dist/snapshot-diff.d.ts +57 -0
- package/dist/text-matching.d.ts +21 -0
- package/dist/trace.d.ts +59 -0
- package/dist/url-match.d.ts +7 -0
- package/dist/viewport.d.ts +26 -0
- package/dist/ws.d.ts +62 -0
- package/package.json +47 -26
- package/presets/agent-events/SKILL.md +1 -1
- package/presets/captcha/SKILL.md +1 -3
- package/presets/chrome/SKILL.md +2 -2
- package/presets/cloak-bridge/SKILL.md +11 -11
- package/presets/network/SKILL.md +15 -13
- package/presets/visual-browse/SKILL.md +14 -10
- package/skills/omowright/SKILL.md +83 -49
- package/skills/omowright/references/aside.md +50 -0
- package/skills/omowright/references/browserskill.md +29 -32
- package/skills/omowright/references/ego.md +24 -0
- package/skills/omowright/references/eval-kernel.md +44 -23
- package/skills/omowright/references/frames-layers-human.md +16 -7
- package/skills/omowright/references/quickstart.md +7 -4
- package/skills/omowright/references/stealth.md +11 -8
- package/src/agent-tabs.js +0 -179
- package/src/aria-hidden.js +0 -47
- package/src/bridge-schemas.js +0 -44
- package/src/bridge-transport.js +0 -83
- package/src/browser-context.js +0 -105
- package/src/browser-process.js +0 -127
- package/src/bsk/browser-signals.js +0 -90
- package/src/bsk/browsers.js +0 -114
- package/src/bsk/connect.js +0 -75
- package/src/bsk/daemon-info.js +0 -100
- package/src/bsk/external-extension.js +0 -110
- package/src/bsk/identify-browser.js +0 -88
- package/src/bsk/install-cli.js +0 -81
- package/src/bsk/ipc-client.js +0 -236
- package/src/bsk/onboard.js +0 -140
- package/src/bsk/screenshot.js +0 -49
- package/src/bsk/session.js +0 -131
- package/src/bsk/snapshot.js +0 -56
- package/src/bsk/targets.js +0 -25
- package/src/captcha-wait.js +0 -79
- package/src/captcha.js +0 -142
- package/src/cdp-errors.js +0 -23
- package/src/cdp-methods.js +0 -69
- package/src/chrome-profile.js +0 -176
- package/src/chrome.js +0 -194
- package/src/cloak-profile.js +0 -266
- package/src/connection.js +0 -234
- package/src/console-events.js +0 -12
- package/src/cookies.js +0 -39
- package/src/core.js +0 -1702
- package/src/cua.js +0 -74
- package/src/dialog-policy.js +0 -80
- package/src/emulate.js +0 -127
- package/src/events.js +0 -111
- package/src/frames-snapshot.js +0 -138
- package/src/har.js +0 -103
- package/src/human-handoff.js +0 -124
- package/src/injected.js +0 -3
- package/src/instance-lock.js +0 -74
- package/src/instances.js +0 -490
- package/src/internal-capability.js +0 -1
- package/src/launch-endpoint.js +0 -185
- package/src/layers.js +0 -138
- package/src/llm.js +0 -201
- package/src/lock-backend-win32.js +0 -54
- package/src/lock-backend.js +0 -81
- package/src/native-host-win32.js +0 -201
- package/src/network-events.js +0 -223
- package/src/network-snoop.js +0 -229
- package/src/nul-frames.js +0 -28
- package/src/open-shadow-query.js +0 -101
- package/src/owner-only.js +0 -196
- package/src/page-bundle.js +0 -1478
- package/src/page-events.js +0 -45
- package/src/page-routes.js +0 -94
- package/src/page-setup.js +0 -239
- package/src/pipe.js +0 -418
- package/src/process-start-time.js +0 -64
- package/src/routes.js +0 -256
- package/src/running-browser.js +0 -85
- package/src/scroll-collect.js +0 -73
- package/src/serial-emitter.js +0 -17
- package/src/shared-connections.js +0 -285
- package/src/snapshot-diff.js +0 -75
- package/src/text-matching.js +0 -101
- package/src/trace.js +0 -183
- package/src/url-match.js +0 -148
- package/src/viewport.js +0 -12
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ChildProcess } from "node:child_process";
|
|
2
|
+
export declare const TERM_GRACE_MS = 5000;
|
|
3
|
+
export declare const browserSpawnDetached: boolean;
|
|
4
|
+
export declare function profileDirFromArgs(browserArgs: readonly string[]): string | null;
|
|
5
|
+
export declare function terminateChild(child: ChildProcess, { quitRequested }?: {
|
|
6
|
+
quitRequested?: boolean;
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
export declare function writeBrowserPidFile(profileDir: string | null | undefined, pid: number | undefined): Promise<void>;
|
|
9
|
+
export declare function removeBrowserPidFile(profileDir: string | null | undefined, pid: number): void;
|
|
10
|
+
export declare function reapOrphanedBrowser(profileDir: string | null | undefined): Promise<void>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type RunCommand = (command: string, args: string[]) => Promise<string | null>;
|
|
2
|
+
export type StatFn = (file: string) => {
|
|
3
|
+
mtimeMs: number;
|
|
4
|
+
};
|
|
5
|
+
export interface BrowserSignals {
|
|
6
|
+
defaultBrowser: string | null;
|
|
7
|
+
running: string[] | null;
|
|
8
|
+
lastUsed: Record<string, number | null>;
|
|
9
|
+
}
|
|
10
|
+
export declare function parseMacDefaultBrowser(plistJson: string): string | null;
|
|
11
|
+
export declare function parseWindowsProgId(regOutput: string | null | undefined): string | null;
|
|
12
|
+
export declare function parseProcessNames(platform: string, output: string | null | undefined): string[];
|
|
13
|
+
export interface ProbeBrowserSignalsOptions {
|
|
14
|
+
platform?: string;
|
|
15
|
+
home?: string;
|
|
16
|
+
browsers?: Array<{
|
|
17
|
+
id: string;
|
|
18
|
+
userDataDir: string;
|
|
19
|
+
}>;
|
|
20
|
+
run?: RunCommand;
|
|
21
|
+
stat?: StatFn;
|
|
22
|
+
}
|
|
23
|
+
export declare function probeBrowserSignals({ platform, home, browsers, run, stat, }?: ProbeBrowserSignalsOptions): Promise<BrowserSignals>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
export declare const BROWSERSKILL_EXTENSION_IDS: Readonly<{
|
|
3
|
+
chrome: "hhcmgoofomhgciiibhipgmgkgnoenaoi";
|
|
4
|
+
edge: "emacgiaaaiojkkpkddmmdfhmokgmnikg";
|
|
5
|
+
}>;
|
|
6
|
+
export declare const STORE_UPDATE_URLS: Readonly<{
|
|
7
|
+
chrome: "https://clients2.google.com/service/update2/crx";
|
|
8
|
+
edge: "https://edge.microsoft.com/extensionwebstorebase/v1/crx";
|
|
9
|
+
}>;
|
|
10
|
+
export declare const STORE_PAGE_URLS: Readonly<{
|
|
11
|
+
chrome: "https://chromewebstore.google.com/detail/hhcmgoofomhgciiibhipgmgkgnoenaoi";
|
|
12
|
+
edge: "https://microsoftedge.microsoft.com/addons/detail/browserskill/emacgiaaaiojkkpkddmmdfhmokgmnikg";
|
|
13
|
+
}>;
|
|
14
|
+
export type StoreId = keyof typeof BROWSERSKILL_EXTENSION_IDS;
|
|
15
|
+
export interface CatalogBrowser {
|
|
16
|
+
id: string;
|
|
17
|
+
label: string;
|
|
18
|
+
store: StoreId;
|
|
19
|
+
userDataDir: string;
|
|
20
|
+
binary: string | null;
|
|
21
|
+
bundleId?: string;
|
|
22
|
+
externalDir?: string | null;
|
|
23
|
+
userExternalDir?: boolean;
|
|
24
|
+
registryKey?: string | null;
|
|
25
|
+
processNames: string[];
|
|
26
|
+
defaultIds: string[];
|
|
27
|
+
externalExtensions: boolean;
|
|
28
|
+
installed: boolean;
|
|
29
|
+
hasProfile: boolean;
|
|
30
|
+
}
|
|
31
|
+
export type Exists = (file: string) => boolean;
|
|
32
|
+
export interface CatalogOptions {
|
|
33
|
+
platform?: string;
|
|
34
|
+
home?: string;
|
|
35
|
+
env?: NodeJS.ProcessEnv;
|
|
36
|
+
exists?: Exists;
|
|
37
|
+
}
|
|
38
|
+
export declare const NON_CHROMIUM_DEFAULTS: readonly {
|
|
39
|
+
id: string;
|
|
40
|
+
label: string;
|
|
41
|
+
match: string[];
|
|
42
|
+
}[];
|
|
43
|
+
export declare const BROWSER_IDS: readonly string[];
|
|
44
|
+
export declare const pathFor: (platform: string) => typeof path.posix;
|
|
45
|
+
export declare function catalogBrowsers({ platform, home, env, exists, }?: CatalogOptions): CatalogBrowser[];
|
|
46
|
+
export declare function detectBrowsers(options?: CatalogOptions): CatalogBrowser[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { BskClient } from "./ipc-client.js";
|
|
2
|
+
import { BskSession } from "./session.js";
|
|
3
|
+
export declare function isTabGroupingExtension(browser: unknown): boolean;
|
|
4
|
+
export declare const TAB_GROUPING_EXTENSION_STEP = "Update the BrowserSkill extension to 0.4.1 or later (chrome://extensions -> Developer mode -> Update, or wait for the store update). Version 0.4.0 puts each task's tabs into a \"BrowserSkill\" tab group that the browser saves and syncs, so the group stays after the task ends; delete any saved \"BrowserSkill\" tab groups by hand.";
|
|
5
|
+
export declare function listBrowsers(client: BskClient, { waitForBrowserMs }?: {
|
|
6
|
+
waitForBrowserMs?: number;
|
|
7
|
+
}): Promise<unknown[]>;
|
|
8
|
+
export interface ConnectBrowserSkillOptions {
|
|
9
|
+
client?: BskClient;
|
|
10
|
+
home?: string;
|
|
11
|
+
env?: NodeJS.ProcessEnv;
|
|
12
|
+
sockPath?: string;
|
|
13
|
+
autoStart?: boolean;
|
|
14
|
+
timeoutMs?: number;
|
|
15
|
+
bskBin?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
browser?: string | null | undefined;
|
|
18
|
+
width?: number;
|
|
19
|
+
height?: number;
|
|
20
|
+
focused?: boolean;
|
|
21
|
+
waitForBrowserMs?: number;
|
|
22
|
+
}
|
|
23
|
+
export declare function connectBrowserSkill({ client, home, env, sockPath, autoStart, timeoutMs, bskBin, name, browser, width, height, focused, waitForBrowserMs, }?: ConnectBrowserSkillOptions): Promise<BskSession>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface DaemonInfo {
|
|
2
|
+
sock_path: string;
|
|
3
|
+
[field: string]: unknown;
|
|
4
|
+
}
|
|
5
|
+
export interface StartDaemonOptions {
|
|
6
|
+
home?: string;
|
|
7
|
+
env?: NodeJS.ProcessEnv;
|
|
8
|
+
bskBin?: string | undefined;
|
|
9
|
+
timeoutMs?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function resolveBskHome(env?: NodeJS.ProcessEnv): string;
|
|
12
|
+
export declare function daemonInfoPath(home: string): string;
|
|
13
|
+
export declare function readDaemonInfo(home: string): DaemonInfo | null;
|
|
14
|
+
export declare function findBskBinary(env?: NodeJS.ProcessEnv): string;
|
|
15
|
+
export declare function windowsDaemonTaskName(home: string): string;
|
|
16
|
+
export declare function startDaemonWithCli({ home, env, bskBin, timeoutMs, }?: StartDaemonOptions): Promise<void>;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { StoreId } from "./browsers.js";
|
|
2
|
+
export { BROWSERSKILL_EXTENSION_IDS, STORE_PAGE_URLS, STORE_UPDATE_URLS, catalogBrowsers, detectBrowsers, } from "./browsers.js";
|
|
3
|
+
export interface ExtensionBrowser {
|
|
4
|
+
id: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
store: StoreId;
|
|
7
|
+
userDataDir?: string;
|
|
8
|
+
externalDir?: string | null;
|
|
9
|
+
userExternalDir?: boolean;
|
|
10
|
+
registryKey?: string | null;
|
|
11
|
+
externalExtensions?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface StoreEntry {
|
|
14
|
+
kind: "store";
|
|
15
|
+
needsRestart: false;
|
|
16
|
+
storeUrl: string;
|
|
17
|
+
humanStep: string;
|
|
18
|
+
}
|
|
19
|
+
export interface RegistryEntry {
|
|
20
|
+
kind: "registry";
|
|
21
|
+
key: string;
|
|
22
|
+
needsRestart: false;
|
|
23
|
+
storeUrl: string;
|
|
24
|
+
regAddArgs: string[];
|
|
25
|
+
regDeleteArgs: string[];
|
|
26
|
+
humanStep: string;
|
|
27
|
+
}
|
|
28
|
+
export interface FileEntry {
|
|
29
|
+
kind: "file";
|
|
30
|
+
path: string;
|
|
31
|
+
content: string;
|
|
32
|
+
needsRestart: true;
|
|
33
|
+
storeUrl: string;
|
|
34
|
+
humanStep: string;
|
|
35
|
+
}
|
|
36
|
+
export type ExtensionEntry = StoreEntry | RegistryEntry | FileEntry;
|
|
37
|
+
export type ExtensionRegistration = ExtensionEntry & {
|
|
38
|
+
registered: boolean;
|
|
39
|
+
alreadyPresent: boolean;
|
|
40
|
+
reason?: "store_only" | "blocklisted" | "reg_failed" | "not_writable";
|
|
41
|
+
detail?: string | undefined;
|
|
42
|
+
};
|
|
43
|
+
export type ExtensionRemoval = ExtensionEntry & {
|
|
44
|
+
removed: boolean;
|
|
45
|
+
detail?: string | undefined;
|
|
46
|
+
};
|
|
47
|
+
type ReadFile = (file: string, encoding: "utf8") => string;
|
|
48
|
+
type WriteFile = (file: string, content: string) => void;
|
|
49
|
+
type RunReg = (args: string[]) => Promise<{
|
|
50
|
+
code: number | null;
|
|
51
|
+
stderr?: string;
|
|
52
|
+
}>;
|
|
53
|
+
export declare function externalExtensionEntry({ platform, browser, }: {
|
|
54
|
+
platform?: string;
|
|
55
|
+
browser: ExtensionBrowser;
|
|
56
|
+
}): ExtensionEntry;
|
|
57
|
+
export declare function isBlocklisted(browser: {
|
|
58
|
+
userDataDir?: string;
|
|
59
|
+
}, id: string, { readFile }?: {
|
|
60
|
+
readFile?: ReadFile;
|
|
61
|
+
}): boolean;
|
|
62
|
+
export interface RegisterExternalExtensionOptions {
|
|
63
|
+
platform?: string;
|
|
64
|
+
browser?: ExtensionBrowser;
|
|
65
|
+
writeFile?: WriteFile;
|
|
66
|
+
readFile?: ReadFile;
|
|
67
|
+
runReg?: RunReg;
|
|
68
|
+
}
|
|
69
|
+
export declare function registerExternalExtension({ platform, browser, writeFile, readFile, runReg, }?: RegisterExternalExtensionOptions): Promise<ExtensionRegistration>;
|
|
70
|
+
export declare function unregisterExternalExtension({ platform, browser, runReg, }?: {
|
|
71
|
+
platform?: string;
|
|
72
|
+
browser?: ExtensionBrowser;
|
|
73
|
+
runReg?: RunReg;
|
|
74
|
+
}): Promise<ExtensionRemoval>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare const RECENT_USE_MS: number;
|
|
2
|
+
export interface IdentifiableBrowser {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
installed: boolean;
|
|
6
|
+
defaultIds: string[];
|
|
7
|
+
processNames: string[];
|
|
8
|
+
}
|
|
9
|
+
export interface IdentifySignals {
|
|
10
|
+
defaultBrowser?: string | null;
|
|
11
|
+
running?: string[] | null;
|
|
12
|
+
lastUsed?: Record<string, number | null>;
|
|
13
|
+
}
|
|
14
|
+
export interface DefaultBrowser {
|
|
15
|
+
raw: string | null;
|
|
16
|
+
id: string | null;
|
|
17
|
+
label: string | null;
|
|
18
|
+
supported: boolean | null;
|
|
19
|
+
}
|
|
20
|
+
export interface CandidateRow {
|
|
21
|
+
id: string;
|
|
22
|
+
label: string;
|
|
23
|
+
installed: boolean;
|
|
24
|
+
isDefault: boolean;
|
|
25
|
+
running: boolean | null;
|
|
26
|
+
lastUsedAt: string | null;
|
|
27
|
+
recentlyUsed: boolean;
|
|
28
|
+
signals: string[];
|
|
29
|
+
}
|
|
30
|
+
export type Confidence = "explicit" | "connected" | "default-and-in-use" | "default" | "only-in-use" | "only-running" | "only-installed";
|
|
31
|
+
export interface Identification<B> {
|
|
32
|
+
primary: B | null;
|
|
33
|
+
primaryId: string | null;
|
|
34
|
+
confidence: Confidence | null;
|
|
35
|
+
needsChoice: boolean;
|
|
36
|
+
reason: string;
|
|
37
|
+
suggested?: string | null;
|
|
38
|
+
defaultBrowser: DefaultBrowser;
|
|
39
|
+
candidates: CandidateRow[];
|
|
40
|
+
}
|
|
41
|
+
export interface IdentifyBrowserOptions<B> {
|
|
42
|
+
catalog: B[];
|
|
43
|
+
signals?: IdentifySignals;
|
|
44
|
+
explicit?: string | null;
|
|
45
|
+
connected?: readonly unknown[];
|
|
46
|
+
now?: number;
|
|
47
|
+
}
|
|
48
|
+
export declare function identifyBrowser<B extends IdentifiableBrowser>({ catalog, signals, explicit, connected, now, }: IdentifyBrowserOptions<B>): Identification<B>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type InstallEnv = Record<string, string | undefined>;
|
|
2
|
+
export interface InstallCommand {
|
|
3
|
+
command: string;
|
|
4
|
+
args: string[];
|
|
5
|
+
env: InstallEnv;
|
|
6
|
+
}
|
|
7
|
+
export interface InstallRunResult {
|
|
8
|
+
code: number | null;
|
|
9
|
+
stdout: string;
|
|
10
|
+
stderr: string;
|
|
11
|
+
}
|
|
12
|
+
export type InstallRunner = (command: string, args: string[], env: InstallEnv) => Promise<InstallRunResult>;
|
|
13
|
+
export interface InstallBskCliOptions {
|
|
14
|
+
platform?: string;
|
|
15
|
+
home?: string;
|
|
16
|
+
installDir?: string | undefined;
|
|
17
|
+
version?: string;
|
|
18
|
+
run?: InstallRunner;
|
|
19
|
+
}
|
|
20
|
+
export type InstallBskCliResult = {
|
|
21
|
+
installed: boolean;
|
|
22
|
+
bskBin: string | null;
|
|
23
|
+
code: number | null;
|
|
24
|
+
stdout: string;
|
|
25
|
+
stderr: string;
|
|
26
|
+
restoredRcFiles: string[];
|
|
27
|
+
};
|
|
28
|
+
export declare function cliInstallCommand({ platform, installDir, version, }?: {
|
|
29
|
+
platform?: string;
|
|
30
|
+
installDir?: string;
|
|
31
|
+
version?: string | undefined;
|
|
32
|
+
}): InstallCommand;
|
|
33
|
+
export declare function runDefault(command: string, args: string[], env: InstallEnv): Promise<InstallRunResult>;
|
|
34
|
+
export declare function snapshotRcFiles(home: string): Map<string, Buffer | null>;
|
|
35
|
+
export declare function restoreRcFiles(snapshot: ReadonlyMap<string, Buffer | null>): string[];
|
|
36
|
+
export declare function installBskCli({ platform, home, installDir, version, run, }?: InstallBskCliOptions): Promise<InstallBskCliResult>;
|
|
37
|
+
export declare function cliVersionDefault(bskBin: string): Promise<string | null>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { DaemonInfo } from "./daemon-info.js";
|
|
2
|
+
export { readDaemonInfo, resolveBskHome } from "./daemon-info.js";
|
|
3
|
+
export interface BskCallOptions {
|
|
4
|
+
idPrefix?: string;
|
|
5
|
+
timeoutMs?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface BskClient {
|
|
8
|
+
call(method: string, params?: unknown, options?: BskCallOptions): Promise<unknown>;
|
|
9
|
+
}
|
|
10
|
+
export interface BskCallHandle {
|
|
11
|
+
rpcId: string;
|
|
12
|
+
promise: Promise<unknown>;
|
|
13
|
+
abort: () => void;
|
|
14
|
+
}
|
|
15
|
+
export interface BskIpcClientOptions {
|
|
16
|
+
home?: string | undefined;
|
|
17
|
+
env?: NodeJS.ProcessEnv | undefined;
|
|
18
|
+
sockPath?: string | undefined;
|
|
19
|
+
autoStart?: boolean | undefined;
|
|
20
|
+
startDaemon?: () => Promise<unknown>;
|
|
21
|
+
timeoutMs?: number | undefined;
|
|
22
|
+
bskBin?: string | undefined;
|
|
23
|
+
}
|
|
24
|
+
interface StaleRecord {
|
|
25
|
+
info: DaemonInfo;
|
|
26
|
+
code: string | undefined;
|
|
27
|
+
}
|
|
28
|
+
export declare function defaultSocketPath(home: string, env?: NodeJS.ProcessEnv): string;
|
|
29
|
+
export declare class BskRpcError extends Error {
|
|
30
|
+
code: string;
|
|
31
|
+
data: unknown;
|
|
32
|
+
constructor(code: string, message: string, data?: unknown);
|
|
33
|
+
}
|
|
34
|
+
export declare class BskIpcClient {
|
|
35
|
+
#private;
|
|
36
|
+
constructor({ home, env, sockPath, autoStart, startDaemon, timeoutMs, bskBin, }?: BskIpcClientOptions);
|
|
37
|
+
get home(): string;
|
|
38
|
+
resolveSocket({ isAborted, stale, }?: {
|
|
39
|
+
isAborted?: () => boolean;
|
|
40
|
+
stale?: StaleRecord | undefined;
|
|
41
|
+
}): Promise<string>;
|
|
42
|
+
call(method: string, params?: unknown, options?: BskCallOptions): Promise<unknown>;
|
|
43
|
+
callWithHandle(method: string, params?: unknown, { idPrefix, timeoutMs }?: BskCallOptions): BskCallHandle;
|
|
44
|
+
cancel(rpcId: string): Promise<unknown>;
|
|
45
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { BskClient } from "./ipc-client.js";
|
|
2
|
+
import type { ExtensionEntry, ExtensionRegistration } from "./external-extension.js";
|
|
3
|
+
import type { BrowserSignals, ProbeBrowserSignalsOptions } from "./browser-signals.js";
|
|
4
|
+
import type { Identification, IdentifySignals } from "./identify-browser.js";
|
|
5
|
+
import type { CatalogBrowser, Exists } from "./browsers.js";
|
|
6
|
+
type CliVersion = (bskBin: string) => Promise<string | null>;
|
|
7
|
+
type ProbeSignals = (options: ProbeBrowserSignalsOptions) => Promise<BrowserSignals>;
|
|
8
|
+
export interface CliReport {
|
|
9
|
+
installed: boolean;
|
|
10
|
+
bskBin: string | null;
|
|
11
|
+
version: string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface DaemonReport {
|
|
14
|
+
running: boolean;
|
|
15
|
+
version?: unknown;
|
|
16
|
+
protocolVersion?: unknown;
|
|
17
|
+
error?: unknown;
|
|
18
|
+
code?: unknown;
|
|
19
|
+
startBlocked?: boolean;
|
|
20
|
+
browsers: unknown;
|
|
21
|
+
sessions: unknown;
|
|
22
|
+
}
|
|
23
|
+
export type RegisteredBrowser = CatalogBrowser & {
|
|
24
|
+
registration: ExtensionEntry;
|
|
25
|
+
extensionRegistered: boolean;
|
|
26
|
+
};
|
|
27
|
+
export type BrowserIdentification = Omit<Identification<RegisteredBrowser>, "primary"> & {
|
|
28
|
+
registeredElsewhere: string[];
|
|
29
|
+
};
|
|
30
|
+
export interface InstallOutcome {
|
|
31
|
+
installed: boolean;
|
|
32
|
+
bskBin: string | null;
|
|
33
|
+
[field: string]: unknown;
|
|
34
|
+
}
|
|
35
|
+
export type InstallCli = (options: {
|
|
36
|
+
platform: string;
|
|
37
|
+
home: string;
|
|
38
|
+
installDir?: string | undefined;
|
|
39
|
+
}) => Promise<InstallOutcome>;
|
|
40
|
+
export interface HumanStepEvent {
|
|
41
|
+
browser: unknown;
|
|
42
|
+
step: string;
|
|
43
|
+
registered: boolean;
|
|
44
|
+
needsRestart: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface BskDoctorOptions {
|
|
47
|
+
platform?: string;
|
|
48
|
+
home?: string;
|
|
49
|
+
env?: NodeJS.ProcessEnv;
|
|
50
|
+
client?: BskClient;
|
|
51
|
+
bskBin?: string | null;
|
|
52
|
+
cliVersion?: CliVersion;
|
|
53
|
+
waitForBrowserMs?: number;
|
|
54
|
+
exists?: Exists;
|
|
55
|
+
browser?: string;
|
|
56
|
+
signals?: IdentifySignals;
|
|
57
|
+
probeSignals?: ProbeSignals;
|
|
58
|
+
now?: number;
|
|
59
|
+
}
|
|
60
|
+
export interface BskDoctorReport {
|
|
61
|
+
cli: CliReport;
|
|
62
|
+
daemon: DaemonReport;
|
|
63
|
+
browsers: RegisteredBrowser[];
|
|
64
|
+
primary: RegisteredBrowser | null;
|
|
65
|
+
identification: BrowserIdentification;
|
|
66
|
+
browsersConnected: unknown[];
|
|
67
|
+
outdatedExtensions: unknown[];
|
|
68
|
+
ready: boolean;
|
|
69
|
+
nextStep?: string | null;
|
|
70
|
+
}
|
|
71
|
+
export interface BskOnboardOptions extends BskDoctorOptions {
|
|
72
|
+
installDir?: string;
|
|
73
|
+
installCli?: InstallCli;
|
|
74
|
+
onHumanStep?: (event: HumanStepEvent) => void;
|
|
75
|
+
waitTotalMs?: number;
|
|
76
|
+
}
|
|
77
|
+
export interface BskOnboardReport {
|
|
78
|
+
cli: CliReport;
|
|
79
|
+
install: InstallOutcome | null;
|
|
80
|
+
daemon: DaemonReport;
|
|
81
|
+
browsers: RegisteredBrowser[];
|
|
82
|
+
primary: RegisteredBrowser | null;
|
|
83
|
+
identification: BrowserIdentification;
|
|
84
|
+
needsChoice: boolean;
|
|
85
|
+
registrations: Array<{
|
|
86
|
+
browser: string;
|
|
87
|
+
} & ExtensionRegistration>;
|
|
88
|
+
humanStep: string | null;
|
|
89
|
+
nextStep: string | null;
|
|
90
|
+
browsersConnected: unknown[];
|
|
91
|
+
outdatedExtensions: unknown[];
|
|
92
|
+
ready: boolean;
|
|
93
|
+
}
|
|
94
|
+
export declare function bskDoctor({ platform, home, env, client, bskBin, cliVersion, waitForBrowserMs, exists, browser, signals, probeSignals, now, }?: BskDoctorOptions): Promise<BskDoctorReport>;
|
|
95
|
+
export declare function bskOnboard({ platform, home, env, client, bskBin, installDir, installCli, cliVersion, onHumanStep, waitForBrowserMs, waitTotalMs, exists, browser, signals, probeSignals, now, }?: BskOnboardOptions): Promise<BskOnboardReport>;
|
|
96
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface ToolSession {
|
|
2
|
+
tool(name: string, params?: Record<string, unknown>): Promise<unknown>;
|
|
3
|
+
}
|
|
4
|
+
export interface ScreenshotOptions {
|
|
5
|
+
ref?: string;
|
|
6
|
+
tabId?: number;
|
|
7
|
+
fullPage?: boolean;
|
|
8
|
+
scope?: string;
|
|
9
|
+
timeoutMs?: number;
|
|
10
|
+
context?: string;
|
|
11
|
+
dependsOn?: readonly string[];
|
|
12
|
+
}
|
|
13
|
+
export interface Screenshot {
|
|
14
|
+
buffer: Buffer;
|
|
15
|
+
width: unknown;
|
|
16
|
+
height: unknown;
|
|
17
|
+
format: unknown;
|
|
18
|
+
captureId: unknown;
|
|
19
|
+
captureUnavailable?: unknown;
|
|
20
|
+
scope?: unknown;
|
|
21
|
+
tabId: unknown;
|
|
22
|
+
dialogs: unknown;
|
|
23
|
+
}
|
|
24
|
+
export declare function captureScreenshot(session: ToolSession, { ref, tabId, fullPage, scope, timeoutMs, context, dependsOn }?: ScreenshotOptions): Promise<Screenshot>;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import type { Target } from "./targets.js";
|
|
2
|
+
import type { Screenshot, ScreenshotOptions } from "./screenshot.js";
|
|
3
|
+
import type { BskClient } from "./ipc-client.js";
|
|
4
|
+
export interface SharedTabOptions {
|
|
5
|
+
context?: string | undefined;
|
|
6
|
+
dependsOn?: readonly string[] | undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface BskSessionInit {
|
|
9
|
+
sessionId?: unknown;
|
|
10
|
+
browserInstanceId?: unknown;
|
|
11
|
+
agentWindowId?: unknown;
|
|
12
|
+
interaction?: unknown;
|
|
13
|
+
}
|
|
14
|
+
export interface NavigationOptions extends SharedTabOptions {
|
|
15
|
+
tabId?: number;
|
|
16
|
+
waitUntil?: string;
|
|
17
|
+
timeoutMs?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface TabTimeoutOptions extends SharedTabOptions {
|
|
20
|
+
tabId?: number | undefined;
|
|
21
|
+
timeoutMs?: number | undefined;
|
|
22
|
+
}
|
|
23
|
+
export interface EvaluateOptions extends TabTimeoutOptions {
|
|
24
|
+
awaitPromise?: boolean;
|
|
25
|
+
returnByValue?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare class BskSession {
|
|
28
|
+
#private;
|
|
29
|
+
sessionId: string;
|
|
30
|
+
browserInstanceId: unknown;
|
|
31
|
+
agentWindowId: unknown;
|
|
32
|
+
interaction: unknown;
|
|
33
|
+
constructor(client: BskClient, { sessionId, browserInstanceId, agentWindowId, interaction }?: BskSessionInit);
|
|
34
|
+
get client(): BskClient;
|
|
35
|
+
get stopped(): boolean;
|
|
36
|
+
tool(name: string, params?: Record<string, unknown>): Promise<unknown>;
|
|
37
|
+
cooperate(action: string, { tabId, timeoutMs, maxTokens }?: {
|
|
38
|
+
tabId?: number;
|
|
39
|
+
timeoutMs?: number;
|
|
40
|
+
maxTokens?: number;
|
|
41
|
+
}): Promise<unknown>;
|
|
42
|
+
navigate(url: string, { tabId, waitUntil, timeoutMs, ...shared }?: NavigationOptions): Promise<unknown>;
|
|
43
|
+
back({ tabId, waitUntil, timeoutMs, ...shared }?: NavigationOptions): Promise<unknown>;
|
|
44
|
+
forward({ tabId, waitUntil, timeoutMs, ...shared }?: NavigationOptions): Promise<unknown>;
|
|
45
|
+
reload({ tabId, waitUntil, timeoutMs, hard, ...shared }?: NavigationOptions & {
|
|
46
|
+
hard?: boolean;
|
|
47
|
+
}): Promise<unknown>;
|
|
48
|
+
observe({ cursor, tabId, maxDepth, maxTokens, debugSurfaces, probeHover, ...shared }?: SharedTabOptions & {
|
|
49
|
+
cursor?: string;
|
|
50
|
+
tabId?: number;
|
|
51
|
+
maxDepth?: number;
|
|
52
|
+
maxTokens?: number;
|
|
53
|
+
debugSurfaces?: boolean;
|
|
54
|
+
probeHover?: boolean;
|
|
55
|
+
}): Promise<unknown>;
|
|
56
|
+
snapshot({ tabId, maxDepth, maxTokens, }?: {
|
|
57
|
+
tabId?: number;
|
|
58
|
+
maxDepth?: number;
|
|
59
|
+
maxTokens?: number;
|
|
60
|
+
}): Promise<unknown>;
|
|
61
|
+
getHtml({ ref, tabId, maxBytes }?: {
|
|
62
|
+
ref?: string;
|
|
63
|
+
tabId?: number;
|
|
64
|
+
maxBytes?: number;
|
|
65
|
+
}): Promise<unknown>;
|
|
66
|
+
screenshot(options?: ScreenshotOptions): Promise<Screenshot>;
|
|
67
|
+
click(target: Target, { button, clickCount, modifiers, tabId, timeoutMs, ...shared }?: TabTimeoutOptions & {
|
|
68
|
+
button?: string | undefined;
|
|
69
|
+
clickCount?: number;
|
|
70
|
+
modifiers?: string[];
|
|
71
|
+
}): Promise<unknown>;
|
|
72
|
+
hover(target: Target, { modifiers, settleMs, tabId, timeoutMs, ...shared }?: TabTimeoutOptions & {
|
|
73
|
+
modifiers?: string[];
|
|
74
|
+
settleMs?: number;
|
|
75
|
+
}): Promise<unknown>;
|
|
76
|
+
focus(target: Target, { tabId, timeoutMs, ...shared }?: TabTimeoutOptions): Promise<unknown>;
|
|
77
|
+
blur(target: Target, { tabId, timeoutMs, ...shared }?: TabTimeoutOptions): Promise<unknown>;
|
|
78
|
+
fill(target: Target, value: string, { clearBefore, tabId, timeoutMs, ...shared }?: TabTimeoutOptions & {
|
|
79
|
+
clearBefore?: boolean;
|
|
80
|
+
}): Promise<unknown>;
|
|
81
|
+
press(key: string, { target, modifiers, holdMs, tabId, timeoutMs, ...shared }?: TabTimeoutOptions & {
|
|
82
|
+
target?: Target;
|
|
83
|
+
modifiers?: string[];
|
|
84
|
+
holdMs?: number;
|
|
85
|
+
}): Promise<unknown>;
|
|
86
|
+
select(target: Target, values: string | string[], { tabId, timeoutMs, ...shared }?: TabTimeoutOptions): Promise<unknown>;
|
|
87
|
+
scrollTo(target: Target, { tabId, timeoutMs, ...shared }?: TabTimeoutOptions): Promise<unknown>;
|
|
88
|
+
wheel({ deltaX, deltaY, target, modifiers, tabId, timeoutMs, ...shared }?: TabTimeoutOptions & {
|
|
89
|
+
deltaX?: number;
|
|
90
|
+
deltaY?: number;
|
|
91
|
+
target?: Target;
|
|
92
|
+
modifiers?: string[];
|
|
93
|
+
}): Promise<unknown>;
|
|
94
|
+
evaluate(expression: string, { tabId, awaitPromise, returnByValue, timeoutMs, ...shared }?: EvaluateOptions): Promise<unknown>;
|
|
95
|
+
tabList({ scope }?: {
|
|
96
|
+
scope?: string;
|
|
97
|
+
}): Promise<unknown>;
|
|
98
|
+
tabCreate({ url, active, index }?: {
|
|
99
|
+
url?: string;
|
|
100
|
+
active?: boolean;
|
|
101
|
+
index?: number;
|
|
102
|
+
}): Promise<unknown>;
|
|
103
|
+
tabClose(tabId: number, shared?: SharedTabOptions): Promise<unknown>;
|
|
104
|
+
tabSelect(tabId: number): Promise<unknown>;
|
|
105
|
+
tabBorrow(tabId: number, { confirmationTimeoutMs }?: {
|
|
106
|
+
confirmationTimeoutMs?: number;
|
|
107
|
+
}): Promise<unknown>;
|
|
108
|
+
tabReturn(tabId: number): Promise<unknown>;
|
|
109
|
+
waitForNavigation({ tabId, waitUntil, timeoutMs, }?: {
|
|
110
|
+
tabId?: number;
|
|
111
|
+
waitUntil?: string;
|
|
112
|
+
timeoutMs?: number;
|
|
113
|
+
}): Promise<unknown>;
|
|
114
|
+
requestHelp({ prompt, title, targets, completionCriteria, tabId, timeoutMs, }?: {
|
|
115
|
+
prompt?: string;
|
|
116
|
+
title?: string;
|
|
117
|
+
targets?: Target[];
|
|
118
|
+
completionCriteria?: unknown;
|
|
119
|
+
tabId?: number;
|
|
120
|
+
timeoutMs?: number;
|
|
121
|
+
}): Promise<unknown>;
|
|
122
|
+
console({ tabId, since, limit, maxTextChars, includeStack, }?: {
|
|
123
|
+
tabId?: number;
|
|
124
|
+
since?: number;
|
|
125
|
+
limit?: number;
|
|
126
|
+
maxTextChars?: number;
|
|
127
|
+
includeStack?: boolean;
|
|
128
|
+
}): Promise<unknown>;
|
|
129
|
+
network({ tabId, since, limit, maxTextChars, }?: {
|
|
130
|
+
tabId?: number;
|
|
131
|
+
since?: number;
|
|
132
|
+
limit?: number;
|
|
133
|
+
maxTextChars?: number;
|
|
134
|
+
}): Promise<unknown>;
|
|
135
|
+
resize(width: number, height: number, shared?: SharedTabOptions): Promise<unknown>;
|
|
136
|
+
emulate({ tabId, off, overrides, ...shared }?: SharedTabOptions & {
|
|
137
|
+
tabId?: number;
|
|
138
|
+
off?: boolean;
|
|
139
|
+
overrides?: Record<string, unknown>;
|
|
140
|
+
}): Promise<unknown>;
|
|
141
|
+
stop(): Promise<unknown>;
|
|
142
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { BskSession } from "./session.js";
|
|
2
|
+
export type EvaluateSession = Pick<BskSession, "evaluate">;
|
|
3
|
+
export interface BskSnapshotOptions {
|
|
4
|
+
tabId?: number;
|
|
5
|
+
timeoutMs?: number;
|
|
6
|
+
context?: string;
|
|
7
|
+
dependsOn?: readonly string[];
|
|
8
|
+
[option: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface BskSnapshot {
|
|
11
|
+
tree: string;
|
|
12
|
+
refs: unknown;
|
|
13
|
+
css: unknown;
|
|
14
|
+
}
|
|
15
|
+
export declare function buildSnapshotExpression(options?: Record<string, unknown>): string;
|
|
16
|
+
export declare function bskSnapshot(session: EvaluateSession, { tabId, timeoutMs, context, dependsOn, ...snapshotOptions }?: BskSnapshotOptions): Promise<BskSnapshot>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface TargetSpec {
|
|
2
|
+
ref?: string;
|
|
3
|
+
selector?: string;
|
|
4
|
+
captureId?: string;
|
|
5
|
+
x?: number;
|
|
6
|
+
y?: number;
|
|
7
|
+
}
|
|
8
|
+
export type Target = string | TargetSpec;
|
|
9
|
+
export type ResolvedTarget = {
|
|
10
|
+
ref: string;
|
|
11
|
+
} | {
|
|
12
|
+
selector: string;
|
|
13
|
+
} | {
|
|
14
|
+
capture_id: string;
|
|
15
|
+
image_x: unknown;
|
|
16
|
+
image_y: unknown;
|
|
17
|
+
};
|
|
18
|
+
export declare function resolveTarget(target: unknown): ResolvedTarget;
|
|
19
|
+
export declare function optionalTarget(target: unknown): ResolvedTarget | Record<string, never>;
|
|
20
|
+
export declare function compact(params: Record<string, unknown>): Record<string, unknown>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type CaptchaWaitOutcome = "matched" | "cancelled" | "timed_out";
|
|
2
|
+
export interface CaptchaWaitResult {
|
|
3
|
+
outcome: CaptchaWaitOutcome;
|
|
4
|
+
elapsedMs: number;
|
|
5
|
+
}
|
|
6
|
+
/** Polled until it returns exactly `true`; `signal` aborts once the wait ends. */
|
|
7
|
+
export type CaptchaWaitPredicate<P> = (page: P, context: {
|
|
8
|
+
signal: AbortSignal;
|
|
9
|
+
}) => unknown;
|
|
10
|
+
export interface CaptchaWaitOptions<P> {
|
|
11
|
+
/** Required: waitForCaptcha throws a TypeError without it. */
|
|
12
|
+
until?: CaptchaWaitPredicate<P> | undefined;
|
|
13
|
+
timeoutMs?: number | undefined;
|
|
14
|
+
pollMs?: number | undefined;
|
|
15
|
+
signal?: AbortSignal | undefined;
|
|
16
|
+
}
|
|
17
|
+
export declare function waitForCaptcha<P>(page: P, { until, timeoutMs, pollMs, signal }?: CaptchaWaitOptions<P>): Promise<CaptchaWaitResult>;
|