Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Fix python request timeout error; Change auth

Tomas Valenta6b32979f0f6f
diff --git a/packages/js-sdk/example.mts b/packages/js-sdk/example.mts
index be9178a26..7065683cb 100644
--- a/packages/js-sdk/example.mts
+++ b/packages/js-sdk/example.mts
@@ -1,26 +1,14 @@
import { Sandbox } from './dist'
-const start = Date.now()
-
const sbx = await Sandbox.create('3pcmtxu6u8it5f6flpkk', {
debug: true,
- domain: 'e2b-staging.com',
- timeoutMs: 5_000,
- logger: console,
+ // domain: 'e2b-staging.com',
+ // timeoutMs: 5_000,
+ // logger: console,
})
-console.log(sbx.sandboxID)
-
-const res = await sbx.commands.run('sleep 20', {
- // requestTimeoutMs: 1,
- // user: 'asdfasdf',
- timeoutMs: 200000,
- background: true,
- onStdout: (data) => {
- // TODO: print also the time elapsed
- console.log(`${(Date.now() - start) / 1000}s: ${data}`)
- },
-})
+const res = await sbx.files.list('/', { user: 'adada' })
+// console.log(res)
// const l = await sbx.commands.list()
diff --git a/packages/js-sdk/src/envd/filesystem/filesystem_pb.ts b/packages/js-sdk/src/envd/filesystem/filesystem_pb.ts
index 26ba3958b..862f8144f 100644
--- a/packages/js-sdk/src/envd/filesystem/filesystem_pb.ts
+++ b/packages/js-sdk/src/envd/filesystem/filesystem_pb.ts
@@ -5,7 +5,6 @@
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto3 } from "@bufbuild/protobuf";
-import { User } from "../permissions/permissions_pb.js";
/**
* @generated from enum filesystem.FileType
@@ -91,11 +90,6 @@ export class MoveRequest extends Message<MoveRequest> {
*/
destination = "";
- /**
- * @generated from field: permissions.User user = 3;
- */
- user?: User;
-
constructor(data?: PartialMessage<MoveRequest>) {
super();
proto3.util.initPartial(data, this);
@@ -106,7 +100,6 @@ export class MoveRequest extends Message<MoveRequest> {
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "source", kind: "scalar", T: 9 /* ScalarType.STRING */ },
{ no: 2, name: "destination", kind: "scalar", T: 9 /* ScalarType.STRING */ },
- { no: 3, name: "user", kind: "message", T: User },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MoveRequest {
@@ -166,11 +159,6 @@ export class MakeDirRequest extends Message<MakeDirRequest> {
*/
path = "";
- /**
- * @generated from field: permissions.User user = 2;
- */
- user?: User;
-
constructor(data?: PartialMessage<MakeDirRequest>) {
super();
proto3.util.initPartial(data, this);
@@ -180,7 +168,6 @@ export class MakeDirRequest extends Message<MakeDirRequest> {
static readonly typeName = "filesystem.MakeDirRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "path", kind: "scalar", T: 9 /* ScalarType.STRING */ },
- { no: 2, name: "user", kind: "message", T: User },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): MakeDirRequest {
@@ -240,11 +227,6 @@ export class RemoveRequest extends Message<RemoveRequest> {
*/
path = "";
- /**
- * @generated from field: permissions.User user = 2;
- */
- user?: User;
-
constructor(data?: PartialMessage<RemoveRequest>) {
super();
proto3.util.initPartial(data, this);
@@ -254,7 +236,6 @@ export class RemoveRequest extends Message<RemoveRequest> {
static readonly typeName = "filesystem.RemoveRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "path", kind: "scalar", T: 9 /* ScalarType.STRING */ },
- { no: 2, name: "user", kind: "message", T: User },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): RemoveRequest {
@@ -314,11 +295,6 @@ export class StatRequest extends Message<StatRequest> {
*/
path = "";
- /**
- * @generated from field: permissions.User user = 2;
- */
- user?: User;
-
constructor(data?: PartialMessage<StatRequest>) {
super();
proto3.util.initPartial(data, this);
@@ -328,7 +304,6 @@ export class StatRequest extends Message<StatRequest> {
static readonly typeName = "filesystem.StatRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "path", kind: "scalar", T: 9 /* ScalarType.STRING */ },
- { no: 2, name: "user", kind: "message", T: User },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): StatRequest {
@@ -437,11 +412,6 @@ export class ListDirRequest extends Message<ListDirRequest> {
*/
path = "";
- /**
- * @generated from field: permissions.User user = 2;
- */
- user?: User;
-
constructor(data?: PartialMessage<ListDirRequest>) {
super();
proto3.util.initPartial(data, this);
@@ -451,7 +421,6 @@ export class ListDirRequest extends Message<ListDirRequest> {
static readonly typeName = "filesystem.ListDirRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "path", kind: "scalar", T: 9 /* ScalarType.STRING */ },
- { no: 2, name: "user", kind: "message", T: User },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListDirRequest {
@@ -517,11 +486,6 @@ export class WatchDirRequest extends Message<WatchDirRequest> {
*/
path = "";
- /**
- * @generated from field: permissions.User user = 2;
- */
- user?: User;
-
constructor(data?: PartialMessage<WatchDirRequest>) {
super();
proto3.util.initPartial(data, this);
@@ -531,7 +495,6 @@ export class WatchDirRequest extends Message<WatchDirRequest> {
static readonly typeName = "filesystem.WatchDirRequest";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "path", kind: "scalar", T: 9 /* ScalarType.STRING */ },
- { no: 2, name: "user", kind: "message", T: User },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): WatchDirRequest {
@@ -712,4 +675,3 @@ export class WatchDirResponse_KeepAlive extends Message<WatchDirResponse_KeepAli
return proto3.util.equals(WatchDirResponse_KeepAlive, a, b);
}
}
-
diff --git a/packages/js-sdk/src/envd/permissions/permissions_pb.ts b/packages/js-sdk/src/envd/permissions/permissions_pb.ts
deleted file mode 100644
index 6430e5b6e..000000000
--- a/packages/js-sdk/src/envd/permissions/permissions_pb.ts
+++ /dev/null
@@ -1,51 +0,0 @@
-// @generated by protoc-gen-es v1.9.0 with parameter "target=ts"
-// @generated from file permissions/permissions.proto (package permissions, syntax proto3)
-/* eslint-disable */
-// @ts-nocheck
-
-import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
-import { Message, proto3 } from "@bufbuild/protobuf";
-
-/**
- * @generated from message permissions.User
- */
-export class User extends Message<User> {
- /**
- * @generated from oneof permissions.User.selector
- */
- selector: {
- /**
- * @generated from field: string username = 1;
- */
- value: string;
- case: "username";
- } | { case: undefined; value?: undefined } = { case: undefined };
-
- constructor(data?: PartialMessage<User>) {
- super();
- proto3.util.initPartial(data, this);
- }
-
- static readonly runtime: typeof proto3 = proto3;
- static readonly typeName = "permissions.User";
- static readonly fields: FieldList = proto3.util.newFieldList(() => [
- { no: 1, name: "username", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "selector" },
- ]);
-
- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): User {
- return new User().fromBinary(bytes, options);
- }
-
- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): User {
- return new User().fromJson(jsonValue, options);
- }
-
- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): User {
- return new User().fromJsonString(jsonString, options);
- }
-
- static equals(a: User | PlainMessage<User> | undefined, b: User | PlainMessage<User> | undefined): boolean {
- return proto3.util.equals(User, a, b);
- }
-}
-
diff --git a/packages/js-sdk/src/envd/process/process_pb.ts b/packages/js-sdk/src/envd/process/process_pb.ts
index 0457f26df..f1205a9a5 100644
--- a/packages/js-sdk/src/envd/process/process_pb.ts
+++ b/packages/js-sdk/src/envd/process/process_pb.ts
@@ -5,7 +5,6 @@
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
import { Message, proto3 } from "@bufbuild/protobuf";
-import { User } from "../permissions/permissions_pb.js";
/**
* @generated from enum process.Signal
@@ -304,11 +303,6 @@ export class StartRequest extends Message<StartRequest> {
*/
tag?: string;
- /**
- * @generated from field: permissions.User user = 4;
- */
- user?: User;
-
constructor(data?: PartialMessage<StartRequest>) {
super();
proto3.util.initPartial(data, this);
@@ -320,7 +314,6 @@ export class StartRequest extends Message<StartRequest> {
{ no: 1, name: "process", kind: "message", T: ProcessConfig },
{ no: 2, name: "pty", kind: "message", T: PTY, opt: true },
{ no: 3, name: "tag", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
- { no: 4, name: "user", kind: "message", T: User },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): StartRequest {
diff --git a/packages/js-sdk/src/envd/rpc.ts b/packages/js-sdk/src/envd/rpc.ts
index 4c08fe59a..d84d64538 100644
--- a/packages/js-sdk/src/envd/rpc.ts
+++ b/packages/js-sdk/src/envd/rpc.ts
@@ -1,4 +1,5 @@
import { Code, ConnectError } from '@connectrpc/connect'
+import { defaultUsername } from '../connectionConfig'
import { SandboxError, InvalidUserError, InvalidPathError, TimeoutError, formatSandboxTimeoutError } from '../errors'
@@ -27,3 +28,17 @@ export function handleRpcError(err: unknown): Error {
return err as Error
}
+
+export function authenticationHeader(username?: string): Record<string, string> {
+ const value = `${username || defaultUsername}:`
+
+ const encoded = isBrowser() ? btoa(value) : Buffer.from(value).toString('base64')
+
+ return {
+ 'Authorization': `Basic ${encoded}`
+ }
+}
+
+export function isBrowser() {
+ return typeof window !== 'undefined'
+}
diff --git a/packages/js-sdk/src/sandbox/filesystem/index.ts b/packages/js-sdk/src/sandbox/filesystem/index.ts
index 465cb8c30..2a066c47a 100644
--- a/packages/js-sdk/src/sandbox/filesystem/index.ts
+++ b/packages/js-sdk/src/sandbox/filesystem/index.ts
@@ -16,7 +16,7 @@ import {
SandboxError
} from '../../errors'
import { handleEnvdApiError } from '../../envd/api'
-import { handleRpcError } from '../../envd/rpc'
+import { authenticationHeader, handleRpcError } from '../../envd/rpc'
import { EnvdApiClient } from '../../envd/api'
import { Filesystem as FilesystemService } from '../../envd/filesystem/filesystem_connect'
@@ -124,15 +124,8 @@ export class Filesystem {
async list(path: string, opts?: FilesystemRequestOpts): Promise<EntryInfo[]> {
try {
- const res = await this.rpc.listDir({
- path,
- user: {
- selector: {
- case: 'username',
- value: opts?.user || defaultUsername,
- },
- },
- }, {
+ const res = await this.rpc.listDir({ path }, {
+ headers: authenticationHeader(opts?.user),
signal: this.connectionConfig.getSignal(opts?.requestTimeoutMs),
})
@@ -157,15 +150,8 @@ export class Filesystem {
async makeDir(path: string, opts?: FilesystemRequestOpts): Promise<boolean> {
try {
- await this.rpc.makeDir({
- path,
- user: {
- selector: {
- case: 'username',
- value: opts?.user || defaultUsername,
- },
- },
- }, {
+ await this.rpc.makeDir({ path }, {
+ headers: authenticationHeader(opts?.user),
signal: this.connectionConfig.getSignal(opts?.requestTimeoutMs),
})
@@ -186,13 +172,8 @@ export class Filesystem {
await this.rpc.move({
source: oldPath,
destination: newPath,
- user: {
- selector: {
- case: 'username',
- value: opts?.user || defaultUsername,
- },
- },
}, {
+ headers: authenticationHeader(opts?.user),
signal: this.connectionConfig.getSignal(opts?.requestTimeoutMs),
})
} catch (err) {
@@ -202,15 +183,8 @@ export class Filesystem {
async remove(path: string, opts?: FilesystemRequestOpts): Promise<void> {
try {
- await this.rpc.remove({
- path,
- user: {
- selector: {
- case: 'username',
- value: opts?.user || defaultUsername,
- },
- },
- }, {
+ await this.rpc.remove({ path }, {
+ headers: authenticationHeader(opts?.user),
signal: this.connectionConfig.getSignal(opts?.requestTimeoutMs),
})
} catch (err) {
@@ -220,15 +194,8 @@ export class Filesystem {
async exists(path: string, opts?: FilesystemRequestOpts): Promise<boolean> {
try {
- await this.rpc.stat({
- path,
- user: {
- selector: {
- case: 'username',
- value: opts?.user || defaultUsername,
- },
- },
- }, {
+ await this.rpc.stat({ path }, {
+ headers: authenticationHeader(opts?.user),
signal: this.connectionConfig.getSignal(opts?.requestTimeoutMs),
})
@@ -259,15 +226,8 @@ export class Filesystem {
}, requestTimeoutMs)
: undefined
- const events = this.rpc.watchDir({
- path,
- user: {
- selector: {
- case: 'username',
- value: opts?.user || defaultUsername,
- },
- },
- }, {
+ const events = this.rpc.watchDir({ path }, {
+ headers: authenticationHeader(opts?.user),
signal: controller.signal,
timeoutMs: opts?.timeout ?? this.defaultWatchTimeout,
})
diff --git a/packages/js-sdk/src/sandbox/process/index.ts b/packages/js-sdk/src/sandbox/process/index.ts
index dffe4beb3..d70219dd6 100644
--- a/packages/js-sdk/src/sandbox/process/index.ts
+++ b/packages/js-sdk/src/sandbox/process/index.ts
@@ -11,9 +11,9 @@ import {
StartResponse,
ProcessConfig,
} from '../../envd/process/process_pb'
-import { ConnectionConfig, defaultUsername, Username, ConnectionOpts } from '../../connectionConfig'
+import { ConnectionConfig, Username, ConnectionOpts } from '../../connectionConfig'
import { SandboxError } from '../../errors'
-import { handleRpcError } from '../../envd/rpc'
+import { authenticationHeader, handleRpcError } from '../../envd/rpc'
import { ProcessHandle, ProcessResult } from './processHandle'
export interface ProcessRequestOpts extends Partial<Pick<ConnectionOpts, 'requestTimeoutMs'>> { }
@@ -175,12 +175,6 @@ export class Process {
: undefined
const events = this.rpc.start({
- user: {
- selector: {
- case: 'username',
- value: opts?.user || defaultUsername,
- },
- },
process: {
cmd: '/bin/bash',
cwd: opts?.cwd,
@@ -188,6 +182,7 @@ export class Process {
args: ['-l', '-c', cmd],
},
}, {
+ headers: authenticationHeader(opts?.user),
signal: controller.signal,
timeoutMs: opts?.timeoutMs ?? this.defaultProcessConnectionTimeout,
})
diff --git a/packages/js-sdk/src/sandbox/pty.ts b/packages/js-sdk/src/sandbox/pty.ts
index e5cc156ea..1ca1dbff3 100644
--- a/packages/js-sdk/src/sandbox/pty.ts
+++ b/packages/js-sdk/src/sandbox/pty.ts
@@ -10,16 +10,17 @@ import {
StartResponse,
StreamInputRequest,
} from '../envd/process/process_pb'
-import { ConnectionConfig, ConnectionOpts, defaultUsername, KEEPALIVE_INTERVAL, Username } from '../connectionConfig'
+import { ConnectionConfig, ConnectionOpts, KEEPALIVE_INTERVAL, Username } from '../connectionConfig'
import { PartialMessage } from '@bufbuild/protobuf'
import { ProcessHandle } from './process/processHandle'
+import { authenticationHeader } from '../envd/rpc'
export interface PtyCreateOpts extends Pick<ConnectionOpts, 'requestTimeoutMs'> {
cols: number
rows: number
onData: (data: Uint8Array) => (void | Promise<void>)
timeout?: number
- username?: Username
+ user?: Username
}
export class Pty {
@@ -39,12 +40,6 @@ export class Pty {
}, requestTimeoutMs)
const events = this.rpc.start({
- user: {
- selector: {
- case: 'username',
- value: opts.username ?? defaultUsername,
- },
- },
process: {
cmd: '/bin/bash',
args: ['-i', '-l'],
@@ -59,6 +54,7 @@ export class Pty {
},
},
}, {
+ headers: authenticationHeader(opts?.user),
signal: controller.signal,
timeoutMs: opts?.timeout ?? 60_000,
})
diff --git a/packages/js-sdk/tests/api/kill.test.mts b/packages/js-sdk/tests/api/kill.test.mts
index d6d92a443..8d5f0367c 100644
--- a/packages/js-sdk/tests/api/kill.test.mts
+++ b/packages/js-sdk/tests/api/kill.test.mts
@@ -1,12 +1,12 @@
-import { assert } from 'vitest'
+import { expect } from 'vitest'
import { sandboxTest, isDebug } from '../setup.mjs'
import { Sandbox } from '../../src'
sandboxTest.skipIf(isDebug)('kill existing sandbox', async ({ sandbox }) => {
- assert.doesNotThrow(() => Sandbox.kill(sandbox.sandboxID))
+ await Sandbox.kill(sandbox.sandboxID)
})
sandboxTest.skipIf(isDebug)('kill non-existing sandbox', async () => {
- assert.throws(() => Sandbox.kill('non-existing-sandbox'))
+ await expect(Sandbox.kill('non-existing-sandbox')).rejects.toThrowError()
})
diff --git a/packages/js-sdk/tests/sandbox/commands/connect.test.mts b/packages/js-sdk/tests/sandbox/commands/connect.test.mts
index 27bf2279b..ae561fb46 100644
--- a/packages/js-sdk/tests/sandbox/commands/connect.test.mts
+++ b/packages/js-sdk/tests/sandbox/commands/connect.test.mts
@@ -1,4 +1,4 @@
-import { assert } from 'vitest'
+import { assert, expect } from 'vitest'
import { sandboxTest } from '../../setup.mjs'
sandboxTest('connect to process', async ({ sandbox }) => {
@@ -14,9 +14,5 @@ sandboxTest('connect to process', async ({ sandbox }) => {
sandboxTest('connect to non-existing process', async ({ sandbox }) => {
const nonExistingPid = 999999
- try {
- await sandbox.commands.connect(nonExistingPid)
- } catch (error) {
- assert.instanceOf(error, Error)
- }
+ await expect(sandbox.commands.connect(nonExistingPid)).rejects.toThrowError()
})
diff --git a/packages/js-sdk/tests/sandbox/commands/kill.test.mts b/packages/js-sdk/tests/sandbox/commands/kill.test.mts
index cf8bb5b31..2a6e51546 100644
--- a/packages/js-sdk/tests/sandbox/commands/kill.test.mts
+++ b/packages/js-sdk/tests/sandbox/commands/kill.test.mts
@@ -1,4 +1,7 @@
-import { assert } from 'vitest'
+import { expect } from 'vitest'
+import { NotFoundError } from '../../../src/errors.js'
+import { ProcessExitError } from '../../../src/index.js'
+
import { sandboxTest } from '../../setup.mjs'
sandboxTest('kill process', async ({ sandbox }) => {
@@ -7,19 +10,11 @@ sandboxTest('kill process', async ({ sandbox }) => {
await sandbox.commands.kill(pid)
- try {
- await sandbox.commands.run(`kill -0 ${pid}`)
- } catch (error) {
- assert.instanceOf(error, Error)
- }
+ await expect(sandbox.commands.run(`kill -0 ${pid}`)).rejects.toThrowError(ProcessExitError)
})
sandboxTest('kill non-existing process', async ({ sandbox }) => {
const nonExistingPid = 999999
- try {
- await sandbox.commands.kill(nonExistingPid)
- } catch (error) {
- assert.instanceOf(error, Error)
- }
+ await expect(sandbox.commands.kill(nonExistingPid)).rejects.toThrowError(NotFoundError)
})
diff --git a/packages/js-sdk/tests/sandbox/commands/run.test.mts b/packages/js-sdk/tests/sandbox/commands/run.test.mts
index 664750cb6..5f451e8e1 100644
--- a/packages/js-sdk/tests/sandbox/commands/run.test.mts
+++ b/packages/js-sdk/tests/sandbox/commands/run.test.mts
@@ -1,4 +1,5 @@
-import { assert } from 'vitest'
+import { expect, assert } from 'vitest'
+
import { sandboxTest } from '../../setup.mjs'
sandboxTest('run', async ({ sandbox }) => {
@@ -27,3 +28,13 @@ sandboxTest('run with multiline string', async ({ sandbox }) => {
assert.equal(cmd.exitCode, 0)
assert.equal(cmd.stdout, `${text}\n`)
})
+
+sandboxTest('run with timeout', async ({ sandbox }) => {
+ const cmd = await sandbox.commands.run('echo "Hello, World!"', { timeoutMs: 1000 })
+
+ assert.equal(cmd.exitCode, 0)
+})
+
+sandboxTest('run with too short timeout', async ({ sandbox }) => {
+ await expect(sandbox.commands.run('sleep 10', { timeoutMs: 1000 })).rejects.toThrow()
+})
diff --git a/packages/js-sdk/tests/sandbox/files/read.test.mts b/packages/js-sdk/tests/sandbox/files/read.test.mts
index 2eae6c2d4..34d34ced6 100644
--- a/packages/js-sdk/tests/sandbox/files/read.test.mts
+++ b/packages/js-sdk/tests/sandbox/files/read.test.mts
@@ -1,5 +1,6 @@
-import { assert } from 'vitest'
+import { expect, assert } from 'vitest'
+import { NotFoundError } from '../../../src'
import { sandboxTest } from '../../setup.mjs'
sandboxTest('read file', async ({ sandbox }) => {
@@ -14,9 +15,5 @@ sandboxTest('read file', async ({ sandbox }) => {
sandboxTest('read non-existing file', async ({ sandbox }) => {
const filename = 'non_existing_file.txt'
- try {
- await sandbox.files.read(filename)
- } catch (error) {
- assert.instanceOf(error, Error)
- }
+ await expect(sandbox.files.read(filename)).rejects.toThrowError(NotFoundError)
})
diff --git a/packages/js-sdk/tests/sandbox/files/remove.test.mts b/packages/js-sdk/tests/sandbox/files/remove.test.mts
index eabc02e7d..ddbc9e1f5 100644
--- a/packages/js-sdk/tests/sandbox/files/remove.test.mts
+++ b/packages/js-sdk/tests/sandbox/files/remove.test.mts
@@ -1,5 +1,6 @@
-import { assert } from 'vitest'
+import { assert, expect } from 'vitest'
+import { NotFoundError } from '../../../src'
import { sandboxTest } from '../../setup.mjs'
sandboxTest('remove file', async ({ sandbox }) => {
@@ -15,9 +16,5 @@ sandboxTest('remove file', async ({ sandbox }) => {
sandboxTest('remove non-existing file', async ({ sandbox }) => {
const filename = 'non_existing_file.txt'
- try {
- await sandbox.files.remove(filename)
- } catch (error) {
- assert.instanceOf(error, Error)
- }
+ await expect(sandbox.files.remove(filename)).rejects.toThrowError(NotFoundError)
})
diff --git a/packages/js-sdk/tests/sandbox/files/rename.test.mts b/packages/js-sdk/tests/sandbox/files/rename.test.mts
index 3c5420c77..18eb5d1b4 100644
--- a/packages/js-sdk/tests/sandbox/files/rename.test.mts
+++ b/packages/js-sdk/tests/sandbox/files/rename.test.mts
@@ -1,5 +1,6 @@
-import { assert } from 'vitest'
+import { assert, expect } from 'vitest'
+import { NotFoundError } from '../../../src'
import { sandboxTest } from '../../setup.mjs'
sandboxTest('rename file', async ({ sandbox }) => {
@@ -21,9 +22,5 @@ sandboxTest('rename non-existing file', async ({ sandbox }) => {
const oldFilename = 'non_existing_file.txt'
const newFilename = 'new_non_existing_file.txt'
- try {
- await sandbox.files.rename(oldFilename, newFilename)
- } catch (error) {
- assert.instanceOf(error, Error)
- }
+ await expect(sandbox.files.rename(oldFilename, newFilename)).rejects.toThrowError(NotFoundError)
})
diff --git a/packages/js-sdk/tests/sandbox/files/watch.test.mts b/packages/js-sdk/tests/sandbox/files/watch.test.mts
index c9f2daccf..bab1adb93 100644
--- a/packages/js-sdk/tests/sandbox/files/watch.test.mts
+++ b/packages/js-sdk/tests/sandbox/files/watch.test.mts
@@ -1,7 +1,7 @@
-import { assert } from 'vitest'
+import { assert, expect } from 'vitest'
import { sandboxTest } from '../../setup.mjs'
-import { FilesystemEventType } from '../../../src'
+import { FilesystemEventType, NotFoundError } from '../../../src'
sandboxTest('watch directory changes', async ({ sandbox }) => {
const dirname = 'test_watch_dir'
@@ -30,9 +30,5 @@ sandboxTest('watch directory changes', async ({ sandbox }) => {
sandboxTest('watch non-existing directory', async ({ sandbox }) => {
const dirname = 'non_existing_watch_dir'
- try {
- await sandbox.files.watch(dirname, () => { })
- } catch (error) {
- assert.instanceOf(error, Error)
- }
+ await expect(sandbox.files.watch(dirname, () => { })).rejects.toThrowError(NotFoundError)
})
diff --git a/packages/js-sdk/tests/sandbox/files/write.test.mts b/packages/js-sdk/tests/sandbox/files/write.test.mts
index de0b69806..a944bc721 100644
--- a/packages/js-sdk/tests/sandbox/files/write.test.mts
+++ b/packages/js-sdk/tests/sandbox/files/write.test.mts
@@ -1,4 +1,4 @@
-import { assert } from 'vitest'
+import { assert, expect } from 'vitest'
import { sandboxTest } from '../../setup.mjs'
@@ -28,9 +28,5 @@ sandboxTest('write to non-existing directory', async ({ sandbox }) => {
const filename = 'non_existing_dir/test_write.txt'
const content = 'This should fail.'
- try {
- await sandbox.files.write(filename, content)
- } catch (error) {
- assert.instanceOf(error, Error)
- }
+ await expect(sandbox.files.write(filename, content)).rejects.toThrowError()
})
diff --git a/packages/js-sdk/tests/sandbox/host.test.mts b/packages/js-sdk/tests/sandbox/host.test.mts
index e69de29bb..d9c535c77 100644
--- a/packages/js-sdk/tests/sandbox/host.test.mts
+++ b/packages/js-sdk/tests/sandbox/host.test.mts
@@ -0,0 +1,23 @@
+import { assert } from 'vitest'
+
+import { isDebug, sandboxTest, wait } from '../setup.mjs'
+
+sandboxTest('ping server in sandbox', async ({ sandbox }) => {
+ const cmd = await sandbox.commands.run('python -m http.server 8000', { background: true })
+
+ try {
+ await wait(1000)
+
+ const host = sandbox.getHost(8000)
+
+ const res = await fetch(`${isDebug ? 'http' : 'https'}://${host}`)
+
+ assert.equal(res.status, 200)
+ } finally {
+ try {
+ await cmd.kill()
+ } catch (e) {
+ console.error(e)
+ }
+ }
+})
diff --git a/packages/js-sdk/tests/sandbox/kill.test.mts b/packages/js-sdk/tests/sandbox/kill.test.mts
index 383cc94e4..11ac5c978 100644
--- a/packages/js-sdk/tests/sandbox/kill.test.mts
+++ b/packages/js-sdk/tests/sandbox/kill.test.mts
@@ -1,9 +1,9 @@
-import { assert } from 'vitest'
+import { expect } from 'vitest'
import { sandboxTest, isDebug } from '../setup.mjs'
sandboxTest.skipIf(isDebug)('kill', async ({ sandbox }) => {
await sandbox.kill()
- assert.throws(() => sandbox.isRunning())
+ await expect(sandbox.isRunning()).rejects.toThrowError()
})
diff --git a/packages/js-sdk/tests/sandbox/timeout.test.mts b/packages/js-sdk/tests/sandbox/timeout.test.mts
index e69de29bb..4312198a3 100644
--- a/packages/js-sdk/tests/sandbox/timeout.test.mts
+++ b/packages/js-sdk/tests/sandbox/timeout.test.mts
@@ -0,0 +1,23 @@
+import { expect } from 'vitest'
+
+import { sandboxTest, isDebug, wait } from '../setup.mjs'
+
+sandboxTest.skipIf(isDebug)('shorten timeout', async ({ sandbox }) => {
+ await sandbox.setTimeout(5000)
+
+ await wait(6000)
+
+ await expect(sandbox.isRunning()).rejects.toThrowError()
+})
+
+sandboxTest.skipIf(isDebug)('shorten then lenghten timeout', async ({ sandbox }) => {
+ await sandbox.setTimeout(5000)
+
+ await wait(1000)
+
+ await sandbox.setTimeout(10000)
+
+ await wait(6000)
+
+ await sandbox.isRunning()
+})
diff --git a/packages/js-sdk/tests/sandbox/uploadUrl.test.mts b/packages/js-sdk/tests/sandbox/uploadUrl.test.mts
index e69de29bb..b225c4ab4 100644
--- a/packages/js-sdk/tests/sandbox/uploadUrl.test.mts
+++ b/packages/js-sdk/tests/sandbox/uploadUrl.test.mts
@@ -0,0 +1,16 @@
+
+import { sandboxTest } from '../setup.mjs'
+
+sandboxTest('upload file via url', async ({ sandbox }) => {
+ const url = sandbox.uploadUrl()
+
+
+})
+
+sandboxTest('upload file via url to specific path', async ({ sandbox }) => {
+ const url = sandbox.uploadUrl('/test/test.txt')
+
+ const res = await fetch(url)
+
+ assert.equal(res.status, 200)
+})
diff --git a/packages/js-sdk/tests/setup.mts b/packages/js-sdk/tests/setup.mts
index 8881fbd06..683a6ecea 100644
--- a/packages/js-sdk/tests/setup.mts
+++ b/packages/js-sdk/tests/setup.mts
@@ -29,3 +29,7 @@ export const sandboxTest = base.extend<SandboxFixture>({
})
export const isDebug = process.env.E2B_DEBUG !== undefined
+
+export async function wait(ms: number) {
+ return new Promise((resolve) => setTimeout(resolve, ms))
+}
diff --git a/packages/python-sdk/connect/client.py b/packages/python-sdk/connect/client.py
index 13ac712e8..c86861d63 100644
--- a/packages/python-sdk/connect/client.py
+++ b/packages/python-sdk/connect/client.py
@@ -131,27 +131,37 @@ class Client:
self._compressor = compressor
self._headers = {**{"user-agent": "connect-python"}, **headers}
- def call_unary(self, req, request_timeout=None, **opts):
+ def call_unary(self, req, request_timeout=None, headers={}, **opts):
data = self._codec.encode(req)
if self._compressor is not None:
data = self._compressor.compress(data)
- extensions = None
+ extensions = (
+ None
+ if request_timeout is None
+ else {
+ "timeout": {
+ "connect": request_timeout,
+ "pool": request_timeout,
+ "read": request_timeout,
+ "write": request_timeout,
+ }
+ }
+ )
- if request_timeout is not None:
- extensions = {"timeout": request_timeout}
+ print("headers", headers)
http_resp = self.pool.request(
"POST",
self.url,
content=data,
- # extensions=extensions,
+ extensions=extensions,
headers={
**self._headers,
+ **headers,
**opts.get("headers", {}),
"connect-protocol-version": "1",
- "connect-protocol-version": "1",
"content-encoding": (
"identity" if self._compressor is None else self._compressor.name
),
@@ -177,13 +187,22 @@ class Client:
return {"connect-timeout-ms": str(timeout * 1000)}
return {}
- def call_server_stream(self, req, request_timeout=None, timeout=None, **opts):
+ def call_server_stream(
+ self,
+ req,
+ request_timeout=None,
+ timeout=None,
+ headers={},
+ **opts,
+ ):
data = self._codec.encode(req)
flags = EnvelopeFlags(0)
- extensions = {}
- if request_timeout is not None:
- extensions = {"timeout": {"connect": request_timeout}}
+ extensions = (
+ None
+ if request_timeout is None
+ else {"timeout": {"connect": request_timeout, "pool": request_timeout}}
+ )
if self._compressor is not None:
data = self._compressor.compress(data)
@@ -201,6 +220,7 @@ class Client:
extensions=extensions,
headers={
**self._headers,
+ **headers,
**opts.get("headers", {}),
**stream_timeout,
"connect-protocol-version": "1",
diff --git a/packages/python-sdk/e2b/connection_config.py b/packages/python-sdk/e2b/connection_config.py
index e10785c37..10c71e36b 100644
--- a/packages/python-sdk/e2b/connection_config.py
+++ b/packages/python-sdk/e2b/connection_config.py
@@ -57,3 +57,5 @@ class ConnectionConfig:
Username = Literal["root", "user"]
+
+default_username: Username = "user"
diff --git a/packages/python-sdk/e2b/envd/filesystem/filesystem_connect.py b/packages/python-sdk/e2b/envd/filesystem/filesystem_connect.py
index 652c5206d..618705e67 100644
--- a/packages/python-sdk/e2b/envd/filesystem/filesystem_connect.py
+++ b/packages/python-sdk/e2b/envd/filesystem/filesystem_connect.py
@@ -16,7 +16,7 @@ class FilesystemClient:
response_type=filesystem_dot_filesystem__pb2.StatResponse,
compressor=compressor,
json=json,
- **opts,
+ **opts
)
self._make_dir = connect.Client(
pool=pool,
@@ -24,7 +24,7 @@ class FilesystemClient:
response_type=filesystem_dot_filesystem__pb2.MakeDirResponse,
compressor=compressor,
json=json,
- **opts,
+ **opts
)
self._move = connect.Client(
pool=pool,
@@ -32,7 +32,7 @@ class FilesystemClient:
response_type=filesystem_dot_filesystem__pb2.MoveResponse,
compressor=compressor,
json=json,
- **opts,
+ **opts
)
self._list_dir = connect.Client(
pool=pool,
@@ -40,7 +40,7 @@ class FilesystemClient:
response_type=filesystem_dot_filesystem__pb2.ListDirResponse,
compressor=compressor,
json=json,
- **opts,
+ **opts
)
self._watch_dir = connect.Client(
pool=pool,
@@ -48,7 +48,7 @@ class FilesystemClient:
response_type=filesystem_dot_filesystem__pb2.WatchDirResponse,
compressor=compressor,
json=json,
- **opts,
+ **opts
)
self._remove = connect.Client(
pool=pool,
@@ -56,35 +56,23 @@ class FilesystemClient:
response_type=filesystem_dot_filesystem__pb2.RemoveResponse,
compressor=compressor,
json=json,
- **opts,
+ **opts
)
- def stat(
- self, req: filesystem_dot_filesystem__pb2.StatRequest, **opts
- ) -> filesystem_dot_filesystem__pb2.StatResponse:
+ def stat(self, req: filesystem_dot_filesystem__pb2.StatRequest, **opts) -> filesystem_dot_filesystem__pb2.StatResponse:
return self._stat.call_unary(req, **opts)
- def make_dir(
- self, req: filesystem_dot_filesystem__pb2.MakeDirRequest, **opts
- ) -> filesystem_dot_filesystem__pb2.MakeDirResponse:
+ def make_dir(self, req: filesystem_dot_filesystem__pb2.MakeDirRequest, **opts) -> filesystem_dot_filesystem__pb2.MakeDirResponse:
return self._make_dir.call_unary(req, **opts)
- def move(
- self, req: filesystem_dot_filesystem__pb2.MoveRequest, **opts
- ) -> filesystem_dot_filesystem__pb2.MoveResponse:
+ def move(self, req: filesystem_dot_filesystem__pb2.MoveRequest, **opts) -> filesystem_dot_filesystem__pb2.MoveResponse:
return self._move.call_unary(req, **opts)
- def list_dir(
- self, req: filesystem_dot_filesystem__pb2.ListDirRequest, **opts
- ) -> filesystem_dot_filesystem__pb2.ListDirResponse:
+ def list_dir(self, req: filesystem_dot_filesystem__pb2.ListDirRequest, **opts) -> filesystem_dot_filesystem__pb2.ListDirResponse:
return self._list_dir.call_unary(req, **opts)
- def watch_dir(
- self, req: filesystem_dot_filesystem__pb2.WatchDirRequest, **opts
- ) -> Generator[filesystem_dot_filesystem__pb2.WatchDirResponse, Any, None]:
+ def watch_dir(self, req: filesystem_dot_filesystem__pb2.WatchDirRequest , **opts) -> Generator[filesystem_dot_filesystem__pb2.WatchDirResponse, Any, None]:
return self._watch_dir.call_server_stream(req, **opts)
- def remove(
- self, req: filesystem_dot_filesystem__pb2.RemoveRequest, **opts
- ) -> filesystem_dot_filesystem__pb2.RemoveResponse:
+ def remove(self, req: filesystem_dot_filesystem__pb2.RemoveRequest, **opts) -> filesystem_dot_filesystem__pb2.RemoveResponse:
return self._remove.call_unary(req, **opts)
diff --git a/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.py b/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.py
index bb14e95b2..bfd24c5f2 100644
--- a/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.py
+++ b/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.py
@@ -7,65 +7,57 @@ from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
-
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
-from e2b.envd.permissions import permissions_pb2 as permissions_dot_permissions__pb2
-DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
- b'\n\x1b\x66ilesystem/filesystem.proto\x12\nfilesystem\x1a\x1dpermissions/permissions.proto"n\n\x0bMoveRequest\x12\x16\n\x06source\x18\x01 \x01(\tR\x06source\x12 \n\x0b\x64\x65stination\x18\x02 \x01(\tR\x0b\x64\x65stination\x12%\n\x04user\x18\x03 \x01(\x0b\x32\x11.permissions.UserR\x04user"\x0e\n\x0cMoveResponse"K\n\x0eMakeDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\x12%\n\x04user\x18\x02 \x01(\x0b\x32\x11.permissions.UserR\x04user"\x11\n\x0fMakeDirResponse"J\n\rRemoveRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\x12%\n\x04user\x18\x02 \x01(\x0b\x32\x11.permissions.UserR\x04user"\x10\n\x0eRemoveResponse"H\n\x0bStatRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\x12%\n\x04user\x18\x02 \x01(\x0b\x32\x11.permissions.UserR\x04user";\n\x0cStatResponse\x12+\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x15.filesystem.EntryInfoR\x05\x65ntry"I\n\tEntryInfo\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12(\n\x04type\x18\x02 \x01(\x0e\x32\x14.filesystem.FileTypeR\x04type"K\n\x0eListDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\x12%\n\x04user\x18\x02 \x01(\x0b\x32\x11.permissions.UserR\x04user"B\n\x0fListDirResponse\x12/\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\x15.filesystem.EntryInfoR\x07\x65ntries"L\n\x0fWatchDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\x12%\n\x04user\x18\x02 \x01(\x0b\x32\x11.permissions.UserR\x04user"\xe1\x02\n\x10WatchDirResponse\x12?\n\x05start\x18\x01 \x01(\x0b\x32\'.filesystem.WatchDirResponse.StartEventH\x00R\x05start\x12N\n\nfilesystem\x18\x02 \x01(\x0b\x32,.filesystem.WatchDirResponse.FilesystemEventH\x00R\nfilesystem\x12\x46\n\tkeepalive\x18\x03 \x01(\x0b\x32&.filesystem.WatchDirResponse.KeepAliveH\x00R\tkeepalive\x1a\x0c\n\nStartEvent\x1aP\n\x0f\x46ilesystemEvent\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12)\n\x04type\x18\x02 \x01(\x0e\x32\x15.filesystem.EventTypeR\x04type\x1a\x0b\n\tKeepAliveB\x07\n\x05\x65vent*R\n\x08\x46ileType\x12\x19\n\x15\x46ILE_TYPE_UNSPECIFIED\x10\x00\x12\x12\n\x0e\x46ILE_TYPE_FILE\x10\x01\x12\x17\n\x13\x46ILE_TYPE_DIRECTORY\x10\x02*\x98\x01\n\tEventType\x12\x1a\n\x16\x45VENT_TYPE_UNSPECIFIED\x10\x00\x12\x15\n\x11\x45VENT_TYPE_CREATE\x10\x01\x12\x14\n\x10\x45VENT_TYPE_WRITE\x10\x02\x12\x15\n\x11\x45VENT_TYPE_REMOVE\x10\x03\x12\x15\n\x11\x45VENT_TYPE_RENAME\x10\x04\x12\x14\n\x10\x45VENT_TYPE_CHMOD\x10\x05\x32\x94\x03\n\nFilesystem\x12\x39\n\x04Stat\x12\x17.filesystem.StatRequest\x1a\x18.filesystem.StatResponse\x12\x42\n\x07MakeDir\x12\x1a.filesystem.MakeDirRequest\x1a\x1b.filesystem.MakeDirResponse\x12\x39\n\x04Move\x12\x17.filesystem.MoveRequest\x1a\x18.filesystem.MoveResponse\x12\x42\n\x07ListDir\x12\x1a.filesystem.ListDirRequest\x1a\x1b.filesystem.ListDirResponse\x12G\n\x08WatchDir\x12\x1b.filesystem.WatchDirRequest\x1a\x1c.filesystem.WatchDirResponse0\x01\x12?\n\x06Remove\x12\x19.filesystem.RemoveRequest\x1a\x1a.filesystem.RemoveResponseBi\n\x0e\x63om.filesystemB\x0f\x46ilesystemProtoP\x01\xa2\x02\x03\x46XX\xaa\x02\nFilesystem\xca\x02\nFilesystem\xe2\x02\x16\x46ilesystem\\GPBMetadata\xea\x02\nFilesystemb\x06proto3'
-)
+DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1b\x66ilesystem/filesystem.proto\x12\nfilesystem\"G\n\x0bMoveRequest\x12\x16\n\x06source\x18\x01 \x01(\tR\x06source\x12 \n\x0b\x64\x65stination\x18\x02 \x01(\tR\x0b\x64\x65stination\"\x0e\n\x0cMoveResponse\"$\n\x0eMakeDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\"\x11\n\x0fMakeDirResponse\"#\n\rRemoveRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\"\x10\n\x0eRemoveResponse\"!\n\x0bStatRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\";\n\x0cStatResponse\x12+\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x15.filesystem.EntryInfoR\x05\x65ntry\"I\n\tEntryInfo\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12(\n\x04type\x18\x02 \x01(\x0e\x32\x14.filesystem.FileTypeR\x04type\"$\n\x0eListDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\"B\n\x0fListDirResponse\x12/\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\x15.filesystem.EntryInfoR\x07\x65ntries\"%\n\x0fWatchDirRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\"\xe1\x02\n\x10WatchDirResponse\x12?\n\x05start\x18\x01 \x01(\x0b\x32\'.filesystem.WatchDirResponse.StartEventH\x00R\x05start\x12N\n\nfilesystem\x18\x02 \x01(\x0b\x32,.filesystem.WatchDirResponse.FilesystemEventH\x00R\nfilesystem\x12\x46\n\tkeepalive\x18\x03 \x01(\x0b\x32&.filesystem.WatchDirResponse.KeepAliveH\x00R\tkeepalive\x1a\x0c\n\nStartEvent\x1aP\n\x0f\x46ilesystemEvent\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12)\n\x04type\x18\x02 \x01(\x0e\x32\x15.filesystem.EventTypeR\x04type\x1a\x0b\n\tKeepAliveB\x07\n\x05\x65vent*R\n\x08\x46ileType\x12\x19\n\x15\x46ILE_TYPE_UNSPECIFIED\x10\x00\x12\x12\n\x0e\x46ILE_TYPE_FILE\x10\x01\x12\x17\n\x13\x46ILE_TYPE_DIRECTORY\x10\x02*\x98\x01\n\tEventType\x12\x1a\n\x16\x45VENT_TYPE_UNSPECIFIED\x10\x00\x12\x15\n\x11\x45VENT_TYPE_CREATE\x10\x01\x12\x14\n\x10\x45VENT_TYPE_WRITE\x10\x02\x12\x15\n\x11\x45VENT_TYPE_REMOVE\x10\x03\x12\x15\n\x11\x45VENT_TYPE_RENAME\x10\x04\x12\x14\n\x10\x45VENT_TYPE_CHMOD\x10\x05\x32\x94\x03\n\nFilesystem\x12\x39\n\x04Stat\x12\x17.filesystem.StatRequest\x1a\x18.filesystem.StatResponse\x12\x42\n\x07MakeDir\x12\x1a.filesystem.MakeDirRequest\x1a\x1b.filesystem.MakeDirResponse\x12\x39\n\x04Move\x12\x17.filesystem.MoveRequest\x1a\x18.filesystem.MoveResponse\x12\x42\n\x07ListDir\x12\x1a.filesystem.ListDirRequest\x1a\x1b.filesystem.ListDirResponse\x12G\n\x08WatchDir\x12\x1b.filesystem.WatchDirRequest\x1a\x1c.filesystem.WatchDirResponse0\x01\x12?\n\x06Remove\x12\x19.filesystem.RemoveRequest\x1a\x1a.filesystem.RemoveResponseBi\n\x0e\x63om.filesystemB\x0f\x46ilesystemProtoP\x01\xa2\x02\x03\x46XX\xaa\x02\nFilesystem\xca\x02\nFilesystem\xe2\x02\x16\x46ilesystem\\GPBMetadata\xea\x02\nFilesystemb\x06proto3')
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
-_builder.BuildTopDescriptorsAndMessages(
- DESCRIPTOR, "filesystem.filesystem_pb2", _globals
-)
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'filesystem.filesystem_pb2', _globals)
if not _descriptor._USE_C_DESCRIPTORS:
- _globals["DESCRIPTOR"]._loaded_options = None
- _globals[
- "DESCRIPTOR"
- ]._serialized_options = b"\n\016com.filesystemB\017FilesystemProtoP\001\242\002\003FXX\252\002\nFilesystem\312\002\nFilesystem\342\002\026Filesystem\\GPBMetadata\352\002\nFilesystem"
- _globals["_FILETYPE"]._serialized_start = 1181
- _globals["_FILETYPE"]._serialized_end = 1263
- _globals["_EVENTTYPE"]._serialized_start = 1266
- _globals["_EVENTTYPE"]._serialized_end = 1418
- _globals["_MOVEREQUEST"]._serialized_start = 74
- _globals["_MOVEREQUEST"]._serialized_end = 184
- _globals["_MOVERESPONSE"]._serialized_start = 186
- _globals["_MOVERESPONSE"]._serialized_end = 200
- _globals["_MAKEDIRREQUEST"]._serialized_start = 202
- _globals["_MAKEDIRREQUEST"]._serialized_end = 277
- _globals["_MAKEDIRRESPONSE"]._serialized_start = 279
- _globals["_MAKEDIRRESPONSE"]._serialized_end = 296
- _globals["_REMOVEREQUEST"]._serialized_start = 298
- _globals["_REMOVEREQUEST"]._serialized_end = 372
- _globals["_REMOVERESPONSE"]._serialized_start = 374
- _globals["_REMOVERESPONSE"]._serialized_end = 390
- _globals["_STATREQUEST"]._serialized_start = 392
- _globals["_STATREQUEST"]._serialized_end = 464
- _globals["_STATRESPONSE"]._serialized_start = 466
- _globals["_STATRESPONSE"]._serialized_end = 525
- _globals["_ENTRYINFO"]._serialized_start = 527
- _globals["_ENTRYINFO"]._serialized_end = 600
- _globals["_LISTDIRREQUEST"]._serialized_start = 602
- _globals["_LISTDIRREQUEST"]._serialized_end = 677
- _globals["_LISTDIRRESPONSE"]._serialized_start = 679
- _globals["_LISTDIRRESPONSE"]._serialized_end = 745
- _globals["_WATCHDIRREQUEST"]._serialized_start = 747
- _globals["_WATCHDIRREQUEST"]._serialized_end = 823
- _globals["_WATCHDIRRESPONSE"]._serialized_start = 826
- _globals["_WATCHDIRRESPONSE"]._serialized_end = 1179
- _globals["_WATCHDIRRESPONSE_STARTEVENT"]._serialized_start = 1063
- _globals["_WATCHDIRRESPONSE_STARTEVENT"]._serialized_end = 1075
- _globals["_WATCHDIRRESPONSE_FILESYSTEMEVENT"]._serialized_start = 1077
- _globals["_WATCHDIRRESPONSE_FILESYSTEMEVENT"]._serialized_end = 1157
- _globals["_WATCHDIRRESPONSE_KEEPALIVE"]._serialized_start = 1159
- _globals["_WATCHDIRRESPONSE_KEEPALIVE"]._serialized_end = 1170
- _globals["_FILESYSTEM"]._serialized_start = 1421
- _globals["_FILESYSTEM"]._serialized_end = 1825
+ _globals['DESCRIPTOR']._loaded_options = None
+ _globals['DESCRIPTOR']._serialized_options = b'\n\016com.filesystemB\017FilesystemProtoP\001\242\002\003FXX\252\002\nFilesystem\312\002\nFilesystem\342\002\026Filesystem\\GPBMetadata\352\002\nFilesystem'
+ _globals['_FILETYPE']._serialized_start=916
+ _globals['_FILETYPE']._serialized_end=998
+ _globals['_EVENTTYPE']._serialized_start=1001
+ _globals['_EVENTTYPE']._serialized_end=1153
+ _globals['_MOVEREQUEST']._serialized_start=43
+ _globals['_MOVEREQUEST']._serialized_end=114
+ _globals['_MOVERESPONSE']._serialized_start=116
+ _globals['_MOVERESPONSE']._serialized_end=130
+ _globals['_MAKEDIRREQUEST']._serialized_start=132
+ _globals['_MAKEDIRREQUEST']._serialized_end=168
+ _globals['_MAKEDIRRESPONSE']._serialized_start=170
+ _globals['_MAKEDIRRESPONSE']._serialized_end=187
+ _globals['_REMOVEREQUEST']._serialized_start=189
+ _globals['_REMOVEREQUEST']._serialized_end=224
+ _globals['_REMOVERESPONSE']._serialized_start=226
+ _globals['_REMOVERESPONSE']._serialized_end=242
+ _globals['_STATREQUEST']._serialized_start=244
+ _globals['_STATREQUEST']._serialized_end=277
+ _globals['_STATRESPONSE']._serialized_start=279
+ _globals['_STATRESPONSE']._serialized_end=338
+ _globals['_ENTRYINFO']._serialized_start=340
+ _globals['_ENTRYINFO']._serialized_end=413
+ _globals['_LISTDIRREQUEST']._serialized_start=415
+ _globals['_LISTDIRREQUEST']._serialized_end=451
+ _globals['_LISTDIRRESPONSE']._serialized_start=453
+ _globals['_LISTDIRRESPONSE']._serialized_end=519
+ _globals['_WATCHDIRREQUEST']._serialized_start=521
+ _globals['_WATCHDIRREQUEST']._serialized_end=558
+ _globals['_WATCHDIRRESPONSE']._serialized_start=561
+ _globals['_WATCHDIRRESPONSE']._serialized_end=914
+ _globals['_WATCHDIRRESPONSE_STARTEVENT']._serialized_start=798
+ _globals['_WATCHDIRRESPONSE_STARTEVENT']._serialized_end=810
+ _globals['_WATCHDIRRESPONSE_FILESYSTEMEVENT']._serialized_start=812
+ _globals['_WATCHDIRRESPONSE_FILESYSTEMEVENT']._serialized_end=892
+ _globals['_WATCHDIRRESPONSE_KEEPALIVE']._serialized_start=894
+ _globals['_WATCHDIRRESPONSE_KEEPALIVE']._serialized_end=905
+ _globals['_FILESYSTEM']._serialized_start=1156
+ _globals['_FILESYSTEM']._serialized_end=1560
# @@protoc_insertion_point(module_scope)
diff --git a/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.pyi b/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.pyi
index bec1f370c..5972b4714 100644
--- a/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.pyi
+++ b/packages/python-sdk/e2b/envd/filesystem/filesystem_pb2.pyi
@@ -1,15 +1,8 @@
-from e2b.envd.permissions import permissions_pb2 as _permissions_pb2
from google.protobuf.internal import containers as _containers
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
-from typing import (
- ClassVar as _ClassVar,
- Iterable as _Iterable,
- Mapping as _Mapping,
- Optional as _Optional,
- Union as _Union,
-)
+from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union
DESCRIPTOR: _descriptor.FileDescriptor
@@ -27,7 +20,6 @@ class EventType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
EVENT_TYPE_REMOVE: _ClassVar[EventType]
EVENT_TYPE_RENAME: _ClassVar[EventType]
EVENT_TYPE_CHMOD: _ClassVar[EventType]
-
FILE_TYPE_UNSPECIFIED: FileType
FILE_TYPE_FILE: FileType
FILE_TYPE_DIRECTORY: FileType
@@ -39,67 +31,42 @@ EVENT_TYPE_RENAME: EventType
EVENT_TYPE_CHMOD: EventType
class MoveRequest(_message.Message):
- __slots__ = ("source", "destination", "user")
+ __slots__ = ("source", "destination")
SOURCE_FIELD_NUMBER: _ClassVar[int]
DESTINATION_FIELD_NUMBER: _ClassVar[int]
- USER_FIELD_NUMBER: _ClassVar[int]
source: str
destination: str
- user: _permissions_pb2.User
- def __init__(
- self,
- source: _Optional[str] = ...,
- destination: _Optional[str] = ...,
- user: _Optional[_Union[_permissions_pb2.User, _Mapping]] = ...,
- ) -> None: ...
+ def __init__(self, source: _Optional[str] = ..., destination: _Optional[str] = ...) -> None: ...
class MoveResponse(_message.Message):
__slots__ = ()
def __init__(self) -> None: ...
class MakeDirRequest(_message.Message):
- __slots__ = ("path", "user")
+ __slots__ = ("path",)
PATH_FIELD_NUMBER: _ClassVar[int]
- USER_FIELD_NUMBER: _ClassVar[int]
path: str
- user: _permissions_pb2.User
- def __init__(
- self,
- path: _Optional[str] = ...,
- user: _Optional[_Union[_permissions_pb2.User, _Mapping]] = ...,
- ) -> None: ...
+ def __init__(self, path: _Optional[str] = ...) -> None: ...
class MakeDirResponse(_message.Message):
__slots__ = ()
def __init__(self) -> None: ...
class RemoveRequest(_message.Message):
- __slots__ = ("path", "user")
+ __slots__ = ("path",)
PATH_FIELD_NUMBER: _ClassVar[int]
- USER_FIELD_NUMBER: _ClassVar[int]
path: str
- user: _permissions_pb2.User
- def __init__(
- self,
- path: _Optional[str] = ...,
- user: _Optional[_Union[_permissions_pb2.User, _Mapping]] = ...,
- ) -> None: ...
+ def __init__(self, path: _Optional[str] = ...) -> None: ...
class RemoveResponse(_message.Message):
__slots__ = ()
def __init__(self) -> None: ...
class StatRequest(_message.Message):
- __slots__ = ("path", "user")
+ __slots__ = ("path",)
PATH_FIELD_NUMBER: _ClassVar[int]
- USER_FIELD_NUMBER: _ClassVar[int]
path: str
- user: _permissions_pb2.User
- def __init__(
- self,
- path: _Optional[str] = ...,
- user: _Optional[_Union[_permissions_pb2.User, _Mapping]] = ...,
- ) -> None: ...
+ def __init__(self, path: _Optional[str] = ...) -> None: ...
class StatResponse(_message.Message):
__slots__ = ("entry",)
@@ -113,61 +80,38 @@ class EntryInfo(_message.Message):
TYPE_FIELD_NUMBER: _ClassVar[int]
name: str
type: FileType
- def __init__(
- self, name: _Optional[str] = ..., type: _Optional[_Union[FileType, str]] = ...
- ) -> None: ...
+ def __init__(self, name: _Optional[str] = ..., type: _Optional[_Union[FileType, str]] = ...) -> None: ...
class ListDirRequest(_message.Message):
- __slots__ = ("path", "user")
+ __slots__ = ("path",)
PATH_FIELD_NUMBER: _ClassVar[int]
- USER_FIELD_NUMBER: _ClassVar[int]
path: str
- user: _permissions_pb2.User
- def __init__(
- self,
- path: _Optional[str] = ...,
- user: _Optional[_Union[_permissions_pb2.User, _Mapping]] = ...,
- ) -> None: ...
+ def __init__(self, path: _Optional[str] = ...) -> None: ...
class ListDirResponse(_message.Message):
__slots__ = ("entries",)
ENTRIES_FIELD_NUMBER: _ClassVar[int]
entries: _containers.RepeatedCompositeFieldContainer[EntryInfo]
- def __init__(
- self, entries: _Optional[_Iterable[_Union[EntryInfo, _Mapping]]] = ...
- ) -> None: ...
+ def __init__(self, entries: _Optional[_Iterable[_Union[EntryInfo, _Mapping]]] = ...) -> None: ...
class WatchDirRequest(_message.Message):
- __slots__ = ("path", "user")
+ __slots__ = ("path",)
PATH_FIELD_NUMBER: _ClassVar[int]
- USER_FIELD_NUMBER: _ClassVar[int]
path: str
- user: _permissions_pb2.User
- def __init__(
- self,
- path: _Optional[str] = ...,
- user: _Optional[_Union[_permissions_pb2.User, _Mapping]] = ...,
- ) -> None: ...
+ def __init__(self, path: _Optional[str] = ...) -> None: ...
class WatchDirResponse(_message.Message):
__slots__ = ("start", "filesystem", "keepalive")
-
class StartEvent(_message.Message):
__slots__ = ()
def __init__(self) -> None: ...
-
class FilesystemEvent(_message.Message):
__slots__ = ("name", "type")
NAME_FIELD_NUMBER: _ClassVar[int]
TYPE_FIELD_NUMBER: _ClassVar[int]
name: str
type: EventType
- def __init__(
- self,
- name: _Optional[str] = ...,
- type: _Optional[_Union[EventType, str]] = ...,
- ) -> None: ...
-
+ def __init__(self, name: _Optional[str] = ..., type: _Optional[_Union[EventType, str]] = ...) -> None: ...
class KeepAlive(_message.Message):
__slots__ = ()
def __init__(self) -> None: ...
@@ -177,9 +121,4 @@ class WatchDirResponse(_message.Message):
start: WatchDirResponse.StartEvent
filesystem: WatchDirResponse.FilesystemEvent
keepalive: WatchDirResponse.KeepAlive
- def __init__(
- self,
- start: _Optional[_Union[WatchDirResponse.StartEvent, _Mapping]] = ...,
- filesystem: _Optional[_Union[WatchDirResponse.FilesystemEvent, _Mapping]] = ...,
- keepalive: _Optional[_Union[WatchDirResponse.KeepAlive, _Mapping]] = ...,
- ) -> None: ...
+ def __init__(self, start: _Optional[_Union[WatchDirResponse.StartEvent, _Mapping]] = ..., filesystem: _Optional[_Union[WatchDirResponse.FilesystemEvent, _Mapping]] = ..., keepalive: _Optional[_Union[WatchDirResponse.KeepAlive, _Mapping]] = ...) -> None: ...
diff --git a/packages/python-sdk/e2b/envd/permissions/permissions_pb2.py b/packages/python-sdk/e2b/envd/permissions/permissions_pb2.py
deleted file mode 100644
index f3c5ff50f..000000000
--- a/packages/python-sdk/e2b/envd/permissions/permissions_pb2.py
+++ /dev/null
@@ -1,32 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: permissions/permissions.proto
-# Protobuf Python Version: 5.26.1
-"""Generated protocol buffer code."""
-from google.protobuf import descriptor as _descriptor
-from google.protobuf import descriptor_pool as _descriptor_pool
-from google.protobuf import symbol_database as _symbol_database
-from google.protobuf.internal import builder as _builder
-
-# @@protoc_insertion_point(imports)
-
-_sym_db = _symbol_database.Default()
-
-
-DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
- b'\n\x1dpermissions/permissions.proto\x12\x0bpermissions"0\n\x04User\x12\x1c\n\x08username\x18\x01 \x01(\tH\x00R\x08usernameB\n\n\x08selectorBo\n\x0f\x63om.permissionsB\x10PermissionsProtoP\x01\xa2\x02\x03PXX\xaa\x02\x0bPermissions\xca\x02\x0bPermissions\xe2\x02\x17Permissions\\GPBMetadata\xea\x02\x0bPermissionsb\x06proto3'
-)
-
-_globals = globals()
-_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
-_builder.BuildTopDescriptorsAndMessages(
- DESCRIPTOR, "permissions.permissions_pb2", _globals
-)
-if not _descriptor._USE_C_DESCRIPTORS:
- _globals["DESCRIPTOR"]._loaded_options = None
- _globals[
- "DESCRIPTOR"
- ]._serialized_options = b"\n\017com.permissionsB\020PermissionsProtoP\001\242\002\003PXX\252\002\013Permissions\312\002\013Permissions\342\002\027Permissions\\GPBMetadata\352\002\013Permissions"
- _globals["_USER"]._serialized_start = 46
- _globals["_USER"]._serialized_end = 94
-# @@protoc_insertion_point(module_scope)
diff --git a/packages/python-sdk/e2b/envd/permissions/permissions_pb2.pyi b/packages/python-sdk/e2b/envd/permissions/permissions_pb2.pyi
deleted file mode 100644
index 6adb3f58a..000000000
--- a/packages/python-sdk/e2b/envd/permissions/permissions_pb2.pyi
+++ /dev/null
@@ -1,11 +0,0 @@
-from google.protobuf import descriptor as _descriptor
-from google.protobuf import message as _message
-from typing import ClassVar as _ClassVar, Optional as _Optional
-
-DESCRIPTOR: _descriptor.FileDescriptor
-
-class User(_message.Message):
- __slots__ = ("username",)
- USERNAME_FIELD_NUMBER: _ClassVar[int]
- username: str
- def __init__(self, username: _Optional[str] = ...) -> None: ...
diff --git a/packages/python-sdk/e2b/envd/process/process_connect.py b/packages/python-sdk/e2b/envd/process/process_connect.py
index d9ef4ba1a..7a1f8ab04 100644
--- a/packages/python-sdk/e2b/envd/process/process_connect.py
+++ b/packages/python-sdk/e2b/envd/process/process_connect.py
@@ -16,7 +16,7 @@ class ProcessClient:
response_type=process_dot_process__pb2.ListResponse,
compressor=compressor,
json=json,
- **opts,
+ **opts
)
self._connect = connect.Client(
pool=pool,
@@ -24,7 +24,7 @@ class ProcessClient:
response_type=process_dot_process__pb2.ConnectResponse,
compressor=compressor,
json=json,
- **opts,
+ **opts
)
self._start = connect.Client(
pool=pool,
@@ -32,7 +32,7 @@ class ProcessClient:
response_type=process_dot_process__pb2.StartResponse,
compressor=compressor,
json=json,
- **opts,
+ **opts
)
self._update = connect.Client(
pool=pool,
@@ -40,7 +40,7 @@ class ProcessClient:
response_type=process_dot_process__pb2.UpdateResponse,
compressor=compressor,
json=json,
- **opts,
+ **opts
)
self._stream_input = connect.Client(
pool=pool,
@@ -48,7 +48,7 @@ class ProcessClient:
response_type=process_dot_process__pb2.StreamInputResponse,
compressor=compressor,
json=json,
- **opts,
+ **opts
)
self._send_input = connect.Client(
pool=pool,
@@ -56,7 +56,7 @@ class ProcessClient:
response_type=process_dot_process__pb2.SendInputResponse,
compressor=compressor,
json=json,
- **opts,
+ **opts
)
self._send_signal = connect.Client(
pool=pool,
@@ -64,40 +64,26 @@ class ProcessClient:
response_type=process_dot_process__pb2.SendSignalResponse,
compressor=compressor,
json=json,
- **opts,
+ **opts
)
- def list(
- self, req: process_dot_process__pb2.ListRequest, **opts
- ) -> process_dot_process__pb2.ListResponse:
+ def list(self, req: process_dot_process__pb2.ListRequest, **opts) -> process_dot_process__pb2.ListResponse:
return self._list.call_unary(req, **opts)
- def connect(
- self, req: process_dot_process__pb2.ConnectRequest, **opts
- ) -> Generator[process_dot_process__pb2.ConnectResponse, Any, None]:
+ def connect(self, req: process_dot_process__pb2.ConnectRequest , **opts) -> Generator[process_dot_process__pb2.ConnectResponse, Any, None]:
return self._connect.call_server_stream(req, **opts)
- def start(
- self, req: process_dot_process__pb2.StartRequest, **opts
- ) -> Generator[process_dot_process__pb2.StartResponse, Any, None]:
+ def start(self, req: process_dot_process__pb2.StartRequest , **opts) -> Generator[process_dot_process__pb2.StartResponse, Any, None]:
return self._start.call_server_stream(req, **opts)
- def update(
- self, req: process_dot_process__pb2.UpdateRequest, **opts
- ) -> process_dot_process__pb2.UpdateResponse:
+ def update(self, req: process_dot_process__pb2.UpdateRequest, **opts) -> process_dot_process__pb2.UpdateResponse:
return self._update.call_unary(req, **opts)
- def stream_input(
- self, req: process_dot_process__pb2.StreamInputRequest, **opts
- ) -> process_dot_process__pb2.StreamInputResponse:
+ def stream_input(self, req: process_dot_process__pb2.StreamInputRequest, **opts) -> process_dot_process__pb2.StreamInputResponse:
return self._stream_input.call_client_stream(req, **opts)
- def send_input(
- self, req: process_dot_process__pb2.SendInputRequest, **opts
- ) -> process_dot_process__pb2.SendInputResponse:
+ def send_input(self, req: process_dot_process__pb2.SendInputRequest, **opts) -> process_dot_process__pb2.SendInputResponse:
return self._send_input.call_unary(req, **opts)
- def send_signal(
- self, req: process_dot_process__pb2.SendSignalRequest, **opts
- ) -> process_dot_process__pb2.SendSignalResponse:
+ def send_signal(self, req: process_dot_process__pb2.SendSignalRequest, **opts) -> process_dot_process__pb2.SendSignalResponse:
return self._send_signal.call_unary(req, **opts)
diff --git a/packages/python-sdk/e2b/envd/process/process_pb2.py b/packages/python-sdk/e2b/envd/process/process_pb2.py
index ca20a39b3..4b2ed2219 100644
--- a/packages/python-sdk/e2b/envd/process/process_pb2.py
+++ b/packages/python-sdk/e2b/envd/process/process_pb2.py
@@ -7,89 +7,83 @@ from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
-
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
-from e2b.envd.permissions import permissions_pb2 as permissions_dot_permissions__pb2
-DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
- b'\n\x15process/process.proto\x12\x07process\x1a\x1dpermissions/permissions.proto"\\\n\x03PTY\x12%\n\x04size\x18\x01 \x01(\x0b\x32\x11.process.PTY.SizeR\x04size\x1a.\n\x04Size\x12\x12\n\x04\x63ols\x18\x01 \x01(\rR\x04\x63ols\x12\x12\n\x04rows\x18\x02 \x01(\rR\x04rows"\xc3\x01\n\rProcessConfig\x12\x10\n\x03\x63md\x18\x01 \x01(\tR\x03\x63md\x12\x12\n\x04\x61rgs\x18\x02 \x03(\tR\x04\x61rgs\x12\x34\n\x04\x65nvs\x18\x03 \x03(\x0b\x32 .process.ProcessConfig.EnvsEntryR\x04\x65nvs\x12\x15\n\x03\x63wd\x18\x04 \x01(\tH\x00R\x03\x63wd\x88\x01\x01\x1a\x37\n\tEnvsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\x42\x06\n\x04_cwd"\r\n\x0bListRequest"n\n\x0bProcessInfo\x12.\n\x06\x63onfig\x18\x01 \x01(\x0b\x32\x16.process.ProcessConfigR\x06\x63onfig\x12\x10\n\x03pid\x18\x02 \x01(\rR\x03pid\x12\x15\n\x03tag\x18\x03 \x01(\tH\x00R\x03tag\x88\x01\x01\x42\x06\n\x04_tag"B\n\x0cListResponse\x12\x32\n\tprocesses\x18\x01 \x03(\x0b\x32\x14.process.ProcessInfoR\tprocesses"\xb3\x01\n\x0cStartRequest\x12\x30\n\x07process\x18\x01 \x01(\x0b\x32\x16.process.ProcessConfigR\x07process\x12#\n\x03pty\x18\x02 \x01(\x0b\x32\x0c.process.PTYH\x00R\x03pty\x88\x01\x01\x12\x15\n\x03tag\x18\x03 \x01(\tH\x01R\x03tag\x88\x01\x01\x12%\n\x04user\x18\x04 \x01(\x0b\x32\x11.permissions.UserR\x04userB\x06\n\x04_ptyB\x06\n\x04_tag"p\n\rUpdateRequest\x12\x32\n\x07process\x18\x01 \x01(\x0b\x32\x18.process.ProcessSelectorR\x07process\x12#\n\x03pty\x18\x02 \x01(\x0b\x32\x0c.process.PTYH\x00R\x03pty\x88\x01\x01\x42\x06\n\x04_pty"\x10\n\x0eUpdateResponse"\x87\x04\n\x0cProcessEvent\x12\x38\n\x05start\x18\x01 \x01(\x0b\x32 .process.ProcessEvent.StartEventH\x00R\x05start\x12\x35\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x1f.process.ProcessEvent.DataEventH\x00R\x04\x64\x61ta\x12\x32\n\x03\x65nd\x18\x03 \x01(\x0b\x32\x1e.process.ProcessEvent.EndEventH\x00R\x03\x65nd\x12?\n\tkeepalive\x18\x04 \x01(\x0b\x32\x1f.process.ProcessEvent.KeepAliveH\x00R\tkeepalive\x1a\x1e\n\nStartEvent\x12\x10\n\x03pid\x18\x01 \x01(\rR\x03pid\x1a]\n\tDataEvent\x12\x18\n\x06stdout\x18\x01 \x01(\x0cH\x00R\x06stdout\x12\x18\n\x06stderr\x18\x02 \x01(\x0cH\x00R\x06stderr\x12\x12\n\x03pty\x18\x03 \x01(\x0cH\x00R\x03ptyB\x08\n\x06output\x1a|\n\x08\x45ndEvent\x12\x1b\n\texit_code\x18\x01 \x01(\x11R\x08\x65xitCode\x12\x16\n\x06\x65xited\x18\x02 \x01(\x08R\x06\x65xited\x12\x16\n\x06status\x18\x03 \x01(\tR\x06status\x12\x19\n\x05\x65rror\x18\x04 \x01(\tH\x00R\x05\x65rror\x88\x01\x01\x42\x08\n\x06_error\x1a\x0b\n\tKeepAliveB\x07\n\x05\x65vent"<\n\rStartResponse\x12+\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x15.process.ProcessEventR\x05\x65vent">\n\x0f\x43onnectResponse\x12+\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x15.process.ProcessEventR\x05\x65vent"s\n\x10SendInputRequest\x12\x32\n\x07process\x18\x01 \x01(\x0b\x32\x18.process.ProcessSelectorR\x07process\x12+\n\x05input\x18\x02 \x01(\x0b\x32\x15.process.ProcessInputR\x05input"\x13\n\x11SendInputResponse"C\n\x0cProcessInput\x12\x16\n\x05stdin\x18\x01 \x01(\x0cH\x00R\x05stdin\x12\x12\n\x03pty\x18\x02 \x01(\x0cH\x00R\x03ptyB\x07\n\x05input"\xea\x02\n\x12StreamInputRequest\x12>\n\x05start\x18\x01 \x01(\x0b\x32&.process.StreamInputRequest.StartEventH\x00R\x05start\x12;\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32%.process.StreamInputRequest.DataEventH\x00R\x04\x64\x61ta\x12\x45\n\tkeepalive\x18\x03 \x01(\x0b\x32%.process.StreamInputRequest.KeepAliveH\x00R\tkeepalive\x1a@\n\nStartEvent\x12\x32\n\x07process\x18\x01 \x01(\x0b\x32\x18.process.ProcessSelectorR\x07process\x1a\x38\n\tDataEvent\x12+\n\x05input\x18\x02 \x01(\x0b\x32\x15.process.ProcessInputR\x05input\x1a\x0b\n\tKeepAliveB\x07\n\x05\x65vent"\x15\n\x13StreamInputResponse"p\n\x11SendSignalRequest\x12\x32\n\x07process\x18\x01 \x01(\x0b\x32\x18.process.ProcessSelectorR\x07process\x12\'\n\x06signal\x18\x02 \x01(\x0e\x32\x0f.process.SignalR\x06signal"\x14\n\x12SendSignalResponse"D\n\x0e\x43onnectRequest\x12\x32\n\x07process\x18\x01 \x01(\x0b\x32\x18.process.ProcessSelectorR\x07process"E\n\x0fProcessSelector\x12\x12\n\x03pid\x18\x01 \x01(\rH\x00R\x03pid\x12\x12\n\x03tag\x18\x02 \x01(\tH\x00R\x03tagB\n\n\x08selector*H\n\x06Signal\x12\x16\n\x12SIGNAL_UNSPECIFIED\x10\x00\x12\x12\n\x0eSIGNAL_SIGTERM\x10\x0f\x12\x12\n\x0eSIGNAL_SIGKILL\x10\t2\xca\x03\n\x07Process\x12\x33\n\x04List\x12\x14.process.ListRequest\x1a\x15.process.ListResponse\x12>\n\x07\x43onnect\x12\x17.process.ConnectRequest\x1a\x18.process.ConnectResponse0\x01\x12\x38\n\x05Start\x12\x15.process.StartRequest\x1a\x16.process.StartResponse0\x01\x12\x39\n\x06Update\x12\x16.process.UpdateRequest\x1a\x17.process.UpdateResponse\x12J\n\x0bStreamInput\x12\x1b.process.StreamInputRequest\x1a\x1c.process.StreamInputResponse(\x01\x12\x42\n\tSendInput\x12\x19.process.SendInputRequest\x1a\x1a.process.SendInputResponse\x12\x45\n\nSendSignal\x12\x1a.process.SendSignalRequest\x1a\x1b.process.SendSignalResponseBW\n\x0b\x63om.processB\x0cProcessProtoP\x01\xa2\x02\x03PXX\xaa\x02\x07Process\xca\x02\x07Process\xe2\x02\x13Process\\GPBMetadata\xea\x02\x07Processb\x06proto3'
-)
+DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x15process/process.proto\x12\x07process\"\\\n\x03PTY\x12%\n\x04size\x18\x01 \x01(\x0b\x32\x11.process.PTY.SizeR\x04size\x1a.\n\x04Size\x12\x12\n\x04\x63ols\x18\x01 \x01(\rR\x04\x63ols\x12\x12\n\x04rows\x18\x02 \x01(\rR\x04rows\"\xc3\x01\n\rProcessConfig\x12\x10\n\x03\x63md\x18\x01 \x01(\tR\x03\x63md\x12\x12\n\x04\x61rgs\x18\x02 \x03(\tR\x04\x61rgs\x12\x34\n\x04\x65nvs\x18\x03 \x03(\x0b\x32 .process.ProcessConfig.EnvsEntryR\x04\x65nvs\x12\x15\n\x03\x63wd\x18\x04 \x01(\tH\x00R\x03\x63wd\x88\x01\x01\x1a\x37\n\tEnvsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\x42\x06\n\x04_cwd\"\r\n\x0bListRequest\"n\n\x0bProcessInfo\x12.\n\x06\x63onfig\x18\x01 \x01(\x0b\x32\x16.process.ProcessConfigR\x06\x63onfig\x12\x10\n\x03pid\x18\x02 \x01(\rR\x03pid\x12\x15\n\x03tag\x18\x03 \x01(\tH\x00R\x03tag\x88\x01\x01\x42\x06\n\x04_tag\"B\n\x0cListResponse\x12\x32\n\tprocesses\x18\x01 \x03(\x0b\x32\x14.process.ProcessInfoR\tprocesses\"\x8c\x01\n\x0cStartRequest\x12\x30\n\x07process\x18\x01 \x01(\x0b\x32\x16.process.ProcessConfigR\x07process\x12#\n\x03pty\x18\x02 \x01(\x0b\x32\x0c.process.PTYH\x00R\x03pty\x88\x01\x01\x12\x15\n\x03tag\x18\x03 \x01(\tH\x01R\x03tag\x88\x01\x01\x42\x06\n\x04_ptyB\x06\n\x04_tag\"p\n\rUpdateRequest\x12\x32\n\x07process\x18\x01 \x01(\x0b\x32\x18.process.ProcessSelectorR\x07process\x12#\n\x03pty\x18\x02 \x01(\x0b\x32\x0c.process.PTYH\x00R\x03pty\x88\x01\x01\x42\x06\n\x04_pty\"\x10\n\x0eUpdateResponse\"\x87\x04\n\x0cProcessEvent\x12\x38\n\x05start\x18\x01 \x01(\x0b\x32 .process.ProcessEvent.StartEventH\x00R\x05start\x12\x35\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\x1f.process.ProcessEvent.DataEventH\x00R\x04\x64\x61ta\x12\x32\n\x03\x65nd\x18\x03 \x01(\x0b\x32\x1e.process.ProcessEvent.EndEventH\x00R\x03\x65nd\x12?\n\tkeepalive\x18\x04 \x01(\x0b\x32\x1f.process.ProcessEvent.KeepAliveH\x00R\tkeepalive\x1a\x1e\n\nStartEvent\x12\x10\n\x03pid\x18\x01 \x01(\rR\x03pid\x1a]\n\tDataEvent\x12\x18\n\x06stdout\x18\x01 \x01(\x0cH\x00R\x06stdout\x12\x18\n\x06stderr\x18\x02 \x01(\x0cH\x00R\x06stderr\x12\x12\n\x03pty\x18\x03 \x01(\x0cH\x00R\x03ptyB\x08\n\x06output\x1a|\n\x08\x45ndEvent\x12\x1b\n\texit_code\x18\x01 \x01(\x11R\x08\x65xitCode\x12\x16\n\x06\x65xited\x18\x02 \x01(\x08R\x06\x65xited\x12\x16\n\x06status\x18\x03 \x01(\tR\x06status\x12\x19\n\x05\x65rror\x18\x04 \x01(\tH\x00R\x05\x65rror\x88\x01\x01\x42\x08\n\x06_error\x1a\x0b\n\tKeepAliveB\x07\n\x05\x65vent\"<\n\rStartResponse\x12+\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x15.process.ProcessEventR\x05\x65vent\">\n\x0f\x43onnectResponse\x12+\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x15.process.ProcessEventR\x05\x65vent\"s\n\x10SendInputRequest\x12\x32\n\x07process\x18\x01 \x01(\x0b\x32\x18.process.ProcessSelectorR\x07process\x12+\n\x05input\x18\x02 \x01(\x0b\x32\x15.process.ProcessInputR\x05input\"\x13\n\x11SendInputResponse\"C\n\x0cProcessInput\x12\x16\n\x05stdin\x18\x01 \x01(\x0cH\x00R\x05stdin\x12\x12\n\x03pty\x18\x02 \x01(\x0cH\x00R\x03ptyB\x07\n\x05input\"\xea\x02\n\x12StreamInputRequest\x12>\n\x05start\x18\x01 \x01(\x0b\x32&.process.StreamInputRequest.StartEventH\x00R\x05start\x12;\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32%.process.StreamInputRequest.DataEventH\x00R\x04\x64\x61ta\x12\x45\n\tkeepalive\x18\x03 \x01(\x0b\x32%.process.StreamInputRequest.KeepAliveH\x00R\tkeepalive\x1a@\n\nStartEvent\x12\x32\n\x07process\x18\x01 \x01(\x0b\x32\x18.process.ProcessSelectorR\x07process\x1a\x38\n\tDataEvent\x12+\n\x05input\x18\x02 \x01(\x0b\x32\x15.process.ProcessInputR\x05input\x1a\x0b\n\tKeepAliveB\x07\n\x05\x65vent\"\x15\n\x13StreamInputResponse\"p\n\x11SendSignalRequest\x12\x32\n\x07process\x18\x01 \x01(\x0b\x32\x18.process.ProcessSelectorR\x07process\x12\'\n\x06signal\x18\x02 \x01(\x0e\x32\x0f.process.SignalR\x06signal\"\x14\n\x12SendSignalResponse\"D\n\x0e\x43onnectRequest\x12\x32\n\x07process\x18\x01 \x01(\x0b\x32\x18.process.ProcessSelectorR\x07process\"E\n\x0fProcessSelector\x12\x12\n\x03pid\x18\x01 \x01(\rH\x00R\x03pid\x12\x12\n\x03tag\x18\x02 \x01(\tH\x00R\x03tagB\n\n\x08selector*H\n\x06Signal\x12\x16\n\x12SIGNAL_UNSPECIFIED\x10\x00\x12\x12\n\x0eSIGNAL_SIGTERM\x10\x0f\x12\x12\n\x0eSIGNAL_SIGKILL\x10\t2\xca\x03\n\x07Process\x12\x33\n\x04List\x12\x14.process.ListRequest\x1a\x15.process.ListResponse\x12>\n\x07\x43onnect\x12\x17.process.ConnectRequest\x1a\x18.process.ConnectResponse0\x01\x12\x38\n\x05Start\x12\x15.process.StartRequest\x1a\x16.process.StartResponse0\x01\x12\x39\n\x06Update\x12\x16.process.UpdateRequest\x1a\x17.process.UpdateResponse\x12J\n\x0bStreamInput\x12\x1b.process.StreamInputRequest\x1a\x1c.process.StreamInputResponse(\x01\x12\x42\n\tSendInput\x12\x19.process.SendInputRequest\x1a\x1a.process.SendInputResponse\x12\x45\n\nSendSignal\x12\x1a.process.SendSignalRequest\x1a\x1b.process.SendSignalResponseBW\n\x0b\x63om.processB\x0cProcessProtoP\x01\xa2\x02\x03PXX\xaa\x02\x07Process\xca\x02\x07Process\xe2\x02\x13Process\\GPBMetadata\xea\x02\x07Processb\x06proto3')
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
-_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, "process.process_pb2", _globals)
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'process.process_pb2', _globals)
if not _descriptor._USE_C_DESCRIPTORS:
- _globals["DESCRIPTOR"]._loaded_options = None
- _globals[
- "DESCRIPTOR"
- ]._serialized_options = b"\n\013com.processB\014ProcessProtoP\001\242\002\003PXX\252\002\007Process\312\002\007Process\342\002\023Process\\GPBMetadata\352\002\007Process"
- _globals["_PROCESSCONFIG_ENVSENTRY"]._loaded_options = None
- _globals["_PROCESSCONFIG_ENVSENTRY"]._serialized_options = b"8\001"
- _globals["_SIGNAL"]._serialized_start = 2386
- _globals["_SIGNAL"]._serialized_end = 2458
- _globals["_PTY"]._serialized_start = 65
- _globals["_PTY"]._serialized_end = 157
- _globals["_PTY_SIZE"]._serialized_start = 111
- _globals["_PTY_SIZE"]._serialized_end = 157
- _globals["_PROCESSCONFIG"]._serialized_start = 160
- _globals["_PROCESSCONFIG"]._serialized_end = 355
- _globals["_PROCESSCONFIG_ENVSENTRY"]._serialized_start = 292
- _globals["_PROCESSCONFIG_ENVSENTRY"]._serialized_end = 347
- _globals["_LISTREQUEST"]._serialized_start = 357
- _globals["_LISTREQUEST"]._serialized_end = 370
- _globals["_PROCESSINFO"]._serialized_start = 372
- _globals["_PROCESSINFO"]._serialized_end = 482
- _globals["_LISTRESPONSE"]._serialized_start = 484
- _globals["_LISTRESPONSE"]._serialized_end = 550
- _globals["_STARTREQUEST"]._serialized_start = 553
- _globals["_STARTREQUEST"]._serialized_end = 732
- _globals["_UPDATEREQUEST"]._serialized_start = 734
- _globals["_UPDATEREQUEST"]._serialized_end = 846
- _globals["_UPDATERESPONSE"]._serialized_start = 848
- _globals["_UPDATERESPONSE"]._serialized_end = 864
- _globals["_PROCESSEVENT"]._serialized_start = 867
- _globals["_PROCESSEVENT"]._serialized_end = 1386
- _globals["_PROCESSEVENT_STARTEVENT"]._serialized_start = 1113
- _globals["_PROCESSEVENT_STARTEVENT"]._serialized_end = 1143
- _globals["_PROCESSEVENT_DATAEVENT"]._serialized_start = 1145
- _globals["_PROCESSEVENT_DATAEVENT"]._serialized_end = 1238
- _globals["_PROCESSEVENT_ENDEVENT"]._serialized_start = 1240
- _globals["_PROCESSEVENT_ENDEVENT"]._serialized_end = 1364
- _globals["_PROCESSEVENT_KEEPALIVE"]._serialized_start = 1366
- _globals["_PROCESSEVENT_KEEPALIVE"]._serialized_end = 1377
- _globals["_STARTRESPONSE"]._serialized_start = 1388
- _globals["_STARTRESPONSE"]._serialized_end = 1448
- _globals["_CONNECTRESPONSE"]._serialized_start = 1450
- _globals["_CONNECTRESPONSE"]._serialized_end = 1512
- _globals["_SENDINPUTREQUEST"]._serialized_start = 1514
- _globals["_SENDINPUTREQUEST"]._serialized_end = 1629
- _globals["_SENDINPUTRESPONSE"]._serialized_start = 1631
- _globals["_SENDINPUTRESPONSE"]._serialized_end = 1650
- _globals["_PROCESSINPUT"]._serialized_start = 1652
- _globals["_PROCESSINPUT"]._serialized_end = 1719
- _globals["_STREAMINPUTREQUEST"]._serialized_start = 1722
- _globals["_STREAMINPUTREQUEST"]._serialized_end = 2084
- _globals["_STREAMINPUTREQUEST_STARTEVENT"]._serialized_start = 1940
- _globals["_STREAMINPUTREQUEST_STARTEVENT"]._serialized_end = 2004
- _globals["_STREAMINPUTREQUEST_DATAEVENT"]._serialized_start = 2006
- _globals["_STREAMINPUTREQUEST_DATAEVENT"]._serialized_end = 2062
- _globals["_STREAMINPUTREQUEST_KEEPALIVE"]._serialized_start = 1366
- _globals["_STREAMINPUTREQUEST_KEEPALIVE"]._serialized_end = 1377
- _globals["_STREAMINPUTRESPONSE"]._serialized_start = 2086
- _globals["_STREAMINPUTRESPONSE"]._serialized_end = 2107
- _globals["_SENDSIGNALREQUEST"]._serialized_start = 2109
- _globals["_SENDSIGNALREQUEST"]._serialized_end = 2221
- _globals["_SENDSIGNALRESPONSE"]._serialized_start = 2223
- _globals["_SENDSIGNALRESPONSE"]._serialized_end = 2243
- _globals["_CONNECTREQUEST"]._serialized_start = 2245
- _globals["_CONNECTREQUEST"]._serialized_end = 2313
- _globals["_PROCESSSELECTOR"]._serialized_start = 2315
- _globals["_PROCESSSELECTOR"]._serialized_end = 2384
- _globals["_PROCESS"]._serialized_start = 2461
- _globals["_PROCESS"]._serialized_end = 2919
+ _globals['DESCRIPTOR']._loaded_options = None
+ _globals['DESCRIPTOR']._serialized_options = b'\n\013com.processB\014ProcessProtoP\001\242\002\003PXX\252\002\007Process\312\002\007Process\342\002\023Process\\GPBMetadata\352\002\007Process'
+ _globals['_PROCESSCONFIG_ENVSENTRY']._loaded_options = None
+ _globals['_PROCESSCONFIG_ENVSENTRY']._serialized_options = b'8\001'
+ _globals['_SIGNAL']._serialized_start=2316
+ _globals['_SIGNAL']._serialized_end=2388
+ _globals['_PTY']._serialized_start=34
+ _globals['_PTY']._serialized_end=126
+ _globals['_PTY_SIZE']._serialized_start=80
+ _globals['_PTY_SIZE']._serialized_end=126
+ _globals['_PROCESSCONFIG']._serialized_start=129
+ _globals['_PROCESSCONFIG']._serialized_end=324
+ _globals['_PROCESSCONFIG_ENVSENTRY']._serialized_start=261
+ _globals['_PROCESSCONFIG_ENVSENTRY']._serialized_end=316
+ _globals['_LISTREQUEST']._serialized_start=326
+ _globals['_LISTREQUEST']._serialized_end=339
+ _globals['_PROCESSINFO']._serialized_start=341
+ _globals['_PROCESSINFO']._serialized_end=451
+ _globals['_LISTRESPONSE']._serialized_start=453
+ _globals['_LISTRESPONSE']._serialized_end=519
+ _globals['_STARTREQUEST']._serialized_start=522
+ _globals['_STARTREQUEST']._serialized_end=662
+ _globals['_UPDATEREQUEST']._serialized_start=664
+ _globals['_UPDATEREQUEST']._serialized_end=776
+ _globals['_UPDATERESPONSE']._serialized_start=778
+ _globals['_UPDATERESPONSE']._serialized_end=794
+ _globals['_PROCESSEVENT']._serialized_start=797
+ _globals['_PROCESSEVENT']._serialized_end=1316
+ _globals['_PROCESSEVENT_STARTEVENT']._serialized_start=1043
+ _globals['_PROCESSEVENT_STARTEVENT']._serialized_end=1073
+ _globals['_PROCESSEVENT_DATAEVENT']._serialized_start=1075
+ _globals['_PROCESSEVENT_DATAEVENT']._serialized_end=1168
+ _globals['_PROCESSEVENT_ENDEVENT']._serialized_start=1170
+ _globals['_PROCESSEVENT_ENDEVENT']._serialized_end=1294
+ _globals['_PROCESSEVENT_KEEPALIVE']._serialized_start=1296
+ _globals['_PROCESSEVENT_KEEPALIVE']._serialized_end=1307
+ _globals['_STARTRESPONSE']._serialized_start=1318
+ _globals['_STARTRESPONSE']._serialized_end=1378
+ _globals['_CONNECTRESPONSE']._serialized_start=1380
+ _globals['_CONNECTRESPONSE']._serialized_end=1442
+ _globals['_SENDINPUTREQUEST']._serialized_start=1444
+ _globals['_SENDINPUTREQUEST']._serialized_end=1559
+ _globals['_SENDINPUTRESPONSE']._serialized_start=1561
+ _globals['_SENDINPUTRESPONSE']._serialized_end=1580
+ _globals['_PROCESSINPUT']._serialized_start=1582
+ _globals['_PROCESSINPUT']._serialized_end=1649
+ _globals['_STREAMINPUTREQUEST']._serialized_start=1652
+ _globals['_STREAMINPUTREQUEST']._serialized_end=2014
+ _globals['_STREAMINPUTREQUEST_STARTEVENT']._serialized_start=1870
+ _globals['_STREAMINPUTREQUEST_STARTEVENT']._serialized_end=1934
+ _globals['_STREAMINPUTREQUEST_DATAEVENT']._serialized_start=1936
+ _globals['_STREAMINPUTREQUEST_DATAEVENT']._serialized_end=1992
+ _globals['_STREAMINPUTREQUEST_KEEPALIVE']._serialized_start=1296
+ _globals['_STREAMINPUTREQUEST_KEEPALIVE']._serialized_end=1307
+ _globals['_STREAMINPUTRESPONSE']._serialized_start=2016
+ _globals['_STREAMINPUTRESPONSE']._serialized_end=2037
+ _globals['_SENDSIGNALREQUEST']._serialized_start=2039
+ _globals['_SENDSIGNALREQUEST']._serialized_end=2151
+ _globals['_SENDSIGNALRESPONSE']._serialized_start=2153
+ _globals['_SENDSIGNALRESPONSE']._serialized_end=2173
+ _globals['_CONNECTREQUEST']._serialized_start=2175
+ _globals['_CONNECTREQUEST']._serialized_end=2243
+ _globals['_PROCESSSELECTOR']._serialized_start=2245
+ _globals['_PROCESSSELECTOR']._serialized_end=2314
+ _globals['_PROCESS']._serialized_start=2391
+ _globals['_PROCESS']._serialized_end=2849
# @@protoc_insertion_point(module_scope)
diff --git a/packages/python-sdk/e2b/envd/process/process_pb2.pyi b/packages/python-sdk/e2b/envd/process/process_pb2.pyi
index e419f7f55..5934e5b49 100644
--- a/packages/python-sdk/e2b/envd/process/process_pb2.pyi
+++ b/packages/python-sdk/e2b/envd/process/process_pb2.pyi
@@ -1,15 +1,8 @@
-from e2b.envd.permissions import permissions_pb2 as _permissions_pb2
from google.protobuf.internal import containers as _containers
from google.protobuf.internal import enum_type_wrapper as _enum_type_wrapper
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
-from typing import (
- ClassVar as _ClassVar,
- Iterable as _Iterable,
- Mapping as _Mapping,
- Optional as _Optional,
- Union as _Union,
-)
+from typing import ClassVar as _ClassVar, Iterable as _Iterable, Mapping as _Mapping, Optional as _Optional, Union as _Union
DESCRIPTOR: _descriptor.FileDescriptor
@@ -18,39 +11,32 @@ class Signal(int, metaclass=_enum_type_wrapper.EnumTypeWrapper):
SIGNAL_UNSPECIFIED: _ClassVar[Signal]
SIGNAL_SIGTERM: _ClassVar[Signal]
SIGNAL_SIGKILL: _ClassVar[Signal]
-
SIGNAL_UNSPECIFIED: Signal
SIGNAL_SIGTERM: Signal
SIGNAL_SIGKILL: Signal
class PTY(_message.Message):
__slots__ = ("size",)
-
class Size(_message.Message):
__slots__ = ("cols", "rows")
COLS_FIELD_NUMBER: _ClassVar[int]
ROWS_FIELD_NUMBER: _ClassVar[int]
cols: int
rows: int
- def __init__(
- self, cols: _Optional[int] = ..., rows: _Optional[int] = ...
- ) -> None: ...
+ def __init__(self, cols: _Optional[int] = ..., rows: _Optional[int] = ...) -> None: ...
SIZE_FIELD_NUMBER: _ClassVar[int]
size: PTY.Size
def __init__(self, size: _Optional[_Union[PTY.Size, _Mapping]] = ...) -> None: ...
class ProcessConfig(_message.Message):
__slots__ = ("cmd", "args", "envs", "cwd")
-
class EnvsEntry(_message.Message):
__slots__ = ("key", "value")
KEY_FIELD_NUMBER: _ClassVar[int]
VALUE_FIELD_NUMBER: _ClassVar[int]
key: str
value: str
- def __init__(
- self, key: _Optional[str] = ..., value: _Optional[str] = ...
- ) -> None: ...
+ def __init__(self, key: _Optional[str] = ..., value: _Optional[str] = ...) -> None: ...
CMD_FIELD_NUMBER: _ClassVar[int]
ARGS_FIELD_NUMBER: _ClassVar[int]
ENVS_FIELD_NUMBER: _ClassVar[int]
@@ -59,13 +45,7 @@ class ProcessConfig(_message.Message):
args: _containers.RepeatedScalarFieldContainer[str]
envs: _containers.ScalarMap[str, str]
cwd: str
- def __init__(
- self,
- cmd: _Optional[str] = ...,
- args: _Optional[_Iterable[str]] = ...,
- envs: _Optional[_Mapping[str, str]] = ...,
- cwd: _Optional[str] = ...,
- ) -> None: ...
+ def __init__(self, cmd: _Optional[str] = ..., args: _Optional[_Iterable[str]] = ..., envs: _Optional[_Mapping[str, str]] = ..., cwd: _Optional[str] = ...) -> None: ...
class ListRequest(_message.Message):
__slots__ = ()
@@ -79,38 +59,23 @@ class ProcessInfo(_message.Message):
config: ProcessConfig
pid: int
tag: str
- def __init__(
- self,
- config: _Optional[_Union[ProcessConfig, _Mapping]] = ...,
- pid: _Optional[int] = ...,
- tag: _Optional[str] = ...,
- ) -> None: ...
+ def __init__(self, config: _Optional[_Union[ProcessConfig, _Mapping]] = ..., pid: _Optional[int] = ..., tag: _Optional[str] = ...) -> None: ...
class ListResponse(_message.Message):
__slots__ = ("processes",)
PROCESSES_FIELD_NUMBER: _ClassVar[int]
processes: _containers.RepeatedCompositeFieldContainer[ProcessInfo]
- def __init__(
- self, processes: _Optional[_Iterable[_Union[ProcessInfo, _Mapping]]] = ...
- ) -> None: ...
+ def __init__(self, processes: _Optional[_Iterable[_Union[ProcessInfo, _Mapping]]] = ...) -> None: ...
class StartRequest(_message.Message):
- __slots__ = ("process", "pty", "tag", "user")
+ __slots__ = ("process", "pty", "tag")
PROCESS_FIELD_NUMBER: _ClassVar[int]
PTY_FIELD_NUMBER: _ClassVar[int]
TAG_FIELD_NUMBER: _ClassVar[int]
- USER_FIELD_NUMBER: _ClassVar[int]
process: ProcessConfig
pty: PTY
tag: str
- user: _permissions_pb2.User
- def __init__(
- self,
- process: _Optional[_Union[ProcessConfig, _Mapping]] = ...,
- pty: _Optional[_Union[PTY, _Mapping]] = ...,
- tag: _Optional[str] = ...,
- user: _Optional[_Union[_permissions_pb2.User, _Mapping]] = ...,
- ) -> None: ...
+ def __init__(self, process: _Optional[_Union[ProcessConfig, _Mapping]] = ..., pty: _Optional[_Union[PTY, _Mapping]] = ..., tag: _Optional[str] = ...) -> None: ...
class UpdateRequest(_message.Message):
__slots__ = ("process", "pty")
@@ -118,11 +83,7 @@ class UpdateRequest(_message.Message):
PTY_FIELD_NUMBER: _ClassVar[int]
process: ProcessSelector
pty: PTY
- def __init__(
- self,
- process: _Optional[_Union[ProcessSelector, _Mapping]] = ...,
- pty: _Optional[_Union[PTY, _Mapping]] = ...,
- ) -> None: ...
+ def __init__(self, process: _Optional[_Union[ProcessSelector, _Mapping]] = ..., pty: _Optional[_Union[PTY, _Mapping]] = ...) -> None: ...
class UpdateResponse(_message.Message):
__slots__ = ()
@@ -130,13 +91,11 @@ class UpdateResponse(_message.Message):
class ProcessEvent(_message.Message):
__slots__ = ("start", "data", "end", "keepalive")
-
class StartEvent(_message.Message):
__slots__ = ("pid",)
PID_FIELD_NUMBER: _ClassVar[int]
pid: int
def __init__(self, pid: _Optional[int] = ...) -> None: ...
-
class DataEvent(_message.Message):
__slots__ = ("stdout", "stderr", "pty")
STDOUT_FIELD_NUMBER: _ClassVar[int]
@@ -145,13 +104,7 @@ class ProcessEvent(_message.Message):
stdout: bytes
stderr: bytes
pty: bytes
- def __init__(
- self,
- stdout: _Optional[bytes] = ...,
- stderr: _Optional[bytes] = ...,
- pty: _Optional[bytes] = ...,
- ) -> None: ...
-
+ def __init__(self, stdout: _Optional[bytes] = ..., stderr: _Optional[bytes] = ..., pty: _Optional[bytes] = ...) -> None: ...
class EndEvent(_message.Message):
__slots__ = ("exit_code", "exited", "status", "error")
EXIT_CODE_FIELD_NUMBER: _ClassVar[int]
@@ -162,14 +115,7 @@ class ProcessEvent(_message.Message):
exited: bool
status: str
error: str
- def __init__(
- self,
- exit_code: _Optional[int] = ...,
- exited: bool = ...,
- status: _Optional[str] = ...,
- error: _Optional[str] = ...,
- ) -> None: ...
-
+ def __init__(self, exit_code: _Optional[int] = ..., exited: bool = ..., status: _Optional[str] = ..., error: _Optional[str] = ...) -> None: ...
class KeepAlive(_message.Message):
__slots__ = ()
def __init__(self) -> None: ...
@@ -181,29 +127,19 @@ class ProcessEvent(_message.Message):
data: ProcessEvent.DataEvent
end: ProcessEvent.EndEvent
keepalive: ProcessEvent.KeepAlive
- def __init__(
- self,
- start: _Optional[_Union[ProcessEvent.StartEvent, _Mapping]] = ...,
- data: _Optional[_Union[ProcessEvent.DataEvent, _Mapping]] = ...,
- end: _Optional[_Union[ProcessEvent.EndEvent, _Mapping]] = ...,
- keepalive: _Optional[_Union[ProcessEvent.KeepAlive, _Mapping]] = ...,
- ) -> None: ...
+ def __init__(self, start: _Optional[_Union[ProcessEvent.StartEvent, _Mapping]] = ..., data: _Optional[_Union[ProcessEvent.DataEvent, _Mapping]] = ..., end: _Optional[_Union[ProcessEvent.EndEvent, _Mapping]] = ..., keepalive: _Optional[_Union[ProcessEvent.KeepAlive, _Mapping]] = ...) -> None: ...
class StartResponse(_message.Message):
__slots__ = ("event",)
EVENT_FIELD_NUMBER: _ClassVar[int]
event: ProcessEvent
- def __init__(
- self, event: _Optional[_Union[ProcessEvent, _Mapping]] = ...
- ) -> None: ...
+ def __init__(self, event: _Optional[_Union[ProcessEvent, _Mapping]] = ...) -> None: ...
class ConnectResponse(_message.Message):
__slots__ = ("event",)
EVENT_FIELD_NUMBER: _ClassVar[int]
event: ProcessEvent
- def __init__(
- self, event: _Optional[_Union[ProcessEvent, _Mapping]] = ...
- ) -> None: ...
+ def __init__(self, event: _Optional[_Union[ProcessEvent, _Mapping]] = ...) -> None: ...
class SendInputRequest(_message.Message):
__slots__ = ("process", "input")
@@ -211,11 +147,7 @@ class SendInputRequest(_message.Message):
INPUT_FIELD_NUMBER: _ClassVar[int]
process: ProcessSelector
input: ProcessInput
- def __init__(
- self,
- process: _Optional[_Union[ProcessSelector, _Mapping]] = ...,
- input: _Optional[_Union[ProcessInput, _Mapping]] = ...,
- ) -> None: ...
+ def __init__(self, process: _Optional[_Union[ProcessSelector, _Mapping]] = ..., input: _Optional[_Union[ProcessInput, _Mapping]] = ...) -> None: ...
class SendInputResponse(_message.Message):
__slots__ = ()
@@ -227,29 +159,20 @@ class ProcessInput(_message.Message):
PTY_FIELD_NUMBER: _ClassVar[int]
stdin: bytes
pty: bytes
- def __init__(
- self, stdin: _Optional[bytes] = ..., pty: _Optional[bytes] = ...
- ) -> None: ...
+ def __init__(self, stdin: _Optional[bytes] = ..., pty: _Optional[bytes] = ...) -> None: ...
class StreamInputRequest(_message.Message):
__slots__ = ("start", "data", "keepalive")
-
class StartEvent(_message.Message):
__slots__ = ("process",)
PROCESS_FIELD_NUMBER: _ClassVar[int]
process: ProcessSelector
- def __init__(
- self, process: _Optional[_Union[ProcessSelector, _Mapping]] = ...
- ) -> None: ...
-
+ def __init__(self, process: _Optional[_Union[ProcessSelector, _Mapping]] = ...) -> None: ...
class DataEvent(_message.Message):
__slots__ = ("input",)
INPUT_FIELD_NUMBER: _ClassVar[int]
input: ProcessInput
- def __init__(
- self, input: _Optional[_Union[ProcessInput, _Mapping]] = ...
- ) -> None: ...
-
+ def __init__(self, input: _Optional[_Union[ProcessInput, _Mapping]] = ...) -> None: ...
class KeepAlive(_message.Message):
__slots__ = ()
def __init__(self) -> None: ...
@@ -259,12 +182,7 @@ class StreamInputRequest(_message.Message):
start: StreamInputRequest.StartEvent
data: StreamInputRequest.DataEvent
keepalive: StreamInputRequest.KeepAlive
- def __init__(
- self,
- start: _Optional[_Union[StreamInputRequest.StartEvent, _Mapping]] = ...,
- data: _Optional[_Union[StreamInputRequest.DataEvent, _Mapping]] = ...,
- keepalive: _Optional[_Union[StreamInputRequest.KeepAlive, _Mapping]] = ...,
- ) -> None: ...
+ def __init__(self, start: _Optional[_Union[StreamInputRequest.StartEvent, _Mapping]] = ..., data: _Optional[_Union[StreamInputRequest.DataEvent, _Mapping]] = ..., keepalive: _Optional[_Union[StreamInputRequest.KeepAlive, _Mapping]] = ...) -> None: ...
class StreamInputResponse(_message.Message):
__slots__ = ()
@@ -276,11 +194,7 @@ class SendSignalRequest(_message.Message):
SIGNAL_FIELD_NUMBER: _ClassVar[int]
process: ProcessSelector
signal: Signal
- def __init__(
- self,
- process: _Optional[_Union[ProcessSelector, _Mapping]] = ...,
- signal: _Optional[_Union[Signal, str]] = ...,
- ) -> None: ...
+ def __init__(self, process: _Optional[_Union[ProcessSelector, _Mapping]] = ..., signal: _Optional[_Union[Signal, str]] = ...) -> None: ...
class SendSignalResponse(_message.Message):
__slots__ = ()
@@ -290,9 +204,7 @@ class ConnectRequest(_message.Message):
__slots__ = ("process",)
PROCESS_FIELD_NUMBER: _ClassVar[int]
process: ProcessSelector
- def __init__(
- self, process: _Optional[_Union[ProcessSelector, _Mapping]] = ...
- ) -> None: ...
+ def __init__(self, process: _Optional[_Union[ProcessSelector, _Mapping]] = ...) -> None: ...
class ProcessSelector(_message.Message):
__slots__ = ("pid", "tag")
@@ -300,6 +212,4 @@ class ProcessSelector(_message.Message):
TAG_FIELD_NUMBER: _ClassVar[int]
pid: int
tag: str
- def __init__(
- self, pid: _Optional[int] = ..., tag: _Optional[str] = ...
- ) -> None: ...
+ def __init__(self, pid: _Optional[int] = ..., tag: _Optional[str] = ...) -> None: ...
diff --git a/packages/python-sdk/e2b/envd/rpc.py b/packages/python-sdk/e2b/envd/rpc.py
index 05fa2d2a2..21d4a13a8 100644
--- a/packages/python-sdk/e2b/envd/rpc.py
+++ b/packages/python-sdk/e2b/envd/rpc.py
@@ -1,3 +1,6 @@
+import base64
+
+from typing import Optional
from connect.client import Code, ConnectException
from e2b.exceptions import (
@@ -7,6 +10,7 @@ from e2b.exceptions import (
TimeoutException,
format_sandbox_timeout_exception,
)
+from e2b.connection_config import Username, default_username
def handle_rpc_exception(e: Exception):
@@ -29,3 +33,11 @@ def handle_rpc_exception(e: Exception):
return SandboxException(f"{e.status}: {e.message}")
else:
return e
+
+
+def authentication_header(user: Optional[Username] = None):
+ value = f"{user if user is not None else default_username}:"
+
+ encoded = base64.b64encode(value.encode("utf-8")).decode("utf-8")
+
+ return {"Authorization": f"Basic {encoded}"}
diff --git a/packages/python-sdk/e2b/sandbox/filesystem/filesystem.py b/packages/python-sdk/e2b/sandbox/filesystem/filesystem.py
index 4f50a8b32..ec9a078ac 100644
--- a/packages/python-sdk/e2b/sandbox/filesystem/filesystem.py
+++ b/packages/python-sdk/e2b/sandbox/filesystem/filesystem.py
@@ -23,9 +23,8 @@ from e2b.exceptions import (
SandboxException,
)
from e2b.envd.api import handle_envd_api_exception
-from e2b.envd.rpc import handle_rpc_exception
+from e2b.envd.rpc import authentication_header, handle_rpc_exception
from e2b.envd.filesystem import filesystem_connect, filesystem_pb2
-from e2b.envd.permissions.permissions_pb2 import User
from e2b.envd.api import ENVD_API_FILES_ROUTE
@@ -145,11 +144,11 @@ class Filesystem:
res = self._rpc.list_dir(
filesystem_pb2.ListDirRequest(
path=path,
- user=User(username=user),
),
request_timeout=self._connection_config.get_request_timeout(
request_timeout
),
+ headers=authentication_header(user),
)
entries: List[EntryInfo] = []
@@ -173,11 +172,11 @@ class Filesystem:
self._rpc.stat(
filesystem_pb2.StatRequest(
path=path,
- user=User(username=user),
),
request_timeout=self._connection_config.get_request_timeout(
request_timeout
),
+ headers=authentication_header(user),
)
return True
@@ -197,11 +196,11 @@ class Filesystem:
self._rpc.remove(
filesystem_pb2.RemoveRequest(
path=path,
- user=User(username=user),
),
request_timeout=self._connection_config.get_request_timeout(
request_timeout
),
+ headers=authentication_header(user),
)
except Exception as e:
raise handle_rpc_exception(e)
@@ -218,11 +217,11 @@ class Filesystem:
filesystem_pb2.MoveRequest(
source=old_path,
destination=new_path,
- user=User(username=user),
),
request_timeout=self._connection_config.get_request_timeout(
request_timeout
),
+ headers=authentication_header(user),
)
except Exception as e:
raise handle_rpc_exception(e)
@@ -237,11 +236,11 @@ class Filesystem:
self._rpc.make_dir(
filesystem_pb2.MakeDirRequest(
path=path,
- user=User(username=user),
),
request_timeout=self._connection_config.get_request_timeout(
request_timeout
),
+ headers=authentication_header(user),
)
return True
@@ -261,12 +260,12 @@ class Filesystem:
events = self._rpc.watch_dir(
filesystem_pb2.WatchDirRequest(
path=path,
- user=User(username=user),
),
request_timeout=self._connection_config.get_request_timeout(
request_timeout
),
timeout=timeout,
+ headers=authentication_header(user),
)
try:
diff --git a/packages/python-sdk/e2b/sandbox/process/main.py b/packages/python-sdk/e2b/sandbox/process/main.py
index c9a490d85..0e8ef9b6a 100644
--- a/packages/python-sdk/e2b/sandbox/process/main.py
+++ b/packages/python-sdk/e2b/sandbox/process/main.py
@@ -4,7 +4,6 @@ import httpcore
from typing import Dict, List, Optional, Literal, overload, Union, Callable
-from e2b.envd.permissions import permissions_pb2
from e2b.envd.process import process_connect, process_pb2
from e2b.sandbox.process.process_handle import ProcessHandle, ProcessResult
from e2b.connection_config import (
@@ -12,7 +11,7 @@ from e2b.connection_config import (
ConnectionConfig,
)
from e2b.exceptions import SandboxException
-from e2b.envd.rpc import handle_rpc_exception
+from e2b.envd.rpc import authentication_header, handle_rpc_exception
@dataclass
@@ -172,7 +171,6 @@ class Process:
):
events = self._rpc.start(
process_pb2.StartRequest(
- user=permissions_pb2.User(username=user),
process=process_pb2.ProcessConfig(
cmd="/bin/bash",
envs=envs,
@@ -180,6 +178,7 @@ class Process:
cwd=cwd,
),
),
+ headers=authentication_header(user),
timeout=timeout,
request_timeout=self._connection_config.get_request_timeout(
request_timeout
diff --git a/packages/python-sdk/scripts/fix-python-pb.sh b/packages/python-sdk/scripts/fix-python-pb.sh
index 3958fa848..33f1a49fe 100755
--- a/packages/python-sdk/scripts/fix-python-pb.sh
+++ b/packages/python-sdk/scripts/fix-python-pb.sh
@@ -1,9 +1,7 @@
#!/bin/bash
-sed -i '.bak' 's/from\ permissions\ import/from e2b.envd.permissions import/g' e2b/envd/permissions/* e2b/envd/process/* e2b/envd/filesystem/*
-sed -i '.bak' 's/from\ process\ import/from e2b.envd.process import/g' e2b/envd/permissions/* e2b/envd/process/* e2b/envd/filesystem/*
-sed -i '.bak' 's/from\ filesystem\ import/from e2b.envd.filesystem import/g' e2b/envd/permissions/* e2b/envd/process/* e2b/envd/filesystem/*
+sed -i '.bak' 's/from\ process\ import/from e2b.envd.process import/g' e2b/envd/process/* e2b/envd/filesystem/*
+sed -i '.bak' 's/from\ filesystem\ import/from e2b.envd.filesystem import/g' e2b/envd/process/* e2b/envd/filesystem/*
-rm e2b/envd/permissions/*.bak
rm e2b/envd/process/*.bak
rm e2b/envd/filesystem/*.bak
diff --git a/spec/envd/filesystem/filesystem.proto b/spec/envd/filesystem/filesystem.proto
index 2c5009b74..9695d8c5d 100644
--- a/spec/envd/filesystem/filesystem.proto
+++ b/spec/envd/filesystem/filesystem.proto
@@ -1,7 +1,5 @@
syntax = "proto3";
-import "permissions/permissions.proto";
-
package filesystem;
service Filesystem {
@@ -16,32 +14,24 @@ service Filesystem {
message MoveRequest {
string source = 1;
string destination = 2;
-
- permissions.User user = 3;
}
message MoveResponse {}
message MakeDirRequest {
string path = 1;
-
- permissions.User user = 2;
}
message MakeDirResponse {}
message RemoveRequest {
string path = 1;
-
- permissions.User user = 2;
}
message RemoveResponse {}
message StatRequest {
string path = 1;
-
- permissions.User user = 2;
}
message StatResponse {
@@ -61,8 +51,6 @@ enum FileType {
message ListDirRequest {
string path = 1;
-
- permissions.User user = 2;
}
message ListDirResponse {
@@ -71,8 +59,6 @@ message ListDirResponse {
message WatchDirRequest {
string path = 1;
-
- permissions.User user = 2;
}
message WatchDirResponse {
diff --git a/spec/envd/permissions/permissions.proto b/spec/envd/permissions/permissions.proto
deleted file mode 100644
index 80cef04f0..000000000
--- a/spec/envd/permissions/permissions.proto
+++ /dev/null
@@ -1,9 +0,0 @@
-syntax = "proto3";
-
-package permissions;
-
-message User {
- oneof selector {
- string username = 1;
- }
-}
diff --git a/spec/envd/process/process.proto b/spec/envd/process/process.proto
index 5e767ce79..031e26734 100644
--- a/spec/envd/process/process.proto
+++ b/spec/envd/process/process.proto
@@ -1,7 +1,5 @@
syntax = "proto3";
-import "permissions/permissions.proto";
-
package process;
service Process {
@@ -37,7 +35,6 @@ message ProcessConfig {
message ListRequest {}
-
message ProcessInfo {
ProcessConfig config = 1;
uint32 pid = 2;
@@ -52,8 +49,6 @@ message StartRequest {
ProcessConfig process = 1;
optional PTY pty = 2;
optional string tag = 3;
-
- permissions.User user = 4;
}
message UpdateRequest {