browse 0.11.3 → 0.11.4
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 +56 -25
- package/bin/run.js +2 -5
- package/dist/commands/click.js +1 -1
- package/dist/commands/cloud/contexts/get.js +1 -1
- package/dist/commands/cloud/contexts/list.js +2 -5
- package/dist/commands/cloud/extensions/get.js +1 -1
- package/dist/commands/cloud/extensions/upload.js +34 -8
- package/dist/commands/cloud/projects/get.js +1 -1
- package/dist/commands/cloud/projects/list.js +2 -5
- package/dist/commands/cloud/projects/usage.js +1 -1
- package/dist/commands/cloud/search.js +2 -2
- package/dist/commands/cloud/secrets/list.js +1 -1
- package/dist/commands/cloud/sessions/create.js +2 -7
- package/dist/commands/cloud/sessions/debug.js +1 -1
- package/dist/commands/cloud/sessions/get.js +1 -1
- package/dist/commands/cloud/sessions/list.js +2 -2
- package/dist/commands/cloud/sessions/logs.js +2 -4
- package/dist/commands/cloud/sessions/uploads/create.js +1 -3
- package/dist/commands/cursor.js +2 -5
- package/dist/commands/doctor.js +1 -1
- package/dist/commands/eval.js +1 -1
- package/dist/commands/fill.js +1 -1
- package/dist/commands/functions/secrets/list.js +1 -1
- package/dist/commands/get.js +1 -1
- package/dist/commands/highlight.js +1 -1
- package/dist/commands/is.js +1 -1
- package/dist/commands/network/clear.js +2 -5
- package/dist/commands/network/off.js +2 -5
- package/dist/commands/network/on.js +2 -5
- package/dist/commands/network/path.js +2 -5
- package/dist/commands/press.js +2 -6
- package/dist/commands/select.js +1 -1
- package/dist/commands/skills/find.js +1 -1
- package/dist/commands/skills/list.js +2 -2
- package/dist/commands/skills/show.js +3 -1
- package/dist/commands/snapshot.js +1 -1
- package/dist/commands/status.js +1 -4
- package/dist/commands/tab/close.js +1 -1
- package/dist/commands/tab/list.js +2 -5
- package/dist/commands/tab/new.js +1 -1
- package/dist/commands/tab/switch.js +1 -1
- package/dist/commands/templates/find.js +1 -1
- package/dist/commands/templates/list.js +1 -1
- package/dist/commands/type.js +1 -1
- package/dist/commands/upload.js +1 -1
- package/dist/hooks/command-not-found.js +2 -6
- package/dist/lib/child-process.js +22 -0
- package/dist/lib/cloud/api.js +1 -2
- package/dist/lib/cloud/reduce-logs.js +3 -6
- package/dist/lib/driver/cdp-tail.js +4 -15
- package/dist/lib/driver/command-cli.js +21 -12
- package/dist/lib/driver/commands/elements.js +2 -6
- package/dist/lib/driver/commands/navigation.js +2 -4
- package/dist/lib/driver/commands/page-info.js +1 -3
- package/dist/lib/driver/commands/runtime.js +2 -5
- package/dist/lib/driver/commands/selectors.js +2 -6
- package/dist/lib/driver/commands/tabs.js +3 -8
- package/dist/lib/driver/daemon/client.js +30 -20
- package/dist/lib/driver/daemon/paths.js +131 -9
- package/dist/lib/driver/daemon/server.js +3 -5
- package/dist/lib/driver/doctor.js +19 -8
- package/dist/lib/driver/local-cdp-discovery.js +1 -1
- package/dist/lib/driver/network-capture.js +1 -1
- package/dist/lib/driver/network-cdp-sidecar.js +14 -11
- package/dist/lib/driver/remote.js +1 -1
- package/dist/lib/driver/runtime.js +7 -3
- package/dist/lib/driver/session-manager.js +7 -5
- package/dist/lib/functions/dev.js +21 -18
- package/dist/lib/functions/init.js +8 -8
- package/dist/lib/functions/publish.js +6 -9
- package/dist/lib/functions/shared.js +4 -2
- package/dist/lib/secrets/seal.js +1 -4
- package/dist/lib/skills/catalog.js +1 -2
- package/dist/lib/skills/install.js +11 -39
- package/dist/lib/telemetry.js +5 -17
- package/dist/lib/templates/api.js +1 -2
- package/dist/lib/templates/scaffold.js +5 -7
- package/dist/lib/update.js +2 -5
- package/oclif.manifest.json +198 -191
- package/package.json +79 -66
- package/skills/browse/SKILL.md +1 -0
package/README.md
CHANGED
|
@@ -47,21 +47,27 @@ browse stop
|
|
|
47
47
|
|
|
48
48
|
`browse` runs a lightweight per-session daemon. The first command starts it, and subsequent commands reuse the same browser — so cookies, tabs, and snapshot refs persist between invocations. Run multiple isolated browsers at once with `--session <name>` (or the `BROWSE_SESSION` env var), and shut a session down with `browse stop`.
|
|
49
49
|
|
|
50
|
+
Commands without target flags reuse the running session's browser, including its headed mode, custom Chrome arguments, or remote settings. Passing only `--local` or `--remote` also reuses a session in that mode. Explicit launch options must match the running session; use `browse stop --session <name>` before changing them.
|
|
51
|
+
|
|
52
|
+
If a daemon disappears after a command selects it, that command fails instead of starting a replacement from the daemon's reported settings. To start a new session, run `browse open <url> --session <name>` with your desired target and launch flags again. When no daemon is running, Browse uses the current command's flags and environment defaults; previous launch settings are not saved.
|
|
53
|
+
|
|
54
|
+
On Unix, custom `BROWSE_DAEMON_DIR` locations must be owned by you and have trusted parents owned by you or root. Shared writable parents need sticky-bit protection, as standard `/tmp` provides. These checks also apply when `TMPDIR` changes the default location.
|
|
55
|
+
|
|
50
56
|
### Browser targets
|
|
51
57
|
|
|
52
58
|
Every driver command accepts the same flags to pick where the browser runs. Mix and match per command:
|
|
53
59
|
|
|
54
|
-
| Flag
|
|
55
|
-
|
|
56
|
-
| _(default)_
|
|
57
|
-
| `--local`
|
|
58
|
-
| `--remote`
|
|
59
|
-
| `--auto-connect`
|
|
60
|
-
| `--cdp <url\|port>`
|
|
61
|
-
| `--target-id <id>`
|
|
62
|
-
| `--chrome-arg <flag>`
|
|
63
|
-
| `--ignore-default-chrome-arg <flag>` | Drop a specific Chrome default launch arg (repeatable, managed-local only)
|
|
64
|
-
| `--no-default-chrome-args`
|
|
60
|
+
| Flag | Target |
|
|
61
|
+
| ------------------------------------ | ---------------------------------------------------------------------------------- |
|
|
62
|
+
| _(default)_ | Managed local browser, or remote when `BROWSERBASE_API_KEY` is set |
|
|
63
|
+
| `--local` | Managed local browser (add `--headed` / `--headless`) |
|
|
64
|
+
| `--remote` | Remote Browserbase session (uses `BROWSERBASE_API_KEY`) |
|
|
65
|
+
| `--auto-connect` | Auto-discover and attach to a local Chrome with remote debugging enabled |
|
|
66
|
+
| `--cdp <url\|port>` | Attach directly to a CDP endpoint (port, `http(s)://`, or `ws(s)://`) |
|
|
67
|
+
| `--target-id <id>` | Select a specific CDP target when attaching to an existing browser |
|
|
68
|
+
| `--chrome-arg <flag>` | Append a Chrome launch arg on top of the defaults (repeatable, managed-local only) |
|
|
69
|
+
| `--ignore-default-chrome-arg <flag>` | Drop a specific Chrome default launch arg (repeatable, managed-local only) |
|
|
70
|
+
| `--no-default-chrome-args` | Launch without any of Chrome's default args (managed-local only) |
|
|
65
71
|
|
|
66
72
|
```bash
|
|
67
73
|
browse open https://example.com # default target
|
|
@@ -184,15 +190,15 @@ browse cdp 9222 # Attach to a CDP endpoint and stream DevTools events (--doma
|
|
|
184
190
|
|
|
185
191
|
These apply across driver commands:
|
|
186
192
|
|
|
187
|
-
| Flag
|
|
188
|
-
|
|
189
|
-
| `-s, --session <name>`
|
|
190
|
-
| `--local` / `--remote`
|
|
191
|
-
| `--headed` / `--headless` | Window visibility for managed local sessions
|
|
192
|
-
| `--auto-connect`
|
|
193
|
-
| `--cdp <url\|port>`
|
|
194
|
-
| `--target-id <id>`
|
|
195
|
-
| `--json`
|
|
193
|
+
| Flag | Description |
|
|
194
|
+
| ------------------------- | ------------------------------------------------------- |
|
|
195
|
+
| `-s, --session <name>` | Named browser session (or `BROWSE_SESSION` env var) |
|
|
196
|
+
| `--local` / `--remote` | Choose a managed local or remote Browserbase browser |
|
|
197
|
+
| `--headed` / `--headless` | Window visibility for managed local sessions |
|
|
198
|
+
| `--auto-connect` | Attach to a local Chrome with remote debugging enabled |
|
|
199
|
+
| `--cdp <url\|port>` | Attach directly to a CDP endpoint |
|
|
200
|
+
| `--target-id <id>` | Select a specific CDP target |
|
|
201
|
+
| `--json` | Emit machine-readable JSON (available on most commands) |
|
|
196
202
|
|
|
197
203
|
## Open web skills catalog
|
|
198
204
|
|
|
@@ -293,11 +299,36 @@ default so `browse` only reads `process.env`. Set `BROWSE_LOAD_DOTENV=0` (or `fa
|
|
|
293
299
|
opt out of `.env` auto-loading now, ahead of that change, or `BROWSE_LOAD_DOTENV=1` to keep
|
|
294
300
|
auto-loading with no warning.
|
|
295
301
|
|
|
296
|
-
| Variable
|
|
297
|
-
|
|
298
|
-
| `BROWSERBASE_API_KEY` | Enables `--remote` sessions and all `browse cloud` / `functions` commands
|
|
299
|
-
| `BROWSE_SESSION`
|
|
300
|
-
| `BROWSE_LOAD_DOTENV`
|
|
302
|
+
| Variable | Description |
|
|
303
|
+
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
304
|
+
| `BROWSERBASE_API_KEY` | Enables `--remote` sessions and all `browse cloud` / `functions` commands |
|
|
305
|
+
| `BROWSE_SESSION` | Default session name (alternative to `-s, --session`) |
|
|
306
|
+
| `BROWSE_LOAD_DOTENV` | Controls `.env` auto-loading: unset = load + warn once (default, deprecated), `0`/`false`/`no` = skip loading, anything else = load silently |
|
|
307
|
+
|
|
308
|
+
## Developing Browse
|
|
309
|
+
|
|
310
|
+
Browse uses the exact published Stagehand version pinned in its `package.json`.
|
|
311
|
+
From the repository root, run `pnpm install`, then
|
|
312
|
+
`pnpm exec turbo run build --filter=browse`. This builds Browse without building
|
|
313
|
+
the workspace SDK. Run `pnpm --filter browse test:cli` for contracts and
|
|
314
|
+
`pnpm --filter browse test:smoke` for a quick Chrome smoke against the local build.
|
|
315
|
+
Run `pnpm --filter browse test:smoke:package` to pack Browse, install it outside the
|
|
316
|
+
repository, and run the same Chrome scenario through the installed executable.
|
|
317
|
+
The Browse Chrome smoke CI jobs run this packed test on Linux and Windows.
|
|
318
|
+
Both commands require Chrome.
|
|
319
|
+
|
|
320
|
+
For an SDK upgrade, publish the SDK first, change Browse's exact dependency
|
|
321
|
+
version, run `pnpm install`, and verify the build and tests. Commit the manifest
|
|
322
|
+
and lockfile together.
|
|
323
|
+
|
|
324
|
+
To experiment with unreleased SDK changes, temporarily change only Browse's
|
|
325
|
+
`@browserbasehq/stagehand` dependency to `workspace:*` and run `pnpm install`.
|
|
326
|
+
Build the local SDK with
|
|
327
|
+
`pnpm exec turbo run build --filter=@browserbasehq/stagehand`, then build and test
|
|
328
|
+
Browse. Keep this override and its lockfile changes uncommitted. When finished,
|
|
329
|
+
restore the published version in Browse's manifest and run `pnpm install` again.
|
|
330
|
+
Rebuild and rerun the tests against the published SDK before submitting changes.
|
|
331
|
+
Release checks reject the local override.
|
|
301
332
|
|
|
302
333
|
## Links
|
|
303
334
|
|
package/bin/run.js
CHANGED
|
@@ -21,15 +21,12 @@ if (!satisfies(process.versions.node, engines.node)) {
|
|
|
21
21
|
// the implicit default get a heads-up before the default changes.
|
|
22
22
|
const dotenvToggle = process.env.BROWSE_LOAD_DOTENV;
|
|
23
23
|
const dotenvOptedOut =
|
|
24
|
-
dotenvToggle !== undefined &&
|
|
25
|
-
["0", "false", "no"].includes(dotenvToggle.toLowerCase());
|
|
24
|
+
dotenvToggle !== undefined && ["0", "false", "no"].includes(dotenvToggle.toLowerCase());
|
|
26
25
|
|
|
27
26
|
if (!dotenvOptedOut) {
|
|
28
27
|
const keysBeforeLoad = new Set(Object.keys(process.env));
|
|
29
28
|
const { parsed } = loadDotenvConfig();
|
|
30
|
-
const appliedFromDotenv = Object.keys(parsed ?? {}).filter(
|
|
31
|
-
(key) => !keysBeforeLoad.has(key),
|
|
32
|
-
);
|
|
29
|
+
const appliedFromDotenv = Object.keys(parsed ?? {}).filter((key) => !keysBeforeLoad.has(key));
|
|
33
30
|
|
|
34
31
|
if (appliedFromDotenv.length > 0 && dotenvToggle === undefined) {
|
|
35
32
|
console.error(
|
package/dist/commands/click.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Args } from "@oclif/core";
|
|
2
2
|
import { BrowseCommand } from "../base.js";
|
|
3
|
-
import { driverCommandFlags, runDriverCommandFromFlags
|
|
3
|
+
import { driverCommandFlags, runDriverCommandFromFlags } from "../lib/driver/command-cli.js";
|
|
4
4
|
export default class Click extends BrowseCommand {
|
|
5
5
|
static description = "Click an element by snapshot ref, XPath, or selector. Use `browse mouse click` for raw coordinates.";
|
|
6
6
|
static examples = [
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Args } from "@oclif/core";
|
|
2
|
-
import { createBrowserbaseClient, outputJson, withBrowserbaseApi
|
|
2
|
+
import { createBrowserbaseClient, outputJson, withBrowserbaseApi } from "../../../lib/cloud/api.js";
|
|
3
3
|
import { resolveContextRefOrFail } from "../../../lib/cloud/contexts-resolve.js";
|
|
4
4
|
import { apiCommonFlags, toApiOptions } from "../../../lib/cloud/flags.js";
|
|
5
5
|
import { BrowseCommand } from "../../../base.js";
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { outputJson } from "../../../lib/cloud/api.js";
|
|
2
|
-
import { listContextAliases
|
|
2
|
+
import { listContextAliases } from "../../../lib/cloud/contexts-store.js";
|
|
3
3
|
import { BrowseCommand } from "../../../base.js";
|
|
4
4
|
import { formatId, formatUtcDateTime, outputFormatFlags, outputTable, resolveOutputFormat, } from "../../../lib/output.js";
|
|
5
5
|
export default class ContextsList extends BrowseCommand {
|
|
6
6
|
static description = "List Browserbase contexts you have saved locally with a name.";
|
|
7
|
-
static examples = [
|
|
8
|
-
"browse cloud contexts list",
|
|
9
|
-
"browse cloud contexts list --json",
|
|
10
|
-
];
|
|
7
|
+
static examples = ["browse cloud contexts list", "browse cloud contexts list --json"];
|
|
11
8
|
static flags = {
|
|
12
9
|
...outputFormatFlags,
|
|
13
10
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Args } from "@oclif/core";
|
|
2
|
-
import { createBrowserbaseClient, outputJson, withBrowserbaseApi
|
|
2
|
+
import { createBrowserbaseClient, outputJson, withBrowserbaseApi } from "../../../lib/cloud/api.js";
|
|
3
3
|
import { apiCommonFlags, toApiOptions } from "../../../lib/cloud/flags.js";
|
|
4
4
|
import { BrowseCommand } from "../../../base.js";
|
|
5
5
|
export default class ExtensionsGet extends BrowseCommand {
|
|
@@ -1,24 +1,50 @@
|
|
|
1
|
-
import { Args } from "@oclif/core";
|
|
1
|
+
import { Args, Flags } from "@oclif/core";
|
|
2
|
+
import { toFile } from "@browserbasehq/sdk";
|
|
3
|
+
import { getExtensionArchive } from "@browserbasehq/stagehand";
|
|
2
4
|
import { createBrowserbaseClient, outputJson, resolveUploadableFile, withBrowserbaseApi, } from "../../../lib/cloud/api.js";
|
|
3
5
|
import { apiCommonFlags, toApiOptions } from "../../../lib/cloud/flags.js";
|
|
4
6
|
import { BrowseCommand } from "../../../base.js";
|
|
7
|
+
import { fail } from "../../../lib/errors.js";
|
|
5
8
|
export default class ExtensionsUpload extends BrowseCommand {
|
|
6
|
-
static description = "Upload a Chrome extension ZIP file.";
|
|
7
|
-
static examples = [
|
|
9
|
+
static description = "Upload a Chrome extension ZIP file or the bundled Stagehand extension.";
|
|
10
|
+
static examples = [
|
|
11
|
+
"browse cloud extensions upload ./extension.zip",
|
|
12
|
+
"browse cloud extensions upload --stagehand",
|
|
13
|
+
];
|
|
8
14
|
static args = {
|
|
9
15
|
file: Args.string({
|
|
10
|
-
required:
|
|
16
|
+
required: false,
|
|
11
17
|
description: "Path to extension ZIP file.",
|
|
12
18
|
}),
|
|
13
19
|
};
|
|
14
|
-
static flags = {
|
|
20
|
+
static flags = {
|
|
21
|
+
...apiCommonFlags,
|
|
22
|
+
stagehand: Flags.boolean({
|
|
23
|
+
description: "Upload the Stagehand extension bundled with the SDK.",
|
|
24
|
+
default: false,
|
|
25
|
+
}),
|
|
26
|
+
};
|
|
15
27
|
async run() {
|
|
16
28
|
const { args, flags } = await this.parse(ExtensionsUpload);
|
|
29
|
+
if (flags.stagehand && args.file) {
|
|
30
|
+
fail("Cannot specify both --stagehand and a file path.");
|
|
31
|
+
}
|
|
32
|
+
if (!flags.stagehand && !args.file) {
|
|
33
|
+
fail("Provide a file path or use --stagehand to upload the Stagehand extension.");
|
|
34
|
+
}
|
|
17
35
|
await withBrowserbaseApi("extensions", async () => {
|
|
18
36
|
const client = createBrowserbaseClient(toApiOptions(flags));
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
37
|
+
let file;
|
|
38
|
+
if (flags.stagehand) {
|
|
39
|
+
const archive = await getExtensionArchive();
|
|
40
|
+
file = await toFile(archive, "stagehand-extension.zip", {
|
|
41
|
+
type: "application/zip",
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
file = await resolveUploadableFile(args.file, "extension");
|
|
46
|
+
}
|
|
47
|
+
outputJson(await client.extensions.create({ file }));
|
|
22
48
|
});
|
|
23
49
|
}
|
|
24
50
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Args } from "@oclif/core";
|
|
2
|
-
import { createBrowserbaseClient, outputJson, withBrowserbaseApi
|
|
2
|
+
import { createBrowserbaseClient, outputJson, withBrowserbaseApi } from "../../../lib/cloud/api.js";
|
|
3
3
|
import { apiCommonFlags, toApiOptions } from "../../../lib/cloud/flags.js";
|
|
4
4
|
import { BrowseCommand } from "../../../base.js";
|
|
5
5
|
export default class ProjectsGet extends BrowseCommand {
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { createBrowserbaseClient, outputJson, withBrowserbaseApi
|
|
1
|
+
import { createBrowserbaseClient, outputJson, withBrowserbaseApi } from "../../../lib/cloud/api.js";
|
|
2
2
|
import { apiCommonFlags, toApiOptions } from "../../../lib/cloud/flags.js";
|
|
3
3
|
import { BrowseCommand } from "../../../base.js";
|
|
4
4
|
import { formatId, formatUtcDateTime, outputFormatFlags, outputTable, resolveOutputFormat, } from "../../../lib/output.js";
|
|
5
5
|
export default class ProjectsList extends BrowseCommand {
|
|
6
6
|
static description = "List projects visible to the current API key.";
|
|
7
|
-
static examples = [
|
|
8
|
-
"browse cloud projects list",
|
|
9
|
-
"browse cloud projects list --json",
|
|
10
|
-
];
|
|
7
|
+
static examples = ["browse cloud projects list", "browse cloud projects list --json"];
|
|
11
8
|
static flags = { ...apiCommonFlags, ...outputFormatFlags };
|
|
12
9
|
async run() {
|
|
13
10
|
const { flags } = await this.parse(ProjectsList);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Args } from "@oclif/core";
|
|
2
|
-
import { createBrowserbaseClient, outputJson, withBrowserbaseApi
|
|
2
|
+
import { createBrowserbaseClient, outputJson, withBrowserbaseApi } from "../../../lib/cloud/api.js";
|
|
3
3
|
import { apiCommonFlags, toApiOptions } from "../../../lib/cloud/flags.js";
|
|
4
4
|
import { BrowseCommand } from "../../../base.js";
|
|
5
5
|
export default class ProjectsUsage extends BrowseCommand {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Args, Flags } from "@oclif/core";
|
|
2
|
-
import { outputJson, requestBrowserbaseJson, writeOutputFile
|
|
2
|
+
import { outputJson, requestBrowserbaseJson, writeOutputFile } from "../../lib/cloud/api.js";
|
|
3
3
|
import { apiCommonFlags, toApiOptions } from "../../lib/cloud/flags.js";
|
|
4
4
|
import { BrowseCommand } from "../../base.js";
|
|
5
|
-
import { outputFormatFlags, outputTable, resolveOutputFormat
|
|
5
|
+
import { outputFormatFlags, outputTable, resolveOutputFormat } from "../../lib/output.js";
|
|
6
6
|
export default class Search extends BrowseCommand {
|
|
7
7
|
static description = "Search the web using the Browserbase Search API.\n\nProvider and mode selection requires the Search API upgrade and is unavailable until that upgrade is deployed.";
|
|
8
8
|
static examples = [
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BrowseCommand } from "../../../base.js";
|
|
2
2
|
import { apiCommonFlags, toApiOptions } from "../../../lib/cloud/flags.js";
|
|
3
3
|
import { listSecrets } from "../../../lib/secrets/api.js";
|
|
4
|
-
import { listSecretsFlags, toListSecretsOptions
|
|
4
|
+
import { listSecretsFlags, toListSecretsOptions } from "../../../lib/secrets/flags.js";
|
|
5
5
|
import { outputJson } from "../../../lib/output.js";
|
|
6
6
|
export default class SecretsList extends BrowseCommand {
|
|
7
7
|
static description = "List project secret metadata with cursor pagination.";
|
|
@@ -3,14 +3,9 @@ import { createBrowserbaseClient, deepMerge, outputJson, resolveBody, withBrowse
|
|
|
3
3
|
import { resolveContextRefOrFail } from "../../../lib/cloud/contexts-resolve.js";
|
|
4
4
|
import { apiCommonFlags, toApiOptions } from "../../../lib/cloud/flags.js";
|
|
5
5
|
import { fail } from "../../../lib/errors.js";
|
|
6
|
-
import { getCliVersion, resolveInstallId, toMetadataValue
|
|
6
|
+
import { getCliVersion, resolveInstallId, toMetadataValue } from "../../../lib/identity.js";
|
|
7
7
|
import { BrowseCommand } from "../../../base.js";
|
|
8
|
-
const REGIONS = [
|
|
9
|
-
"us-west-2",
|
|
10
|
-
"us-east-1",
|
|
11
|
-
"eu-central-1",
|
|
12
|
-
"ap-southeast-1",
|
|
13
|
-
];
|
|
8
|
+
const REGIONS = ["us-west-2", "us-east-1", "eu-central-1", "ap-southeast-1"];
|
|
14
9
|
function buildSessionCreateBody(flags) {
|
|
15
10
|
const body = {};
|
|
16
11
|
const browserSettings = {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Args } from "@oclif/core";
|
|
2
|
-
import { createBrowserbaseClient, outputJson, withBrowserbaseApi
|
|
2
|
+
import { createBrowserbaseClient, outputJson, withBrowserbaseApi } from "../../../lib/cloud/api.js";
|
|
3
3
|
import { apiCommonFlags, toApiOptions } from "../../../lib/cloud/flags.js";
|
|
4
4
|
import { BrowseCommand } from "../../../base.js";
|
|
5
5
|
export default class SessionsDebug extends BrowseCommand {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Args } from "@oclif/core";
|
|
2
|
-
import { createBrowserbaseClient, outputJson, withBrowserbaseApi
|
|
2
|
+
import { createBrowserbaseClient, outputJson, withBrowserbaseApi } from "../../../lib/cloud/api.js";
|
|
3
3
|
import { apiCommonFlags, toApiOptions } from "../../../lib/cloud/flags.js";
|
|
4
4
|
import { BrowseCommand } from "../../../base.js";
|
|
5
5
|
export default class SessionsGet extends BrowseCommand {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Flags } from "@oclif/core";
|
|
2
|
-
import { createBrowserbaseClient, outputJson, withBrowserbaseApi
|
|
2
|
+
import { createBrowserbaseClient, outputJson, withBrowserbaseApi } from "../../../lib/cloud/api.js";
|
|
3
3
|
import { apiCommonFlags, toApiOptions } from "../../../lib/cloud/flags.js";
|
|
4
4
|
import { BrowseCommand } from "../../../base.js";
|
|
5
5
|
import { formatId, formatUtcDateTime, outputFormatFlags, outputTable, resolveOutputFormat, } from "../../../lib/output.js";
|
|
@@ -139,6 +139,6 @@ function formatMetadata(metadata) {
|
|
|
139
139
|
return "-";
|
|
140
140
|
}
|
|
141
141
|
return Object.entries(metadata)
|
|
142
|
-
.map(([key, value]) => value === true || value === "true" ? key : `${key}=${String(value)}`)
|
|
142
|
+
.map(([key, value]) => (value === true || value === "true" ? key : `${key}=${String(value)}`))
|
|
143
143
|
.join(",");
|
|
144
144
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Args, Flags } from "@oclif/core";
|
|
2
|
-
import { createBrowserbaseClient, outputJson, withBrowserbaseApi
|
|
2
|
+
import { createBrowserbaseClient, outputJson, withBrowserbaseApi } from "../../../lib/cloud/api.js";
|
|
3
3
|
import { apiCommonFlags, toApiOptions } from "../../../lib/cloud/flags.js";
|
|
4
4
|
import { reduceLogs } from "../../../lib/cloud/reduce-logs.js";
|
|
5
5
|
import { BrowseCommand } from "../../../base.js";
|
|
@@ -31,9 +31,7 @@ export default class SessionsLogs extends BrowseCommand {
|
|
|
31
31
|
const client = createBrowserbaseClient(toApiOptions(flags));
|
|
32
32
|
const raw = await client.sessions.logs.list(args.id);
|
|
33
33
|
if (flags["only-errors"]) {
|
|
34
|
-
const arr = Array.isArray(raw)
|
|
35
|
-
? raw
|
|
36
|
-
: (raw?.data ?? []);
|
|
34
|
+
const arr = Array.isArray(raw) ? raw : (raw?.data ?? []);
|
|
37
35
|
outputJson(reduceLogs(arr, {
|
|
38
36
|
failedRequests: flags["failed-requests"],
|
|
39
37
|
}));
|
|
@@ -4,9 +4,7 @@ import { apiCommonFlags, toApiOptions } from "../../../../lib/cloud/flags.js";
|
|
|
4
4
|
import { BrowseCommand } from "../../../../base.js";
|
|
5
5
|
export default class SessionsUploadsCreate extends BrowseCommand {
|
|
6
6
|
static description = "Upload a file to a Browserbase session.";
|
|
7
|
-
static examples = [
|
|
8
|
-
"browse cloud sessions uploads create <session-id> ./file.pdf",
|
|
9
|
-
];
|
|
7
|
+
static examples = ["browse cloud sessions uploads create <session-id> ./file.pdf"];
|
|
10
8
|
static args = {
|
|
11
9
|
id: Args.string({ required: true, description: "Session ID." }),
|
|
12
10
|
file: Args.string({
|
package/dist/commands/cursor.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { BrowseCommand } from "../base.js";
|
|
2
|
-
import { driverCommandFlags, runDriverCommandFromFlags
|
|
2
|
+
import { driverCommandFlags, runDriverCommandFromFlags } from "../lib/driver/command-cli.js";
|
|
3
3
|
export default class Cursor extends BrowseCommand {
|
|
4
4
|
static description = "Enable a visible cursor overlay in the active browser page.";
|
|
5
|
-
static examples = [
|
|
6
|
-
"browse cursor",
|
|
7
|
-
"browse cursor --session research",
|
|
8
|
-
];
|
|
5
|
+
static examples = ["browse cursor", "browse cursor --session research"];
|
|
9
6
|
static flags = {
|
|
10
7
|
...driverCommandFlags,
|
|
11
8
|
};
|
package/dist/commands/doctor.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Flags } from "@oclif/core";
|
|
2
2
|
import { BrowseCommand } from "../base.js";
|
|
3
|
-
import { driverCommandFlags
|
|
3
|
+
import { driverCommandFlags } from "../lib/driver/command-cli.js";
|
|
4
4
|
import { buildDoctorReport, renderDoctorReport } from "../lib/driver/doctor.js";
|
|
5
5
|
import { sessionName } from "../lib/driver/flags.js";
|
|
6
6
|
import { outputJson } from "../lib/output.js";
|
package/dist/commands/eval.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Args } from "@oclif/core";
|
|
2
2
|
import { BrowseCommand } from "../base.js";
|
|
3
|
-
import { driverCommandFlags, runDriverCommandFromFlags
|
|
3
|
+
import { driverCommandFlags, runDriverCommandFromFlags } from "../lib/driver/command-cli.js";
|
|
4
4
|
export default class Eval extends BrowseCommand {
|
|
5
5
|
static description = "Evaluate JavaScript in the active browser page.";
|
|
6
6
|
static examples = [
|
package/dist/commands/fill.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Args, Flags } from "@oclif/core";
|
|
2
2
|
import { BrowseCommand } from "../base.js";
|
|
3
|
-
import { driverCommandFlags, runDriverCommandFromFlags
|
|
3
|
+
import { driverCommandFlags, runDriverCommandFromFlags } from "../lib/driver/command-cli.js";
|
|
4
4
|
export default class Fill extends BrowseCommand {
|
|
5
5
|
static description = "Fill an input-like element by snapshot ref, XPath, or selector.";
|
|
6
6
|
static examples = [
|
|
@@ -2,7 +2,7 @@ import { Args } from "@oclif/core";
|
|
|
2
2
|
import { BrowseCommand } from "../../../base.js";
|
|
3
3
|
import { apiCommonFlags, toApiOptions } from "../../../lib/cloud/flags.js";
|
|
4
4
|
import { listFunctionSecrets } from "../../../lib/secrets/api.js";
|
|
5
|
-
import { listSecretsFlags, toListSecretsOptions
|
|
5
|
+
import { listSecretsFlags, toListSecretsOptions } from "../../../lib/secrets/flags.js";
|
|
6
6
|
import { outputJson } from "../../../lib/output.js";
|
|
7
7
|
export default class FunctionSecretsList extends BrowseCommand {
|
|
8
8
|
static description = "List metadata for secrets attached to a function with cursor pagination.";
|
package/dist/commands/get.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Args } from "@oclif/core";
|
|
2
2
|
import { BrowseCommand } from "../base.js";
|
|
3
|
-
import { driverCommandFlags, runDriverCommandFromFlags
|
|
3
|
+
import { driverCommandFlags, runDriverCommandFromFlags } from "../lib/driver/command-cli.js";
|
|
4
4
|
const GET_TYPES = [
|
|
5
5
|
"url",
|
|
6
6
|
"title",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Args, Flags } from "@oclif/core";
|
|
2
2
|
import { BrowseCommand } from "../base.js";
|
|
3
|
-
import { driverCommandFlags, runDriverCommandFromFlags
|
|
3
|
+
import { driverCommandFlags, runDriverCommandFromFlags } from "../lib/driver/command-cli.js";
|
|
4
4
|
export default class Highlight extends BrowseCommand {
|
|
5
5
|
static description = "Highlight an element by snapshot ref, XPath, or selector.";
|
|
6
6
|
static examples = [
|
package/dist/commands/is.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Args } from "@oclif/core";
|
|
2
2
|
import { BrowseCommand } from "../base.js";
|
|
3
|
-
import { driverCommandFlags, runDriverCommandFromFlags
|
|
3
|
+
import { driverCommandFlags, runDriverCommandFromFlags } from "../lib/driver/command-cli.js";
|
|
4
4
|
export default class Is extends BrowseCommand {
|
|
5
5
|
static description = "Check element state by snapshot ref, XPath, or selector.";
|
|
6
6
|
static examples = [
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { BrowseCommand } from "../../base.js";
|
|
2
|
-
import { driverCommandFlags, runDriverCommandFromFlags
|
|
2
|
+
import { driverCommandFlags, runDriverCommandFromFlags } from "../../lib/driver/command-cli.js";
|
|
3
3
|
export default class NetworkClear extends BrowseCommand {
|
|
4
4
|
static description = "Clear captured network request directories for the active browser session.";
|
|
5
|
-
static examples = [
|
|
6
|
-
"browse network clear",
|
|
7
|
-
"browse network clear --session research",
|
|
8
|
-
];
|
|
5
|
+
static examples = ["browse network clear", "browse network clear --session research"];
|
|
9
6
|
static flags = {
|
|
10
7
|
...driverCommandFlags,
|
|
11
8
|
};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { BrowseCommand } from "../../base.js";
|
|
2
|
-
import { driverCommandFlags, runDriverCommandFromFlags
|
|
2
|
+
import { driverCommandFlags, runDriverCommandFromFlags } from "../../lib/driver/command-cli.js";
|
|
3
3
|
export default class NetworkOff extends BrowseCommand {
|
|
4
4
|
static description = "Disable network capture for the active browser session.";
|
|
5
|
-
static examples = [
|
|
6
|
-
"browse network off",
|
|
7
|
-
"browse network off --session research",
|
|
8
|
-
];
|
|
5
|
+
static examples = ["browse network off", "browse network off --session research"];
|
|
9
6
|
static flags = {
|
|
10
7
|
...driverCommandFlags,
|
|
11
8
|
};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { BrowseCommand } from "../../base.js";
|
|
2
|
-
import { driverCommandFlags, runDriverCommandFromFlags
|
|
2
|
+
import { driverCommandFlags, runDriverCommandFromFlags } from "../../lib/driver/command-cli.js";
|
|
3
3
|
export default class NetworkOn extends BrowseCommand {
|
|
4
4
|
static description = "Enable network capture for the active browser session.";
|
|
5
|
-
static examples = [
|
|
6
|
-
"browse network on",
|
|
7
|
-
"browse network on --session research",
|
|
8
|
-
];
|
|
5
|
+
static examples = ["browse network on", "browse network on --session research"];
|
|
9
6
|
static flags = {
|
|
10
7
|
...driverCommandFlags,
|
|
11
8
|
};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { BrowseCommand } from "../../base.js";
|
|
2
|
-
import { driverCommandFlags, runDriverCommandFromFlags
|
|
2
|
+
import { driverCommandFlags, runDriverCommandFromFlags } from "../../lib/driver/command-cli.js";
|
|
3
3
|
export default class NetworkPath extends BrowseCommand {
|
|
4
4
|
static description = "Print the network capture directory for the active browser session.";
|
|
5
|
-
static examples = [
|
|
6
|
-
"browse network path",
|
|
7
|
-
"browse network path --session research",
|
|
8
|
-
];
|
|
5
|
+
static examples = ["browse network path", "browse network path --session research"];
|
|
9
6
|
static flags = {
|
|
10
7
|
...driverCommandFlags,
|
|
11
8
|
};
|
package/dist/commands/press.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { Args } from "@oclif/core";
|
|
2
2
|
import { BrowseCommand } from "../base.js";
|
|
3
|
-
import { driverCommandFlags, runDriverCommandFromFlags
|
|
3
|
+
import { driverCommandFlags, runDriverCommandFromFlags } from "../lib/driver/command-cli.js";
|
|
4
4
|
export default class Press extends BrowseCommand {
|
|
5
5
|
static aliases = ["key"];
|
|
6
6
|
static description = "Press a keyboard key in the active page.";
|
|
7
|
-
static examples = [
|
|
8
|
-
"browse press Enter",
|
|
9
|
-
"browse press Escape",
|
|
10
|
-
"browse key Meta+K",
|
|
11
|
-
];
|
|
7
|
+
static examples = ["browse press Enter", "browse press Escape", "browse key Meta+K"];
|
|
12
8
|
static args = {
|
|
13
9
|
key: Args.string({
|
|
14
10
|
description: "Key name or key chord, for example Enter, Escape, Meta+K.",
|
package/dist/commands/select.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Args, Flags } from "@oclif/core";
|
|
2
2
|
import { BrowseCommand } from "../base.js";
|
|
3
|
-
import { driverCommandFlags, runDriverCommandFromFlags
|
|
3
|
+
import { driverCommandFlags, runDriverCommandFromFlags } from "../lib/driver/command-cli.js";
|
|
4
4
|
export default class Select extends BrowseCommand {
|
|
5
5
|
static description = "Select an option on a select-like element by snapshot ref, XPath, or selector.";
|
|
6
6
|
static examples = [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Args, Flags } from "@oclif/core";
|
|
2
2
|
import { BrowseCommand } from "../../base.js";
|
|
3
|
-
import { outputFormatFlags, outputJson, resolveOutputFormat
|
|
3
|
+
import { outputFormatFlags, outputJson, resolveOutputFormat } from "../../lib/output.js";
|
|
4
4
|
import { exactSkillMatch, listCatalogSkills, outputSkillTable, printSkillDetail, prioritizeExactSkillMatch, } from "../../lib/skills/catalog.js";
|
|
5
5
|
export default class SkillsFind extends BrowseCommand {
|
|
6
6
|
static description = "Find Browse.sh catalog skills by slug, domain, title, description, category, alias, or tag.";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Flags } from "@oclif/core";
|
|
2
2
|
import { BrowseCommand } from "../../base.js";
|
|
3
|
-
import { outputFormatFlags, outputJson, resolveOutputFormat
|
|
4
|
-
import { listCatalogSkills, outputSkillTable
|
|
3
|
+
import { outputFormatFlags, outputJson, resolveOutputFormat } from "../../lib/output.js";
|
|
4
|
+
import { listCatalogSkills, outputSkillTable } from "../../lib/skills/catalog.js";
|
|
5
5
|
export default class SkillsList extends BrowseCommand {
|
|
6
6
|
static description = "List Browse.sh catalog skills.";
|
|
7
7
|
static examples = [
|
|
@@ -13,7 +13,9 @@ export default class SkillsShow extends BrowseCommand {
|
|
|
13
13
|
contents = await readFile(skillMdPath, "utf8");
|
|
14
14
|
}
|
|
15
15
|
catch (error) {
|
|
16
|
-
fail(`Could not read the bundled browse skill (SKILL.md): ${error.message}`, 1, {
|
|
16
|
+
fail(`Could not read the bundled browse skill (SKILL.md): ${error.message}`, 1, {
|
|
17
|
+
resultCode: "skill_show_missing",
|
|
18
|
+
});
|
|
17
19
|
}
|
|
18
20
|
this.log(contents);
|
|
19
21
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Flags } from "@oclif/core";
|
|
2
2
|
import { BrowseCommand } from "../base.js";
|
|
3
|
-
import { driverCommandFlags, runDriverCommandFromFlags
|
|
3
|
+
import { driverCommandFlags, runDriverCommandFromFlags } from "../lib/driver/command-cli.js";
|
|
4
4
|
export default class Snapshot extends BrowseCommand {
|
|
5
5
|
static description = "Print the active page accessibility snapshot and cache refs for element commands. Pass --full to also include the ref maps (xpathMap, urlMap).";
|
|
6
6
|
static examples = [
|
package/dist/commands/status.js
CHANGED
|
@@ -4,10 +4,7 @@ import { getDriverStatus } from "../lib/driver/daemon/client.js";
|
|
|
4
4
|
import { outputJson } from "../lib/output.js";
|
|
5
5
|
export default class Status extends BrowseCommand {
|
|
6
6
|
static description = "Show the browse driver daemon status for a named session.";
|
|
7
|
-
static examples = [
|
|
8
|
-
"browse status",
|
|
9
|
-
"browse status --session research",
|
|
10
|
-
];
|
|
7
|
+
static examples = ["browse status", "browse status --session research"];
|
|
11
8
|
static flags = {
|
|
12
9
|
session: sessionFlag,
|
|
13
10
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Args } from "@oclif/core";
|
|
2
2
|
import { BrowseCommand } from "../../base.js";
|
|
3
|
-
import { driverCommandFlags, runDriverCommandFromFlags
|
|
3
|
+
import { driverCommandFlags, runDriverCommandFromFlags } from "../../lib/driver/command-cli.js";
|
|
4
4
|
export default class TabClose extends BrowseCommand {
|
|
5
5
|
static description = "Close a tab by index or targetId. Without an argument, closes the active tab. Prefer targetId for stability.";
|
|
6
6
|
static examples = [
|