fix: remove obsolete BrowserManager TypeScript API from README (#821)
* fix: remove obsolete BrowserManager TypeScript API references from README
The TypeScript src/ was removed in commit 8e43469 (full native #754),
but README still referenced the non-existent BrowserManager API.
Replace Lambda example with CLI-based handler and remove Programmatic API section.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* chore
---------
Co-authored-by: hyunjinee <leehj0110@kakao.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
hyunjinee
parent
19ba9048a0
commit
0745db44a2
@@ -794,15 +794,15 @@ See the [environments example](examples/environments/) for a working demo with a
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
import chromium from '@sparticuz/chromium';
|
import chromium from '@sparticuz/chromium';
|
||||||
import { BrowserManager } from 'agent-browser';
|
import { execSync } from 'child_process';
|
||||||
|
|
||||||
export async function handler() {
|
export async function handler() {
|
||||||
const browser = new BrowserManager();
|
const executablePath = await chromium.executablePath();
|
||||||
await browser.launch({
|
const result = execSync(
|
||||||
executablePath: await chromium.executablePath(),
|
`AGENT_BROWSER_EXECUTABLE_PATH=${executablePath} agent-browser open https://example.com && agent-browser snapshot -i --json`,
|
||||||
headless: true,
|
{ encoding: 'utf-8' }
|
||||||
});
|
);
|
||||||
// ... use browser
|
return JSON.parse(result);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -953,51 +953,6 @@ Connect to `ws://localhost:9223` to receive frames and send input:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Programmatic API
|
|
||||||
|
|
||||||
For advanced use, control streaming directly via the protocol:
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import { BrowserManager } from 'agent-browser';
|
|
||||||
|
|
||||||
const browser = new BrowserManager();
|
|
||||||
await browser.launch({ headless: true });
|
|
||||||
await browser.navigate('https://example.com');
|
|
||||||
|
|
||||||
// Start screencast
|
|
||||||
await browser.startScreencast(
|
|
||||||
(frame) => {
|
|
||||||
// frame.data is base64-encoded image
|
|
||||||
// frame.metadata contains viewport info
|
|
||||||
console.log('Frame received:', frame.metadata.deviceWidth, 'x', frame.metadata.deviceHeight);
|
|
||||||
},
|
|
||||||
{
|
|
||||||
format: 'jpeg',
|
|
||||||
quality: 80,
|
|
||||||
maxWidth: 1280,
|
|
||||||
maxHeight: 720,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
// Inject mouse events
|
|
||||||
await browser.injectMouseEvent({
|
|
||||||
type: 'mousePressed',
|
|
||||||
x: 100,
|
|
||||||
y: 200,
|
|
||||||
button: 'left',
|
|
||||||
});
|
|
||||||
|
|
||||||
// Inject keyboard events
|
|
||||||
await browser.injectKeyboardEvent({
|
|
||||||
type: 'keyDown',
|
|
||||||
key: 'Enter',
|
|
||||||
code: 'Enter',
|
|
||||||
});
|
|
||||||
|
|
||||||
// Stop when done
|
|
||||||
await browser.stopScreencast();
|
|
||||||
```
|
|
||||||
|
|
||||||
## Architecture
|
## Architecture
|
||||||
|
|
||||||
agent-browser uses a client-daemon architecture:
|
agent-browser uses a client-daemon architecture:
|
||||||
|
|||||||
Reference in New Issue
Block a user