Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Add teams endpoint
Jakub Novak3485e74d384c
diff --git a/packages/js-sdk/src/api/schema.gen.ts b/packages/js-sdk/src/api/schema.gen.tsindex 747c1d6a0..b69500ff5 100644--- a/packages/js-sdk/src/api/schema.gen.ts+++ b/packages/js-sdk/src/api/schema.gen.ts@@ -14,6 +14,21 @@ export interface paths {};};};+ "/teams": {+ /** List all teams */+ get: {+ responses: {+ /** Successfully returned all teams */+ 200: {+ content: {+ "application/json": components["schemas"]["Team"][];+ };+ };+ 401: components["responses"]["401"];+ 500: components["responses"]["500"];+ };+ };+ };"/sandboxes": {/** List all running sandboxes */get: {@@ -21,7 +36,7 @@ export interface paths {/** Successfully returned all running sandboxes */200: {content: {- "application/json": components["schemas"]["RunningSandboxes"][];+ "application/json": components["schemas"]["RunningSandbox"][];};};400: components["responses"]["400"];@@ -57,7 +72,7 @@ export interface paths {sandboxID: components["parameters"]["sandboxID"];};query: {- /** Starting timestamp of the logs that should be returned */+ /** Starting timestamp of the logs that should be returned in milliseconds */start?: number;/** Maximum number of logs that should be returned */limit?: number;@@ -93,6 +108,34 @@ export interface paths {};};};+ "/sandboxes/{sandboxID}/timeout": {+ /** Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request. Calling this method multiple times overwrites the TTL, each time using the current timestamp as the starting point to measure the timeout duration. */+ post: {+ parameters: {+ path: {+ sandboxID: components["parameters"]["sandboxID"];+ };+ };+ responses: {+ /** Successfully set the sandbox timeout */+ 204: never;+ 401: components["responses"]["401"];+ 404: components["responses"]["404"];+ 500: components["responses"]["500"];+ };+ requestBody: {+ content: {+ "application/json": {+ /**+ * Format: int32+ * @description Timeout in seconds from the current time after which the sandbox should expire+ */+ timeout: number;+ };+ };+ };+ };+ };"/sandboxes/{sandboxID}/refreshes": {/** Refresh the sandbox extending its time to live */post: {@@ -130,6 +173,11 @@ export interface paths {401: components["responses"]["401"];500: components["responses"]["500"];};+ requestBody: {+ content: {+ "application/json": components["schemas"]["TemplatesListRequest"];+ };+ };};/** Create a new template */post: {@@ -206,32 +254,6 @@ export interface paths {};};};- "/templates/{templateID}/builds/{buildID}/logs": {- /** Add a build log */- post: {- parameters: {- path: {- templateID: components["parameters"]["templateID"];- buildID: components["parameters"]["buildID"];- };- };- responses: {- /** Successfully added log */- 201: unknown;- 401: components["responses"]["401"];- 404: components["responses"]["404"];- };- requestBody: {- content: {- "application/json": {- /** @description API secret */- apiSecret: string;- logs: string[];- };- };- };- };- };"/templates/{templateID}/builds/{buildID}/status": {/** Get template build info */get: {@@ -262,6 +284,26 @@ export interface paths {export interface components {schemas: {+ Team: {+ /** @description Identifier of the team */+ teamID: string;+ /** @description Name of the team */+ name: string;+ /** @description API key for the team */+ apiKey: string;+ /** @description Whether the team is the default team */+ isDefault: boolean;+ };+ /**+ * Format: int32+ * @description CPU cores for the sandbox+ */+ CPUCount: number;+ /**+ * Format: int32+ * @description Memory for the sandbox in MB+ */+ MemoryMB: number;SandboxMetadata: { [key: string]: string };/** @description Log entry with timestamp and line */SandboxLog: {@@ -286,8 +328,10 @@ export interface components {alias?: string;/** @description Identifier of the client */clientID: string;+ /** @description Version of the envd running in the sandbox */+ envdVersion: string;};- RunningSandboxes: {+ RunningSandbox: {/** @description Identifier of the template from which is the sandbox created */templateID: string;/** @description Alias of the template */@@ -301,15 +345,19 @@ export interface components {* @description Time when the sandbox was started*/startedAt: string;- /** @description CPU cores for the sandbox */- cpuCount: number;- /** @description Memory limit for the sandbox in MB */- memoryMB: number;+ cpuCount: components["schemas"]["CPUCount"];+ memoryMB: components["schemas"]["MemoryMB"];metadata?: components["schemas"]["SandboxMetadata"];};NewSandbox: {/** @description Identifier of the required template */templateID: string;+ /**+ * Format: int32+ * @description Time to live for the sandbox in seconds.+ * @default 15+ */+ timeout?: number;metadata?: components["schemas"]["SandboxMetadata"];};Template: {@@ -317,28 +365,28 @@ export interface components {templateID: string;/** @description Identifier of the last successful build for given template */buildID: string;- /** @description CPU cores for the sandbox */- cpuCount: number;- /** @description Memory limit for the sandbox in MB */- memoryMB: number;+ cpuCount: components["schemas"]["CPUCount"];+ memoryMB: components["schemas"]["MemoryMB"];/** @description Whether the template is public or only accessible by the team */public: boolean;/** @description Aliases of the template */aliases?: string[];- } & {- storageGB: unknown;};TemplateBuildRequest: {/** @description Alias of the template */alias?: string;/** @description Dockerfile for the template */dockerfile: string;+ /** @description Identifier of the team */+ teamID?: string;/** @description Start command to execute in the template after the build */startCmd?: string;- /** @description CPU cores for the template */- cpuCount?: number;- /** @description Memory limit for the template in MB */- memoryMB?: number;+ cpuCount?: components["schemas"]["CPUCount"];+ memoryMB?: components["schemas"]["MemoryMB"];+ };+ TemplatesListRequest: {+ /** @description Identifier of the team */+ teamID: string;};TemplateBuild: {/**@@ -354,9 +402,7 @@ export interface components {* @description Status of the template* @enum {string}*/- status?: "building" | "ready" | "error";- } & {- finished: unknown;+ status: "building" | "ready" | "error";};Error: {/**diff --git a/packages/js-sdk/src/sandbox/index.ts b/packages/js-sdk/src/sandbox/index.tsindex f12c6fe76..b757e4558 100644--- a/packages/js-sdk/src/sandbox/index.ts+++ b/packages/js-sdk/src/sandbox/index.ts@@ -518,7 +518,7 @@ export class Sandbox extends SandboxConnection {const sandboxIDAndClientID = id.split('-')const sandboxID = sandboxIDAndClientID[0]const clientID = sandboxIDAndClientID[1]- opts.__sandbox = { sandboxID, clientID, templateID: 'unknown' }+ opts.__sandbox = { sandboxID, clientID, templateID: 'unknown', envdVersion: 'unknown' }const sandbox = new this(opts, true) as InstanceType<S>await sandbox._open({ timeout: opts?.timeout })diff --git a/spec/openapi.yml b/spec/openapi.ymlindex 8fdbb8b15..e2963f994 100644--- a/spec/openapi.yml+++ b/spec/openapi.yml@@ -38,26 +38,26 @@ components:type: stringresponses:- 400:+ "400":description: Bad requestcontent:application/json:schema:$ref: "#/components/schemas/Error"- 401:+ "401":description: Authentication errorcontent:application/json:schema:$ref: "#/components/schemas/Error"- 404:+ "404":description: Not foundcontent:application/json:schema:$ref: "#/components/schemas/Error"- 500:+ "500":description: Server errorcontent:application/json:@@ -65,6 +65,40 @@ components:$ref: "#/components/schemas/Error"schemas:+ Team:+ required:+ - teamID+ - name+ - apiKey+ - isDefault+ properties:+ teamID:+ type: string+ description: Identifier of the team+ name:+ type: string+ description: Name of the team+ apiKey:+ type: string+ description: API key for the team+ isDefault:+ type: boolean+ description: Whether the team is the default team++ CPUCount:+ type: integer+ format: int32+ minimum: 1+ maximum: 8+ description: CPU cores for the sandbox++ MemoryMB:+ type: integer+ format: int32+ minimum: 128+ maximum: 8192+ description: Memory for the sandbox in MB+SandboxMetadata:additionalProperties:type: string@@ -99,6 +133,7 @@ components:- templateID- sandboxID- clientID+ - envdVersionproperties:templateID:type: string@@ -112,8 +147,11 @@ components:clientID:type: stringdescription: Identifier of the client+ envdVersion:+ type: string+ description: Version of the envd running in the sandbox- RunningSandboxes:+ RunningSandbox:required:- templateID- sandboxID@@ -139,11 +177,9 @@ components:format: date-timedescription: Time when the sandbox was startedcpuCount:- type: integer- description: CPU cores for the sandbox+ $ref: "#/components/schemas/CPUCount"memoryMB:- type: integer- description: Memory limit for the sandbox in MB+ $ref: "#/components/schemas/MemoryMB"metadata:$ref: "#/components/schemas/SandboxMetadata"@@ -154,6 +190,12 @@ components:templateID:type: stringdescription: Identifier of the required template+ timeout:+ type: integer+ format: int32+ minimum: 0+ default: 15+ description: Time to live for the sandbox in seconds.metadata:$ref: "#/components/schemas/SandboxMetadata"@@ -163,7 +205,6 @@ components:- buildID- cpuCount- memoryMB- - storageGB- publicproperties:templateID:@@ -173,11 +214,9 @@ components:type: stringdescription: Identifier of the last successful build for given templatecpuCount:- type: integer- description: CPU cores for the sandbox+ $ref: "#/components/schemas/CPUCount"memoryMB:- type: integer- description: Memory limit for the sandbox in MB+ $ref: "#/components/schemas/MemoryMB"public:type: booleandescription: Whether the template is public or only accessible by the team@@ -197,23 +236,30 @@ components:dockerfile:description: Dockerfile for the templatetype: string+ teamID:+ type: string+ description: Identifier of the teamstartCmd:description: Start command to execute in the template after the buildtype: stringcpuCount:- description: CPU cores for the template- type: integer- minimum: 1+ $ref: "#/components/schemas/CPUCount"memoryMB:- description: Memory limit for the template in MB- type: integer- minimum: 128+ $ref: "#/components/schemas/MemoryMB"++ TemplatesListRequest:+ required:+ - teamID+ properties:+ teamID:+ type: string+ description: Identifier of the teamTemplateBuild:required:- templateID- buildID- - finished+ - status- logsproperties:logs:@@ -252,16 +298,38 @@ components:tags:- name: templates- name: sandboxes+ - name: authpaths:/health:get:description: Health checkresponses:- 200:+ "200":description: Request was successful- 401:+ "401":+ $ref: "#/components/responses/401"++ /teams:+ get:+ description: List all teams+ tags: [auth]+ security:+ - AccessTokenAuth: []+ responses:+ "200":+ description: Successfully returned all teams+ content:+ application/json:+ schema:+ type: array+ items:+ allOf:+ - $ref: "#/components/schemas/Team"+ "401":$ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"/sandboxes:get:@@ -270,7 +338,7 @@ paths:security:- ApiKeyAuth: []responses:- 200:+ "200":description: Successfully returned all running sandboxescontent:application/json:@@ -278,12 +346,12 @@ paths:type: arrayitems:allOf:- - $ref: "#/components/schemas/RunningSandboxes"- 401:+ - $ref: "#/components/schemas/RunningSandbox"+ "401":$ref: "#/components/responses/401"- 400:+ "400":$ref: "#/components/responses/400"- 500:+ "500":$ref: "#/components/responses/500"post:description: Create a sandbox from the template@@ -297,17 +365,17 @@ paths:schema:$ref: "#/components/schemas/NewSandbox"responses:- 201:+ "201":description: The sandbox was created successfullycontent:application/json:schema:$ref: "#/components/schemas/Sandbox"- 401:+ "401":$ref: "#/components/responses/401"- 400:+ "400":$ref: "#/components/responses/400"- 500:+ "500":$ref: "#/components/responses/500"/sandboxes/{sandboxID}/logs:@@ -322,25 +390,29 @@ paths:name: startschema:type: integer+ format: int64+ minimum: 0description: Starting timestamp of the logs that should be returned in milliseconds- in: queryname: limitschema:default: 1000+ format: int32+ minimum: 0type: integerdescription: Maximum number of logs that should be returnedresponses:- 200:+ "200":description: Successfully returned the sandbox logscontent:application/json:schema:$ref: "#/components/schemas/SandboxLogs"- 404:+ "404":$ref: "#/components/responses/404"- 401:+ "401":$ref: "#/components/responses/401"- 500:+ "500":$ref: "#/components/responses/500"/sandboxes/{sandboxID}:@@ -352,13 +424,44 @@ paths:parameters:- $ref: "#/components/parameters/sandboxID"responses:- 204:+ "204":description: The sandbox was killed successfully- 404:+ "404":$ref: "#/components/responses/404"- 401:+ "401":$ref: "#/components/responses/401"- 500:+ "500":+ $ref: "#/components/responses/500"++ /sandboxes/{sandboxID}/timeout:+ post:+ description: Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request. Calling this method multiple times overwrites the TTL, each time using the current timestamp as the starting point to measure the timeout duration.+ security:+ - ApiKeyAuth: []+ tags: [sandboxes]+ requestBody:+ content:+ application/json:+ schema:+ type: object+ required:+ - timeout+ properties:+ timeout:+ description: Timeout in seconds from the current time after which the sandbox should expire+ type: integer+ format: int32+ minimum: 0+ parameters:+ - $ref: "#/components/parameters/sandboxID"+ responses:+ "204":+ description: Successfully set the sandbox timeout+ "401":+ $ref: "#/components/responses/401"+ "404":+ $ref: "#/components/responses/404"+ "500":$ref: "#/components/responses/500"/sandboxes/{sandboxID}/refreshes:@@ -368,7 +471,6 @@ paths:- ApiKeyAuth: []tags: [sandboxes]requestBody:- required: falsecontent:application/json:schema:@@ -382,11 +484,11 @@ paths:parameters:- $ref: "#/components/parameters/sandboxID"responses:- 204:+ "204":description: Successfully refreshed the sandbox- 401:+ "401":$ref: "#/components/responses/401"- 404:+ "404":$ref: "#/components/responses/404"/templates:@@ -395,8 +497,15 @@ paths:tags: [templates]security:- AccessTokenAuth: []+ requestBody:+ required: false+ content:+ application/json:+ schema:+ $ref: "#/components/schemas/TemplatesListRequest"+responses:- 200:+ "200":description: Successfully returned all templatescontent:application/json:@@ -405,9 +514,9 @@ paths:items:allOf:- $ref: "#/components/schemas/Template"- 401:+ "401":$ref: "#/components/responses/401"- 500:+ "500":$ref: "#/components/responses/500"post:description: Create a new template@@ -422,15 +531,15 @@ paths:$ref: "#/components/schemas/TemplateBuildRequest"responses:- 202:+ "202":description: The build was acceptedcontent:application/json:schema:$ref: "#/components/schemas/Template"- 401:+ "401":$ref: "#/components/responses/401"- 500:+ "500":$ref: "#/components/responses/500"/templates/{templateID}:@@ -449,15 +558,15 @@ paths:$ref: "#/components/schemas/TemplateBuildRequest"responses:- 202:+ "202":description: The build was acceptedcontent:application/json:schema:$ref: "#/components/schemas/Template"- 401:+ "401":$ref: "#/components/responses/401"- 500:+ "500":$ref: "#/components/responses/500"delete:description: Delete a template@@ -467,11 +576,11 @@ paths:parameters:- $ref: "#/components/parameters/templateID"responses:- 204:+ "204":description: The template was deleted successfully- 401:+ "401":$ref: "#/components/responses/401"- 500:+ "500":$ref: "#/components/responses/500"/templates/{templateID}/builds/{buildID}:@@ -484,45 +593,13 @@ paths:- $ref: "#/components/parameters/templateID"- $ref: "#/components/parameters/buildID"responses:- 202:+ "202":description: The build has started- 401:+ "401":$ref: "#/components/responses/401"- 500:+ "500":$ref: "#/components/responses/500"- /templates/{templateID}/builds/{buildID}/logs:- post:- description: Add a build log- tags: [templates]- parameters:- - $ref: "#/components/parameters/templateID"- - $ref: "#/components/parameters/buildID"- requestBody:- required: true- content:- application/json:- schema:- type: object- required:- - apiSecret- - logs- properties:- apiSecret:- description: API secret- type: string- logs:- type: array- items:- type: string- responses:- 201:- description: Successfully added log- 401:- $ref: "#/components/responses/401"- 404:- $ref: "#/components/responses/404"-/templates/{templateID}/builds/{buildID}/status:get:description: Get template build info@@ -537,17 +614,19 @@ paths:schema:default: 0type: integer+ format: int32+ minimum: 0description: Index of the starting build log that should be returned with the templateresponses:- 200:+ "200":description: Successfully returned the templatecontent:application/json:schema:$ref: "#/components/schemas/TemplateBuild"- 401:+ "401":$ref: "#/components/responses/401"- 404:+ "404":$ref: "#/components/responses/404"- 500:+ "500":$ref: "#/components/responses/500"