mirror of
https://github.com/harivansh-afk/sandbox-agent.git
synced 2026-04-15 07:04:48 +00:00
chore: sync workspace changes
This commit is contained in:
parent
8a91b8e9aa
commit
6aa591bd91
13 changed files with 237 additions and 26 deletions
|
|
@ -1,4 +1,6 @@
|
|||
export { SandboxAgent, SandboxAgentError } from "./client.ts";
|
||||
export { buildInspectorUrl } from "./inspector.ts";
|
||||
export type { InspectorUrlOptions } from "./inspector.ts";
|
||||
export type {
|
||||
SandboxAgentConnectOptions,
|
||||
SandboxAgentStartOptions,
|
||||
|
|
|
|||
32
sdks/typescript/src/inspector.ts
Normal file
32
sdks/typescript/src/inspector.ts
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
const INSPECTOR_URL = "https://inspect.sandboxagent.dev";
|
||||
|
||||
export interface InspectorUrlOptions {
|
||||
/**
|
||||
* Base URL of the sandbox-agent server.
|
||||
*/
|
||||
baseUrl: string;
|
||||
/**
|
||||
* Optional bearer token for authentication.
|
||||
*/
|
||||
token?: string;
|
||||
/**
|
||||
* Optional extra headers to pass to the sandbox-agent server.
|
||||
* Will be JSON-encoded in the URL.
|
||||
*/
|
||||
headers?: Record<string, string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds a URL to the sandbox-agent inspector UI with the given connection parameters.
|
||||
*/
|
||||
export function buildInspectorUrl(options: InspectorUrlOptions): string {
|
||||
const normalized = options.baseUrl.replace(/\/+$/, "");
|
||||
const params = new URLSearchParams({ url: normalized });
|
||||
if (options.token) {
|
||||
params.set("token", options.token);
|
||||
}
|
||||
if (options.headers && Object.keys(options.headers).length > 0) {
|
||||
params.set("headers", JSON.stringify(options.headers));
|
||||
}
|
||||
return `${INSPECTOR_URL}?${params.toString()}`;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue