Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Changed `template ls` command to sync with latest API changes (#508)
Mish Ushakovfc8086dcf525
diff --git a/.changeset/khaki-owls-refuse.md b/.changeset/khaki-owls-refuse.mdnew file mode 100644index 000000000..2adfdf19d--- /dev/null+++ b/.changeset/khaki-owls-refuse.md@@ -0,0 +1,5 @@+---+'@e2b/cli': patch+---++Changed template ls command to sync with latest API changesdiff --git a/packages/cli/src/commands/template/list.ts b/packages/cli/src/commands/template/list.tsindex 6c4fe48c9..46666944f 100644--- a/packages/cli/src/commands/template/list.ts+++ b/packages/cli/src/commands/template/list.ts@@ -32,6 +32,7 @@ export const listCommand = new commander.Command('list')const table = new tablePrinter.Table({title: 'Sandbox templates',columns: [+ { name: 'visibility', alignment: 'left', title: 'Access' },{ name: 'templateID', alignment: 'left', title: 'Template ID' },{name: 'aliases',@@ -42,11 +43,23 @@ export const listCommand = new commander.Command('list')},{ name: 'cpuCount', alignment: 'right', title: 'vCPUs' },{ name: 'memoryMB', alignment: 'right', title: 'RAM MiB' },+ { name: 'createdBy', alignment: 'right', title: 'Created by' },+ { name: 'createdAt', alignment: 'right', title: 'Created at' },+ ],+ disabledColumns: [+ 'public',+ 'buildID',+ 'buildCount',+ 'lastSpawnedAt',+ 'spawnCount',+ 'updatedAt',],- disabledColumns: ['public', 'buildID'],rows: templates.map((template) => ({...template,+ visibility: template.public ? 'Public' : 'Private',aliases: listAliases(template.aliases),+ createdBy: template.createdBy?.email,+ createdAt: new Date(template.createdAt).toLocaleDateString(),})),style: {headerTop: {diff --git a/packages/js-sdk/src/api/schema.gen.ts b/packages/js-sdk/src/api/schema.gen.tsindex 62a662f38..3cc9a39e3 100644--- a/packages/js-sdk/src/api/schema.gen.ts+++ b/packages/js-sdk/src/api/schema.gen.ts@@ -247,6 +247,28 @@ export interface paths {500: components["responses"]["500"];};};+ /** @description Update template */+ patch: {+ parameters: {+ path: {+ templateID: components["parameters"]["templateID"];+ };+ };+ requestBody: {+ content: {+ "application/json": components["schemas"]["TemplateUpdateRequest"];+ };+ };+ responses: {+ /** @description The template was updated successfully */+ 200: {+ content: never;+ };+ 400: components["responses"]["400"];+ 401: components["responses"]["401"];+ 500: components["responses"]["500"];+ };+ };};"/templates/{templateID}/builds/{buildID}": {/** @description Start the build */@@ -395,17 +417,52 @@ export interface components {/** @description Identifier of the team */teamID: string;};+ TeamUser: {+ /** @description Email of the user */+ email: string;+ /**+ * Format: uuid+ * @description Identifier of the user+ */+ id: string;+ };Template: {/** @description Aliases of the template */aliases?: string[];+ /**+ * Format: int32+ * @description Number of times the template was built+ */+ buildCount: number;/** @description Identifier of the last successful build for given template */buildID: string;cpuCount: components["schemas"]["CPUCount"];+ /**+ * Format: date-time+ * @description Time when the template was created+ */+ createdAt: string;+ createdBy: components["schemas"]["TeamUser"] | null;+ /**+ * Format: date-time+ * @description Time when the template was last used+ */+ lastSpawnedAt: string;memoryMB: components["schemas"]["MemoryMB"];/** @description Whether the template is public or only accessible by the team */public: boolean;+ /**+ * Format: int64+ * @description Number of times the template was used+ */+ spawnCount: number;/** @description Identifier of the template */templateID: string;+ /**+ * Format: date-time+ * @description Time when the template was last updated+ */+ updatedAt: string;};TemplateBuild: {/** @description Identifier of the build */@@ -435,6 +492,10 @@ export interface components {/** @description Identifier of the team */teamID?: string;};+ TemplateUpdateRequest: {+ /** @description Whether the template is public or only accessible by the team */+ public?: boolean;+ };};responses: {/** @description Bad request */diff --git a/spec/openapi.yml b/spec/openapi.ymlindex 8fae421e5..17a1db854 100644--- a/spec/openapi.yml+++ b/spec/openapi.yml@@ -85,6 +85,25 @@ components:type: booleandescription: Whether the team is the default team+ TeamUser:+ required:+ - id+ properties:+ id:+ type: string+ format: uuid+ description: Identifier of the user+ email:+ type: string+ description: Email of the user++ TemplateUpdateRequest:+ properties:+ public:+ type: boolean+ description: Whether the template is public or only accessible by the team+CPUCount:type: integerformat: int32@@ -218,6 +237,12 @@ components:- cpuCount- memoryMB- public+ - createdAt+ - updatedAt+ - createdBy+ - lastSpawnedAt+ - spawnCount+ - buildCountproperties:templateID:type: string@@ -237,6 +262,30 @@ components:description: Aliases of the templateitems:type: string+ createdAt:+ type: string+ format: date-time+ description: Time when the template was created+ updatedAt:+ type: string+ format: date-time+ description: Time when the template was last updated+ createdBy:+ allOf:+ - $ref: "#/components/schemas/TeamUser"+ nullable: true+ lastSpawnedAt:+ type: string+ format: date-time+ description: Time when the template was last used+ spawnCount:+ type: integer+ format: int64+ description: Number of times the template was used+ buildCount:+ type: integer+ format: int32+ description: Number of times the template was builtTemplateBuildRequest:required:@@ -586,6 +635,28 @@ paths:$ref: "#/components/responses/401""500":$ref: "#/components/responses/500"+ patch:+ description: Update template+ tags: [templates]+ security:+ - AccessTokenAuth: []+ parameters:+ - $ref: "#/components/parameters/templateID"+ requestBody:+ required: true+ content:+ application/json:+ schema:+ $ref: "#/components/schemas/TemplateUpdateRequest"+ responses:+ "200":+ description: The template was updated successfully+ "400":+ $ref: "#/components/responses/400"+ "401":+ $ref: "#/components/responses/401"+ "500":+ $ref: "#/components/responses/500"/templates/{templateID}/builds/{buildID}:post: