mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 06:04:43 +00:00
feat: [US-020] - Add TypeScript SDK browser lifecycle and CDP methods
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
45cc8a8383
commit
8ade8bba9d
1 changed files with 24 additions and 0 deletions
|
|
@ -30,6 +30,8 @@ import {
|
|||
type AgentInstallRequest,
|
||||
type AgentInstallResponse,
|
||||
type AgentListResponse,
|
||||
type BrowserStartRequest,
|
||||
type BrowserStatusResponse,
|
||||
type DesktopActionResponse,
|
||||
type DesktopClipboardQuery,
|
||||
type DesktopClipboardResponse,
|
||||
|
|
@ -2008,6 +2010,28 @@ export class SandboxAgent {
|
|||
return new DesktopStreamSession(this.connectDesktopStreamWebSocket(options));
|
||||
}
|
||||
|
||||
async startBrowser(request: BrowserStartRequest = {}): Promise<BrowserStatusResponse> {
|
||||
return this.requestJson("POST", `${API_PREFIX}/browser/start`, {
|
||||
body: request,
|
||||
});
|
||||
}
|
||||
|
||||
async stopBrowser(): Promise<BrowserStatusResponse> {
|
||||
return this.requestJson("POST", `${API_PREFIX}/browser/stop`);
|
||||
}
|
||||
|
||||
async getBrowserStatus(): Promise<BrowserStatusResponse> {
|
||||
return this.requestJson("GET", `${API_PREFIX}/browser/status`);
|
||||
}
|
||||
|
||||
getBrowserCdpUrl(options: ProcessTerminalWebSocketUrlOptions = {}): string {
|
||||
return toWebSocketUrl(
|
||||
this.buildUrl(`${API_PREFIX}/browser/cdp`, {
|
||||
access_token: options.accessToken ?? this.token,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
private async getLiveConnection(agent: string): Promise<LiveAcpConnection> {
|
||||
await this.awaitHealthy();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue