Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

feat: keep user and workdir from the template in the sandbox (#944)

Jakub Dobryde771ea3eb62
diff --git a/.changeset/nervous-seahorses-deliver.md b/.changeset/nervous-seahorses-deliver.md
new file mode 100644
index 000000000..41b4df74a
--- /dev/null
+++ b/.changeset/nervous-seahorses-deliver.md
@@ -0,0 +1,7 @@
+---
+'@e2b/python-sdk': patch
+'e2b': patch
+'@e2b/cli': patch
+---
+
+allow omitting user in commands to use the default from template
diff --git a/packages/js-sdk/.prettierignore b/packages/js-sdk/.prettierignore
new file mode 100644
index 000000000..655f26c40
--- /dev/null
+++ b/packages/js-sdk/.prettierignore
@@ -0,0 +1 @@
+schema.gen.ts
diff --git a/packages/js-sdk/src/api/schema.gen.ts b/packages/js-sdk/src/api/schema.gen.ts
index ee1445701..9af886761 100644
--- a/packages/js-sdk/src/api/schema.gen.ts
+++ b/packages/js-sdk/src/api/schema.gen.ts
@@ -4,1698 +4,1695 @@
*/
export interface paths {
- '/sandboxes': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- /** @description List all running sandboxes */
- get: {
- parameters: {
- query?: {
- /** @description Metadata query used to filter the sandboxes (e.g. "user=abc&app=prod"). Each key and values must be URL encoded. */
- metadata?: string
- }
- header?: never
- path?: never
- cookie?: never
- }
- requestBody?: never
- responses: {
- /** @description Successfully returned all running sandboxes */
- 200: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['ListedSandbox'][]
- }
- }
- 400: components['responses']['400']
- 401: components['responses']['401']
- 500: components['responses']['500']
- }
- }
- put?: never
- /** @description Create a sandbox from the template */
- post: {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- requestBody: {
- content: {
- 'application/json': components['schemas']['NewSandbox']
- }
- }
- responses: {
- /** @description The sandbox was created successfully */
- 201: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['Sandbox']
- }
- }
- 400: components['responses']['400']
- 401: components['responses']['401']
- 500: components['responses']['500']
- }
- }
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
- '/sandboxes/{sandboxID}': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- /** @description Get a sandbox by id */
- get: {
- parameters: {
- query?: never
- header?: never
- path: {
- sandboxID: components['parameters']['sandboxID']
- }
- cookie?: never
- }
- requestBody?: never
- responses: {
- /** @description Successfully returned the sandbox */
- 200: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['SandboxDetail']
- }
- }
- 401: components['responses']['401']
- 404: components['responses']['404']
- 500: components['responses']['500']
- }
- }
- put?: never
- post?: never
- /** @description Kill a sandbox */
- delete: {
- parameters: {
- query?: never
- header?: never
- path: {
- sandboxID: components['parameters']['sandboxID']
- }
- cookie?: never
- }
- requestBody?: never
- responses: {
- /** @description The sandbox was killed successfully */
- 204: {
- headers: {
- [name: string]: unknown
- }
- content?: never
- }
- 401: components['responses']['401']
- 404: components['responses']['404']
- 500: components['responses']['500']
- }
- }
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
- '/sandboxes/{sandboxID}/logs': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- /** @description Get sandbox logs */
- get: {
- parameters: {
- query?: {
- /** @description Maximum number of logs that should be returned */
- limit?: number
- /** @description Starting timestamp of the logs that should be returned in milliseconds */
- start?: number
- }
- header?: never
- path: {
- sandboxID: components['parameters']['sandboxID']
- }
- cookie?: never
- }
- requestBody?: never
- responses: {
- /** @description Successfully returned the sandbox logs */
- 200: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['SandboxLogs']
- }
- }
- 401: components['responses']['401']
- 404: components['responses']['404']
- 500: components['responses']['500']
- }
- }
- put?: never
- post?: never
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
- '/sandboxes/{sandboxID}/metrics': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- /** @description Get sandbox metrics */
- get: {
- parameters: {
- query?: {
- end?: number
- /** @description Unix timestamp for the start of the interval, in seconds, for which the metrics */
- start?: number
- }
- header?: never
- path: {
- sandboxID: components['parameters']['sandboxID']
- }
- cookie?: never
- }
- requestBody?: never
- responses: {
- /** @description Successfully returned the sandbox metrics */
- 200: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['SandboxMetric'][]
- }
- }
- 400: components['responses']['400']
- 401: components['responses']['401']
- 404: components['responses']['404']
- 500: components['responses']['500']
- }
- }
- put?: never
- post?: never
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
- '/sandboxes/{sandboxID}/pause': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- get?: never
- put?: never
- /** @description Pause the sandbox */
- post: {
- parameters: {
- query?: never
- header?: never
- path: {
- sandboxID: components['parameters']['sandboxID']
- }
- cookie?: never
- }
- requestBody?: never
- responses: {
- /** @description The sandbox was paused successfully and can be resumed */
- 204: {
- headers: {
- [name: string]: unknown
- }
- content?: never
- }
- 401: components['responses']['401']
- 404: components['responses']['404']
- 409: components['responses']['409']
- 500: components['responses']['500']
- }
- }
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
- '/sandboxes/{sandboxID}/refreshes': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- get?: never
- put?: never
- /** @description Refresh the sandbox extending its time to live */
- post: {
- parameters: {
- query?: never
- header?: never
- path: {
- sandboxID: components['parameters']['sandboxID']
- }
- cookie?: never
- }
- requestBody?: {
- content: {
- 'application/json': {
- /** @description Duration for which the sandbox should be kept alive in seconds */
- duration?: number
- }
- }
- }
- responses: {
- /** @description Successfully refreshed the sandbox */
- 204: {
- headers: {
- [name: string]: unknown
- }
- content?: never
- }
- 401: components['responses']['401']
- 404: components['responses']['404']
- }
- }
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
- '/sandboxes/{sandboxID}/resume': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- get?: never
- put?: never
- /** @description Resume the sandbox */
- post: {
- parameters: {
- query?: never
- header?: never
- path: {
- sandboxID: components['parameters']['sandboxID']
- }
- cookie?: never
- }
- requestBody: {
- content: {
- 'application/json': components['schemas']['ResumedSandbox']
- }
- }
- responses: {
- /** @description The sandbox was resumed successfully */
- 201: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['Sandbox']
- }
- }
- 401: components['responses']['401']
- 404: components['responses']['404']
- 409: components['responses']['409']
- 500: components['responses']['500']
- }
- }
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
- '/sandboxes/{sandboxID}/timeout': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- get?: never
- put?: never
- /** @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. */
- post: {
- parameters: {
- query?: never
- header?: never
- path: {
- sandboxID: components['parameters']['sandboxID']
- }
- cookie?: never
- }
- requestBody?: {
- content: {
- 'application/json': {
+ "/sandboxes": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** @description List all running sandboxes */
+ get: {
+ parameters: {
+ query?: {
+ /** @description Metadata query used to filter the sandboxes (e.g. "user=abc&app=prod"). Each key and values must be URL encoded. */
+ metadata?: string;
+ };
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Successfully returned all running sandboxes */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["ListedSandbox"][];
+ };
+ };
+ 400: components["responses"]["400"];
+ 401: components["responses"]["401"];
+ 500: components["responses"]["500"];
+ };
+ };
+ put?: never;
+ /** @description Create a sandbox from the template */
+ post: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ requestBody: {
+ content: {
+ "application/json": components["schemas"]["NewSandbox"];
+ };
+ };
+ responses: {
+ /** @description The sandbox was created successfully */
+ 201: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Sandbox"];
+ };
+ };
+ 400: components["responses"]["400"];
+ 401: components["responses"]["401"];
+ 500: components["responses"]["500"];
+ };
+ };
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/sandboxes/{sandboxID}": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** @description Get a sandbox by id */
+ get: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ sandboxID: components["parameters"]["sandboxID"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Successfully returned the sandbox */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["SandboxDetail"];
+ };
+ };
+ 401: components["responses"]["401"];
+ 404: components["responses"]["404"];
+ 500: components["responses"]["500"];
+ };
+ };
+ put?: never;
+ post?: never;
+ /** @description Kill a sandbox */
+ delete: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ sandboxID: components["parameters"]["sandboxID"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The sandbox was killed successfully */
+ 204: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ 401: components["responses"]["401"];
+ 404: components["responses"]["404"];
+ 500: components["responses"]["500"];
+ };
+ };
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/sandboxes/{sandboxID}/logs": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** @description Get sandbox logs */
+ get: {
+ parameters: {
+ query?: {
+ /** @description Maximum number of logs that should be returned */
+ limit?: number;
+ /** @description Starting timestamp of the logs that should be returned in milliseconds */
+ start?: number;
+ };
+ header?: never;
+ path: {
+ sandboxID: components["parameters"]["sandboxID"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Successfully returned the sandbox logs */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["SandboxLogs"];
+ };
+ };
+ 401: components["responses"]["401"];
+ 404: components["responses"]["404"];
+ 500: components["responses"]["500"];
+ };
+ };
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/sandboxes/{sandboxID}/metrics": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** @description Get sandbox metrics */
+ get: {
+ parameters: {
+ query?: {
+ end?: number;
+ /** @description Unix timestamp for the start of the interval, in seconds, for which the metrics */
+ start?: number;
+ };
+ header?: never;
+ path: {
+ sandboxID: components["parameters"]["sandboxID"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Successfully returned the sandbox metrics */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["SandboxMetric"][];
+ };
+ };
+ 400: components["responses"]["400"];
+ 401: components["responses"]["401"];
+ 404: components["responses"]["404"];
+ 500: components["responses"]["500"];
+ };
+ };
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/sandboxes/{sandboxID}/pause": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ get?: never;
+ put?: never;
+ /** @description Pause the sandbox */
+ post: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ sandboxID: components["parameters"]["sandboxID"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The sandbox was paused successfully and can be resumed */
+ 204: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ 401: components["responses"]["401"];
+ 404: components["responses"]["404"];
+ 409: components["responses"]["409"];
+ 500: components["responses"]["500"];
+ };
+ };
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/sandboxes/{sandboxID}/refreshes": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ get?: never;
+ put?: never;
+ /** @description Refresh the sandbox extending its time to live */
+ post: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ sandboxID: components["parameters"]["sandboxID"];
+ };
+ cookie?: never;
+ };
+ requestBody?: {
+ content: {
+ "application/json": {
+ /** @description Duration for which the sandbox should be kept alive in seconds */
+ duration?: number;
+ };
+ };
+ };
+ responses: {
+ /** @description Successfully refreshed the sandbox */
+ 204: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ 401: components["responses"]["401"];
+ 404: components["responses"]["404"];
+ };
+ };
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/sandboxes/{sandboxID}/resume": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ get?: never;
+ put?: never;
+ /** @description Resume the sandbox */
+ post: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ sandboxID: components["parameters"]["sandboxID"];
+ };
+ cookie?: never;
+ };
+ requestBody: {
+ content: {
+ "application/json": components["schemas"]["ResumedSandbox"];
+ };
+ };
+ responses: {
+ /** @description The sandbox was resumed successfully */
+ 201: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Sandbox"];
+ };
+ };
+ 401: components["responses"]["401"];
+ 404: components["responses"]["404"];
+ 409: components["responses"]["409"];
+ 500: components["responses"]["500"];
+ };
+ };
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/sandboxes/{sandboxID}/timeout": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ get?: never;
+ put?: never;
+ /** @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. */
+ post: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ sandboxID: components["parameters"]["sandboxID"];
+ };
+ cookie?: never;
+ };
+ requestBody?: {
+ content: {
+ "application/json": {
+ /**
+ * Format: int32
+ * @description Timeout in seconds from the current time after which the sandbox should expire
+ */
+ timeout: number;
+ };
+ };
+ };
+ responses: {
+ /** @description Successfully set the sandbox timeout */
+ 204: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ 401: components["responses"]["401"];
+ 404: components["responses"]["404"];
+ 500: components["responses"]["500"];
+ };
+ };
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/sandboxes/metrics": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** @description List metrics for given sandboxes */
+ get: {
+ parameters: {
+ query: {
+ /** @description Comma-separated list of sandbox IDs to get metrics for */
+ sandbox_ids: string[];
+ };
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Successfully returned all running sandboxes with metrics */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["SandboxesWithMetrics"];
+ };
+ };
+ 400: components["responses"]["400"];
+ 401: components["responses"]["401"];
+ 500: components["responses"]["500"];
+ };
+ };
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/teams": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** @description List all teams */
+ get: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Successfully returned all teams */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Team"][];
+ };
+ };
+ 401: components["responses"]["401"];
+ 500: components["responses"]["500"];
+ };
+ };
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/teams/{teamID}/metrics": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** @description Get metrics for the team */
+ get: {
+ parameters: {
+ query?: {
+ end?: number;
+ /** @description Unix timestamp for the start of the interval, in seconds, for which the metrics */
+ start?: number;
+ };
+ header?: never;
+ path: {
+ teamID: components["parameters"]["teamID"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Successfully returned the team metrics */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["TeamMetric"][];
+ };
+ };
+ 400: components["responses"]["400"];
+ 401: components["responses"]["401"];
+ 403: components["responses"]["403"];
+ 500: components["responses"]["500"];
+ };
+ };
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/templates": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** @description List all templates */
+ get: {
+ parameters: {
+ query?: {
+ teamID?: string;
+ };
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Successfully returned all templates */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Template"][];
+ };
+ };
+ 401: components["responses"]["401"];
+ 500: components["responses"]["500"];
+ };
+ };
+ put?: never;
+ /** @description Create a new template */
+ post: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ requestBody: {
+ content: {
+ "application/json": components["schemas"]["TemplateBuildRequest"];
+ };
+ };
+ responses: {
+ /** @description The build was accepted */
+ 202: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Template"];
+ };
+ };
+ 400: components["responses"]["400"];
+ 401: components["responses"]["401"];
+ 500: components["responses"]["500"];
+ };
+ };
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/templates/{templateID}": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ get?: never;
+ put?: never;
+ /** @description Rebuild an template */
+ post: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ templateID: components["parameters"]["templateID"];
+ };
+ cookie?: never;
+ };
+ requestBody: {
+ content: {
+ "application/json": components["schemas"]["TemplateBuildRequest"];
+ };
+ };
+ responses: {
+ /** @description The build was accepted */
+ 202: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Template"];
+ };
+ };
+ 401: components["responses"]["401"];
+ 500: components["responses"]["500"];
+ };
+ };
+ /** @description Delete a template */
+ delete: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ templateID: components["parameters"]["templateID"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The template was deleted successfully */
+ 204: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ 401: components["responses"]["401"];
+ 500: components["responses"]["500"];
+ };
+ };
+ options?: never;
+ head?: never;
+ /** @description Update template */
+ patch: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ templateID: components["parameters"]["templateID"];
+ };
+ cookie?: never;
+ };
+ requestBody: {
+ content: {
+ "application/json": components["schemas"]["TemplateUpdateRequest"];
+ };
+ };
+ responses: {
+ /** @description The template was updated successfully */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ 400: components["responses"]["400"];
+ 401: components["responses"]["401"];
+ 500: components["responses"]["500"];
+ };
+ };
+ trace?: never;
+ };
+ "/templates/{templateID}/builds/{buildID}": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ get?: never;
+ put?: never;
+ /** @description Start the build */
+ post: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ buildID: components["parameters"]["buildID"];
+ templateID: components["parameters"]["templateID"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The build has started */
+ 202: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ 401: components["responses"]["401"];
+ 500: components["responses"]["500"];
+ };
+ };
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/templates/{templateID}/builds/{buildID}/status": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** @description Get template build info */
+ get: {
+ parameters: {
+ query?: {
+ level?: components["schemas"]["LogLevel"];
+ /** @description Index of the starting build log that should be returned with the template */
+ logsOffset?: number;
+ };
+ header?: never;
+ path: {
+ buildID: components["parameters"]["buildID"];
+ templateID: components["parameters"]["templateID"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Successfully returned the template */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["TemplateBuild"];
+ };
+ };
+ 401: components["responses"]["401"];
+ 404: components["responses"]["404"];
+ 500: components["responses"]["500"];
+ };
+ };
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/templates/{templateID}/files/{hash}": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** @description Get an upload link for a tar file containing build layer files */
+ get: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ hash: string;
+ templateID: components["parameters"]["templateID"];
+ };
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The upload link where to upload the tar file */
+ 201: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["TemplateBuildFileUpload"];
+ };
+ };
+ 400: components["responses"]["400"];
+ 401: components["responses"]["401"];
+ 404: components["responses"]["404"];
+ 500: components["responses"]["500"];
+ };
+ };
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/v2/sandboxes": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** @description List all sandboxes */
+ get: {
+ parameters: {
+ query?: {
+ /** @description Maximum number of items to return per page */
+ limit?: number;
+ /** @description Metadata query used to filter the sandboxes (e.g. "user=abc&app=prod"). Each key and values must be URL encoded. */
+ metadata?: string;
+ /** @description Cursor to start the list from */
+ nextToken?: string;
+ /** @description Filter sandboxes by one or more states */
+ state?: components["schemas"]["SandboxState"][];
+ };
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Successfully returned all running sandboxes */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["ListedSandbox"][];
+ };
+ };
+ 400: components["responses"]["400"];
+ 401: components["responses"]["401"];
+ 500: components["responses"]["500"];
+ };
+ };
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/v2/templates": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ get?: never;
+ put?: never;
+ /** @description Create a new template */
+ post: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ requestBody: {
+ content: {
+ "application/json": components["schemas"]["TemplateBuildRequestV2"];
+ };
+ };
+ responses: {
+ /** @description The build was requested successfully */
+ 202: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Template"];
+ };
+ };
+ 400: components["responses"]["400"];
+ 401: components["responses"]["401"];
+ 500: components["responses"]["500"];
+ };
+ };
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/v2/templates/{templateID}/builds/{buildID}": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ get?: never;
+ put?: never;
+ /** @description Start the build */
+ post: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path: {
+ buildID: components["parameters"]["buildID"];
+ templateID: components["parameters"]["templateID"];
+ };
+ cookie?: never;
+ };
+ requestBody: {
+ content: {
+ "application/json": components["schemas"]["TemplateBuildStartV2"];
+ };
+ };
+ responses: {
+ /** @description The build has started */
+ 202: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ 401: components["responses"]["401"];
+ 500: components["responses"]["500"];
+ };
+ };
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+}
+export type webhooks = Record<string, never>;
+export interface components {
+ schemas: {
+ AWSRegistry: {
+ /** @description AWS Access Key ID for ECR authentication */
+ awsAccessKeyId: string;
+ /** @description AWS Region where the ECR registry is located */
+ awsRegion: string;
+ /** @description AWS Secret Access Key for ECR authentication */
+ awsSecretAccessKey: string;
+ /**
+ * @description Type of registry authentication (enum property replaced by openapi-typescript)
+ * @enum {string}
+ */
+ type: "aws";
+ };
+ BuildLogEntry: {
+ level: components["schemas"]["LogLevel"];
+ /** @description Log message content */
+ message: string;
+ /**
+ * Format: date-time
+ * @description Timestamp of the log entry
+ */
+ timestamp: string;
+ };
+ BuildStatusReason: {
+ /** @description Message with the status reason, currently reporting only for error status */
+ message: string;
+ /** @description Step that failed */
+ step?: string;
+ };
+ /**
+ * Format: int32
+ * @description CPU cores for the sandbox
+ */
+ CPUCount: number;
+ CreatedAccessToken: {
+ /**
+ * Format: date-time
+ * @description Timestamp of access token creation
+ */
+ createdAt: string;
+ /**
+ * Format: uuid
+ * @description Identifier of the access token
+ */
+ id: string;
+ mask: components["schemas"]["IdentifierMaskingDetails"];
+ /** @description Name of the access token */
+ name: string;
+ /** @description The fully created access token */
+ token: string;
+ };
+ CreatedTeamAPIKey: {
+ /**
+ * Format: date-time
+ * @description Timestamp of API key creation
+ */
+ createdAt: string;
+ createdBy?: components["schemas"]["TeamUser"] | null;
+ /**
+ * Format: uuid
+ * @description Identifier of the API key
+ */
+ id: string;
+ /** @description Raw value of the API key */
+ key: string;
+ /**
+ * Format: date-time
+ * @description Last time this API key was used
+ */
+ lastUsed?: string | null;
+ mask: components["schemas"]["IdentifierMaskingDetails"];
+ /** @description Name of the API key */
+ name: string;
+ };
+ DiskMetrics: {
+ /** @description Device name */
+ device: string;
+ /** @description Filesystem type (e.g., ext4, xfs) */
+ filesystemType: string;
+ /** @description Mount point of the disk */
+ mountPoint: string;
+ /**
+ * Format: uint64
+ * @description Total space in bytes
+ */
+ totalBytes: number;
+ /**
+ * Format: uint64
+ * @description Used space in bytes
+ */
+ usedBytes: number;
+ };
+ /**
+ * Format: int32
+ * @description Disk size for the sandbox in MiB
+ */
+ DiskSizeMB: number;
+ /** @description Version of the envd running in the sandbox */
+ EnvdVersion: string;
+ EnvVars: {
+ [key: string]: string;
+ };
+ Error: {
/**
* Format: int32
- * @description Timeout in seconds from the current time after which the sandbox should expire
- */
- timeout: number
- }
- }
- }
- responses: {
- /** @description Successfully set the sandbox timeout */
- 204: {
- headers: {
- [name: string]: unknown
- }
- content?: never
- }
- 401: components['responses']['401']
- 404: components['responses']['404']
- 500: components['responses']['500']
- }
- }
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
- '/sandboxes/metrics': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- /** @description List metrics for given sandboxes */
- get: {
- parameters: {
- query: {
- /** @description Comma-separated list of sandbox IDs to get metrics for */
- sandbox_ids: string[]
- }
- header?: never
- path?: never
- cookie?: never
- }
- requestBody?: never
- responses: {
- /** @description Successfully returned all running sandboxes with metrics */
- 200: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['SandboxesWithMetrics']
- }
- }
- 400: components['responses']['400']
- 401: components['responses']['401']
- 500: components['responses']['500']
- }
- }
- put?: never
- post?: never
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
- '/teams': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- /** @description List all teams */
- get: {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- requestBody?: never
- responses: {
- /** @description Successfully returned all teams */
- 200: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['Team'][]
- }
- }
- 401: components['responses']['401']
- 500: components['responses']['500']
- }
- }
- put?: never
- post?: never
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
- '/teams/{teamID}/metrics': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- /** @description Get metrics for the team */
- get: {
- parameters: {
- query?: {
- end?: number
- /** @description Unix timestamp for the start of the interval, in seconds, for which the metrics */
- start?: number
- }
- header?: never
- path: {
- teamID: components['parameters']['teamID']
- }
- cookie?: never
- }
- requestBody?: never
- responses: {
- /** @description Successfully returned the team metrics */
- 200: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['TeamMetric'][]
- }
- }
- 400: components['responses']['400']
- 401: components['responses']['401']
- 403: components['responses']['403']
- 500: components['responses']['500']
- }
- }
- put?: never
- post?: never
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
- '/templates': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- /** @description List all templates */
- get: {
- parameters: {
- query?: {
- teamID?: string
- }
- header?: never
- path?: never
- cookie?: never
- }
- requestBody?: never
- responses: {
- /** @description Successfully returned all templates */
- 200: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['Template'][]
- }
- }
- 401: components['responses']['401']
- 500: components['responses']['500']
- }
- }
- put?: never
- /** @description Create a new template */
- post: {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- requestBody: {
- content: {
- 'application/json': components['schemas']['TemplateBuildRequest']
- }
- }
- responses: {
- /** @description The build was accepted */
- 202: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['Template']
- }
- }
- 400: components['responses']['400']
- 401: components['responses']['401']
- 500: components['responses']['500']
- }
- }
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
- '/templates/{templateID}': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- get?: never
- put?: never
- /** @description Rebuild an template */
- post: {
- parameters: {
- query?: never
- header?: never
- path: {
- templateID: components['parameters']['templateID']
- }
- cookie?: never
- }
- requestBody: {
- content: {
- 'application/json': components['schemas']['TemplateBuildRequest']
- }
- }
- responses: {
- /** @description The build was accepted */
- 202: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['Template']
- }
- }
- 401: components['responses']['401']
- 500: components['responses']['500']
- }
- }
- /** @description Delete a template */
- delete: {
- parameters: {
- query?: never
- header?: never
- path: {
- templateID: components['parameters']['templateID']
- }
- cookie?: never
- }
- requestBody?: never
- responses: {
- /** @description The template was deleted successfully */
- 204: {
- headers: {
- [name: string]: unknown
- }
- content?: never
- }
- 401: components['responses']['401']
- 500: components['responses']['500']
- }
- }
- options?: never
- head?: never
- /** @description Update template */
- patch: {
- parameters: {
- query?: never
- header?: never
- path: {
- templateID: components['parameters']['templateID']
- }
- cookie?: never
- }
- requestBody: {
- content: {
- 'application/json': components['schemas']['TemplateUpdateRequest']
- }
- }
- responses: {
- /** @description The template was updated successfully */
- 200: {
- headers: {
- [name: string]: unknown
- }
- content?: never
- }
- 400: components['responses']['400']
- 401: components['responses']['401']
- 500: components['responses']['500']
- }
- }
- trace?: never
- }
- '/templates/{templateID}/builds/{buildID}': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- get?: never
- put?: never
- /** @description Start the build */
- post: {
- parameters: {
- query?: never
- header?: never
- path: {
- buildID: components['parameters']['buildID']
- templateID: components['parameters']['templateID']
- }
- cookie?: never
- }
- requestBody?: never
- responses: {
- /** @description The build has started */
- 202: {
- headers: {
- [name: string]: unknown
- }
- content?: never
- }
- 401: components['responses']['401']
- 500: components['responses']['500']
- }
- }
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
- '/templates/{templateID}/builds/{buildID}/status': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- /** @description Get template build info */
- get: {
- parameters: {
- query?: {
- level?: components['schemas']['LogLevel']
- /** @description Index of the starting build log that should be returned with the template */
- logsOffset?: number
- }
- header?: never
- path: {
- buildID: components['parameters']['buildID']
- templateID: components['parameters']['templateID']
- }
- cookie?: never
- }
- requestBody?: never
- responses: {
- /** @description Successfully returned the template */
- 200: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['TemplateBuild']
- }
- }
- 401: components['responses']['401']
- 404: components['responses']['404']
- 500: components['responses']['500']
- }
- }
- put?: never
- post?: never
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
- '/templates/{templateID}/files/{hash}': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- /** @description Get an upload link for a tar file containing build layer files */
- get: {
- parameters: {
- query?: never
- header?: never
- path: {
- hash: string
- templateID: components['parameters']['templateID']
- }
- cookie?: never
- }
- requestBody?: never
- responses: {
- /** @description The upload link where to upload the tar file */
- 201: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['TemplateBuildFileUpload']
- }
- }
- 400: components['responses']['400']
- 401: components['responses']['401']
- 404: components['responses']['404']
- 500: components['responses']['500']
- }
- }
- put?: never
- post?: never
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
- '/v2/sandboxes': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- /** @description List all sandboxes */
- get: {
- parameters: {
- query?: {
- /** @description Maximum number of items to return per page */
- limit?: number
- /** @description Metadata query used to filter the sandboxes (e.g. "user=abc&app=prod"). Each key and values must be URL encoded. */
- metadata?: string
- /** @description Cursor to start the list from */
- nextToken?: string
- /** @description Filter sandboxes by one or more states */
- state?: components['schemas']['SandboxState'][]
- }
- header?: never
- path?: never
- cookie?: never
- }
- requestBody?: never
- responses: {
- /** @description Successfully returned all running sandboxes */
- 200: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['ListedSandbox'][]
- }
- }
- 400: components['responses']['400']
- 401: components['responses']['401']
- 500: components['responses']['500']
- }
- }
- put?: never
- post?: never
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
- '/v2/templates': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- get?: never
- put?: never
- /** @description Create a new template */
- post: {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- requestBody: {
- content: {
- 'application/json': components['schemas']['TemplateBuildRequestV2']
- }
- }
- responses: {
- /** @description The build was requested successfully */
- 202: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['Template']
- }
- }
- 400: components['responses']['400']
- 401: components['responses']['401']
- 500: components['responses']['500']
- }
- }
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
- '/v2/templates/{templateID}/builds/{buildID}': {
+ * @description Error code
+ */
+ code: number;
+ /** @description Error */
+ message: string;
+ };
+ FromImageRegistry: components["schemas"]["AWSRegistry"] | components["schemas"]["GCPRegistry"] | components["schemas"]["GeneralRegistry"];
+ GCPRegistry: {
+ /** @description Service Account JSON for GCP authentication */
+ serviceAccountJson: string;
+ /**
+ * @description Type of registry authentication (enum property replaced by openapi-typescript)
+ * @enum {string}
+ */
+ type: "gcp";
+ };
+ GeneralRegistry: {
+ /** @description Password to use for the registry */
+ password: string;
+ /**
+ * @description Type of registry authentication (enum property replaced by openapi-typescript)
+ * @enum {string}
+ */
+ type: "registry";
+ /** @description Username to use for the registry */
+ username: string;
+ };
+ IdentifierMaskingDetails: {
+ /** @description Prefix used in masked version of the token or key */
+ maskedValuePrefix: string;
+ /** @description Suffix used in masked version of the token or key */
+ maskedValueSuffix: string;
+ /** @description Prefix that identifies the token or key type */
+ prefix: string;
+ /** @description Length of the token or key */
+ valueLength: number;
+ };
+ ListedSandbox: {
+ /** @description Alias of the template */
+ alias?: string;
+ /**
+ * @deprecated
+ * @description Identifier of the client
+ */
+ clientID: string;
+ cpuCount: components["schemas"]["CPUCount"];
+ diskSizeMB: components["schemas"]["DiskSizeMB"];
+ /**
+ * Format: date-time
+ * @description Time when the sandbox will expire
+ */
+ endAt: string;
+ envdVersion: components["schemas"]["EnvdVersion"];
+ memoryMB: components["schemas"]["MemoryMB"];
+ metadata?: components["schemas"]["SandboxMetadata"];
+ /** @description Identifier of the sandbox */
+ sandboxID: string;
+ /**
+ * Format: date-time
+ * @description Time when the sandbox was started
+ */
+ startedAt: string;
+ state: components["schemas"]["SandboxState"];
+ /** @description Identifier of the template from which is the sandbox created */
+ templateID: string;
+ };
+ /**
+ * @description State of the sandbox
+ * @enum {string}
+ */
+ LogLevel: "debug" | "info" | "warn" | "error";
+ /**
+ * Format: int32
+ * @description Memory for the sandbox in MiB
+ */
+ MemoryMB: number;
+ NewAccessToken: {
+ /** @description Name of the access token */
+ name: string;
+ };
+ NewSandbox: {
+ /** @description Allow sandbox to access the internet */
+ allow_internet_access?: boolean;
+ /**
+ * @description Automatically pauses the sandbox after the timeout
+ * @default false
+ */
+ autoPause: boolean;
+ envVars?: components["schemas"]["EnvVars"];
+ metadata?: components["schemas"]["SandboxMetadata"];
+ /** @description Secure all system communication with sandbox */
+ secure?: boolean;
+ /** @description Identifier of the required template */
+ templateID: string;
+ /**
+ * Format: int32
+ * @description Time to live for the sandbox in seconds.
+ * @default 15
+ */
+ timeout: number;
+ };
+ NewTeamAPIKey: {
+ /** @description Name of the API key */
+ name: string;
+ };
+ Node: {
+ /** @description Identifier of the cluster */
+ clusterID: string;
+ /** @description Commit of the orchestrator */
+ commit: string;
+ /**
+ * Format: uint64
+ * @description Number of sandbox create fails
+ */
+ createFails: number;
+ /**
+ * Format: uint64
+ * @description Number of sandbox create successes
+ */
+ createSuccesses: number;
+ /** @description Identifier of the node */
+ id: string;
+ metrics: components["schemas"]["NodeMetrics"];
+ /**
+ * @deprecated
+ * @description Identifier of the nomad node
+ */
+ nodeID: string;
+ /**
+ * Format: uint32
+ * @description Number of sandboxes running on the node
+ */
+ sandboxCount: number;
+ /**
+ * Format: int
+ * @description Number of starting Sandboxes
+ */
+ sandboxStartingCount: number;
+ /** @description Service instance identifier of the node */
+ serviceInstanceID: string;
+ status: components["schemas"]["NodeStatus"];
+ /** @description Version of the orchestrator */
+ version: string;
+ };
+ NodeDetail: {
+ /** @description List of cached builds id on the node */
+ cachedBuilds: string[];
+ /** @description Identifier of the cluster */
+ clusterID: string;
+ /** @description Commit of the orchestrator */
+ commit: string;
+ /**
+ * Format: uint64
+ * @description Number of sandbox create fails
+ */
+ createFails: number;
+ /**
+ * Format: uint64
+ * @description Number of sandbox create successes
+ */
+ createSuccesses: number;
+ /** @description Identifier of the node */
+ id: string;
+ metrics: components["schemas"]["NodeMetrics"];
+ /**
+ * @deprecated
+ * @description Identifier of the nomad node
+ */
+ nodeID: string;
+ /** @description List of sandboxes running on the node */
+ sandboxes: components["schemas"]["ListedSandbox"][];
+ /** @description Service instance identifier of the node */
+ serviceInstanceID: string;
+ status: components["schemas"]["NodeStatus"];
+ /** @description Version of the orchestrator */
+ version: string;
+ };
+ /** @description Node metrics */
+ NodeMetrics: {
+ /**
+ * Format: uint32
+ * @description Number of allocated CPU cores
+ */
+ allocatedCPU: number;
+ /**
+ * Format: uint64
+ * @description Amount of allocated memory in bytes
+ */
+ allocatedMemoryBytes: number;
+ /**
+ * Format: uint32
+ * @description Total number of CPU cores on the node
+ */
+ cpuCount: number;
+ /**
+ * Format: uint32
+ * @description Node CPU usage percentage
+ */
+ cpuPercent: number;
+ /** @description Detailed metrics for each disk/mount point */
+ disks: components["schemas"]["DiskMetrics"][];
+ /**
+ * Format: uint64
+ * @description Total node memory in bytes
+ */
+ memoryTotalBytes: number;
+ /**
+ * Format: uint64
+ * @description Node memory used in bytes
+ */
+ memoryUsedBytes: number;
+ };
+ /**
+ * @description Status of the node
+ * @enum {string}
+ */
+ NodeStatus: "ready" | "draining" | "connecting" | "unhealthy";
+ NodeStatusChange: {
+ status: components["schemas"]["NodeStatus"];
+ };
+ ResumedSandbox: {
+ /**
+ * @deprecated
+ * @description Automatically pauses the sandbox after the timeout
+ */
+ autoPause?: boolean;
+ /**
+ * Format: int32
+ * @description Time to live for the sandbox in seconds.
+ * @default 15
+ */
+ timeout: number;
+ };
+ Sandbox: {
+ /** @description Alias of the template */
+ alias?: string;
+ /**
+ * @deprecated
+ * @description Identifier of the client
+ */
+ clientID: string;
+ /** @description Base domain where the sandbox traffic is accessible */
+ domain?: string | null;
+ /** @description Access token used for envd communication */
+ envdAccessToken?: string;
+ envdVersion: components["schemas"]["EnvdVersion"];
+ /** @description Identifier of the sandbox */
+ sandboxID: string;
+ /** @description Identifier of the template from which is the sandbox created */
+ templateID: string;
+ };
+ SandboxDetail: {
+ /** @description Alias of the template */
+ alias?: string;
+ /**
+ * @deprecated
+ * @description Identifier of the client
+ */
+ clientID: string;
+ cpuCount: components["schemas"]["CPUCount"];
+ diskSizeMB: components["schemas"]["DiskSizeMB"];
+ /** @description Base domain where the sandbox traffic is accessible */
+ domain?: string | null;
+ /**
+ * Format: date-time
+ * @description Time when the sandbox will expire
+ */
+ endAt: string;
+ /** @description Access token used for envd communication */
+ envdAccessToken?: string;
+ envdVersion: components["schemas"]["EnvdVersion"];
+ memoryMB: components["schemas"]["MemoryMB"];
+ metadata?: components["schemas"]["SandboxMetadata"];
+ /** @description Identifier of the sandbox */
+ sandboxID: string;
+ /**
+ * Format: date-time
+ * @description Time when the sandbox was started
+ */
+ startedAt: string;
+ state: components["schemas"]["SandboxState"];
+ /** @description Identifier of the template from which is the sandbox created */
+ templateID: string;
+ };
+ SandboxesWithMetrics: {
+ sandboxes: {
+ [key: string]: components["schemas"]["SandboxMetric"];
+ };
+ };
+ /** @description Log entry with timestamp and line */
+ SandboxLog: {
+ /** @description Log line content */
+ line: string;
+ /**
+ * Format: date-time
+ * @description Timestamp of the log entry
+ */
+ timestamp: string;
+ };
+ SandboxLogEntry: {
+ fields: {
+ [key: string]: string;
+ };
+ level: components["schemas"]["LogLevel"];
+ /** @description Log message content */
+ message: string;
+ /**
+ * Format: date-time
+ * @description Timestamp of the log entry
+ */
+ timestamp: string;
+ };
+ SandboxLogs: {
+ /** @description Structured logs of the sandbox */
+ logEntries: components["schemas"]["SandboxLogEntry"][];
+ /** @description Logs of the sandbox */
+ logs: components["schemas"]["SandboxLog"][];
+ };
+ SandboxMetadata: {
+ [key: string]: string;
+ };
+ /** @description Metric entry with timestamp and line */
+ SandboxMetric: {
+ /**
+ * Format: int32
+ * @description Number of CPU cores
+ */
+ cpuCount: number;
+ /**
+ * Format: float
+ * @description CPU usage percentage
+ */
+ cpuUsedPct: number;
+ /**
+ * Format: int64
+ * @description Total disk space in bytes
+ */
+ diskTotal: number;
+ /**
+ * Format: int64
+ * @description Disk used in bytes
+ */
+ diskUsed: number;
+ /**
+ * Format: int64
+ * @description Total memory in bytes
+ */
+ memTotal: number;
+ /**
+ * Format: int64
+ * @description Memory used in bytes
+ */
+ memUsed: number;
+ /**
+ * Format: date-time
+ * @description Timestamp of the metric entry
+ */
+ timestamp: string;
+ };
+ /**
+ * @description State of the sandbox
+ * @enum {string}
+ */
+ SandboxState: "running" | "paused";
+ Team: {
+ /** @description API key for the team */
+ apiKey: string;
+ /** @description Whether the team is the default team */
+ isDefault: boolean;
+ /** @description Name of the team */
+ name: string;
+ /** @description Identifier of the team */
+ teamID: string;
+ };
+ TeamAPIKey: {
+ /**
+ * Format: date-time
+ * @description Timestamp of API key creation
+ */
+ createdAt: string;
+ createdBy?: components["schemas"]["TeamUser"] | null;
+ /**
+ * Format: uuid
+ * @description Identifier of the API key
+ */
+ id: string;
+ /**
+ * Format: date-time
+ * @description Last time this API key was used
+ */
+ lastUsed?: string | null;
+ mask: components["schemas"]["IdentifierMaskingDetails"];
+ /** @description Name of the API key */
+ name: string;
+ };
+ /** @description Team metric with timestamp */
+ TeamMetric: {
+ /**
+ * Format: int32
+ * @description The number of concurrent sandboxes for the team
+ */
+ concurrentSandboxes: number;
+ /**
+ * Format: float
+ * @description Number of sandboxes started per second
+ */
+ sandboxStartRate: number;
+ /**
+ * Format: date-time
+ * @description Timestamp of the metric entry
+ */
+ timestamp: 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;
+ diskSizeMB: components["schemas"]["DiskSizeMB"];
+ envdVersion: components["schemas"]["EnvdVersion"];
+ /**
+ * Format: date-time
+ * @description Time when the template was last used
+ */
+ lastSpawnedAt: string | null;
+ 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 */
+ buildID: string;
+ /**
+ * @description Build logs structured
+ * @default []
+ */
+ logEntries: components["schemas"]["BuildLogEntry"][];
+ /**
+ * @description Build logs
+ * @default []
+ */
+ logs: string[];
+ reason?: components["schemas"]["BuildStatusReason"];
+ /**
+ * @description Status of the template
+ * @enum {string}
+ */
+ status: "building" | "waiting" | "ready" | "error";
+ /** @description Identifier of the template */
+ templateID: string;
+ };
+ TemplateBuildFileUpload: {
+ /** @description Whether the file is already present in the cache */
+ present: boolean;
+ /** @description Url where the file should be uploaded to */
+ url?: string;
+ };
+ TemplateBuildRequest: {
+ /** @description Alias of the template */
+ alias?: string;
+ cpuCount?: components["schemas"]["CPUCount"];
+ /** @description Dockerfile for the template */
+ dockerfile: string;
+ memoryMB?: components["schemas"]["MemoryMB"];
+ /** @description Ready check command to execute in the template after the build */
+ readyCmd?: string;
+ /** @description Start command to execute in the template after the build */
+ startCmd?: string;
+ /** @description Identifier of the team */
+ teamID?: string;
+ };
+ TemplateBuildRequestV2: {
+ /** @description Alias of the template */
+ alias: string;
+ cpuCount?: components["schemas"]["CPUCount"];
+ memoryMB?: components["schemas"]["MemoryMB"];
+ /** @description Identifier of the team */
+ teamID?: string;
+ };
+ TemplateBuildStartV2: {
+ /**
+ * @description Whether the whole build should be forced to run regardless of the cache
+ * @default false
+ */
+ force: boolean;
+ /** @description Image to use as a base for the template build */
+ fromImage?: string;
+ fromImageRegistry?: components["schemas"]["FromImageRegistry"];
+ /** @description Template to use as a base for the template build */
+ fromTemplate?: string;
+ /** @description Ready check command to execute in the template after the build */
+ readyCmd?: string;
+ /** @description Start command to execute in the template after the build */
+ startCmd?: string;
+ /**
+ * @description List of steps to execute in the template build
+ * @default []
+ */
+ steps: components["schemas"]["TemplateStep"][];
+ };
+ /** @description Step in the template build process */
+ TemplateStep: {
+ /**
+ * @description Arguments for the step
+ * @default []
+ */
+ args: string[];
+ /** @description Hash of the files used in the step */
+ filesHash?: string;
+ /**
+ * @description Whether the step should be forced to run regardless of the cache
+ * @default false
+ */
+ force: boolean;
+ /** @description Type of the step */
+ type: string;
+ };
+ TemplateUpdateRequest: {
+ /** @description Whether the template is public or only accessible by the team */
+ public?: boolean;
+ };
+ UpdateTeamAPIKey: {
+ /** @description New name for the API key */
+ name: string;
+ };
+ };
+ responses: {
+ /** @description Bad request */
+ 400: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Error"];
+ };
+ };
+ /** @description Authentication error */
+ 401: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Error"];
+ };
+ };
+ /** @description Forbidden */
+ 403: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Error"];
+ };
+ };
+ /** @description Not found */
+ 404: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Error"];
+ };
+ };
+ /** @description Conflict */
+ 409: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Error"];
+ };
+ };
+ /** @description Server error */
+ 500: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Error"];
+ };
+ };
+ };
parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- get?: never
- put?: never
- /** @description Start the build */
- post: {
- parameters: {
- query?: never
- header?: never
- path: {
- buildID: components['parameters']['buildID']
- templateID: components['parameters']['templateID']
- }
- cookie?: never
- }
- requestBody: {
- content: {
- 'application/json': components['schemas']['TemplateBuildStartV2']
- }
- }
- responses: {
- /** @description The build has started */
- 202: {
- headers: {
- [name: string]: unknown
- }
- content?: never
- }
- 401: components['responses']['401']
- 500: components['responses']['500']
- }
- }
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
-}
-export type webhooks = Record<string, never>
-export interface components {
- schemas: {
- AWSRegistry: {
- /** @description AWS Access Key ID for ECR authentication */
- awsAccessKeyId: string
- /** @description AWS Region where the ECR registry is located */
- awsRegion: string
- /** @description AWS Secret Access Key for ECR authentication */
- awsSecretAccessKey: string
- /**
- * @description Type of registry authentication (enum property replaced by openapi-typescript)
- * @enum {string}
- */
- type: 'aws'
- }
- BuildLogEntry: {
- level: components['schemas']['LogLevel']
- /** @description Log message content */
- message: string
- /**
- * Format: date-time
- * @description Timestamp of the log entry
- */
- timestamp: string
- }
- BuildStatusReason: {
- /** @description Message with the status reason, currently reporting only for error status */
- message: string
- /** @description Step that failed */
- step?: string
- }
- /**
- * Format: int32
- * @description CPU cores for the sandbox
- */
- CPUCount: number
- CreatedAccessToken: {
- /**
- * Format: date-time
- * @description Timestamp of access token creation
- */
- createdAt: string
- /**
- * Format: uuid
- * @description Identifier of the access token
- */
- id: string
- mask: components['schemas']['IdentifierMaskingDetails']
- /** @description Name of the access token */
- name: string
- /** @description The fully created access token */
- token: string
- }
- CreatedTeamAPIKey: {
- /**
- * Format: date-time
- * @description Timestamp of API key creation
- */
- createdAt: string
- createdBy?: components['schemas']['TeamUser'] | null
- /**
- * Format: uuid
- * @description Identifier of the API key
- */
- id: string
- /** @description Raw value of the API key */
- key: string
- /**
- * Format: date-time
- * @description Last time this API key was used
- */
- lastUsed?: string | null
- mask: components['schemas']['IdentifierMaskingDetails']
- /** @description Name of the API key */
- name: string
- }
- DiskMetrics: {
- /** @description Device name */
- device: string
- /** @description Filesystem type (e.g., ext4, xfs) */
- filesystemType: string
- /** @description Mount point of the disk */
- mountPoint: string
- /**
- * Format: uint64
- * @description Total space in bytes
- */
- totalBytes: number
- /**
- * Format: uint64
- * @description Used space in bytes
- */
- usedBytes: number
- }
- /**
- * Format: int32
- * @description Disk size for the sandbox in MiB
- */
- DiskSizeMB: number
- /** @description Version of the envd running in the sandbox */
- EnvdVersion: string
- EnvVars: {
- [key: string]: string
- }
- Error: {
- /**
- * Format: int32
- * @description Error code
- */
- code: number
- /** @description Error */
- message: string
- }
- FromImageRegistry:
- | components['schemas']['AWSRegistry']
- | components['schemas']['GCPRegistry']
- | components['schemas']['GeneralRegistry']
- GCPRegistry: {
- /** @description Service Account JSON for GCP authentication */
- serviceAccountJson: string
- /**
- * @description Type of registry authentication (enum property replaced by openapi-typescript)
- * @enum {string}
- */
- type: 'gcp'
- }
- GeneralRegistry: {
- /** @description Password to use for the registry */
- password: string
- /**
- * @description Type of registry authentication (enum property replaced by openapi-typescript)
- * @enum {string}
- */
- type: 'registry'
- /** @description Username to use for the registry */
- username: string
- }
- IdentifierMaskingDetails: {
- /** @description Prefix used in masked version of the token or key */
- maskedValuePrefix: string
- /** @description Suffix used in masked version of the token or key */
- maskedValueSuffix: string
- /** @description Prefix that identifies the token or key type */
- prefix: string
- /** @description Length of the token or key */
- valueLength: number
- }
- ListedSandbox: {
- /** @description Alias of the template */
- alias?: string
- /**
- * @deprecated
- * @description Identifier of the client
- */
- clientID: string
- cpuCount: components['schemas']['CPUCount']
- diskSizeMB: components['schemas']['DiskSizeMB']
- /**
- * Format: date-time
- * @description Time when the sandbox will expire
- */
- endAt: string
- envdVersion: components['schemas']['EnvdVersion']
- memoryMB: components['schemas']['MemoryMB']
- metadata?: components['schemas']['SandboxMetadata']
- /** @description Identifier of the sandbox */
- sandboxID: string
- /**
- * Format: date-time
- * @description Time when the sandbox was started
- */
- startedAt: string
- state: components['schemas']['SandboxState']
- /** @description Identifier of the template from which is the sandbox created */
- templateID: string
- }
- /**
- * @description State of the sandbox
- * @enum {string}
- */
- LogLevel: 'debug' | 'info' | 'warn' | 'error'
- /**
- * Format: int32
- * @description Memory for the sandbox in MiB
- */
- MemoryMB: number
- NewAccessToken: {
- /** @description Name of the access token */
- name: string
- }
- NewSandbox: {
- /** @description Allow sandbox to access the internet */
- allow_internet_access?: boolean
- /**
- * @description Automatically pauses the sandbox after the timeout
- * @default false
- */
- autoPause: boolean
- envVars?: components['schemas']['EnvVars']
- metadata?: components['schemas']['SandboxMetadata']
- /** @description Secure all system communication with sandbox */
- secure?: boolean
- /** @description Identifier of the required template */
- templateID: string
- /**
- * Format: int32
- * @description Time to live for the sandbox in seconds.
- * @default 15
- */
- timeout: number
- }
- NewTeamAPIKey: {
- /** @description Name of the API key */
- name: string
- }
- Node: {
- /** @description Identifier of the cluster */
- clusterID: string
- /** @description Commit of the orchestrator */
- commit: string
- /**
- * Format: uint64
- * @description Number of sandbox create fails
- */
- createFails: number
- /**
- * Format: uint64
- * @description Number of sandbox create successes
- */
- createSuccesses: number
- /** @description Identifier of the node */
- id: string
- metrics: components['schemas']['NodeMetrics']
- /**
- * @deprecated
- * @description Identifier of the nomad node
- */
- nodeID: string
- /**
- * Format: uint32
- * @description Number of sandboxes running on the node
- */
- sandboxCount: number
- /**
- * Format: int
- * @description Number of starting Sandboxes
- */
- sandboxStartingCount: number
- /** @description Service instance identifier of the node */
- serviceInstanceID: string
- status: components['schemas']['NodeStatus']
- /** @description Version of the orchestrator */
- version: string
- }
- NodeDetail: {
- /** @description List of cached builds id on the node */
- cachedBuilds: string[]
- /** @description Identifier of the cluster */
- clusterID: string
- /** @description Commit of the orchestrator */
- commit: string
- /**
- * Format: uint64
- * @description Number of sandbox create fails
- */
- createFails: number
- /**
- * Format: uint64
- * @description Number of sandbox create successes
- */
- createSuccesses: number
- /** @description Identifier of the node */
- id: string
- metrics: components['schemas']['NodeMetrics']
- /**
- * @deprecated
- * @description Identifier of the nomad node
- */
- nodeID: string
- /** @description List of sandboxes running on the node */
- sandboxes: components['schemas']['ListedSandbox'][]
- /** @description Service instance identifier of the node */
- serviceInstanceID: string
- status: components['schemas']['NodeStatus']
- /** @description Version of the orchestrator */
- version: string
- }
- /** @description Node metrics */
- NodeMetrics: {
- /**
- * Format: uint32
- * @description Number of allocated CPU cores
- */
- allocatedCPU: number
- /**
- * Format: uint64
- * @description Amount of allocated memory in bytes
- */
- allocatedMemoryBytes: number
- /**
- * Format: uint32
- * @description Total number of CPU cores on the node
- */
- cpuCount: number
- /**
- * Format: uint32
- * @description Node CPU usage percentage
- */
- cpuPercent: number
- /** @description Detailed metrics for each disk/mount point */
- disks: components['schemas']['DiskMetrics'][]
- /**
- * Format: uint64
- * @description Total node memory in bytes
- */
- memoryTotalBytes: number
- /**
- * Format: uint64
- * @description Node memory used in bytes
- */
- memoryUsedBytes: number
- }
- /**
- * @description Status of the node
- * @enum {string}
- */
- NodeStatus: 'ready' | 'draining' | 'connecting' | 'unhealthy'
- NodeStatusChange: {
- status: components['schemas']['NodeStatus']
- }
- ResumedSandbox: {
- /**
- * @deprecated
- * @description Automatically pauses the sandbox after the timeout
- */
- autoPause?: boolean
- /**
- * Format: int32
- * @description Time to live for the sandbox in seconds.
- * @default 15
- */
- timeout: number
- }
- Sandbox: {
- /** @description Alias of the template */
- alias?: string
- /**
- * @deprecated
- * @description Identifier of the client
- */
- clientID: string
- /** @description Base domain where the sandbox traffic is accessible */
- domain?: string | null
- /** @description Access token used for envd communication */
- envdAccessToken?: string
- envdVersion: components['schemas']['EnvdVersion']
- /** @description Identifier of the sandbox */
- sandboxID: string
- /** @description Identifier of the template from which is the sandbox created */
- templateID: string
- }
- SandboxDetail: {
- /** @description Alias of the template */
- alias?: string
- /**
- * @deprecated
- * @description Identifier of the client
- */
- clientID: string
- cpuCount: components['schemas']['CPUCount']
- diskSizeMB: components['schemas']['DiskSizeMB']
- /** @description Base domain where the sandbox traffic is accessible */
- domain?: string | null
- /**
- * Format: date-time
- * @description Time when the sandbox will expire
- */
- endAt: string
- /** @description Access token used for envd communication */
- envdAccessToken?: string
- envdVersion: components['schemas']['EnvdVersion']
- memoryMB: components['schemas']['MemoryMB']
- metadata?: components['schemas']['SandboxMetadata']
- /** @description Identifier of the sandbox */
- sandboxID: string
- /**
- * Format: date-time
- * @description Time when the sandbox was started
- */
- startedAt: string
- state: components['schemas']['SandboxState']
- /** @description Identifier of the template from which is the sandbox created */
- templateID: string
- }
- SandboxesWithMetrics: {
- sandboxes: {
- [key: string]: components['schemas']['SandboxMetric']
- }
- }
- /** @description Log entry with timestamp and line */
- SandboxLog: {
- /** @description Log line content */
- line: string
- /**
- * Format: date-time
- * @description Timestamp of the log entry
- */
- timestamp: string
- }
- SandboxLogEntry: {
- fields: {
- [key: string]: string
- }
- level: components['schemas']['LogLevel']
- /** @description Log message content */
- message: string
- /**
- * Format: date-time
- * @description Timestamp of the log entry
- */
- timestamp: string
- }
- SandboxLogs: {
- /** @description Structured logs of the sandbox */
- logEntries: components['schemas']['SandboxLogEntry'][]
- /** @description Logs of the sandbox */
- logs: components['schemas']['SandboxLog'][]
- }
- SandboxMetadata: {
- [key: string]: string
- }
- /** @description Metric entry with timestamp and line */
- SandboxMetric: {
- /**
- * Format: int32
- * @description Number of CPU cores
- */
- cpuCount: number
- /**
- * Format: float
- * @description CPU usage percentage
- */
- cpuUsedPct: number
- /**
- * Format: int64
- * @description Total disk space in bytes
- */
- diskTotal: number
- /**
- * Format: int64
- * @description Disk used in bytes
- */
- diskUsed: number
- /**
- * Format: int64
- * @description Total memory in bytes
- */
- memTotal: number
- /**
- * Format: int64
- * @description Memory used in bytes
- */
- memUsed: number
- /**
- * Format: date-time
- * @description Timestamp of the metric entry
- */
- timestamp: string
- }
- /**
- * @description State of the sandbox
- * @enum {string}
- */
- SandboxState: 'running' | 'paused'
- Team: {
- /** @description API key for the team */
- apiKey: string
- /** @description Whether the team is the default team */
- isDefault: boolean
- /** @description Name of the team */
- name: string
- /** @description Identifier of the team */
- teamID: string
- }
- TeamAPIKey: {
- /**
- * Format: date-time
- * @description Timestamp of API key creation
- */
- createdAt: string
- createdBy?: components['schemas']['TeamUser'] | null
- /**
- * Format: uuid
- * @description Identifier of the API key
- */
- id: string
- /**
- * Format: date-time
- * @description Last time this API key was used
- */
- lastUsed?: string | null
- mask: components['schemas']['IdentifierMaskingDetails']
- /** @description Name of the API key */
- name: string
- }
- /** @description Team metric with timestamp */
- TeamMetric: {
- /**
- * Format: int32
- * @description The number of concurrent sandboxes for the team
- */
- concurrentSandboxes: number
- /**
- * Format: float
- * @description Number of sandboxes started per second
- */
- sandboxStartRate: number
- /**
- * Format: date-time
- * @description Timestamp of the metric entry
- */
- timestamp: 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
- diskSizeMB: components['schemas']['DiskSizeMB']
- envdVersion: components['schemas']['EnvdVersion']
- /**
- * Format: date-time
- * @description Time when the template was last used
- */
- lastSpawnedAt: string | null
- 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 */
- buildID: string
- /**
- * @description Build logs structured
- * @default []
- */
- logEntries: components['schemas']['BuildLogEntry'][]
- /**
- * @description Build logs
- * @default []
- */
- logs: string[]
- reason?: components['schemas']['BuildStatusReason']
- /**
- * @description Status of the template
- * @enum {string}
- */
- status: 'building' | 'waiting' | 'ready' | 'error'
- /** @description Identifier of the template */
- templateID: string
- }
- TemplateBuildFileUpload: {
- /** @description Whether the file is already present in the cache */
- present: boolean
- /** @description Url where the file should be uploaded to */
- url?: string
- }
- TemplateBuildRequest: {
- /** @description Alias of the template */
- alias?: string
- cpuCount?: components['schemas']['CPUCount']
- /** @description Dockerfile for the template */
- dockerfile: string
- memoryMB?: components['schemas']['MemoryMB']
- /** @description Ready check command to execute in the template after the build */
- readyCmd?: string
- /** @description Start command to execute in the template after the build */
- startCmd?: string
- /** @description Identifier of the team */
- teamID?: string
- }
- TemplateBuildRequestV2: {
- /** @description Alias of the template */
- alias: string
- cpuCount?: components['schemas']['CPUCount']
- memoryMB?: components['schemas']['MemoryMB']
- /** @description Identifier of the team */
- teamID?: string
- }
- TemplateBuildStartV2: {
- /**
- * @description Whether the whole build should be forced to run regardless of the cache
- * @default false
- */
- force: boolean
- /** @description Image to use as a base for the template build */
- fromImage?: string
- fromImageRegistry?: components['schemas']['FromImageRegistry']
- /** @description Template to use as a base for the template build */
- fromTemplate?: string
- /** @description Ready check command to execute in the template after the build */
- readyCmd?: string
- /** @description Start command to execute in the template after the build */
- startCmd?: string
- /**
- * @description List of steps to execute in the template build
- * @default []
- */
- steps: components['schemas']['TemplateStep'][]
- }
- /** @description Step in the template build process */
- TemplateStep: {
- /**
- * @description Arguments for the step
- * @default []
- */
- args: string[]
- /** @description Hash of the files used in the step */
- filesHash?: string
- /**
- * @description Whether the step should be forced to run regardless of the cache
- * @default false
- */
- force: boolean
- /** @description Type of the step */
- type: string
- }
- TemplateUpdateRequest: {
- /** @description Whether the template is public or only accessible by the team */
- public?: boolean
- }
- UpdateTeamAPIKey: {
- /** @description New name for the API key */
- name: string
- }
- }
- responses: {
- /** @description Bad request */
- 400: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['Error']
- }
- }
- /** @description Authentication error */
- 401: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['Error']
- }
- }
- /** @description Forbidden */
- 403: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['Error']
- }
- }
- /** @description Not found */
- 404: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['Error']
- }
- }
- /** @description Conflict */
- 409: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['Error']
- }
- }
- /** @description Server error */
- 500: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['Error']
- }
- }
- }
- parameters: {
- accessTokenID: string
- apiKeyID: string
- buildID: string
- nodeID: string
- sandboxID: string
- teamID: string
- templateID: string
- }
- requestBodies: never
- headers: never
- pathItems: never
+ accessTokenID: string;
+ apiKeyID: string;
+ buildID: string;
+ nodeID: string;
+ sandboxID: string;
+ teamID: string;
+ templateID: string;
+ };
+ requestBodies: never;
+ headers: never;
+ pathItems: never;
}
-export type $defs = Record<string, never>
-export type operations = Record<string, never>
+export type $defs = Record<string, never>;
+export type operations = Record<string, never>;
diff --git a/packages/js-sdk/src/connectionConfig.ts b/packages/js-sdk/src/connectionConfig.ts
index 428d4a011..f0acd0088 100644
--- a/packages/js-sdk/src/connectionConfig.ts
+++ b/packages/js-sdk/src/connectionConfig.ts
@@ -109,6 +109,6 @@ export class ConnectionConfig {
/**
* User used for the operation in the sandbox.
*/
-export type Username = 'root' | 'user'
export const defaultUsername: Username = 'user'
+export type Username = string
diff --git a/packages/js-sdk/src/envd/rpc.ts b/packages/js-sdk/src/envd/rpc.ts
index 38d511044..9ad34ec6e 100644
--- a/packages/js-sdk/src/envd/rpc.ts
+++ b/packages/js-sdk/src/envd/rpc.ts
@@ -1,15 +1,17 @@
import { Code, ConnectError } from '@connectrpc/connect'
import { runtime } from '../utils'
-import { defaultUsername } from '../connectionConfig'
+import { compareVersions } from 'compare-versions'
+import { defaultUsername } from '../connectionConfig'
import {
- SandboxError,
- TimeoutError,
+ AuthenticationError,
formatSandboxTimeoutError,
InvalidArgumentError,
NotFoundError,
- AuthenticationError,
+ SandboxError,
+ TimeoutError,
} from '../errors'
+import { ENVD_DEFAULT_USER } from './versions'
export function handleRpcError(err: unknown): Error {
if (err instanceof ConnectError) {
@@ -52,9 +54,21 @@ function encode64(value: string): string {
}
export function authenticationHeader(
- username?: string
+ envdVersion: string,
+ username: string | undefined
): Record<string, string> {
- const value = `${username || defaultUsername}:`
+ if (
+ username == undefined &&
+ compareVersions(envdVersion, ENVD_DEFAULT_USER) < 0
+ ) {
+ username = defaultUsername
+ }
+
+ if (!username) {
+ return {}
+ }
+
+ const value = `${username}:`
const encoded = encode64(value)
diff --git a/packages/js-sdk/src/envd/schema.gen.ts b/packages/js-sdk/src/envd/schema.gen.ts
index f38b4841e..9c39a43d3 100644
--- a/packages/js-sdk/src/envd/schema.gen.ts
+++ b/packages/js-sdk/src/envd/schema.gen.ts
@@ -4,343 +4,367 @@
*/
export interface paths {
- '/envs': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- /** Get the environment variables */
- get: {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- requestBody?: never
- responses: {
- /** @description Environment variables */
- 200: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['EnvVars']
- }
- }
- }
- }
- put?: never
- post?: never
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
- '/files': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- /** Download a file */
- get: {
- parameters: {
- query: {
- /** @description Path to the file, URL encoded. Can be relative to user's home directory. */
- path?: components['parameters']['FilePath']
- /** @description Signature used for file access permission verification. */
- signature?: components['parameters']['Signature']
- /** @description Signature expiration used for defining the expiration time of the signature. */
- signature_expiration?: components['parameters']['SignatureExpiration']
- /** @description User used for setting the owner, or resolving relative paths. */
- username: components['parameters']['User']
- }
- header?: never
- path?: never
- cookie?: never
- }
- requestBody?: never
- responses: {
- 200: components['responses']['DownloadSuccess']
- 400: components['responses']['InvalidPath']
- 401: components['responses']['InvalidUser']
- 404: components['responses']['FileNotFound']
- 500: components['responses']['InternalServerError']
- }
- }
- put?: never
- /** Upload a file and ensure the parent directories exist. If the file exists, it will be overwritten. */
- post: {
- parameters: {
- query: {
- /** @description Path to the file, URL encoded. Can be relative to user's home directory. */
- path?: components['parameters']['FilePath']
- /** @description Signature used for file access permission verification. */
- signature?: components['parameters']['Signature']
- /** @description Signature expiration used for defining the expiration time of the signature. */
- signature_expiration?: components['parameters']['SignatureExpiration']
- /** @description User used for setting the owner, or resolving relative paths. */
- username: components['parameters']['User']
- }
- header?: never
- path?: never
- cookie?: never
- }
- requestBody: components['requestBodies']['File']
- responses: {
- 200: components['responses']['UploadSuccess']
- 400: components['responses']['InvalidPath']
- 401: components['responses']['InvalidUser']
- 500: components['responses']['InternalServerError']
- 507: components['responses']['NotEnoughDiskSpace']
- }
- }
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
- '/health': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- /** Check the health of the service */
- get: {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- requestBody?: never
- responses: {
- /** @description The service is healthy */
- 204: {
- headers: {
- [name: string]: unknown
- }
- content?: never
- }
- }
- }
- put?: never
- post?: never
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
- '/init': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- get?: never
- put?: never
- /** Set initial vars, ensure the time and metadata is synced with the host */
- post: {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- requestBody?: {
- content: {
- 'application/json': {
- /** @description Access token for secure access to envd service */
- accessToken?: string
- envVars?: components['schemas']['EnvVars']
- }
- }
- }
- responses: {
- /** @description Env vars set, the time and metadata is synced with the host */
- 204: {
- headers: {
- [name: string]: unknown
- }
- content?: never
- }
- }
- }
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
- '/metrics': {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- /** Get the stats of the service */
- get: {
- parameters: {
- query?: never
- header?: never
- path?: never
- cookie?: never
- }
- requestBody?: never
- responses: {
- /** @description The resource usage metrics of the service */
- 200: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['Metrics']
- }
- }
- }
- }
- put?: never
- post?: never
- delete?: never
- options?: never
- head?: never
- patch?: never
- trace?: never
- }
+ "/envs": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Get the environment variables */
+ get: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description Environment variables */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["EnvVars"];
+ };
+ };
+ };
+ };
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/files": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Download a file */
+ get: {
+ parameters: {
+ query?: {
+ /** @description Path to the file, URL encoded. Can be relative to user's home directory. */
+ path?: components["parameters"]["FilePath"];
+ /** @description Signature used for file access permission verification. */
+ signature?: components["parameters"]["Signature"];
+ /** @description Signature expiration used for defining the expiration time of the signature. */
+ signature_expiration?: components["parameters"]["SignatureExpiration"];
+ /** @description User used for setting the owner, or resolving relative paths. */
+ username?: components["parameters"]["User"];
+ };
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ 200: components["responses"]["DownloadSuccess"];
+ 400: components["responses"]["InvalidPath"];
+ 401: components["responses"]["InvalidUser"];
+ 404: components["responses"]["FileNotFound"];
+ 500: components["responses"]["InternalServerError"];
+ };
+ };
+ put?: never;
+ /** Upload a file and ensure the parent directories exist. If the file exists, it will be overwritten. */
+ post: {
+ parameters: {
+ query?: {
+ /** @description Path to the file, URL encoded. Can be relative to user's home directory. */
+ path?: components["parameters"]["FilePath"];
+ /** @description Signature used for file access permission verification. */
+ signature?: components["parameters"]["Signature"];
+ /** @description Signature expiration used for defining the expiration time of the signature. */
+ signature_expiration?: components["parameters"]["SignatureExpiration"];
+ /** @description User used for setting the owner, or resolving relative paths. */
+ username?: components["parameters"]["User"];
+ };
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ requestBody: components["requestBodies"]["File"];
+ responses: {
+ 200: components["responses"]["UploadSuccess"];
+ 400: components["responses"]["InvalidPath"];
+ 401: components["responses"]["InvalidUser"];
+ 500: components["responses"]["InternalServerError"];
+ 507: components["responses"]["NotEnoughDiskSpace"];
+ };
+ };
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/health": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Check the health of the service */
+ get: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The service is healthy */
+ 204: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ };
+ };
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/init": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ get?: never;
+ put?: never;
+ /** Set initial vars, ensure the time and metadata is synced with the host */
+ post: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ requestBody?: {
+ content: {
+ "application/json": {
+ /** @description Access token for secure access to envd service */
+ accessToken?: string;
+ /** @description The default user to use for operations */
+ defaultUser?: string;
+ /** @description The default working directory to use for operations */
+ defaultWorkdir?: string;
+ envVars?: components["schemas"]["EnvVars"];
+ /** @description IP address of the hyperloop server to connect to */
+ hyperloopIP?: string;
+ /**
+ * Format: date-time
+ * @description The current timestamp in RFC3339 format
+ */
+ timestamp?: string;
+ };
+ };
+ };
+ responses: {
+ /** @description Env vars set, the time and metadata is synced with the host */
+ 204: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content?: never;
+ };
+ };
+ };
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
+ "/metrics": {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ /** Get the stats of the service */
+ get: {
+ parameters: {
+ query?: never;
+ header?: never;
+ path?: never;
+ cookie?: never;
+ };
+ requestBody?: never;
+ responses: {
+ /** @description The resource usage metrics of the service */
+ 200: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Metrics"];
+ };
+ };
+ };
+ };
+ put?: never;
+ post?: never;
+ delete?: never;
+ options?: never;
+ head?: never;
+ patch?: never;
+ trace?: never;
+ };
}
-export type webhooks = Record<string, never>
+export type webhooks = Record<string, never>;
export interface components {
- schemas: {
- EntryInfo: {
- /** @description Name of the file */
- name: string
- /** @description Path to the file */
- path: string
- /**
- * @description Type of the file
- * @enum {string}
- */
- type: 'file'
- }
- /** @description Environment variables to set */
- EnvVars: {
- [key: string]: string
- }
- Error: {
- /** @description Error code */
- code: number
- /** @description Error message */
- message: string
- }
- /** @description Resource usage metrics */
- Metrics: {
- /**
- * Format: float
- * @description CPU usage percentage
- */
- cpu_used_pct?: number
- /** @description Total virtual memory usage in bytes */
- mem_bytes?: number
- }
- }
- responses: {
- /** @description Entire file downloaded successfully. */
- DownloadSuccess: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/octet-stream': string
- }
- }
- /** @description File not found */
- FileNotFound: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['Error']
- }
- }
- /** @description Internal server error */
- InternalServerError: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['Error']
- }
- }
- /** @description Invalid path */
- InvalidPath: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['Error']
- }
- }
- /** @description Invalid user */
- InvalidUser: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['Error']
- }
- }
- /** @description Not enough disk space */
- NotEnoughDiskSpace: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['Error']
- }
- }
- /** @description The file was uploaded successfully. */
- UploadSuccess: {
- headers: {
- [name: string]: unknown
- }
- content: {
- 'application/json': components['schemas']['EntryInfo'][]
- }
- }
- }
- parameters: {
- /** @description Path to the file, URL encoded. Can be relative to user's home directory. */
- FilePath: string
- /** @description Signature used for file access permission verification. */
- Signature: string
- /** @description Signature expiration used for defining the expiration time of the signature. */
- SignatureExpiration: number
- /** @description User used for setting the owner, or resolving relative paths. */
- User: string
- }
- requestBodies: {
- File: {
- content: {
- 'multipart/form-data': {
- /** Format: binary */
- file?: string
- }
- }
- }
- }
- headers: never
- pathItems: never
+ schemas: {
+ EntryInfo: {
+ /** @description Name of the file */
+ name: string;
+ /** @description Path to the file */
+ path: string;
+ /**
+ * @description Type of the file
+ * @enum {string}
+ */
+ type: "file";
+ };
+ /** @description Environment variables to set */
+ EnvVars: {
+ [key: string]: string;
+ };
+ Error: {
+ /** @description Error code */
+ code: number;
+ /** @description Error message */
+ message: string;
+ };
+ /** @description Resource usage metrics */
+ Metrics: {
+ /** @description Number of CPU cores */
+ cpu_count?: number;
+ /**
+ * Format: float
+ * @description CPU usage percentage
+ */
+ cpu_used_pct?: number;
+ /** @description Total disk space in bytes */
+ disk_total?: number;
+ /** @description Used disk space in bytes */
+ disk_used?: number;
+ /** @description Total virtual memory in bytes */
+ mem_total?: number;
+ /** @description Used virtual memory in bytes */
+ mem_used?: number;
+ /**
+ * Format: int64
+ * @description Unix timestamp in UTC for current sandbox time
+ */
+ ts?: number;
+ };
+ };
+ responses: {
+ /** @description Entire file downloaded successfully. */
+ DownloadSuccess: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/octet-stream": string;
+ };
+ };
+ /** @description File not found */
+ FileNotFound: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Error"];
+ };
+ };
+ /** @description Internal server error */
+ InternalServerError: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Error"];
+ };
+ };
+ /** @description Invalid path */
+ InvalidPath: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Error"];
+ };
+ };
+ /** @description Invalid user */
+ InvalidUser: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Error"];
+ };
+ };
+ /** @description Not enough disk space */
+ NotEnoughDiskSpace: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["Error"];
+ };
+ };
+ /** @description The file was uploaded successfully. */
+ UploadSuccess: {
+ headers: {
+ [name: string]: unknown;
+ };
+ content: {
+ "application/json": components["schemas"]["EntryInfo"][];
+ };
+ };
+ };
+ parameters: {
+ /** @description Path to the file, URL encoded. Can be relative to user's home directory. */
+ FilePath: string;
+ /** @description Signature used for file access permission verification. */
+ Signature: string;
+ /** @description Signature expiration used for defining the expiration time of the signature. */
+ SignatureExpiration: number;
+ /** @description User used for setting the owner, or resolving relative paths. */
+ User: string;
+ };
+ requestBodies: {
+ File: {
+ content: {
+ "multipart/form-data": {
+ /** Format: binary */
+ file?: string;
+ };
+ };
+ };
+ };
+ headers: never;
+ pathItems: never;
}
-export type $defs = Record<string, never>
-export type operations = Record<string, never>
+export type $defs = Record<string, never>;
+export type operations = Record<string, never>;
diff --git a/packages/js-sdk/src/envd/versions.ts b/packages/js-sdk/src/envd/versions.ts
index 104ecbb25..8a81fc87d 100644
--- a/packages/js-sdk/src/envd/versions.ts
+++ b/packages/js-sdk/src/envd/versions.ts
@@ -1,3 +1,4 @@
export const ENVD_VERSION_RECURSIVE_WATCH = '0.1.4'
export const ENVD_DEBUG_FALLBACK = '99.99.99'
export const ENVD_COMMANDS_STDIN = '0.3.0'
+export const ENVD_DEFAULT_USER = '0.4.0'
diff --git a/packages/js-sdk/src/sandbox/commands/index.ts b/packages/js-sdk/src/sandbox/commands/index.ts
index f0fee1198..8aff14897 100644
--- a/packages/js-sdk/src/sandbox/commands/index.ts
+++ b/packages/js-sdk/src/sandbox/commands/index.ts
@@ -1,28 +1,28 @@
import {
+ Client,
Code,
ConnectError,
- createClient,
- Client,
Transport,
+ createClient,
} from '@connectrpc/connect'
-import {
- Signal,
- Process as ProcessService,
-} from '../../envd/process/process_pb'
+import { compareVersions } from 'compare-versions'
import {
ConnectionConfig,
- Username,
ConnectionOpts,
- KEEPALIVE_PING_INTERVAL_SEC,
KEEPALIVE_PING_HEADER,
+ KEEPALIVE_PING_INTERVAL_SEC,
+ Username,
} from '../../connectionConfig'
-import { authenticationHeader, handleRpcError } from '../../envd/rpc'
-import { CommandResult, CommandHandle } from './commandHandle'
import { handleProcessStartEvent } from '../../envd/api'
-import { compareVersions } from 'compare-versions'
+import {
+ Process as ProcessService,
+ Signal,
+} from '../../envd/process/process_pb'
+import { authenticationHeader, handleRpcError } from '../../envd/rpc'
import { ENVD_COMMANDS_STDIN } from '../../envd/versions'
import { SandboxError } from '../../errors'
+import { CommandHandle, CommandResult } from './commandHandle'
export { Pty } from './pty'
/**
@@ -49,7 +49,7 @@ export interface CommandStartOpts extends CommandRequestOpts {
/**
* User to run the command as.
*
- * @default `user`
+ * @default `default Sandbox user (as specified in the template)`
*/
user?: Username
/**
@@ -393,7 +393,7 @@ export class Commands {
},
{
headers: {
- ...authenticationHeader(opts?.user),
+ ...authenticationHeader(this.envdVersion, opts?.user),
[KEEPALIVE_PING_HEADER]: KEEPALIVE_PING_INTERVAL_SEC.toString(),
},
signal: controller.signal,
diff --git a/packages/js-sdk/src/sandbox/commands/pty.ts b/packages/js-sdk/src/sandbox/commands/pty.ts
index 4e93231bd..c937036e7 100644
--- a/packages/js-sdk/src/sandbox/commands/pty.ts
+++ b/packages/js-sdk/src/sandbox/commands/pty.ts
@@ -44,7 +44,7 @@ export interface PtyCreateOpts
/**
* User to use for the PTY.
*
- * @default `user`
+ * @default `default Sandbox user (as specified in the template)`
*/
user?: Username
/**
@@ -66,12 +66,17 @@ export interface PtyCreateOpts
*/
export class Pty {
private readonly rpc: Client<typeof ProcessService>
+ private readonly envdVersion: string
constructor(
private readonly transport: Transport,
- private readonly connectionConfig: ConnectionConfig
+ private readonly connectionConfig: ConnectionConfig,
+ metadata: {
+ version: string
+ }
) {
this.rpc = createClient(ProcessService, this.transport)
+ this.envdVersion = metadata.version
}
/**
@@ -109,7 +114,7 @@ export class Pty {
},
{
headers: {
- ...authenticationHeader(opts?.user),
+ ...authenticationHeader(this.envdVersion, opts?.user),
[KEEPALIVE_PING_HEADER]: KEEPALIVE_PING_INTERVAL_SEC.toString(),
},
signal: controller.signal,
diff --git a/packages/js-sdk/src/sandbox/filesystem/index.ts b/packages/js-sdk/src/sandbox/filesystem/index.ts
index e31669a5d..875d4e3cd 100644
--- a/packages/js-sdk/src/sandbox/filesystem/index.ts
+++ b/packages/js-sdk/src/sandbox/filesystem/index.ts
@@ -1,9 +1,9 @@
import {
- createClient,
- Transport,
Client,
- ConnectError,
Code,
+ ConnectError,
+ createClient,
+ Transport,
} from '@connectrpc/connect'
import {
ConnectionConfig,
@@ -19,16 +19,19 @@ import { authenticationHeader, handleRpcError } from '../../envd/rpc'
import { EnvdApiClient } from '../../envd/api'
import {
- FileType as FsFileType,
Filesystem as FilesystemService,
+ FileType as FsFileType,
} from '../../envd/filesystem/filesystem_pb'
import { FilesystemEvent, WatchHandle } from './watchHandle'
+import type { Timestamp } from '@bufbuild/protobuf/wkt'
import { compareVersions } from 'compare-versions'
+import {
+ ENVD_DEFAULT_USER,
+ ENVD_VERSION_RECURSIVE_WATCH,
+} from '../../envd/versions'
import { InvalidArgumentError, TemplateError } from '../../errors'
-import { ENVD_VERSION_RECURSIVE_WATCH } from '../../envd/versions'
-import type { Timestamp } from '@bufbuild/protobuf/wkt'
/**
* Sandbox filesystem object information.
@@ -247,11 +250,19 @@ export class Filesystem {
): Promise<unknown> {
const format = opts?.format ?? 'text'
+ let user = opts?.user
+ if (
+ user == undefined &&
+ compareVersions(this.envdApi.version, ENVD_DEFAULT_USER) < 0
+ ) {
+ user = defaultUsername
+ }
+
const res = await this.envdApi.api.GET('/files', {
params: {
query: {
path,
- username: opts?.user || defaultUsername,
+ username: user,
},
},
parseAs: format === 'bytes' ? 'arrayBuffer' : format,
@@ -347,11 +358,19 @@ export class Filesystem {
writeFiles.map((f) => new Response(f.data).blob())
)
+ let user = writeOpts?.user
+ if (
+ user == undefined &&
+ compareVersions(this.envdApi.version, ENVD_DEFAULT_USER) < 0
+ ) {
+ user = defaultUsername
+ }
+
const res = await this.envdApi.api.POST('/files', {
params: {
query: {
path,
- username: writeOpts?.user || defaultUsername,
+ username: user,
},
},
bodySerializer() {
@@ -401,7 +420,7 @@ export class Filesystem {
depth: opts?.depth ?? 1,
},
{
- headers: authenticationHeader(opts?.user),
+ headers: authenticationHeader(this.envdApi.version, opts?.user),
signal: this.connectionConfig.getSignal(opts?.requestTimeoutMs),
}
)
@@ -446,7 +465,7 @@ export class Filesystem {
await this.rpc.makeDir(
{ path },
{
- headers: authenticationHeader(opts?.user),
+ headers: authenticationHeader(this.envdApi.version, opts?.user),
signal: this.connectionConfig.getSignal(opts?.requestTimeoutMs),
}
)
@@ -484,7 +503,7 @@ export class Filesystem {
destination: newPath,
},
{
- headers: authenticationHeader(opts?.user),
+ headers: authenticationHeader(this.envdApi.version, opts?.user),
signal: this.connectionConfig.getSignal(opts?.requestTimeoutMs),
}
)
@@ -522,7 +541,7 @@ export class Filesystem {
await this.rpc.remove(
{ path },
{
- headers: authenticationHeader(opts?.user),
+ headers: authenticationHeader(this.envdApi.version, opts?.user),
signal: this.connectionConfig.getSignal(opts?.requestTimeoutMs),
}
)
@@ -544,7 +563,7 @@ export class Filesystem {
await this.rpc.stat(
{ path },
{
- headers: authenticationHeader(opts?.user),
+ headers: authenticationHeader(this.envdApi.version, opts?.user),
signal: this.connectionConfig.getSignal(opts?.requestTimeoutMs),
}
)
@@ -576,7 +595,7 @@ export class Filesystem {
try {
const res = await this.rpc.stat(
{ path },
- { headers: authenticationHeader(opts?.user) }
+ { headers: authenticationHeader(this.envdApi.version, opts?.user) }
)
if (!res.entry) {
@@ -647,7 +666,7 @@ export class Filesystem {
},
{
headers: {
- ...authenticationHeader(opts?.user),
+ ...authenticationHeader(this.envdApi.version, opts?.user),
[KEEPALIVE_PING_HEADER]: KEEPALIVE_PING_INTERVAL_SEC.toString(),
},
signal: controller.signal,
diff --git a/packages/js-sdk/src/sandbox/index.ts b/packages/js-sdk/src/sandbox/index.ts
index c847f0f90..9e6337d5c 100644
--- a/packages/js-sdk/src/sandbox/index.ts
+++ b/packages/js-sdk/src/sandbox/index.ts
@@ -23,7 +23,7 @@ import {
import { getSignature } from './signature'
import { compareVersions } from 'compare-versions'
import { SandboxError } from '../errors'
-import { ENVD_DEBUG_FALLBACK } from '../envd/versions'
+import { ENVD_DEBUG_FALLBACK, ENVD_DEFAULT_USER } from '../envd/versions'
/**
* Options for sandbox upload/download URL generation.
@@ -177,7 +177,9 @@ export class Sandbox extends SandboxApi {
this.commands = new Commands(rpcTransport, this.connectionConfig, {
version: opts.envdVersion,
})
- this.pty = new Pty(rpcTransport, this.connectionConfig)
+ this.pty = new Pty(rpcTransport, this.connectionConfig, {
+ version: opts.envdVersion,
+ })
}
/**
@@ -599,7 +601,14 @@ export class Sandbox extends SandboxApi {
)
}
- const username = opts.user ?? defaultUsername
+ let username = opts.user
+ if (
+ username == undefined &&
+ compareVersions(this.envdApi.version, ENVD_DEFAULT_USER) < 0
+ ) {
+ username = defaultUsername
+ }
+
const filePath = path ?? ''
const fileUrl = this.fileUrl(filePath, username)
@@ -644,7 +653,14 @@ export class Sandbox extends SandboxApi {
)
}
- const username = opts.user ?? defaultUsername
+ let username = opts.user
+ if (
+ username == undefined &&
+ compareVersions(this.envdApi.version, ENVD_DEFAULT_USER) < 0
+ ) {
+ username = defaultUsername
+ }
+
const fileUrl = this.fileUrl(path, username)
if (useSignature) {
@@ -711,10 +727,12 @@ export class Sandbox extends SandboxApi {
})
}
- private fileUrl(path?: string, username?: string) {
+ private fileUrl(path: string | undefined, username: string | undefined) {
const url = new URL('/files', this.envdApiUrl)
- url.searchParams.set('username', username ?? defaultUsername)
+ if (username) {
+ url.searchParams.set('username', username)
+ }
if (path) {
url.searchParams.set('path', path)
}
diff --git a/packages/js-sdk/src/sandbox/signature.ts b/packages/js-sdk/src/sandbox/signature.ts
index e8506b8b5..891986b20 100644
--- a/packages/js-sdk/src/sandbox/signature.ts
+++ b/packages/js-sdk/src/sandbox/signature.ts
@@ -15,7 +15,7 @@ import { sha256 } from '../utils'
interface SignatureOpts {
path: string
operation: 'read' | 'write'
- user: string
+ user: string | undefined
expirationInSeconds?: number
envdAccessToken?: string
}
@@ -39,6 +39,11 @@ export async function getSignature({
: null
let signatureRaw: string
+ // if user is undefined, set it to empty string to handle default user
+ if (user == undefined) {
+ user = ''
+ }
+
if (signatureExpiration === null) {
signatureRaw = `${path}:${operation}:${user}:${envdAccessToken}`
} else {
diff --git a/packages/python-sdk/e2b/connection_config.py b/packages/python-sdk/e2b/connection_config.py
index ee9e78129..e6d2bb71d 100644
--- a/packages/python-sdk/e2b/connection_config.py
+++ b/packages/python-sdk/e2b/connection_config.py
@@ -1,6 +1,6 @@
import os
-from typing import Literal, Optional, Dict, TypedDict
+from typing import Optional, Dict, TypedDict
from httpx._types import ProxyTypes
from typing_extensions import Unpack
@@ -159,7 +159,7 @@ class ConnectionConfig:
}
-Username = Literal["root", "user"]
+Username = str
"""
User used for the operation in the sandbox.
"""
diff --git a/packages/python-sdk/e2b/envd/rpc.py b/packages/python-sdk/e2b/envd/rpc.py
index 98a1895cf..f8b2f3b9f 100644
--- a/packages/python-sdk/e2b/envd/rpc.py
+++ b/packages/python-sdk/e2b/envd/rpc.py
@@ -1,6 +1,7 @@
import base64
from typing import Optional
+from packaging.version import Version
from e2b_connect.client import Code, ConnectException
from e2b.exceptions import (
@@ -13,6 +14,7 @@ from e2b.exceptions import (
RateLimitException,
)
from e2b.connection_config import Username, default_username
+from e2b.envd.versions import ENVD_DEFAULT_USER
def handle_rpc_exception(e: Exception):
@@ -43,8 +45,16 @@ def handle_rpc_exception(e: Exception):
return e
-def authentication_header(user: Optional[Username] = None):
- value = f"{user if user is not None else default_username}:"
+def authentication_header(
+ envd_version: Version, user: Optional[Username] = None
+) -> dict[str, str]:
+ if user is None and envd_version < ENVD_DEFAULT_USER:
+ user = default_username
+
+ if not user:
+ return {}
+
+ value = f"{user}:"
encoded = base64.b64encode(value.encode("utf-8")).decode("utf-8")
diff --git a/packages/python-sdk/e2b/envd/versions.py b/packages/python-sdk/e2b/envd/versions.py
index 47595e3d1..965e7f8a8 100644
--- a/packages/python-sdk/e2b/envd/versions.py
+++ b/packages/python-sdk/e2b/envd/versions.py
@@ -3,3 +3,4 @@ from packaging.version import Version
ENVD_VERSION_RECURSIVE_WATCH = Version("0.1.4")
ENVD_DEBUG_FALLBACK = Version("99.99.99")
ENVD_COMMANDS_STDIN = Version("0.3.0")
+ENVD_DEFAULT_USER = Version("0.4.0")
diff --git a/packages/python-sdk/e2b/sandbox/main.py b/packages/python-sdk/e2b/sandbox/main.py
index 124e64906..2a91fe6ee 100644
--- a/packages/python-sdk/e2b/sandbox/main.py
+++ b/packages/python-sdk/e2b/sandbox/main.py
@@ -4,8 +4,9 @@ from packaging.version import Version
from typing import Optional, TypedDict
from e2b.sandbox.signature import get_signature
-from e2b.connection_config import ConnectionConfig
+from e2b.connection_config import ConnectionConfig, default_username
from e2b.envd.api import ENVD_API_FILES_ROUTE
+from e2b.envd.versions import ENVD_DEFAULT_USER
from httpx import Limits
@@ -87,13 +88,15 @@ class SandboxBase:
def _file_url(
self,
path: str,
- user: str = "user",
+ user: Optional[str] = None,
signature: Optional[str] = None,
signature_expiration: Optional[int] = None,
) -> str:
url = urllib.parse.urljoin(self.envd_api_url, ENVD_API_FILES_ROUTE)
query = {"path": path} if path else {}
- query = {**query, "username": user}
+
+ if user:
+ query["username"] = user
if signature:
query["signature"] = signature
@@ -114,34 +117,42 @@ class SandboxBase:
def download_url(
self,
path: str,
- user: str = "user",
+ user: Optional[str] = None,
use_signature_expiration: Optional[int] = None,
) -> str:
"""
Get the URL to download a file from the sandbox.
:param path: Path to the file to download
- :param user: User to upload the file as
+ :param user: User to download the file as
:param use_signature_expiration: Expiration time for the signed URL in seconds
:return: URL for downloading file
"""
+ username = user
+ if username is None and self._envd_version < ENVD_DEFAULT_USER:
+ username = default_username
+
use_signature = self._envd_access_token is not None
if use_signature:
signature = get_signature(
- path, "read", user, self._envd_access_token, use_signature_expiration
+ path,
+ "read",
+ username,
+ self._envd_access_token,
+ use_signature_expiration,
)
return self._file_url(
- path, user, signature["signature"], signature["expiration"]
+ path, username, signature["signature"], signature["expiration"]
)
else:
- return self._file_url(path)
+ return self._file_url(path, username)
def upload_url(
self,
path: str,
- user: str = "user",
+ user: Optional[str] = None,
use_signature_expiration: Optional[int] = None,
) -> str:
"""
@@ -156,16 +167,24 @@ class SandboxBase:
:return: URL for uploading file
"""
+ username = user
+ if username is None and self._envd_version < ENVD_DEFAULT_USER:
+ username = default_username
+
use_signature = self._envd_access_token is not None
if use_signature:
signature = get_signature(
- path, "write", user, self._envd_access_token, use_signature_expiration
+ path,
+ "write",
+ username,
+ self._envd_access_token,
+ use_signature_expiration,
)
return self._file_url(
- path, user, signature["signature"], signature["expiration"]
+ path, username, signature["signature"], signature["expiration"]
)
else:
- return self._file_url(path)
+ return self._file_url(path, username)
def get_host(self, port: int) -> str:
"""
diff --git a/packages/python-sdk/e2b/sandbox/signature.py b/packages/python-sdk/e2b/sandbox/signature.py
index b08a40b96..d00fb4e58 100644
--- a/packages/python-sdk/e2b/sandbox/signature.py
+++ b/packages/python-sdk/e2b/sandbox/signature.py
@@ -15,7 +15,7 @@ class Signature(TypedDict):
def get_signature(
path: str,
operation: Operation,
- user: str,
+ user: Optional[str],
envd_access_token: Optional[str],
expiration_in_seconds: Optional[int] = None,
) -> Signature:
@@ -29,6 +29,10 @@ def get_signature(
int(time.time()) + expiration_in_seconds if expiration_in_seconds else None
)
+ # if user is None, set it to empty string to handle default user
+ if user is None:
+ user = ""
+
raw = (
f"{path}:{operation}:{user}:{envd_access_token}"
if expiration is None
diff --git a/packages/python-sdk/e2b/sandbox_async/commands/command.py b/packages/python-sdk/e2b/sandbox_async/commands/command.py
index 012007fb3..7c94d8567 100644
--- a/packages/python-sdk/e2b/sandbox_async/commands/command.py
+++ b/packages/python-sdk/e2b/sandbox_async/commands/command.py
@@ -139,7 +139,7 @@ class Commands:
cmd: str,
background: Union[Literal[False], None] = None,
envs: Optional[Dict[str, str]] = None,
- user: Username = "user",
+ user: Optional[Username] = None,
cwd: Optional[str] = None,
on_stdout: Optional[OutputHandler[Stdout]] = None,
on_stderr: Optional[OutputHandler[Stderr]] = None,
@@ -171,7 +171,7 @@ class Commands:
cmd: str,
background: Literal[True],
envs: Optional[Dict[str, str]] = None,
- user: Username = "user",
+ user: Optional[Username] = None,
cwd: Optional[str] = None,
on_stdout: Optional[OutputHandler[Stdout]] = None,
on_stderr: Optional[OutputHandler[Stderr]] = None,
@@ -202,7 +202,7 @@ class Commands:
cmd: str,
background: Union[bool, None] = None,
envs: Optional[Dict[str, str]] = None,
- user: Username = "user",
+ user: Optional[Username] = None,
cwd: Optional[str] = None,
on_stdout: Optional[OutputHandler[Stdout]] = None,
on_stderr: Optional[OutputHandler[Stderr]] = None,
@@ -257,7 +257,7 @@ class Commands:
stdin=stdin,
),
headers={
- **authentication_header(user),
+ **authentication_header(self._envd_version, user),
KEEPALIVE_PING_HEADER: str(KEEPALIVE_PING_INTERVAL_SEC),
},
timeout=timeout,
diff --git a/packages/python-sdk/e2b/sandbox_async/commands/pty.py b/packages/python-sdk/e2b/sandbox_async/commands/pty.py
index 7dca71a3b..0c87a024d 100644
--- a/packages/python-sdk/e2b/sandbox_async/commands/pty.py
+++ b/packages/python-sdk/e2b/sandbox_async/commands/pty.py
@@ -3,7 +3,7 @@ from typing import Dict, Optional
import e2b_connect
import httpcore
-
+from packaging.version import Version
from e2b.envd.process import process_connect, process_pb2
from e2b.connection_config import (
Username,
@@ -31,8 +31,10 @@ class Pty:
envd_api_url: str,
connection_config: ConnectionConfig,
pool: httpcore.AsyncConnectionPool,
+ envd_version: Version,
) -> None:
self._connection_config = connection_config
+ self._envd_version = envd_version
self._rpc = process_connect.ProcessClient(
envd_api_url,
# TODO: Fix and enable compression again — the headers compression is not solved for streaming.
@@ -104,7 +106,7 @@ class Pty:
self,
size: PtySize,
on_data: OutputHandler[PtyOutput],
- user: Username = "user",
+ user: Optional[Username] = None,
cwd: Optional[str] = None,
envs: Optional[Dict[str, str]] = None,
timeout: Optional[float] = 60,
@@ -138,7 +140,7 @@ class Pty:
),
),
headers={
- **authentication_header(user),
+ **authentication_header(self._envd_version, user),
KEEPALIVE_PING_HEADER: str(KEEPALIVE_PING_INTERVAL_SEC),
},
timeout=timeout,
diff --git a/packages/python-sdk/e2b/sandbox_async/filesystem/filesystem.py b/packages/python-sdk/e2b/sandbox_async/filesystem/filesystem.py
index e20668fa4..1fd572a34 100644
--- a/packages/python-sdk/e2b/sandbox_async/filesystem/filesystem.py
+++ b/packages/python-sdk/e2b/sandbox_async/filesystem/filesystem.py
@@ -8,13 +8,14 @@ import e2b_connect as connect
from e2b.connection_config import (
ConnectionConfig,
Username,
+ default_username,
KEEPALIVE_PING_HEADER,
KEEPALIVE_PING_INTERVAL_SEC,
)
from e2b.envd.api import ENVD_API_FILES_ROUTE, ahandle_envd_api_exception
from e2b.envd.filesystem import filesystem_connect, filesystem_pb2
from e2b.envd.rpc import authentication_header, handle_rpc_exception
-from e2b.envd.versions import ENVD_VERSION_RECURSIVE_WATCH
+from e2b.envd.versions import ENVD_VERSION_RECURSIVE_WATCH, ENVD_DEFAULT_USER
from e2b.exceptions import SandboxException, TemplateException, InvalidArgumentException
from e2b.sandbox.filesystem.filesystem import (
WriteInfo,
@@ -59,7 +60,7 @@ class Filesystem:
self,
path: str,
format: Literal["text"] = "text",
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> str:
"""
@@ -79,7 +80,7 @@ class Filesystem:
self,
path: str,
format: Literal["bytes"],
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> bytearray:
"""
@@ -99,7 +100,7 @@ class Filesystem:
self,
path: str,
format: Literal["stream"],
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> AsyncIterator[bytes]:
"""
@@ -118,12 +119,20 @@ class Filesystem:
self,
path: str,
format: Literal["text", "bytes", "stream"] = "text",
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
):
+ username = user
+ if username is None and self._envd_version < ENVD_DEFAULT_USER:
+ username = default_username
+
+ params = {"path": path}
+ if username:
+ params["username"] = username
+
r = await self._envd_api.get(
ENVD_API_FILES_ROUTE,
- params={"path": path, "username": user},
+ params=params,
timeout=self._connection_config.get_request_timeout(request_timeout),
)
@@ -142,7 +151,7 @@ class Filesystem:
self,
path: str,
data: Union[str, bytes, IO],
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> WriteInfo:
"""
@@ -170,7 +179,7 @@ class Filesystem:
async def write_files(
self,
files: List[WriteEntry],
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> List[WriteInfo]:
"""
@@ -186,7 +195,13 @@ class Filesystem:
:param request_timeout: Timeout for the request
:return: Information about the written files
"""
- params = {"username": user}
+ username = user
+ if username is None and self._envd_version < ENVD_DEFAULT_USER:
+ username = default_username
+
+ params = {}
+ if username:
+ params["username"] = username
if len(files) == 1:
params["path"] = files[0]["path"]
@@ -229,7 +244,7 @@ class Filesystem:
self,
path: str,
depth: Optional[int] = 1,
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> List[EntryInfo]:
"""
@@ -251,7 +266,7 @@ class Filesystem:
request_timeout=self._connection_config.get_request_timeout(
request_timeout
),
- headers=authentication_header(user),
+ headers=authentication_header(self._envd_version, user),
)
entries: List[EntryInfo] = []
@@ -286,7 +301,7 @@ class Filesystem:
async def exists(
self,
path: str,
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> bool:
"""
@@ -304,7 +319,7 @@ class Filesystem:
request_timeout=self._connection_config.get_request_timeout(
request_timeout
),
- headers=authentication_header(user),
+ headers=authentication_header(self._envd_version, user),
)
return True
@@ -318,7 +333,7 @@ class Filesystem:
async def get_info(
self,
path: str,
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> EntryInfo:
"""
@@ -336,7 +351,7 @@ class Filesystem:
request_timeout=self._connection_config.get_request_timeout(
request_timeout
),
- headers=authentication_header(user),
+ headers=authentication_header(self._envd_version, user),
)
return EntryInfo(
@@ -361,7 +376,7 @@ class Filesystem:
async def remove(
self,
path: str,
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> None:
"""
@@ -377,7 +392,7 @@ class Filesystem:
request_timeout=self._connection_config.get_request_timeout(
request_timeout
),
- headers=authentication_header(user),
+ headers=authentication_header(self._envd_version, user),
)
except Exception as e:
raise handle_rpc_exception(e)
@@ -386,7 +401,7 @@ class Filesystem:
self,
old_path: str,
new_path: str,
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> EntryInfo:
"""
@@ -408,7 +423,7 @@ class Filesystem:
request_timeout=self._connection_config.get_request_timeout(
request_timeout
),
- headers=authentication_header(user),
+ headers=authentication_header(self._envd_version, user),
)
return EntryInfo(
@@ -434,7 +449,7 @@ class Filesystem:
async def make_dir(
self,
path: str,
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> bool:
"""
@@ -452,7 +467,7 @@ class Filesystem:
request_timeout=self._connection_config.get_request_timeout(
request_timeout
),
- headers=authentication_header(user),
+ headers=authentication_header(self._envd_version, user),
)
return True
@@ -467,7 +482,7 @@ class Filesystem:
path: str,
on_event: OutputHandler[FilesystemEvent],
on_exit: Optional[OutputHandler[Exception]] = None,
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
timeout: Optional[float] = 60,
recursive: bool = False,
@@ -498,7 +513,7 @@ class Filesystem:
),
timeout=timeout,
headers={
- **authentication_header(user),
+ **authentication_header(self._envd_version, user),
KEEPALIVE_PING_HEADER: str(KEEPALIVE_PING_INTERVAL_SEC),
},
)
diff --git a/packages/python-sdk/e2b/sandbox_async/main.py b/packages/python-sdk/e2b/sandbox_async/main.py
index 2a6c8e6eb..7247eb424 100644
--- a/packages/python-sdk/e2b/sandbox_async/main.py
+++ b/packages/python-sdk/e2b/sandbox_async/main.py
@@ -117,6 +117,7 @@ class AsyncSandbox(SandboxApi):
self.envd_api_url,
self.connection_config,
self._transport.pool,
+ self._envd_version,
)
async def is_running(self, request_timeout: Optional[float] = None) -> bool:
diff --git a/packages/python-sdk/e2b/sandbox_sync/commands/command.py b/packages/python-sdk/e2b/sandbox_sync/commands/command.py
index 6459a4433..79c1b951c 100644
--- a/packages/python-sdk/e2b/sandbox_sync/commands/command.py
+++ b/packages/python-sdk/e2b/sandbox_sync/commands/command.py
@@ -138,7 +138,7 @@ class Commands:
cmd: str,
background: Union[Literal[False], None] = None,
envs: Optional[Dict[str, str]] = None,
- user: Username = "user",
+ user: Optional[Username] = None,
cwd: Optional[str] = None,
on_stdout: Optional[Callable[[str], None]] = None,
on_stderr: Optional[Callable[[str], None]] = None,
@@ -170,7 +170,7 @@ class Commands:
cmd: str,
background: Literal[True],
envs: Optional[Dict[str, str]] = None,
- user: Username = "user",
+ user: Optional[Username] = None,
cwd: Optional[str] = None,
on_stdout: None = None,
on_stderr: None = None,
@@ -199,7 +199,7 @@ class Commands:
cmd: str,
background: Union[bool, None] = None,
envs: Optional[Dict[str, str]] = None,
- user: Username = "user",
+ user: Optional[Username] = None,
cwd: Optional[str] = None,
on_stdout: Optional[Callable[[str], None]] = None,
on_stderr: Optional[Callable[[str], None]] = None,
@@ -257,7 +257,7 @@ class Commands:
stdin=stdin,
),
headers={
- **authentication_header(user),
+ **authentication_header(self._envd_version, user),
KEEPALIVE_PING_HEADER: str(KEEPALIVE_PING_INTERVAL_SEC),
},
timeout=timeout,
diff --git a/packages/python-sdk/e2b/sandbox_sync/commands/pty.py b/packages/python-sdk/e2b/sandbox_sync/commands/pty.py
index bc9c7cd63..d381f74ff 100644
--- a/packages/python-sdk/e2b/sandbox_sync/commands/pty.py
+++ b/packages/python-sdk/e2b/sandbox_sync/commands/pty.py
@@ -3,6 +3,7 @@ import httpcore
from typing import Dict, Optional
+from packaging.version import Version
from e2b.envd.process import process_connect, process_pb2
from e2b.connection_config import (
Username,
@@ -26,8 +27,10 @@ class Pty:
envd_api_url: str,
connection_config: ConnectionConfig,
pool: httpcore.ConnectionPool,
+ envd_version: Version,
) -> None:
self._connection_config = connection_config
+ self._envd_version = envd_version
self._rpc = process_connect.ProcessClient(
envd_api_url,
# TODO: Fix and enable compression again — the headers compression is not solved for streaming.
@@ -98,7 +101,7 @@ class Pty:
def create(
self,
size: PtySize,
- user: Username = "user",
+ user: Optional[Username] = None,
cwd: Optional[str] = None,
envs: Optional[Dict[str, str]] = None,
timeout: Optional[float] = 60,
@@ -131,7 +134,7 @@ class Pty:
),
),
headers={
- **authentication_header(user),
+ **authentication_header(self._envd_version, user),
KEEPALIVE_PING_HEADER: str(KEEPALIVE_PING_INTERVAL_SEC),
},
timeout=timeout,
diff --git a/packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.py b/packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.py
index ab90a3089..960779c70 100644
--- a/packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.py
+++ b/packages/python-sdk/e2b/sandbox_sync/filesystem/filesystem.py
@@ -8,11 +8,12 @@ import httpcore
import httpx
from packaging.version import Version
-from e2b.envd.versions import ENVD_VERSION_RECURSIVE_WATCH
+from e2b.envd.versions import ENVD_VERSION_RECURSIVE_WATCH, ENVD_DEFAULT_USER
from e2b.exceptions import SandboxException, TemplateException, InvalidArgumentException
from e2b.connection_config import (
ConnectionConfig,
Username,
+ default_username,
KEEPALIVE_PING_HEADER,
KEEPALIVE_PING_INTERVAL_SEC,
)
@@ -60,7 +61,7 @@ class Filesystem:
self,
path: str,
format: Literal["text"] = "text",
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> str:
"""
@@ -80,7 +81,7 @@ class Filesystem:
self,
path: str,
format: Literal["bytes"],
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> bytearray:
"""
@@ -100,7 +101,7 @@ class Filesystem:
self,
path: str,
format: Literal["stream"],
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> Iterator[bytes]:
"""
@@ -119,12 +120,20 @@ class Filesystem:
self,
path: str,
format: Literal["text", "bytes", "stream"] = "text",
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
):
+ username = user
+ if username is None and self._envd_version < ENVD_DEFAULT_USER:
+ username = default_username
+
+ params = {"path": path}
+ if username:
+ params["username"] = username
+
r = self._envd_api.get(
ENVD_API_FILES_ROUTE,
- params={"path": path, "username": user},
+ params=params,
timeout=self._connection_config.get_request_timeout(request_timeout),
)
@@ -143,7 +152,7 @@ class Filesystem:
self,
path: str,
data: Union[str, bytes, IO],
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> WriteInfo:
"""
@@ -173,7 +182,7 @@ class Filesystem:
def write_files(
self,
files: List[WriteEntry],
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> List[WriteInfo]:
"""
@@ -187,7 +196,13 @@ class Filesystem:
:param request_timeout: Timeout for the request
:return: Information about the written files
"""
- params = {"username": user}
+ username = user
+ if username is None and self._envd_version < ENVD_DEFAULT_USER:
+ username = default_username
+
+ params = {}
+ if username:
+ params["username"] = username
if len(files) == 1:
params["path"] = files[0]["path"]
@@ -230,7 +245,7 @@ class Filesystem:
self,
path: str,
depth: Optional[int] = 1,
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> List[EntryInfo]:
"""
@@ -252,7 +267,7 @@ class Filesystem:
request_timeout=self._connection_config.get_request_timeout(
request_timeout
),
- headers=authentication_header(user),
+ headers=authentication_header(self._envd_version, user),
)
entries: List[EntryInfo] = []
@@ -287,7 +302,7 @@ class Filesystem:
def exists(
self,
path: str,
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> bool:
"""
@@ -305,7 +320,7 @@ class Filesystem:
request_timeout=self._connection_config.get_request_timeout(
request_timeout
),
- headers=authentication_header(user),
+ headers=authentication_header(self._envd_version, user),
)
return True
@@ -318,7 +333,7 @@ class Filesystem:
def get_info(
self,
path: str,
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> EntryInfo:
"""
@@ -336,7 +351,7 @@ class Filesystem:
request_timeout=self._connection_config.get_request_timeout(
request_timeout
),
- headers=authentication_header(user),
+ headers=authentication_header(self._envd_version, user),
)
return EntryInfo(
@@ -362,7 +377,7 @@ class Filesystem:
def remove(
self,
path: str,
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> None:
"""
@@ -378,7 +393,7 @@ class Filesystem:
request_timeout=self._connection_config.get_request_timeout(
request_timeout
),
- headers=authentication_header(user),
+ headers=authentication_header(self._envd_version, user),
)
except Exception as e:
raise handle_rpc_exception(e)
@@ -387,7 +402,7 @@ class Filesystem:
self,
old_path: str,
new_path: str,
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> EntryInfo:
"""
@@ -409,7 +424,7 @@ class Filesystem:
request_timeout=self._connection_config.get_request_timeout(
request_timeout
),
- headers=authentication_header(user),
+ headers=authentication_header(self._envd_version, user),
)
return EntryInfo(
@@ -435,7 +450,7 @@ class Filesystem:
def make_dir(
self,
path: str,
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
) -> bool:
"""
@@ -453,7 +468,7 @@ class Filesystem:
request_timeout=self._connection_config.get_request_timeout(
request_timeout
),
- headers=authentication_header(user),
+ headers=authentication_header(self._envd_version, user),
)
return True
@@ -466,7 +481,7 @@ class Filesystem:
def watch_dir(
self,
path: str,
- user: Username = "user",
+ user: Optional[Username] = None,
request_timeout: Optional[float] = None,
recursive: bool = False,
) -> WatchHandle:
@@ -493,7 +508,7 @@ class Filesystem:
request_timeout
),
headers={
- **authentication_header(user),
+ **authentication_header(self._envd_version, user),
KEEPALIVE_PING_HEADER: str(KEEPALIVE_PING_INTERVAL_SEC),
},
)
diff --git a/packages/python-sdk/e2b/sandbox_sync/main.py b/packages/python-sdk/e2b/sandbox_sync/main.py
index b31e9e907..1add58d97 100644
--- a/packages/python-sdk/e2b/sandbox_sync/main.py
+++ b/packages/python-sdk/e2b/sandbox_sync/main.py
@@ -120,6 +120,7 @@ class Sandbox(SandboxApi):
self.envd_api_url,
self.connection_config,
self._transport.pool,
+ self._envd_version,
)
def is_running(self, request_timeout: Optional[float] = None) -> bool:
diff --git a/spec/envd/envd.yaml b/spec/envd/envd.yaml
index d03e24abb..9649c24a1 100644
--- a/spec/envd/envd.yaml
+++ b/spec/envd/envd.yaml
@@ -12,7 +12,7 @@ paths:
get:
summary: Check the health of the service
responses:
- "204":
+ '204':
description: The service is healthy
/metrics:
@@ -22,12 +22,12 @@ paths:
- AccessTokenAuth: []
- {}
responses:
- "200":
+ '200':
description: The resource usage metrics of the service
content:
application/json:
- schema:
- $ref: "#/components/schemas/Metrics"
+ schema:
+ $ref: '#/components/schemas/Metrics'
/init:
post:
@@ -41,13 +41,26 @@ paths:
schema:
type: object
properties:
+ hyperloopIP:
+ type: string
+ description: IP address of the hyperloop server to connect to
envVars:
- $ref: "#/components/schemas/EnvVars"
+ $ref: '#/components/schemas/EnvVars'
accessToken:
type: string
description: Access token for secure access to envd service
+ timestamp:
+ type: string
+ format: date-time
+ description: The current timestamp in RFC3339 format
+ defaultUser:
+ type: string
+ description: The default user to use for operations
+ defaultWorkdir:
+ type: string
+ description: The default working directory to use for operations
responses:
- "204":
+ '204':
description: Env vars set, the time and metadata is synced with the host
/envs:
@@ -57,12 +70,12 @@ paths:
- AccessTokenAuth: []
- {}
responses:
- "200":
+ '200':
description: Environment variables
content:
application/json:
schema:
- $ref: "#/components/schemas/EnvVars"
+ $ref: '#/components/schemas/EnvVars'
/files:
get:
@@ -72,21 +85,21 @@ paths:
- AccessTokenAuth: []
- {}
parameters:
- - $ref: "#/components/parameters/FilePath"
- - $ref: "#/components/parameters/User"
- - $ref: "#/components/parameters/Signature"
- - $ref: "#/components/parameters/SignatureExpiration"
+ - $ref: '#/components/parameters/FilePath'
+ - $ref: '#/components/parameters/User'
+ - $ref: '#/components/parameters/Signature'
+ - $ref: '#/components/parameters/SignatureExpiration'
responses:
- "200":
- $ref: "#/components/responses/DownloadSuccess"
- "401":
- $ref: "#/components/responses/InvalidUser"
- "400":
- $ref: "#/components/responses/InvalidPath"
- "404":
- $ref: "#/components/responses/FileNotFound"
- "500":
- $ref: "#/components/responses/InternalServerError"
+ '200':
+ $ref: '#/components/responses/DownloadSuccess'
+ '401':
+ $ref: '#/components/responses/InvalidUser'
+ '400':
+ $ref: '#/components/responses/InvalidPath'
+ '404':
+ $ref: '#/components/responses/FileNotFound'
+ '500':
+ $ref: '#/components/responses/InternalServerError'
post:
summary: Upload a file and ensure the parent directories exist. If the file exists, it will be overwritten.
tags: [files]
@@ -94,23 +107,23 @@ paths:
- AccessTokenAuth: []
- {}
parameters:
- - $ref: "#/components/parameters/FilePath"
- - $ref: "#/components/parameters/User"
- - $ref: "#/components/parameters/Signature"
- - $ref: "#/components/parameters/SignatureExpiration"
+ - $ref: '#/components/parameters/FilePath'
+ - $ref: '#/components/parameters/User'
+ - $ref: '#/components/parameters/Signature'
+ - $ref: '#/components/parameters/SignatureExpiration'
requestBody:
- $ref: "#/components/requestBodies/File"
+ $ref: '#/components/requestBodies/File'
responses:
- "200":
- $ref: "#/components/responses/UploadSuccess"
- "400":
- $ref: "#/components/responses/InvalidPath"
- "401":
- $ref: "#/components/responses/InvalidUser"
- "500":
- $ref: "#/components/responses/InternalServerError"
- "507":
- $ref: "#/components/responses/NotEnoughDiskSpace"
+ '200':
+ $ref: '#/components/responses/UploadSuccess'
+ '400':
+ $ref: '#/components/responses/InvalidPath'
+ '401':
+ $ref: '#/components/responses/InvalidUser'
+ '500':
+ $ref: '#/components/responses/InternalServerError'
+ '507':
+ $ref: '#/components/responses/NotEnoughDiskSpace'
components:
securitySchemes:
@@ -130,11 +143,10 @@ components:
User:
name: username
in: query
- required: true
+ required: false
description: User used for setting the owner, or resolving relative paths.
schema:
type: string
- pattern: "^(root|user)$"
Signature:
name: signature
in: query
@@ -170,7 +182,7 @@ components:
schema:
type: array
items:
- $ref: "#/components/schemas/EntryInfo"
+ $ref: '#/components/schemas/EntryInfo'
DownloadSuccess:
description: Entire file downloaded successfully.
@@ -185,31 +197,31 @@ components:
content:
application/json:
schema:
- $ref: "#/components/schemas/Error"
+ $ref: '#/components/schemas/Error'
InternalServerError:
description: Internal server error
content:
application/json:
schema:
- $ref: "#/components/schemas/Error"
+ $ref: '#/components/schemas/Error'
FileNotFound:
description: File not found
content:
application/json:
schema:
- $ref: "#/components/schemas/Error"
+ $ref: '#/components/schemas/Error'
InvalidUser:
description: Invalid user
content:
application/json:
schema:
- $ref: "#/components/schemas/Error"
+ $ref: '#/components/schemas/Error'
NotEnoughDiskSpace:
description: Not enough disk space
content:
application/json:
schema:
- $ref: "#/components/schemas/Error"
+ $ref: '#/components/schemas/Error'
schemas:
Error:
@@ -239,20 +251,36 @@ components:
type: string
description: Type of the file
enum:
- - file
+ - file
EnvVars:
type: object
description: Environment variables to set
additionalProperties:
- type: string
+ type: string
Metrics:
type: object
description: Resource usage metrics
properties:
+ ts:
+ type: integer
+ format: int64
+ description: Unix timestamp in UTC for current sandbox time
+ cpu_count:
+ type: integer
+ description: Number of CPU cores
cpu_used_pct:
type: number
format: float
description: CPU usage percentage
- mem_bytes:
+ mem_total:
+ type: integer
+ description: Total virtual memory in bytes
+ mem_used:
+ type: integer
+ description: Used virtual memory in bytes
+ disk_used:
+ type: integer
+ description: Used disk space in bytes
+ disk_total:
type: integer
- description: Total virtual memory usage in bytes
+ description: Total disk space in bytes