mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 07:04:48 +00:00
feat: [US-021] - Add TypeScript SDK browser navigation and tab methods
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8ade8bba9d
commit
9776e0f4cb
1 changed files with 53 additions and 0 deletions
|
|
@ -30,8 +30,17 @@ import {
|
||||||
type AgentInstallRequest,
|
type AgentInstallRequest,
|
||||||
type AgentInstallResponse,
|
type AgentInstallResponse,
|
||||||
type AgentListResponse,
|
type AgentListResponse,
|
||||||
|
type BrowserActionResponse,
|
||||||
|
type BrowserCreateTabRequest,
|
||||||
|
type BrowserNavigateRequest,
|
||||||
|
type BrowserPageInfo,
|
||||||
|
type BrowserReloadRequest,
|
||||||
type BrowserStartRequest,
|
type BrowserStartRequest,
|
||||||
type BrowserStatusResponse,
|
type BrowserStatusResponse,
|
||||||
|
type BrowserTabInfo,
|
||||||
|
type BrowserTabListResponse,
|
||||||
|
type BrowserWaitRequest,
|
||||||
|
type BrowserWaitResponse,
|
||||||
type DesktopActionResponse,
|
type DesktopActionResponse,
|
||||||
type DesktopClipboardQuery,
|
type DesktopClipboardQuery,
|
||||||
type DesktopClipboardResponse,
|
type DesktopClipboardResponse,
|
||||||
|
|
@ -2032,6 +2041,50 @@ export class SandboxAgent {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async browserNavigate(request: BrowserNavigateRequest): Promise<BrowserPageInfo> {
|
||||||
|
return this.requestJson("POST", `${API_PREFIX}/browser/navigate`, {
|
||||||
|
body: request,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async browserBack(): Promise<BrowserPageInfo> {
|
||||||
|
return this.requestJson("POST", `${API_PREFIX}/browser/back`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async browserForward(): Promise<BrowserPageInfo> {
|
||||||
|
return this.requestJson("POST", `${API_PREFIX}/browser/forward`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async browserReload(request: BrowserReloadRequest = {}): Promise<BrowserPageInfo> {
|
||||||
|
return this.requestJson("POST", `${API_PREFIX}/browser/reload`, {
|
||||||
|
body: request,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async browserWait(request: BrowserWaitRequest): Promise<BrowserWaitResponse> {
|
||||||
|
return this.requestJson("POST", `${API_PREFIX}/browser/wait`, {
|
||||||
|
body: request,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async getBrowserTabs(): Promise<BrowserTabListResponse> {
|
||||||
|
return this.requestJson("GET", `${API_PREFIX}/browser/tabs`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async createBrowserTab(request: BrowserCreateTabRequest = {}): Promise<BrowserTabInfo> {
|
||||||
|
return this.requestJson("POST", `${API_PREFIX}/browser/tabs`, {
|
||||||
|
body: request,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async activateBrowserTab(tabId: string): Promise<BrowserTabInfo> {
|
||||||
|
return this.requestJson("POST", `${API_PREFIX}/browser/tabs/${tabId}/activate`);
|
||||||
|
}
|
||||||
|
|
||||||
|
async closeBrowserTab(tabId: string): Promise<BrowserActionResponse> {
|
||||||
|
return this.requestJson("DELETE", `${API_PREFIX}/browser/tabs/${tabId}`);
|
||||||
|
}
|
||||||
|
|
||||||
private async getLiveConnection(agent: string): Promise<LiveAcpConnection> {
|
private async getLiveConnection(agent: string): Promise<LiveAcpConnection> {
|
||||||
await this.awaitHealthy();
|
await this.awaitHealthy();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue