Skip to content

Commit

Permalink
feat(typespec): Add types for browserbase tools
Browse files Browse the repository at this point in the history
Signed-off-by: Diwank Singh Tomer <[email protected]>
  • Loading branch information
creatorrr committed Oct 29, 2024
1 parent ba1241b commit c84c935
Show file tree
Hide file tree
Showing 9 changed files with 1,593 additions and 2 deletions.
404 changes: 404 additions & 0 deletions agents-api/agents_api/autogen/Tools.py

Large diffs are not rendered by default.

404 changes: 404 additions & 0 deletions integrations-service/integrations/autogen/Tools.py

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions typespec/tools/browserbase/contexts.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import "../../common";

using Common;

namespace Tools;

// TODO: Implement these
/** browserbase context provider */
model BrowserbaseContextIntegrationDef extends BaseBrowserbaseIntegrationDef {
/** The specific method of the integration to call */
method?: "create_context" = "create_context";

/** The arguments for the method */
arguments?: unknown;
}
16 changes: 16 additions & 0 deletions typespec/tools/browserbase/extensions.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import "../../common";

using Common;

namespace Tools;


// // TODO: Implement these
// /** browserbase extension provider */
// model BrowserbaseExtensionIntegrationDef extends BaseBrowserbaseIntegrationDef {
// /** The specific method of the integration to call */
// method?: "create_extension" | "get_extension" | "delete_extension";

// /** The arguments for the method */
// arguments?: unknown;
// }
111 changes: 111 additions & 0 deletions typespec/tools/browserbase/main.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
import "../../common";
import "./contexts.tsp";
import "./extensions.tsp";
import "./sessions.tsp";

namespace Tools;

using Common;

alias BrowserbaseMethod = (
/** Get live URLs from the browserbase context */
| "get_live_urls"

/** List the sessions in the browserbase context */
| "list_sessions"

/** Create a new session in the browserbase context */
| "create_session"

/** Get a session from the browserbase context */
| "get_session"

/** Update a session in the browserbase context */
| "update_session"

// TODO: Implement these
/** Create a new browserbase context */
| "create_context"

/** Upload an extension to the browserbase context */
| "upload_extension"

/** Get an extension from the browserbase context */
| "get_extension"

/** Delete an extension from the browserbase context */
| "delete_extension"

/** Create session uploads in the browserbase context */
| "create_session_uploads"

/** Get session downloads from the browserbase context */
| "get_session_downloads"

/** Get logs from the browserbase context */
| "get_logs"

/** Get recordings from the browserbase context */
| "get_recordings"
);

/** The setup parameters for the browserbase integration */
model BrowserbaseSetup {
/** API key for the browserbase integration */
api_key: string;
}

/** The base definition for a browserbase integration */
model BaseBrowserbaseIntegrationDef extends BaseIntegrationDef {
provider: "browserbase" = "browserbase";
setup?: BrowserbaseSetup;
method?: BrowserbaseMethod;
arguments?: unknown;
}

alias BrowserbaseIntegrationDef = (
| BrowserbaseContextIntegrationDef
// | BrowserbaseExtensionIntegrationDef
| BrowserbaseSessionIntegrationDef
);

alias BrowserbaseArguments = (
| BrowserbaseSessionArguments
// TODO: Implement these
// | BrowserbaseContextArguments
// | BrowserbaseExtensionArguments
);

alias BrowserbaseOutput = (
| BrowserbaseSessionOutput
// TODO: Implement these
// | BrowserbaseContextOutput
// | BrowserbaseExtensionOutput
);

model BrowserbaseProviderCard extends BaseProviderCard {
provider: "browserbase" = "browserbase";
setup: BrowserbaseSetup;
methods: ProviderMethod<BrowserbaseArguments, BrowserbaseOutput>[] = #[
#{
method: "list_sessions",
description: "List the sessions in the browserbase context",
},
#{
method: "create_session",
description: "Create a new session in the browserbase context",
},
#{
method: "get_session",
description: "Get a session from the browserbase context",
},
#{
method: "update_session",
description: "Update a session in the browserbase context",
},
#{
method: "get_session_live_urls",
description: "Get live URLs from the browserbase context",
}
];
}
239 changes: 239 additions & 0 deletions typespec/tools/browserbase/sessions.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,239 @@
import "../../common";

using Common;

namespace Tools;

alias BrowserbaseSessionMethod = (
/** Get live URLs from the browserbase context */
| "get_live_urls"

/** List the sessions in the browserbase context */
| "list_sessions"

/** Create a new session in the browserbase context */
| "create_session"

/** Get a session from the browserbase context */
| "get_session"

/** Update a session in the browserbase context */
| "update_session"

// TODO: Implement these
| "create_context"
| "upload_extension"
| "get_extension"
| "delete_extension"
| "create_session_uploads"
| "get_session_downloads"
| "get_logs"
| "get_recordings"
);

alias BrowserbaseSessionIntegrationDef =
| BrowserbaseListSessionsIntegrationDef
| BrowserbaseCreateSessionIntegrationDef
| BrowserbaseGetSessionIntegrationDef
| BrowserbaseUpdateSessionIntegrationDef
| BrowserbaseGetSessionLiveUrlsIntegrationDef;
//
// TODO: Implement these
// | BrowserbaseCreateContextIntegrationDef
// | BrowserbaseUploadExtensionIntegrationDef
// | BrowserbaseGetExtensionIntegrationDef
// | BrowserbaseDeleteExtensionIntegrationDef
// | BrowserbaseCreateSessionUploadsIntegrationDef
// | BrowserbaseGetSessionDownloadsIntegrationDef
// | BrowserbaseGetLogsIntegrationDef
// | BrowserbaseGetRecordingsIntegrationDef

alias BrowserbaseSessionArguments =
| BrowserbaseListSessionsArguments
| BrowserbaseCreateSessionArguments
| BrowserbaseGetSessionArguments
| BrowserbaseUpdateSessionArguments
| BrowserbaseGetSessionLiveUrlsArguments;
//
// TODO: Implement these
// | BrowserbaseCreateContextArguments
// | BrowserbaseUploadExtensionArguments
// | BrowserbaseGetExtensionArguments
// | BrowserbaseDeleteExtensionArguments
// | BrowserbaseCreateSessionUploadsArguments
// | BrowserbaseGetSessionDownloadsArguments
// | BrowserbaseGetLogsArguments
// | BrowserbaseGetRecordingsArguments

alias BrowserbaseSessionOutput =
| BrowserbaseListSessionsOutput
| BrowserbaseCreateSessionOutput
| BrowserbaseGetSessionOutput
| BrowserbaseUpdateSessionOutput
| BrowserbaseGetSessionLiveUrlsOutput;
//
// TODO: Implement these
// | BrowserbaseCreateContextOutput
// | BrowserbaseUploadExtensionOutput
// | BrowserbaseGetExtensionOutput
// | BrowserbaseDeleteExtensionOutput
// | BrowserbaseCreateSessionUploadsOutput
// | BrowserbaseGetSessionDownloadsOutput
// | BrowserbaseGetLogsOutput
// | BrowserbaseGetRecordingsOutput

/** browserbase list sessions integration definition */
model BrowserbaseListSessionsIntegrationDef
extends BaseBrowserbaseIntegrationDef {
/** The specific method of the integration to call */
method: "list_sessions" = "list_sessions";

/** The arguments for the method */
arguments?: BrowserbaseListSessionsArguments;
}

model BrowserbaseListSessionsArguments {
/** The status of the sessions to list (Available options: RUNNING, ERROR, TIMED_OUT, COMPLETED) */
status?: "RUNNING" | "ERROR" | "TIMED_OUT" | "COMPLETED";
}

alias BrowserbaseListSessionsOutput = {
id: string;
createdAt: string;
updatedAt: string;
projectId: string;
startedAt: string;
endedAt: string;
expiresAt: string;
status: "RUNNING" | "ERROR" | "TIMED_OUT" | "COMPLETED";
proxyBytes: uint64;
avgCpuUsage: uint64;
memoryUsage: uint64;
keepAlive: boolean;
contextId?: string;
}[];

