Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Imrpove method signatures and docstrings
Tomas Valenta8acffec4108d
diff --git a/packages/js-sdk/src/sandbox/index.ts b/packages/js-sdk/src/sandbox/index.tsindex fac0d7ac2..71d9a1cfd 100644--- a/packages/js-sdk/src/sandbox/index.ts+++ b/packages/js-sdk/src/sandbox/index.ts@@ -266,13 +266,8 @@ export class Sandbox extends SandboxConnection {// Init Process handlerthis.process = {- /**- * Starts a new process.- * @param optsOrID Process options or Process ID- * @returns New process- */- start: async (optsOrID: string | ProcessOpts) => {- const opts = typeof optsOrID === 'string' ? { cmd: optsOrID } : optsOrID+ start: async (optsOrCmd: string | ProcessOpts) => {+ const opts = typeof optsOrCmd === 'string' ? { cmd: optsOrCmd } : optsOrCmdconst start = async ({cmd,onStdout,@@ -410,9 +405,9 @@ export class Sandbox extends SandboxConnection {const timeout = opts.timeoutreturn await withTimeout(start, timeout)(opts)},-- startAndWait: async (optsOrID: string | ProcessOpts) => {- const process = await this.process.start(optsOrID)+ startAndWait: async (optsOrCmd: string | ProcessOpts) => {+ const opts = typeof optsOrCmd === 'string' ? { cmd: optsOrCmd } : optsOrCmd+ const process = await this.process.start(opts)return await process.wait()}}@@ -434,8 +429,7 @@ export class Sandbox extends SandboxConnection {}/**- * Creates a new Sandbox.- * @param optsOrID Sandbox options or Sandbox ID+ * Creates a new Sandbox from the default `base` sandbox template.* @returns New Sandbox** @example@@ -443,6 +437,32 @@ export class Sandbox extends SandboxConnection {* const sandbox = await Sandbox.create()* ```*/+ static async create(): Promise<Sandbox>;+ /**+ * Creates a new Sandbox from the template with the specified ID.+ * @param id Sandbox ID+ * @returns New Sandbox+ *+ * @example+ * ```ts+ * const sandbox = await Sandbox.create("sandboxID")+ * ```+ */+ static async create(id: string): Promise<Sandbox>;+ /**+ * Creates a new Sandbox from the specified options.+ * @param opts Sandbox options+ * @returns New Sandbox+ *+ * @example+ * ```ts+ * const sandbox = await Sandbox.create({+ * id: "sandboxID",+ * onStdout: console.log,+ * })+ * ```+ */+ static async create(opts: SandboxOpts): Promise<Sandbox>;static async create(optsOrID?: string | SandboxOpts) {const opts = typeof optsOrID === 'string' ? { id: optsOrID } : optsOrIDreturn new Sandbox(opts)@@ -458,7 +478,7 @@ export class Sandbox extends SandboxConnection {/*** Reconnects to an existing Sandbox.- * @param sandboxIDorOpts Sandbox ID or Sandbox options+ * @param sandboxID Sandbox ID* @returns Existing Sandbox** @example@@ -466,12 +486,24 @@ export class Sandbox extends SandboxConnection {* const sandbox = await Sandbox.reconnect(sandboxID)* ```*/- static async reconnect(- sandboxIDorOpts: string | Omit<SandboxOpts, 'id'> & { sandboxID: string }- ) {+ static async reconnect(sandboxID: string): Promise<Sandbox>;+ /**+ * Reconnects to an existing Sandbox.+ * @param opts Sandbox options+ * @returns Existing Sandbox+ *+ * @example+ * ```ts+ * const sandbox = await Sandbox.reconnect({+ * sandboxID,+ * })+ * ```+ */+ static async reconnect(opts: Omit<SandboxOpts, 'id'> & { sandboxID: string }): Promise<Sandbox>;+ static async reconnect(sandboxIDorOpts: string | Omit<SandboxOpts, 'id'> & { sandboxID: string }) {let sandboxID: stringlet opts: SandboxOpts- if (typeof sandboxIDorOpts === 'string'){+ if (typeof sandboxIDorOpts === 'string') {sandboxID = sandboxIDorOptsopts = {}} else {diff --git a/packages/js-sdk/src/sandbox/process.ts b/packages/js-sdk/src/sandbox/process.tsindex 603ce9f1f..de361f915 100644--- a/packages/js-sdk/src/sandbox/process.ts+++ b/packages/js-sdk/src/sandbox/process.ts@@ -165,6 +165,28 @@ export interface ProcessOpts {}export interface ProcessManager {- readonly start: (optsOrID: string | ProcessOpts) => Promise<Process>;- readonly startAndWait: (optsOrID: string | ProcessOpts) => Promise<ProcessOutput>;+ /**+ * Starts a new process.+ * @param cmd Command to execute+ * @returns New process+ */+ start(cmd: string): Promise<Process>;+ /**+ * Starts a new process.+ * @param opts Process options+ * @returns New process+ */+ start(opts: ProcessOpts): Promise<Process>;+ /**+ * Starts a new process and wait until it finishes.+ * @param cmd Command to execute+ * @returns New process+ */+ startAndWait(cmd: string): Promise<ProcessOutput>;+ /**+ * Starts a new process and wait until it finishes.+ * @param opts Process options+ * @returns New process+ */+ startAndWait(opts: ProcessOpts): Promise<ProcessOutput>;}diff --git a/packages/js-sdk/src/templates/dataAnalysis.ts b/packages/js-sdk/src/templates/dataAnalysis.tsindex dce49fadc..6a1da33ec 100644--- a/packages/js-sdk/src/templates/dataAnalysis.ts+++ b/packages/js-sdk/src/templates/dataAnalysis.ts@@ -27,6 +27,7 @@ export class DataAnalysis extends Sandbox {super({ id: DataAnalysisEnvId, ...opts })}+ static override async create(): Promise<DataAnalysis>;static override async create(opts?: Omit<SandboxOpts, 'id'>) {return new DataAnalysis({ ...opts })._open({ timeout: opts?.timeout })