Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/browserstack-provider-plugin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'agent-device': minor
---

Extract BrowserStack out of the bundled WebDriver provider into the new `@agent-device/browserstack` plugin package. Install it with `agent-device plugins add @agent-device/browserstack`, then close your sessions and run `agent-device daemon stop --state-dir <path>` for your daemon before reconnecting. Commands for a saved BrowserStack connection keep working while the plugin is installed; without it, `connect browserstack` explains how to install the plugin.
8 changes: 5 additions & 3 deletions .fallowrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"tools/depgraph-view/app.js",
"scripts/check-provider-plugin.mjs",
"scripts/check-affected/command.ts",
"packages/provider-browserstack/test/package-smoke.mjs",
"packages/provider-browserstack/tsdown.config.ts",
"packages/provider-testmu/test/package-smoke.mjs",
"packages/maestro/test/package-artifact.test.mjs",
"packages/maestro/test/packed-clickability.mjs",
Expand Down Expand Up @@ -110,9 +112,9 @@
// @agent-device/provider-limrun owns the source import, while the published
// root build externalizes @limrun/api and retains runtime imports in packed chunks.
"@limrun/api",
// @agent-device/testmu imports agent-device type-only, and its tsconfig maps those specifiers
// through this workspace link to core source so typecheck needs no build; Fallow then credits
// the source files rather than the package.
// @agent-device/browserstack and @agent-device/testmu import agent-device type-only, and their
// tsconfigs map those specifiers through this workspace link to core source so typecheck needs
// no build; Fallow then credits the source files rather than the package.
"agent-device",
// Nothing in the root imports the TV plugins or the tv-cdp package they bundle, but layering
// requires the root manifest to declare every workspace package.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ The same session and evidence model works at every step: the agent explores the
| --- | --- | --- |
| Local | Trying commands and debugging apps on simulators, emulators, physical devices, macOS, and Linux. | Follow the Quick Start. |
| CI/CD | Automated pull request and merge validation with replay scripts and captured artifacts. | Try the [EAS workflow template](https://github.com/callstackincubator/eas-agent-device/blob/main/.eas/workflows/agent-qa-mobile.yml). |
| Cloud / remote | Linux runners, managed devices, and remote jobs. | Set up a [remote proxy](https://agent-device.dev/docs/remote-proxy), connect a [device cloud](https://agent-device.dev/docs/device-clouds) (BrowserStack, AWS Device Farm, TestMu AI, Limrun), or [contact Callstack](mailto:hello@callstack.com) for team QA. |
| Cloud / remote | Linux runners, managed devices, and remote jobs. | Set up a [remote proxy](https://agent-device.dev/docs/remote-proxy), connect a [device cloud](https://agent-device.dev/docs/device-clouds) (BrowserStack and TestMu AI through `agent-device plugins add`, AWS Device Farm, Limrun), or [contact Callstack](mailto:hello@callstack.com) for team QA. |

## How it works

Expand Down
1 change: 1 addition & 0 deletions docs/agents/code-ownership.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Before you edit a module with many callers, run `pnpm depgraph affected <path>`.

| Question | Owner |
| --- | --- |
| Shared bundler policy | `packages/build-config/src/index.ts` |
| Command names | `packages/command-registry/src/catalog.ts` |
| Command descriptors | `packages/command-registry/src/`: `registry.ts`, `descriptor-*.ts`, `descriptors/` |
| Daemon request-policy predicates | `packages/daemon/src/core/daemon-command-registry.ts` |
Expand Down
2 changes: 2 additions & 0 deletions examples/sdk/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"include": [".", "../../src/**/*", "../../packages/command-registry/src/global.d.ts"],
"exclude": ["../../src/**/*.test.ts", "../../src/**/__tests__/**", "../../src/**/*.fixtures.ts"],
"references": [
{ "path": "../../packages/build-config" },
{ "path": "../../packages/ad-replay" },
{ "path": "../../packages/ad-script" },
{ "path": "../../packages/apple-runner" },
Expand Down Expand Up @@ -64,6 +65,7 @@
{ "path": "../../packages/provider-limrun" },
{ "path": "../../packages/provider-revyl" },
{ "path": "../../packages/provider-testmu" },
{ "path": "../../packages/provider-browserstack" },
{ "path": "../../packages/provider-webos" },
{ "path": "../../packages/provider-tizen" },
{ "path": "../../packages/provider-webdriver" },
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,10 @@
"yaml": "^2.9.0",
"yauzl": "^3.4.0",
"@agent-device/testmu": "workspace:*",
"@agent-device/browserstack": "workspace:*",
"@agent-device/revyl": "workspace:*",
"@agent-device/webos": "workspace:*",
"@agent-device/tizen": "workspace:*"
"@agent-device/tizen": "workspace:*",
"@agent-device/build-config": "workspace:*"
}
}
16 changes: 16 additions & 0 deletions packages/build-config/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "@agent-device/build-config",
"version": "0.0.0",
"private": true,
"type": "module",
"description": "Shared repository bundler configuration.",
"exports": {
".": {
"types": "./src/index.ts",
"default": "./src/index.ts"
}
},
"devDependencies": {
"rolldown": "1.2.5"
}
}
21 changes: 21 additions & 0 deletions packages/build-config/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { InputOptions } from 'rolldown';

export const strictBundlerInputOptions: InputOptions = {
onLog(level, log, handler) {
if (log.code === 'UNRESOLVED_IMPORT') throw new Error(log.message);
handler(level, log);
},
};

export const providerPluginBuildConfig = {
entry: { 'agent-device': 'src/index.ts' },
outDir: 'dist',
format: 'esm' as const,
platform: 'node' as const,
target: 'es2022' as const,
minify: true,
dts: false,
hash: false,
deps: { alwaysBundle: [/^@agent-device\//] },
inputOptions: strictBundlerInputOptions,
};
14 changes: 14 additions & 0 deletions packages/build-config/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"composite": true,
"noEmit": false,
"emitDeclarationOnly": true,
"declaration": true,
"declarationDir": "./dist-types",
"rootDir": "./src",
"tsBuildInfoFile": "./dist-types/index.tsbuildinfo"
},
"include": ["src"],
"references": []
}
40 changes: 40 additions & 0 deletions packages/provider-browserstack/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# @agent-device/browserstack

Use BrowserStack App Automate Android and iOS devices with [agent-device](https://agent-device.dev).
You need a BrowserStack account with App Automate access.

```sh
npm install -g agent-device
agent-device plugins add @agent-device/browserstack
export BROWSERSTACK_USERNAME=your-username
export BROWSERSTACK_ACCESS_KEY=your-access-key
agent-device connect browserstack --session checkout-android --platform android --device "Google Pixel 8" --provider-os-version 14.0 --provider-app bs://app-id
```

See the [BrowserStack guide](https://agent-device.dev/docs/browserstack) for setup and supported operations.
To update the plugin, run `agent-device plugins update @agent-device/browserstack`.

After you add or update the plugin, close your sessions and run `agent-device daemon stop --state-dir <path>` for your daemon before reconnecting.

## Use it from JavaScript

The package default-exports a plugin factory. Pass credentials as options, or leave them out to read `BROWSERSTACK_USERNAME` and `BROWSERSTACK_ACCESS_KEY` from the environment:

```js
import { startAgentDevice } from 'agent-device';
import browserstack from '@agent-device/browserstack';

const host = await startAgentDevice({
stateDir: './.my-app/agent-device-state',
plugins: [
browserstack({ credentials: { username: 'your-username', accessKey: 'your-access-key' } }),
],
});
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
Resolved
try {
console.log(await host.client.sessions.list());
} finally {
await host.close();
}
```

Each credential key passed as an option replaces its environment variable. A key left out uses the environment, and only that environment key participates in the credential fingerprint.
59 changes: 59 additions & 0 deletions packages/provider-browserstack/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"name": "@agent-device/browserstack",
"version": "0.22.0-dev",
"private": true,
"type": "module",
"description": "BrowserStack real-device cloud plugin for agent-device.",
"files": [
"dist"
],
"scripts": {
"build": "tsdown --config tsdown.config.ts",
"prepack": "pnpm build"
},
"exports": {
".": {
"types": "./src/index.ts",
"default": "./src/index.ts"
},
"./agent-device": {
"types": "./src/index.ts",
"default": "./src/index.ts"
},
"./connection-verification": {
"types": "./src/browserstack-connection-verification.ts",
"default": "./src/browserstack-connection-verification.ts"
},
"./package.json": "./package.json"
},
"devDependencies": {
"@agent-device/contracts": "workspace:*",
"@agent-device/kernel": "workspace:*",
"@agent-device/provider-webdriver": "workspace:*",
"agent-device": "workspace:*",
"@agent-device/test-kit": "workspace:*",
"@agent-device/build-config": "workspace:*"
},
"publishConfig": {
"exports": {
".": {
"import": "./dist/agent-device.mjs"
},
"./agent-device": {
"import": "./dist/agent-device.mjs"
},
"./connection-verification": {
"import": "./dist/connection-verification.mjs"
},
"./package.json": "./package.json"
},
"access": "public"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/callstack/agent-device.git",
"directory": "packages/provider-browserstack"
},
"homepage": "https://agent-device.dev/docs/browserstack"
}
Loading
Loading