/** browserbase create session integration definition */
model BrowserbaseCreateSessionIntegrationDef
extends BaseBrowserbaseIntegrationDef {
method: "create_session" = "create_session";

/** The arguments for the method */
arguments: BrowserbaseCreateSessionArguments;
}

model BrowserbaseCreateSessionArguments {
/** The Project ID. Can be found in Settings. */
projectId: string;

/** The uploaded Extension ID. See Upload Extension. */
extensionId?: string;

/** Browser settings */
browserSettings?: Record<unknown>;

/** Duration in seconds after which the session will automatically end. Defaults to the Project's defaultTimeout. */
timeout?: uint16;

/** Set to true to keep the session alive even after disconnections. This is available on the Startup plan only. */
keepAlive?: boolean;

/** Proxy configuration. Can be true for default proxy, or an array of proxy configurations. */
proxies?: boolean | Record<unknown>[];
}

model BrowserbaseCreateSessionOutput {
id: string;
createdAt: string;
updatedAt: string;
projectId: string;
startedAt: string;
endedAt: string;
expiresAt: string;
status: "RUNNING" | "ERROR" | "TIMED_OUT" | "COMPLETED";
proxyBytes: uint64;
avgCpuUsage: uint64;
memoryUsage: uint64;
keepAlive: boolean;
contextId?: string;
}

/** browserbase get session integration definition */
model BrowserbaseGetSessionIntegrationDef
extends BaseBrowserbaseIntegrationDef {
method: "get_session" = "get_session";
arguments: BrowserbaseGetSessionArguments;
}

model BrowserbaseGetSessionArguments {
id: string;
}

model BrowserbaseGetSessionOutput {
id: string;
createdAt: string;
updatedAt: string;
projectId: string;
startedAt: string;
endedAt: string;
expiresAt: string;
status: "RUNNING" | "ERROR" | "TIMED_OUT" | "COMPLETED";
proxyBytes: uint64;
avgCpuUsage: uint64;
memoryUsage: uint64;
keepAlive: boolean;
contextId?: string;
}

/** browserbase update session integration definition */
model BrowserbaseUpdateSessionIntegrationDef
extends BaseBrowserbaseIntegrationDef {
method: "update_session" = "update_session";
arguments: BrowserbaseUpdateSessionArguments;
}

model BrowserbaseUpdateSessionArguments {
id: string;
status: "REQUEST_RELEASE";
}

model BrowserbaseUpdateSessionOutput {
id: string;
createdAt: string;
updatedAt: string;
projectId: string;
startedAt: string;
endedAt: string;
expiresAt: string;
status: "RUNNING" | "ERROR" | "TIMED_OUT" | "COMPLETED";
proxyBytes: uint64;
avgCpuUsage: uint64;
memoryUsage: uint64;
keepAlive: boolean;
contextId?: string;
}

/** browserbase get session live urls integration definition */
model BrowserbaseGetSessionLiveUrlsIntegrationDef
extends BaseBrowserbaseIntegrationDef {
method: "get_live_urls" = "get_live_urls";
arguments: BrowserbaseGetSessionLiveUrlsArguments;
}

model BrowserbaseGetSessionLiveUrlsArguments {
id: string;
}

model BrowserbaseGetSessionLiveUrlsOutput {
debuggerFullscreenUrl?: url;
debuggerUrl?: url;
wsUrl?: url;
pages: {
id?: string;
url?: url;
faviconUrl?: url;
title?: string;
debuggerUrl?: url;
debuggerFullscreenUrl?: url;
}[] = #[];
}
1 change: 1 addition & 0 deletions typespec/tools/main.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import "./email.tsp";
import "./spider.tsp";
import "./weather.tsp";
import "./wikipedia.tsp";
import "./browserbase";

namespace Tools;

Expand Down
Loading

0 comments on commit c84c935

Please sign in to comment.