Skip to content

armgit / E2B

Public Imported from GitHub
0

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

Fix input stream; [WIP] Python SDK

Tomas Valentab04342cbff28
diff --git a/packages/js-sdk/src/connectionConfig.ts b/packages/js-sdk/src/connectionConfig.ts
index 96bab775d..2feadae83 100644
--- a/packages/js-sdk/src/connectionConfig.ts
+++ b/packages/js-sdk/src/connectionConfig.ts
@@ -34,3 +34,5 @@ export class ConnectionConfig {
}
export type Username = 'root' | 'user'
+
+export const defaultUsername: Username = 'user'
diff --git a/packages/js-sdk/src/envd/process/process_pb.ts b/packages/js-sdk/src/envd/process/process_pb.ts
index 01a647bc5..02dc410fd 100644
--- a/packages/js-sdk/src/envd/process/process_pb.ts
+++ b/packages/js-sdk/src/envd/process/process_pb.ts
@@ -199,14 +199,63 @@ export class ListRequest extends Message<ListRequest> {
}
}
+/**
+ * @generated from message envd.process.ProcessInfo
+ */
+export class ProcessInfo extends Message<ProcessInfo> {
+ /**
+ * @generated from field: envd.process.ProcessConfig config = 1;
+ */
+ config?: ProcessConfig;
+
+ /**
+ * @generated from field: uint32 pid = 2;
+ */
+ pid = 0;
+
+ /**
+ * @generated from field: optional string tag = 3;
+ */
+ tag?: string;
+
+ constructor(data?: PartialMessage<ProcessInfo>) {
+ super();
+ proto3.util.initPartial(data, this);
+ }
+
+ static readonly runtime: typeof proto3 = proto3;
+ static readonly typeName = "envd.process.ProcessInfo";
+ static readonly fields: FieldList = proto3.util.newFieldList(() => [
+ { no: 1, name: "config", kind: "message", T: ProcessConfig },
+ { no: 2, name: "pid", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },
+ { no: 3, name: "tag", kind: "scalar", T: 9 /* ScalarType.STRING */, opt: true },
+ ]);
+
+ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ProcessInfo {
+ return new ProcessInfo().fromBinary(bytes, options);
+ }
+
+ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): ProcessInfo {
+ return new ProcessInfo().fromJson(jsonValue, options);
+ }
+
+ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): ProcessInfo {
+ return new ProcessInfo().fromJsonString(jsonString, options);
+ }
+
+ static equals(a: ProcessInfo | PlainMessage<ProcessInfo> | undefined, b: ProcessInfo | PlainMessage<ProcessInfo> | undefined): boolean {
+ return proto3.util.equals(ProcessInfo, a, b);
+ }
+}
+
/**
* @generated from message envd.process.ListResponse
*/
export class ListResponse extends Message<ListResponse> {
/**
- * @generated from field: repeated envd.process.ProcessConfig processes = 1;
+ * @generated from field: repeated envd.process.ProcessInfo processes = 1;
*/
- processes: ProcessConfig[] = [];
+ processes: ProcessInfo[] = [];
constructor(data?: PartialMessage<ListResponse>) {
super();
@@ -216,7 +265,7 @@ export class ListResponse extends Message<ListResponse> {
static readonly runtime: typeof proto3 = proto3;
static readonly typeName = "envd.process.ListResponse";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
- { no: 1, name: "processes", kind: "message", T: ProcessConfig, repeated: true },
+ { no: 1, name: "processes", kind: "message", T: ProcessInfo, repeated: true },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListResponse {
@@ -251,7 +300,12 @@ export class StartRequest extends Message<StartRequest> {
pty?: PTY;
/**
- * @generated from field: envd.permissions.User user = 3;
+ * @generated from field: optional string tag = 3;
+ */
+ tag?: string;
+
+ /**
+ * @generated from field: envd.permissions.User user = 4;
*/
user?: User;
@@ -265,7 +319,8 @@ export class StartRequest extends Message<StartRequest> {
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "process", kind: "message", T: ProcessConfig },
{ no: 2, name: "pty", kind: "message", T: PTY, opt: true },
- { no: 3, name: "user", kind: "message", T: User },
+ { 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 {
@@ -1042,6 +1097,12 @@ export class ProcessSelector extends Message<ProcessSelector> {
*/
value: number;
case: "pid";
+ } | {
+ /**
+ * @generated from field: string tag = 2;
+ */
+ value: string;
+ case: "tag";
} | { case: undefined; value?: undefined } = { case: undefined };
constructor(data?: PartialMessage<ProcessSelector>) {
@@ -1053,6 +1114,7 @@ export class ProcessSelector extends Message<ProcessSelector> {
static readonly typeName = "envd.process.ProcessSelector";
static readonly fields: FieldList = proto3.util.newFieldList(() => [
{ no: 1, name: "pid", kind: "scalar", T: 13 /* ScalarType.UINT32 */, oneof: "selector" },
+ { no: 2, name: "tag", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "selector" },
]);
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ProcessSelector {
diff --git a/packages/js-sdk/src/index.ts b/packages/js-sdk/src/index.ts
index b34334485..f94818af2 100644
--- a/packages/js-sdk/src/index.ts
+++ b/packages/js-sdk/src/index.ts
@@ -21,9 +21,10 @@ export {
export { ProcessHandle } from './sandbox/process/processHandle'
export type { ProcessOutput, ProcessResult } from './sandbox/process/processHandle'
export type {
- ProcessConfig,
+ ProcessInfo,
ProcessBackgroundRunOpts,
ProcessRunOpts,
+ ProcessRequestOpts,
} from './sandbox/process'
export type {
diff --git a/packages/js-sdk/src/sandbox/filesystem/index.ts b/packages/js-sdk/src/sandbox/filesystem/index.ts
index 7d3d33f92..9aec60c1d 100644
--- a/packages/js-sdk/src/sandbox/filesystem/index.ts
+++ b/packages/js-sdk/src/sandbox/filesystem/index.ts
@@ -5,7 +5,7 @@ import {
PromiseClient,
} from '@connectrpc/connect'
-import { ConnectionOpts, Username } from '../../connectionConfig'
+import { ConnectionOpts, defaultUsername, Username } from '../../connectionConfig'
import { EnvdApiClient } from '../../envd/api'
import { FilesystemService } from '../../envd/filesystem/filesystem_connect'
import {
@@ -17,7 +17,7 @@ export type EntryInfo = PlainMessage<FsEntryInfo>
export type FileFormat = 'text' | 'stream' | 'arrayBuffer' | 'blob'
-export interface WriteOpts extends Pick<ConnectionOpts, 'requestTimeoutMs'> {
+export interface FilesystemRequestOpts extends Partial<Pick<ConnectionOpts, 'requestTimeoutMs'>> {
user?: Username
}
@@ -34,17 +34,18 @@ export class Filesystem {
this.rpc = createPromiseClient(FilesystemService, transport)
}
- async read(path: string, format: 'text', opts?: Pick<ConnectionOpts, 'requestTimeoutMs'>): Promise<string>
- async read(path: string, format: 'arrayBuffer', opts?: Pick<ConnectionOpts, 'requestTimeoutMs'>): Promise<ArrayBuffer>
- async read(path: string, format: 'blob', opts?: Pick<ConnectionOpts, 'requestTimeoutMs'>): Promise<Blob>
- async read(path: string, format: 'stream', opts?: Pick<ConnectionOpts, 'requestTimeoutMs'>): Promise<ReadableStream>
- async read(path: string, format: FileFormat = 'text', opts?: Pick<ConnectionOpts, 'requestTimeoutMs'>): Promise<unknown> {
+ async read(path: string, format: 'text', opts?: FilesystemRequestOpts): Promise<string>
+ async read(path: string, format: 'arrayBuffer', opts?: FilesystemRequestOpts): Promise<ArrayBuffer>
+ async read(path: string, format: 'blob', opts?: FilesystemRequestOpts): Promise<Blob>
+ async read(path: string, format: 'stream', opts?: FilesystemRequestOpts): Promise<ReadableStream<Uint8Array>>
+ async read(path: string, format: FileFormat = 'text', opts?: FilesystemRequestOpts): Promise<unknown> {
const requestTimeoutMs = opts?.requestTimeoutMs ?? this.connectionConfig.requestTimeoutMs
const response = await this.envdApi.api.GET('/files/{path}', {
params: {
path: {
path,
+ user: opts?.user ?? defaultUsername,
},
},
parseAs: format,
@@ -54,11 +55,11 @@ export class Filesystem {
return response.data
}
- async write(path: string, data: string, opts?: WriteOpts): Promise<void>
- async write(path: string, data: ArrayBuffer, opts?: WriteOpts): Promise<void>
- async write(path: string, data: Blob, opts?: WriteOpts): Promise<void>
- async write(path: string, data: ReadableStream, opts?: WriteOpts): Promise<void>
- async write(path: string, data: string | ArrayBuffer | Blob | ReadableStream, opts?: WriteOpts): Promise<void> {
+ async write(path: string, data: string, opts?: FilesystemRequestOpts): Promise<void>
+ async write(path: string, data: ArrayBuffer, opts?: FilesystemRequestOpts): Promise<void>
+ async write(path: string, data: Blob, opts?: FilesystemRequestOpts): Promise<void>
+ async write(path: string, data: ReadableStream<Uint8Array>, opts?: FilesystemRequestOpts): Promise<void>
+ async write(path: string, data: string | ArrayBuffer | Blob | ReadableStream<Uint8Array>, opts?: FilesystemRequestOpts): Promise<void> {
const requestTimeoutMs = opts?.requestTimeoutMs ?? this.connectionConfig.requestTimeoutMs
await this.envdApi.api.PUT('/files/{path}', {
@@ -67,7 +68,7 @@ export class Filesystem {
path,
},
query: {
- user: opts?.user ?? 'user',
+ user: opts?.user ?? defaultUsername,
},
},
bodySerializer(body) {
@@ -82,26 +83,44 @@ export class Filesystem {
})
}
- async list(path: string, opts?: Pick<ConnectionOpts, 'requestTimeoutMs'>): Promise<EntryInfo[]> {
+ async list(path: string, opts?: FilesystemRequestOpts): Promise<EntryInfo[]> {
const res = await this.rpc.list({
path,
+ user: {
+ selector: {
+ case: 'username',
+ value: opts?.user || defaultUsername,
+ },
+ },
}, {
timeoutMs: opts?.requestTimeoutMs ?? this.connectionConfig.requestTimeoutMs,
})
return res.entries
}
- async remove(path: string, opts?: Pick<ConnectionOpts, 'requestTimeoutMs'>): Promise<void> {
+ async remove(path: string, opts?: FilesystemRequestOpts): Promise<void> {
await this.rpc.remove({
path,
+ user: {
+ selector: {
+ case: 'username',
+ value: opts?.user || defaultUsername,
+ },
+ },
}, {
timeoutMs: opts?.requestTimeoutMs ?? this.connectionConfig.requestTimeoutMs,
})
}
- async exists(path: string, opts?: Pick<ConnectionOpts, 'requestTimeoutMs'>): Promise<EntryInfo> {
+ async exists(path: string, opts?: FilesystemRequestOpts): Promise<EntryInfo> {
const res = await this.rpc.stat({
- path
+ path,
+ user: {
+ selector: {
+ case: 'username',
+ value: opts?.user || defaultUsername,
+ },
+ },
}, {
timeoutMs: opts?.requestTimeoutMs ?? this.connectionConfig.requestTimeoutMs,
})
@@ -111,12 +130,18 @@ export class Filesystem {
async watch(
path: string,
onEvent: (event: FilesystemEvent) => void | Promise<void>,
- opts?: Pick<ConnectionOpts, 'requestTimeoutMs'>,
+ opts?: FilesystemRequestOpts,
): Promise<WatchHandle> {
const controller = new AbortController()
const events = this.rpc.watch({
path,
+ user: {
+ selector: {
+ case: 'username',
+ value: opts?.user || defaultUsername,
+ },
+ },
}, {
signal: controller.signal,
timeoutMs: opts?.requestTimeoutMs ?? this.connectionConfig.requestTimeoutMs,
diff --git a/packages/js-sdk/src/sandbox/index.ts b/packages/js-sdk/src/sandbox/index.ts
index ef5a98059..f23390c65 100644
--- a/packages/js-sdk/src/sandbox/index.ts
+++ b/packages/js-sdk/src/sandbox/index.ts
@@ -1,6 +1,6 @@
import { createConnectTransport } from '@connectrpc/connect-web'
-import { ConnectionOpts, ConnectionConfig } from '../connectionConfig'
+import { ConnectionOpts, ConnectionConfig, defaultUsername } from '../connectionConfig'
import { Filesystem } from './filesystem'
import { Process } from './process'
import { Pty } from './pty'
@@ -47,7 +47,7 @@ export class Sandbox extends SandboxApi {
get uploadUrl() {
const url = new URL('/files', this.envdApiUrl)
- url.searchParams.set('user', 'user')
+ url.searchParams.set('user', defaultUsername)
return url.toString()
}
@@ -70,17 +70,11 @@ export class Sandbox extends SandboxApi {
return `${port}-${this.sandboxID}.${this.connectionConfig.domain}`
}
- async setTimeout(timeout: number, opts?: Pick<SandboxOpts, 'requestTimeoutMs'>) {
- await Sandbox.setTimeout(this.sandboxID, timeout, { ...this.connectionConfig, ...opts })
+ async setTimeout(timeoutMs: number, opts?: Pick<SandboxOpts, 'requestTimeoutMs'>) {
+ await Sandbox.setTimeout(this.sandboxID, timeoutMs, { ...this.connectionConfig, ...opts })
}
async kill(opts?: Pick<SandboxOpts, 'requestTimeoutMs'>) {
await Sandbox.kill(this.sandboxID, { ...this.connectionConfig, ...opts })
}
}
-
-async function name() {
- const sbx = await Sandbox.spawn()
-
- const res = await sbx.commands.run('clas', { background: false })
-}
diff --git a/packages/js-sdk/src/sandbox/process/index.ts b/packages/js-sdk/src/sandbox/process/index.ts
index 7ccd579f0..1a7fe6ba2 100644
--- a/packages/js-sdk/src/sandbox/process/index.ts
+++ b/packages/js-sdk/src/sandbox/process/index.ts
@@ -7,16 +7,18 @@ import {
import { ProcessService } from '../../envd/process/process_connect'
import {
- ProcessConfig as PsProcessConfig,
+ ProcessInfo as PsProcessInfo,
Signal,
StartResponse,
} from '../../envd/process/process_pb'
-import { ConnectionOpts, Username } from '../../connectionConfig'
+import { ConnectionOpts, defaultUsername, Username } from '../../connectionConfig'
import { ProcessHandle, ProcessOutput } from './processHandle'
-export type ProcessConfig = PlainMessage<PsProcessConfig>
+export type ProcessInfo = PlainMessage<PsProcessInfo>
-interface ProcessStartOpts extends Partial<Pick<ConnectionOpts, 'requestTimeoutMs'>> {
+export interface ProcessRequestOpts extends Partial<Pick<ConnectionOpts, 'requestTimeoutMs'>> { }
+
+interface ProcessStartOpts extends ProcessRequestOpts {
background?: boolean
cwd?: string
user?: Username
@@ -43,14 +45,14 @@ export class Process {
this.rpc = createPromiseClient(ProcessService, transport)
}
- async list(opts?: Pick<ConnectionOpts, 'requestTimeoutMs'>): Promise<ProcessConfig[]> {
+ async list(opts?: ProcessRequestOpts): Promise<ProcessInfo[]> {
const res = await this.rpc.list({}, {
timeoutMs: opts?.requestTimeoutMs ?? this.connectionConfig.requestTimeoutMs,
})
return res.processes
}
- async kill(pid: number, opts?: Pick<ConnectionOpts, 'requestTimeoutMs'>): Promise<void> {
+ async kill(pid: number, opts?: ProcessRequestOpts): Promise<void> {
await this.rpc.sendSignal({
process: {
selector: {
@@ -64,6 +66,37 @@ export class Process {
})
}
+ async connect(
+ pid: number,
+ opts?: {
+ onStdout?: ((data: string) => void | Promise<void>),
+ onStderr?: ((data: string) => void | Promise<void>),
+ } & Pick<ConnectionOpts, 'requestTimeoutMs'>
+ ): Promise<ProcessHandle> {
+ const controller = new AbortController()
+
+ const events = this.rpc.connect({
+ process: {
+ selector: {
+ case: 'pid',
+ value: pid,
+ }
+ },
+ }, {
+ signal: controller.signal,
+ timeoutMs: opts?.requestTimeoutMs ?? this.connectionConfig.requestTimeoutMs,
+ })
+
+ return new ProcessHandle(
+ pid,
+ () => controller.abort(),
+ () => this.kill(pid),
+ events,
+ opts?.onStdout,
+ opts?.onStderr,
+ )
+ }
+
async run(
cmd: string,
opts?: ProcessRunOpts,
@@ -90,10 +123,10 @@ export class Process {
const controller = new AbortController()
const events = this.rpc.start({
- owner: {
- credential: {
+ user: {
+ selector: {
case: 'username',
- value: opts?.user || 'user',
+ value: opts?.user || defaultUsername,
},
},
process: {
diff --git a/packages/js-sdk/src/sandbox/pty.ts b/packages/js-sdk/src/sandbox/pty.ts
index 97d485ab0..b41dcfc0f 100644
--- a/packages/js-sdk/src/sandbox/pty.ts
+++ b/packages/js-sdk/src/sandbox/pty.ts
@@ -1,4 +1,3 @@
-import { PlainMessage } from '@bufbuild/protobuf'
import {
createPromiseClient,
PromiseClient,
@@ -7,34 +6,36 @@ import {
import { ProcessService } from '../envd/process/process_connect'
import {
- StreamInputRequest,
Signal,
StartResponse,
+ StreamInputRequest,
} from '../envd/process/process_pb'
-import { ConnectionConfig, ConnectionOpts } from '../connectionConfig'
+import { ConnectionConfig, ConnectionOpts, defaultUsername } from '../connectionConfig'
import { ProcessHandle } from './process/processHandle'
+import { PartialMessage } from '@bufbuild/protobuf'
export interface StreamInputHandle {
stop: () => void
+ sendData: (data: Uint8Array) => void
}
export class Pty {
- private readonly service: PromiseClient<typeof ProcessService> = createPromiseClient(ProcessService, this.transport)
+ private readonly rpc: PromiseClient<typeof ProcessService> = createPromiseClient(ProcessService, this.transport)
constructor(private readonly transport: Transport, private readonly connectionConfig: ConnectionConfig) { }
- async start({ cols, rows, onData }: {
+ async create({ cols, rows, onData }: {
cols: number,
rows: number,
onData: (data: Uint8Array) => void | Promise<void>,
}, opts?: Pick<ConnectionOpts, 'requestTimeoutMs'>): Promise<ProcessHandle> {
const controller = new AbortController()
- const events = this.service.start({
+ const events = this.rpc.start({
user: {
selector: {
case: 'username',
- value: 'user',
+ value: defaultUsername,
},
},
process: {
@@ -74,16 +75,45 @@ export class Pty {
)
}
- async streamInput(params: AsyncIterable<PlainMessage<StreamInputRequest>>, opts?: Pick<ConnectionOpts, 'requestTimeoutMs'>): Promise<StreamInputHandle> {
+ async streamInput(pid: number, opts?: Pick<ConnectionOpts, 'requestTimeoutMs'>): Promise<StreamInputHandle> {
const controller = new AbortController()
- this.service.streamInput(params, {
+ const events = new AsyncQueue<PartialMessage<StreamInputRequest>>()
+
+ this.rpc.streamInput(events, {
signal: controller.signal,
timeoutMs: opts?.requestTimeoutMs ?? this.connectionConfig.requestTimeoutMs,
})
+ events.enqueue({
+ event: {
+ case: 'start',
+ value: {
+ process: {
+ selector: {
+ case: 'pid',
+ value: pid,
+ },
+ },
+ },
+ },
+ })
+
return {
stop: () => controller.abort(),
+ sendData: (data: Uint8Array) => events.enqueue({
+ event: {
+ case: 'data',
+ value: {
+ input: {
+ input: {
+ case: 'pty',
+ value: data,
+ },
+ },
+ },
+ },
+ }),
}
}
@@ -95,7 +125,7 @@ export class Pty {
},
opts?: Pick<ConnectionOpts, 'requestTimeoutMs'>,
): Promise<void> {
- await this.service.update({
+ await this.rpc.update({
process: {
selector: {
case: 'pid',
@@ -110,8 +140,8 @@ export class Pty {
})
}
- async kill(pid: number, opts?: Pick<ConnectionOpts, 'requestTimeoutMs'>): Promise<void> {
- await this.service.sendSignal({
+ private async kill(pid: number, opts?: Pick<ConnectionOpts, 'requestTimeoutMs'>): Promise<void> {
+ await this.rpc.sendSignal({
process: {
selector: {
case: 'pid',
@@ -124,3 +154,31 @@ export class Pty {
})
}
}
+
+class AsyncQueue<T> {
+ private readonly resolvers: ((value: T) => void)[] = []
+ private readonly promises: Promise<T>[] = []
+
+ enqueue(t: T) {
+ if (!this.resolvers.length) this.add()
+ this.resolvers.shift()!(t)
+ }
+
+ [Symbol.asyncIterator]() {
+ return {
+ next: () => this.dequeue()!.then(value => ({ done: false, value })),
+ [Symbol.asyncIterator]() { return this },
+ }
+ }
+
+ private dequeue() {
+ if (!this.promises.length) this.add()
+ return this.promises.shift()
+ }
+
+ private add() {
+ this.promises.push(new Promise(resolve => {
+ this.resolvers.push(resolve)
+ }))
+ }
+}
diff --git a/packages/js-sdk/src/sandbox/sandboxApi.ts b/packages/js-sdk/src/sandbox/sandboxApi.ts
index e15a0cf36..f520d3ef9 100644
--- a/packages/js-sdk/src/sandbox/sandboxApi.ts
+++ b/packages/js-sdk/src/sandbox/sandboxApi.ts
@@ -47,7 +47,7 @@ export class SandboxApi {
template: string,
opts?: ConnectionOpts & {
metadata?: Record<string, string>,
- timeout?: number,
+ timeoutMs?: number,
}): Promise<string> {
const config = new ConnectionConfig(opts)
const client = new ApiClient(config)
@@ -56,7 +56,7 @@ export class SandboxApi {
body: {
templateID: template,
metadata: opts?.metadata,
- timeout: opts?.timeout,
+ timeout: opts?.timeoutMs ? this.timeoutToSeconds(opts.timeoutMs) : undefined,
},
})
@@ -78,11 +78,15 @@ export class SandboxApi {
},
},
body: {
- timeout: timeoutMs,
+ timeout: this.timeoutToSeconds(timeoutMs),
},
})
}
+ private static timeoutToSeconds(timeout: number): number {
+ return Math.ceil(timeout / 1000)
+ }
+
private static getSandboxID({ sandboxID, clientID }: { sandboxID: string, clientID: string }): string {
return `${sandboxID}-${clientID}`
}
diff --git a/packages/python-sdk/connect/client.py b/packages/python-sdk/connect/client.py
index 77871c505..1940e2a50 100644
--- a/packages/python-sdk/connect/client.py
+++ b/packages/python-sdk/connect/client.py
@@ -1,6 +1,8 @@
import gzip
import json
import struct
+import urllib3
+
from enum import Flag, IntEnum
from google.protobuf import json_format
@@ -45,16 +47,7 @@ _default_connection_pool = None
def default_connection_pool():
global _default_connection_pool
if _default_connection_pool is None:
- import httpcore
-
- try:
- import h2 # noqa: F401
-
- http2 = True
- del h2
- except ModuleNotFoundError:
- http2 = False
- _default_connection_pool = httpcore.ConnectionPool(http2=http2)
+ _default_connection_pool = urllib3.PoolManager()
return _default_connection_pool
@@ -165,7 +158,7 @@ class Client:
raise error_for_response(http_resp)
return self._codec.decode(
- http_resp.content,
+ http_resp.data,
msg_type=self._response_type,
)
@@ -177,7 +170,7 @@ class Client:
data = self._compressor.compress(data)
flags |= EnvelopeFlags.compressed
- with self.pool.stream(
+ with self.pool.request(
"POST",
self.url,
content=encode_envelope(
@@ -202,36 +195,39 @@ class Client:
needs_header = True
flags, data_len = 0, 0
- for chunk in http_resp.iter_stream():
- buffer += chunk
-
- if needs_header:
- header = buffer[:envelope_header_length]
- buffer = buffer[envelope_header_length:]
- flags, data_len = decode_envelope_header(header)
- needs_header = False
- end_stream = EnvelopeFlags.end_stream in flags
-
- if len(buffer) >= data_len:
- buffer = buffer[:data_len]
-
- if end_stream:
- data = json.loads(buffer)
- if "error" in data:
- raise make_error(data["error"])
-
- # TODO: Figure out what else might be possible
- return
-
- # TODO: handle server message compression
- # if EnvelopeFlags.compression in flags:
- # TODO: should the client potentially use a different codec
- # based on response header? Or can we assume they're always
- # the same and an error otherwise.
- yield self._codec.decode(buffer, msg_type=self._response_type)
-
- buffer = buffer[data_len:]
- needs_header = True
+ try:
+ for chunk in http_resp.stream():
+ buffer += chunk
+
+ if needs_header:
+ header = buffer[:envelope_header_length]
+ buffer = buffer[envelope_header_length:]
+ flags, data_len = decode_envelope_header(header)
+ needs_header = False
+ end_stream = EnvelopeFlags.end_stream in flags
+
+ if len(buffer) >= data_len:
+ buffer = buffer[:data_len]
+
+ if end_stream:
+ data = json.loads(buffer)
+ if "error" in data:
+ raise make_error(data["error"])
+
+ # TODO: Figure out what else might be possible
+ return
+
+ # TODO: handle server message compression
+ # if EnvelopeFlags.compression in flags:
+ # TODO: should the client potentially use a different codec
+ # based on response header? Or can we assume they're always
+ # the same and an error otherwise.
+ yield self._codec.decode(buffer, msg_type=self._response_type)
+
+ buffer = buffer[data_len:]
+ needs_header = True
+ finally:
+ http_resp.close()
def call_client_stream(self, req, **opts):
raise NotImplementedError("client stream not supported")
diff --git a/packages/python-sdk/e2b/__init__.py b/packages/python-sdk/e2b/__init__.py
index cbad16cd4..f93354e64 100644
--- a/packages/python-sdk/e2b/__init__.py
+++ b/packages/python-sdk/e2b/__init__.py
@@ -1,20 +1,11 @@
-"""
-Secure sandboxed cloud environments made for AI agents and AI apps
-
-Check usage docs - https://e2b.dev/docs/sandbox/overview
-
-E2B Sandbox is a secure sandboxed cloud environment made for AI agents and AI
-apps. Sandboxes allow AI agents and apps to have long running cloud secure
-environments. In these environments, large language models can use the same
-tools as humans do.
-"""
-
-from envd.filesystem.v1.filesystem_pb2 import FilesystemEvent, FileType, EntryInfo
from .api import (
ApiClient,
AuthenticationException,
client,
)
-from .connection_config import ConnectionConfig
+from .connection_config import ConnectionConfig, Username
from .sandbox.main import Sandbox
-from .sandbox.process import ProcessHandle, ProcessOutput, ProcessResult
+from .sandbox.process.process_handle import ProcessHandle, ProcessOutput, ProcessResult
+from .sandbox.filesystem.watch_handle import WatchHandle
+from envd.filesystem.filesystem_pb2 import FilesystemEvent, FileType, EntryInfo
+from .sandbox.filesystem.filesystem import FileFormat
diff --git a/packages/python-sdk/e2b/api/metadata.py b/packages/python-sdk/e2b/api/metadata.py
index 0e46292f2..b38910077 100644
--- a/packages/python-sdk/e2b/api/metadata.py
+++ b/packages/python-sdk/e2b/api/metadata.py
@@ -1,14 +1,13 @@
import platform
-# from importlib import metadata
+from importlib import metadata
default_headers = {
"lang": "python",
"lang_version": platform.python_version(),
"machine": platform.machine(),
"os": platform.platform(),
- # TODO: Should this be disabled?
- # "package_version": metadata.version("e2b"),
+ "package_version": metadata.version("e2b"),
"processor": platform.processor(),
"publisher": "e2b",
"release": platform.release(),
diff --git a/packages/python-sdk/e2b/connection_config.py b/packages/python-sdk/e2b/connection_config.py
index 7388b6b3d..ae4bca859 100644
--- a/packages/python-sdk/e2b/connection_config.py
+++ b/packages/python-sdk/e2b/connection_config.py
@@ -1,6 +1,6 @@
import os
-from typing import Optional
+from typing import Literal, Optional
DOMAIN = os.getenv("E2B_DOMAIN", "e2b.dev")
@@ -29,3 +29,6 @@ class ConnectionConfig:
)
self.api_url = "http://localhost:3000" if debug else f"https://api.{domain}"
+
+
+Username = Literal["root", "user"]
diff --git a/packages/python-sdk/e2b/sandbox/filesystem.py b/packages/python-sdk/e2b/sandbox/filesystem/filesystem.py
similarity index 58%
rename from packages/python-sdk/e2b/sandbox/filesystem.py
rename to packages/python-sdk/e2b/sandbox/filesystem/filesystem.py
index aa3a154e7..673665aec 100644
--- a/packages/python-sdk/e2b/sandbox/filesystem.py
+++ b/packages/python-sdk/e2b/sandbox/filesystem/filesystem.py
@@ -1,39 +1,93 @@
-import logging
import connect
-from typing import List, Optional, Literal
+from typing import List, Optional, overload, Literal, Union
+
from e2b.envd import EnvdApiClient, client
+from e2b.sandbox.filesystem.watch_handle import WatchHandle
+from e2b.connection_config import Username
+from envd.filesystem import filesystem_connect, filesystem_pb2
-from envd.filesystem.v1 import filesystem_connect, filesystem_pb2
-logger = logging.getLogger(__name__)
+FileFormat = Literal["text", "bytearray"]
-# TODO: Provide a way to cancel requests (watch)
class Filesystem:
- def __init__(self, base_url: str, envd_api_client: EnvdApiClient) -> None:
- self._envd_api = envd_api_client
+ def __init__(self, envd_api_url: str) -> None:
+ self._envd_api = EnvdApiClient(api_url=envd_api_url)
- self._service = filesystem_connect.FilesystemServiceClient(
- base_url,
+ self._rpc = filesystem_connect.FilesystemServiceClient(
+ envd_api_url,
compressor=connect.GzipCompressor,
)
- def read(self, path: str, request_timeout: Optional[float]) -> bytearray:
- # TODO: Check if exceptions are properly thrown
- # TODO: Add support for formats
+ @overload
+ def read(
+ self,
+ path: str,
+ format: Literal["text"] = "text",
+ request_timeout: Optional[float] = None,
+ user: Username = "user",
+ ) -> str: ...
+
+ @overload
+ def read(
+ self,
+ path: str,
+ format: Literal["bytearray"],
+ request_timeout: Optional[float] = None,
+ user: Username = "user",
+ ) -> bytearray: ...
- return client.FilesApi(self._envd_api).files_path_get(
+ def read(
+ self,
+ path: str,
+ format: FileFormat = "text",
+ request_timeout: Optional[float] = None,
+ user: Username = "user",
+ ):
+ res = client.FilesApi(self._envd_api).files_path_get(
path=path,
_request_timeout=request_timeout,
)
+ if format == "text":
+ return res.decode()
+
+ return res
+
+ @overload
+ def write(
+ self,
+ path: str,
+ data: bytearray,
+ request_timeout: Optional[float] = None,
+ user: Username = "user",
+ ) -> str: ...
+
+ @overload
def write(
self,
path: str,
data: bytes,
+ request_timeout: Optional[float] = None,
+ user: Username = "user",
+ ) -> str: ...
+
+ @overload
+ def write(
+ self,
+ path: str,
+ data: str,
+ request_timeout: Optional[float] = None,
+ user: Username = "user",
+ ) -> bytearray: ...
+
+ def write(
+ self,
+ path: str,
+ data: Union[bytes, bytearray, str],
request_timeout: Optional[float],
- user: Literal["root", "user"] = "user",
+ user: Username = "user",
) -> None:
client.FilesApi(self._envd_api).files_path_put(
path=path,
@@ -44,19 +98,19 @@ class Filesystem:
)
def list(self, path: str) -> List[filesystem_pb2.EntryInfo]:
- res = self._service.list(
+ res = self._rpc.list(
filesystem_pb2.ListRequest(path=path),
)
return [entry for entry in res.entries]
- def stat(self, path: str) -> filesystem_pb2.EntryInfo:
- res = self._service.stat(
+ def exists(self, path: str) -> filesystem_pb2.EntryInfo:
+ res = self._rpc.stat(
filesystem_pb2.StatRequest(path=path),
)
return res.entry
def remove(self, path: str) -> None:
- self._service.remove(
+ self._rpc.remove(
filesystem_pb2.RemoveRequest(path=path),
)
@@ -65,15 +119,11 @@ class Filesystem:
path: str,
request_timeout: Optional[float],
):
- events = self._service.watch(
+ events = self._rpc.watch(
filesystem_pb2.WatchRequest(path=path),
)
- def stream():
- for event in events:
- yield event.event
-
- return stream()
+ return WatchHandle(events=events)
# def upload_file(self, file: IO, timeout: Optional[float] = TIMEOUT) -> str:
# """
diff --git a/packages/python-sdk/e2b/sandbox/filesystem/watch_handle.py b/packages/python-sdk/e2b/sandbox/filesystem/watch_handle.py
new file mode 100644
index 000000000..7d04d8de1
--- /dev/null
+++ b/packages/python-sdk/e2b/sandbox/filesystem/watch_handle.py
@@ -0,0 +1,18 @@
+from typing import Any, Generator
+
+from envd.filesystem.filesystem_pb2 import WatchResponse
+
+
+class WatchHandle(Generator):
+ def __init__(
+ self,
+ events: Generator[WatchResponse, Any, None],
+ ):
+ self._events = events
+
+ def __next__(self):
+ event = next(self._events)
+ return event.event
+
+ def __iter__(self):
+ return self
diff --git a/packages/python-sdk/e2b/sandbox/main.py b/packages/python-sdk/e2b/sandbox/main.py
index ce30e6aca..982fc6e95 100644
--- a/packages/python-sdk/e2b/sandbox/main.py
+++ b/packages/python-sdk/e2b/sandbox/main.py
@@ -1,22 +1,24 @@
-import logging
+import urllib.parse
from typing import Optional, Dict
-from e2b.envd import EnvdApiClient
-from e2b.sandbox.filesystem import Filesystem
-from e2b.sandbox.process import Process
+from e2b.sandbox.filesystem.filesystem import Filesystem
+from e2b.sandbox.process.main import Process
from e2b.sandbox.sandbox_api import SandboxApi
from e2b.connection_config import ConnectionConfig
-logger = logging.getLogger(__name__)
-
-# TODO: Add requestTimeout
-# TODO: Add logging (interceptors?)
-
class Sandbox(SandboxApi):
_envd_port = 49982
+ @property
+ def files(self) -> Filesystem:
+ return self._filesystem
+
+ @property
+ def commands(self) -> Process:
+ return self._process
+
def __init__(
self,
template: str = "base-v1",
@@ -50,14 +52,12 @@ class Sandbox(SandboxApi):
else:
self.sandbox_id = sandbox_id
- sandbox_server_url = (
+ self._envd_api_url = (
f"{'http' if debug else 'https'}://{self.get_host(self._envd_port)}"
)
- envd_api_client = EnvdApiClient(api_url=sandbox_server_url)
-
- self.filesystem = Filesystem(sandbox_server_url, envd_api_client)
- self.process = Process(sandbox_server_url)
+ self._filesystem = Filesystem(self._envd_api_url)
+ self._process = Process(self._envd_api_url)
def get_host(self, port: int) -> str:
if self._connection_config.debug:
@@ -85,8 +85,6 @@ class Sandbox(SandboxApi):
timeout: int,
request_timeout: Optional[float] = None,
) -> None:
- # TODO: Ensure the ** works
-
SandboxApi.set_timeout(
sandbox_id=self.sandbox_id,
timeout=timeout,
@@ -101,9 +99,21 @@ class Sandbox(SandboxApi):
request_timeout=request_timeout,
)
+ @property
def upload_url(self) -> str:
- host = self.get_host(self._envd_port)
+ url = urllib.parse.urljoin(self._envd_api_url, "/files?")
+ params = urllib.parse.urlencode(
+ {"user": "user"},
+ )
+ url = urllib.parse.urljoin(url, params)
+
+ return url
+
+
+sbx = Sandbox()
+
- # TODO: Finish url
+res = sbx.commands.run("ls -l", background=True)
- return f"{'http' if self._connection_config.debug else 'https'}://{host}/files"
+for r in res:
+ res.close()
diff --git a/packages/python-sdk/e2b/sandbox/process.py b/packages/python-sdk/e2b/sandbox/process.py
deleted file mode 100644
index 827ac92e6..000000000
--- a/packages/python-sdk/e2b/sandbox/process.py
+++ /dev/null
@@ -1,143 +0,0 @@
-import logging
-import connect
-
-from typing import Dict, Optional, Callable, Any, Generator, Union, Literal
-
-from envd.process.v1 import process_connect, process_pb2
-from pydantic import BaseModel
-
-logger = logging.getLogger(__name__)
-
-
-class ProcessOutput(BaseModel):
- stdout: Optional[str] = None
- stderr: Optional[str] = None
-
-
-class ProcessResult(ProcessOutput):
- exit_code: int
- error: Optional[str]
-
-
-class ProcessHandle:
- def __init__(
- self,
- pid: int,
- kill: Callable[[], None],
- events: Generator[
- Union[process_pb2.StartResponse, process_pb2.ConnectResponse], Any, None
- ],
- ):
- self.pid = pid
- self.kill = kill
- self._events = events
-
- self._stdout: bytes = b""
- self._stderr: bytes = b""
-
- self.result: Optional[ProcessResult] = None
-
- def __next__(self):
- event = next(self._events)
-
- if event.HasField("data"):
- if event.event.data.stdout:
- self._stdout += event.event.data.stdout
- return ProcessOutput(stdout=self._stdout.decode())
- if event.event.data.stderr:
- self._stderr += event.event.data.stderr
- return ProcessOutput(stderr=self._stderr.decode())
- if event.HasField("end"):
- self.result = ProcessResult(
- stdout=self._stdout.decode(),
- stderr=self._stderr.decode(),
- exit_code=event.event.end.exit_code,
- error=event.event.end.error,
- )
-
- raise StopIteration
-
- def __iter__(self):
- return self
-
- def wait(self):
- for _ in self:
- pass
-
- if self.result is None:
- raise RuntimeError("Process has not ended")
-
- return self.result
-
-
-# TODO: Add disconnect for process handle
-class Process:
- def __init__(self, base_url: str) -> None:
- self.base_url = base_url
-
- self._service = process_connect.ProcessServiceClient(
- self.base_url,
- compressor=connect.GzipCompressor,
- )
-
- def list(self):
- res = self._service.list(
- process_pb2.ListRequest(),
- )
- return [p for p in res.processes]
-
- def kill(self, pid: int):
- self._service.send_signal(
- process_pb2.SendSignalRequest(
- process=process_pb2.ProcessSelector(pid=pid),
- signal=process_pb2.Signal.SIGNAL_SIGKILL,
- ),
- )
-
- def sendStdin(self, pid: int, data: bytes):
- self._service.send_input(
- process_pb2.SendInputRequest(
- process=process_pb2.ProcessSelector(pid=pid),
- input=process_pb2.ProcessInput(stdin=data),
- ),
- )
-
- def start(
- self,
- cmd: str,
- envs: Optional[Dict[str, str]] = {},
- user: Literal["root", "user"] = "user",
- cwd: Optional[str] = None,
- ):
- events = self._service.start(
- process_pb2.StartRequest(
- owner=process_pb2.Credential(username=user),
- process=process_pb2.ProcessConfig(
- cmd="/bin/bash",
- envs=envs,
- args=["-l", "-c", cmd],
- cwd=cwd,
- ),
- ),
- )
-
- start_event = next(events)
-
- return ProcessHandle(
- pid=start_event.event.start.pid,
- kill=lambda: self.kill(start_event.event.start.pid),
- events=events,
- )
-
- def connect(self, pid: int):
- events = self._service.connect(
- process_pb2.ConnectRequest(
- process=process_pb2.ProcessSelector(pid=pid),
- ),
- )
-
- return ProcessHandle(
- pid=pid,
- kill=lambda: self.kill(pid),
- events=events,
- )
diff --git a/packages/python-sdk/e2b/sandbox/process/main.py b/packages/python-sdk/e2b/sandbox/process/main.py
new file mode 100644
index 000000000..d378a75d4
--- /dev/null
+++ b/packages/python-sdk/e2b/sandbox/process/main.py
@@ -0,0 +1,100 @@
+import connect
+
+from typing import Dict, List, Optional, Literal, overload, Union, Callable
+from envd.permissions import permissions_pb2
+
+from envd.process import process_connect, process_pb2
+from e2b.sandbox.process.process_handle import ProcessHandle, ProcessResult
+from e2b.connection_config import Username
+
+
+class Process:
+ def __init__(self, envd_api_url: str) -> None:
+ self._rpc = process_connect.ProcessServiceClient(
+ envd_api_url,
+ compressor=connect.GzipCompressor,
+ )
+
+ def list(self) -> List[process_pb2.ProcessInfo]:
+ res = self._rpc.list(
+ process_pb2.ListRequest(),
+ )
+ return [p for p in res.processes]
+
+ def kill(self, pid: int):
+ self._rpc.send_signal(
+ process_pb2.SendSignalRequest(
+ process=process_pb2.ProcessSelector(pid=pid),
+ signal=process_pb2.Signal.SIGNAL_SIGKILL,
+ ),
+ )
+
+ @overload
+ def run(
+ self,
+ cmd: str,
+ background: Union[Literal[False], None] = None,
+ envs: Optional[Dict[str, str]] = {},
+ user: Username = "user",
+ cwd: Optional[str] = None,
+ on_stdout: Optional[Callable[[str], None]] = None,
+ on_stderr: Optional[Callable[[str], None]] = None,
+ ) -> ProcessResult: ...
+
+ @overload
+ def run(
+ self,
+ cmd: str,
+ background: Literal[True],
+ envs: Optional[Dict[str, str]] = {},
+ user: Username = "user",
+ cwd: Optional[str] = None,
+ ) -> ProcessHandle: ...
+
+ def run(
+ self,
+ cmd: str,
+ background: Union[bool, None] = None,
+ envs: Optional[Dict[str, str]] = {},
+ user: Username = "user",
+ cwd: Optional[str] = None,
+ on_stdout: Optional[Callable[[str], None]] = None,
+ on_stderr: Optional[Callable[[str], None]] = None,
+ ):
+ proc = self._start(cmd, envs, user, cwd)
+
+ return (
+ proc
+ if background
+ else proc.wait(
+ on_stdout=on_stdout,
+ on_stderr=on_stderr,
+ )
+ )
+
+ def _start(
+ self,
+ cmd: str,
+ envs: Optional[Dict[str, str]] = {},
+ user: Username = "user",
+ cwd: Optional[str] = None,
+ ):
+ events = self._rpc.start(
+ process_pb2.StartRequest(
+ user=permissions_pb2.User(username=user),
+ process=process_pb2.ProcessConfig(
+ cmd="/bin/bash",
+ envs=envs,
+ args=["-l", "-c", cmd],
+ cwd=cwd,
+ ),
+ ),
+ )
+
+ start_event = next(events)
+
+ return ProcessHandle(
+ pid=start_event.event.start.pid,
+ handle_kill=lambda: self.kill(start_event.event.start.pid),
+ events=events,
+ )
diff --git a/packages/python-sdk/e2b/sandbox/process/process_handle.py b/packages/python-sdk/e2b/sandbox/process/process_handle.py
new file mode 100644
index 000000000..291128825
--- /dev/null
+++ b/packages/python-sdk/e2b/sandbox/process/process_handle.py
@@ -0,0 +1,83 @@
+from typing import Optional, Callable, Any, Generator, Union
+
+from envd.process import process_pb2
+from pydantic import BaseModel
+
+
+class ProcessOutput(BaseModel):
+ stdout: Optional[str] = None
+ stderr: Optional[str] = None
+
+
+class ProcessResult(ProcessOutput):
+ exit_code: int
+ error: Optional[str]
+
+
+class ProcessHandle(Generator):
+ @property
+ def pid(self):
+ return self._pid
+
+ def __init__(
+ self,
+ pid: int,
+ handle_kill: Callable[[], None],
+ events: Generator[
+ Union[process_pb2.StartResponse, process_pb2.ConnectResponse], Any, None
+ ],
+ ):
+ self._pid = pid
+ self._handle_kill = handle_kill
+ self._events = events
+
+ self._stdout: bytes = b""
+ self._stderr: bytes = b""
+
+ self._result: Optional[ProcessResult] = None
+
+ def __next__(self):
+ event = next(self._events)
+
+ if event.HasField(field_name="data"):
+ if event.event.data.stdout:
+ self._stdout += event.event.data.stdout
+ return ProcessOutput(stdout=self._stdout.decode())
+ if event.event.data.stderr:
+ self._stderr += event.event.data.stderr
+ return ProcessOutput(stderr=self._stderr.decode())
+ if event.HasField("end"):
+ self._result = ProcessResult(
+ stdout=self._stdout.decode(),
+ stderr=self._stderr.decode(),
+ exit_code=event.event.end.exit_code,
+ error=event.event.end.error,
+ )
+
+ raise StopIteration
+
+ def __iter__(self):
+ return self
+
+ def close(self) -> None:
+ self._events.close()
+
+ def wait(
+ self,
+ on_stdout: Optional[Callable[[str], None]] = None,
+ on_stderr: Optional[Callable[[str], None]] = None,
+ ):
+ for output in self:
+ if output.stdout and on_stdout:
+ on_stdout(output.stdout)
+ if output.stderr and on_stderr:
+ on_stderr(output.stderr)
+
+ if self._result is None:
+ raise RuntimeError("Process has not ended")
+
+ return self._result
+
+ def kill(self):
+ self.close()
+ self._handle_kill()
diff --git a/packages/python-sdk/e2b/sandbox/sandbox_api.py b/packages/python-sdk/e2b/sandbox/sandbox_api.py
index 088abf858..e97646856 100644
--- a/packages/python-sdk/e2b/sandbox/sandbox_api.py
+++ b/packages/python-sdk/e2b/sandbox/sandbox_api.py
@@ -1,5 +1,3 @@
-import logging
-
from typing import Optional, Dict, List
from pydantic import BaseModel
from datetime import datetime
@@ -7,8 +5,6 @@ from datetime import datetime
from e2b.api import ApiClient, models, client
from e2b.connection_config import ConnectionConfig
-logger = logging.getLogger(__name__)
-
class RunningSandbox(BaseModel):
sandbox_id: str
@@ -65,8 +61,6 @@ class SandboxApi:
request_timeout=request_timeout,
)
- # TODO: Ensure the short id/long id works with kill
-
with ApiClient(config) as api_client:
client.SandboxesApi(api_client).sandboxes_sandbox_id_delete(
sandbox_id,
diff --git a/packages/python-sdk/envd/filesystem/filesystem_connect.py b/packages/python-sdk/envd/filesystem/filesystem_connect.py
new file mode 100644
index 000000000..92d726729
--- /dev/null
+++ b/packages/python-sdk/envd/filesystem/filesystem_connect.py
@@ -0,0 +1,56 @@
+# Code generated by protoc-gen-connect-python 0.1.0.dev2, DO NOT EDIT.
+from typing import Any, Generator
+
+import connect
+
+from envd.filesystem import filesystem_pb2 as envd_dot_filesystem_dot_filesystem__pb2
+
+FilesystemServiceName = "envd.filesystem.FilesystemService"
+
+
+class FilesystemServiceClient:
+ def __init__(self, base_url, *, pool=None, compressor=None, json=False, **opts):
+ self._stat = connect.Client(
+ pool=pool,
+ url=f"{base_url}/{FilesystemServiceName}/Stat",
+ response_type=envd_dot_filesystem_dot_filesystem__pb2.StatResponse,
+ compressor=compressor,
+ json=json,
+ **opts
+ )
+ self._list = connect.Client(
+ pool=pool,
+ url=f"{base_url}/{FilesystemServiceName}/List",
+ response_type=envd_dot_filesystem_dot_filesystem__pb2.ListResponse,
+ compressor=compressor,
+ json=json,
+ **opts
+ )
+ self._watch = connect.Client(
+ pool=pool,
+ url=f"{base_url}/{FilesystemServiceName}/Watch",
+ response_type=envd_dot_filesystem_dot_filesystem__pb2.WatchResponse,
+ compressor=compressor,
+ json=json,
+ **opts
+ )
+ self._remove = connect.Client(
+ pool=pool,
+ url=f"{base_url}/{FilesystemServiceName}/Remove",
+ response_type=envd_dot_filesystem_dot_filesystem__pb2.RemoveResponse,
+ compressor=compressor,
+ json=json,
+ **opts
+ )
+
+ def stat(self, req: envd_dot_filesystem_dot_filesystem__pb2.StatRequest, **opts) -> envd_dot_filesystem_dot_filesystem__pb2.StatResponse:
+ return self._stat.call_unary(req, **opts)
+
+ def list(self, req: envd_dot_filesystem_dot_filesystem__pb2.ListRequest, **opts) -> envd_dot_filesystem_dot_filesystem__pb2.ListResponse:
+ return self._list.call_unary(req, **opts)
+
+ def watch(self, req: envd_dot_filesystem_dot_filesystem__pb2.WatchRequest , **opts) -> Generator[envd_dot_filesystem_dot_filesystem__pb2.WatchResponse, Any, None]:
+ return self._watch.call_server_stream(req, **opts)
+
+ def remove(self, req: envd_dot_filesystem_dot_filesystem__pb2.RemoveRequest, **opts) -> envd_dot_filesystem_dot_filesystem__pb2.RemoveResponse:
+ return self._remove.call_unary(req, **opts)
diff --git a/packages/python-sdk/envd/filesystem/filesystem_pb2.py b/packages/python-sdk/envd/filesystem/filesystem_pb2.py
new file mode 100644
index 000000000..6e6f635e0
--- /dev/null
+++ b/packages/python-sdk/envd/filesystem/filesystem_pb2.py
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: envd/filesystem/filesystem.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()
+
+
+from envd.permissions import permissions_pb2 as envd_dot_permissions_dot_permissions__pb2
+
+
+DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n envd/filesystem/filesystem.proto\x12\x0f\x65nvd.filesystem\x1a\"envd/permissions/permissions.proto\"O\n\rRemoveRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\x12*\n\x04user\x18\x02 \x01(\x0b\x32\x16.envd.permissions.UserR\x04user\"\x10\n\x0eRemoveResponse\"M\n\x0bStatRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\x12*\n\x04user\x18\x02 \x01(\x0b\x32\x16.envd.permissions.UserR\x04user\"@\n\x0cStatResponse\x12\x30\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x1a.envd.filesystem.EntryInfoR\x05\x65ntry\"N\n\tEntryInfo\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12-\n\x04type\x18\x02 \x01(\x0e\x32\x19.envd.filesystem.FileTypeR\x04type\"M\n\x0bListRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\x12*\n\x04user\x18\x02 \x01(\x0b\x32\x16.envd.permissions.UserR\x04user\"D\n\x0cListResponse\x12\x34\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\x1a.envd.filesystem.EntryInfoR\x07\x65ntries\"N\n\x0cWatchRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\x12*\n\x04user\x18\x02 \x01(\x0b\x32\x16.envd.permissions.UserR\x04user\"G\n\rWatchResponse\x12\x36\n\x05\x65vent\x18\x01 \x01(\x0b\x32 .envd.filesystem.FilesystemEventR\x05\x65vent\"U\n\x0f\x46ilesystemEvent\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\x12.\n\x04type\x18\x02 \x01(\x0e\x32\x1a.envd.filesystem.EventTypeR\x04type*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\xb2\x02\n\x11\x46ilesystemService\x12\x43\n\x04Stat\x12\x1c.envd.filesystem.StatRequest\x1a\x1d.envd.filesystem.StatResponse\x12\x43\n\x04List\x12\x1c.envd.filesystem.ListRequest\x1a\x1d.envd.filesystem.ListResponse\x12H\n\x05Watch\x12\x1d.envd.filesystem.WatchRequest\x1a\x1e.envd.filesystem.WatchResponse0\x01\x12I\n\x06Remove\x12\x1e.envd.filesystem.RemoveRequest\x1a\x1f.envd.filesystem.RemoveResponseB\x83\x01\n\x13\x63om.envd.filesystemB\x0f\x46ilesystemProtoP\x01\xa2\x02\x03\x45\x46X\xaa\x02\x0f\x45nvd.Filesystem\xca\x02\x0f\x45nvd\\Filesystem\xe2\x02\x1b\x45nvd\\Filesystem\\GPBMetadata\xea\x02\x10\x45nvd::Filesystemb\x06proto3')
+
+_globals = globals()
+_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'envd.filesystem.filesystem_pb2', _globals)
+if not _descriptor._USE_C_DESCRIPTORS:
+ _globals['DESCRIPTOR']._loaded_options = None
+ _globals['DESCRIPTOR']._serialized_options = b'\n\023com.envd.filesystemB\017FilesystemProtoP\001\242\002\003EFX\252\002\017Envd.Filesystem\312\002\017Envd\\Filesystem\342\002\033Envd\\Filesystem\\GPBMetadata\352\002\020Envd::Filesystem'
+ _globals['_FILETYPE']._serialized_start=802
+ _globals['_FILETYPE']._serialized_end=884
+ _globals['_EVENTTYPE']._serialized_start=887
+ _globals['_EVENTTYPE']._serialized_end=1039
+ _globals['_REMOVEREQUEST']._serialized_start=89
+ _globals['_REMOVEREQUEST']._serialized_end=168
+ _globals['_REMOVERESPONSE']._serialized_start=170
+ _globals['_REMOVERESPONSE']._serialized_end=186
+ _globals['_STATREQUEST']._serialized_start=188
+ _globals['_STATREQUEST']._serialized_end=265
+ _globals['_STATRESPONSE']._serialized_start=267
+ _globals['_STATRESPONSE']._serialized_end=331
+ _globals['_ENTRYINFO']._serialized_start=333
+ _globals['_ENTRYINFO']._serialized_end=411
+ _globals['_LISTREQUEST']._serialized_start=413
+ _globals['_LISTREQUEST']._serialized_end=490
+ _globals['_LISTRESPONSE']._serialized_start=492
+ _globals['_LISTRESPONSE']._serialized_end=560
+ _globals['_WATCHREQUEST']._serialized_start=562
+ _globals['_WATCHREQUEST']._serialized_end=640
+ _globals['_WATCHRESPONSE']._serialized_start=642
+ _globals['_WATCHRESPONSE']._serialized_end=713
+ _globals['_FILESYSTEMEVENT']._serialized_start=715
+ _globals['_FILESYSTEMEVENT']._serialized_end=800
+ _globals['_FILESYSTEMSERVICE']._serialized_start=1042
+ _globals['_FILESYSTEMSERVICE']._serialized_end=1348
+# @@protoc_insertion_point(module_scope)
diff --git a/packages/python-sdk/envd/filesystem/v1/filesystem_pb2.pyi b/packages/python-sdk/envd/filesystem/filesystem_pb2.pyi
similarity index 61%
rename from packages/python-sdk/envd/filesystem/v1/filesystem_pb2.pyi
rename to packages/python-sdk/envd/filesystem/filesystem_pb2.pyi
index 2332d36cc..0db25253a 100644
--- a/packages/python-sdk/envd/filesystem/v1/filesystem_pb2.pyi
+++ b/packages/python-sdk/envd/filesystem/filesystem_pb2.pyi
@@ -1,14 +1,9 @@
+from 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
@@ -26,7 +21,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
@@ -38,20 +32,24 @@ EVENT_TYPE_RENAME: EventType
EVENT_TYPE_CHMOD: EventType
class RemoveRequest(_message.Message):
- __slots__ = ("path",)
+ __slots__ = ("path", "user")
PATH_FIELD_NUMBER: _ClassVar[int]
+ USER_FIELD_NUMBER: _ClassVar[int]
path: str
- def __init__(self, path: _Optional[str] = ...) -> None: ...
+ user: _permissions_pb2.User
+ def __init__(self, path: _Optional[str] = ..., user: _Optional[_Union[_permissions_pb2.User, _Mapping]] = ...) -> None: ...
class RemoveResponse(_message.Message):
__slots__ = ()
def __init__(self) -> None: ...
class StatRequest(_message.Message):
- __slots__ = ("path",)
+ __slots__ = ("path", "user")
PATH_FIELD_NUMBER: _ClassVar[int]
+ USER_FIELD_NUMBER: _ClassVar[int]
path: str
- def __init__(self, path: _Optional[str] = ...) -> None: ...
+ user: _permissions_pb2.User
+ def __init__(self, path: _Optional[str] = ..., user: _Optional[_Union[_permissions_pb2.User, _Mapping]] = ...) -> None: ...
class StatResponse(_message.Message):
__slots__ = ("entry",)
@@ -65,37 +63,35 @@ 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 ListRequest(_message.Message):
- __slots__ = ("path",)
+ __slots__ = ("path", "user")
PATH_FIELD_NUMBER: _ClassVar[int]
+ USER_FIELD_NUMBER: _ClassVar[int]
path: str
- def __init__(self, path: _Optional[str] = ...) -> None: ...
+ user: _permissions_pb2.User
+ def __init__(self, path: _Optional[str] = ..., user: _Optional[_Union[_permissions_pb2.User, _Mapping]] = ...) -> None: ...
class ListResponse(_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 WatchRequest(_message.Message):
- __slots__ = ("path",)
+ __slots__ = ("path", "user")
PATH_FIELD_NUMBER: _ClassVar[int]
+ USER_FIELD_NUMBER: _ClassVar[int]
path: str
- def __init__(self, path: _Optional[str] = ...) -> None: ...
+ user: _permissions_pb2.User
+ def __init__(self, path: _Optional[str] = ..., user: _Optional[_Union[_permissions_pb2.User, _Mapping]] = ...) -> None: ...
class WatchResponse(_message.Message):
__slots__ = ("event",)
EVENT_FIELD_NUMBER: _ClassVar[int]
event: FilesystemEvent
- def __init__(
- self, event: _Optional[_Union[FilesystemEvent, _Mapping]] = ...
- ) -> None: ...
+ def __init__(self, event: _Optional[_Union[FilesystemEvent, _Mapping]] = ...) -> None: ...
class FilesystemEvent(_message.Message):
__slots__ = ("path", "type")
@@ -103,6 +99,4 @@ class FilesystemEvent(_message.Message):
TYPE_FIELD_NUMBER: _ClassVar[int]
path: str
type: EventType
- def __init__(
- self, path: _Optional[str] = ..., type: _Optional[_Union[EventType, str]] = ...
- ) -> None: ...
+ def __init__(self, path: _Optional[str] = ..., type: _Optional[_Union[EventType, str]] = ...) -> None: ...
diff --git a/packages/python-sdk/envd/filesystem/v1/filesystem_connect.py b/packages/python-sdk/envd/filesystem/v1/filesystem_connect.py
deleted file mode 100644
index 84e87c888..000000000
--- a/packages/python-sdk/envd/filesystem/v1/filesystem_connect.py
+++ /dev/null
@@ -1,68 +0,0 @@
-# Code generated by protoc-gen-connect-python 0.1.0.dev2, DO NOT EDIT.
-from typing import Any, Generator
-
-import connect
-
-from envd.filesystem.v1 import (
- filesystem_pb2 as envd_dot_filesystem_dot_v1_dot_filesystem__pb2,
-)
-
-FilesystemServiceName = "envd.filesystem.v1.FilesystemService"
-
-
-class FilesystemServiceClient:
- def __init__(self, base_url, *, pool=None, compressor=None, json=False, **opts):
- self._stat = connect.Client(
- pool=pool,
- url=f"{base_url}/{FilesystemServiceName}/Stat",
- response_type=envd_dot_filesystem_dot_v1_dot_filesystem__pb2.StatResponse,
- compressor=compressor,
- json=json,
- **opts,
- )
- self._list = connect.Client(
- pool=pool,
- url=f"{base_url}/{FilesystemServiceName}/List",
- response_type=envd_dot_filesystem_dot_v1_dot_filesystem__pb2.ListResponse,
- compressor=compressor,
- json=json,
- **opts,
- )
- self._watch = connect.Client(
- pool=pool,
- url=f"{base_url}/{FilesystemServiceName}/Watch",
- response_type=envd_dot_filesystem_dot_v1_dot_filesystem__pb2.WatchResponse,
- compressor=compressor,
- json=json,
- **opts,
- )
- self._remove = connect.Client(
- pool=pool,
- url=f"{base_url}/{FilesystemServiceName}/Remove",
- response_type=envd_dot_filesystem_dot_v1_dot_filesystem__pb2.RemoveResponse,
- compressor=compressor,
- json=json,
- **opts,
- )
-
- def stat(
- self, req: envd_dot_filesystem_dot_v1_dot_filesystem__pb2.StatRequest, **opts
- ) -> envd_dot_filesystem_dot_v1_dot_filesystem__pb2.StatResponse:
- return self._stat.call_unary(req, **opts)
-
- def list(
- self, req: envd_dot_filesystem_dot_v1_dot_filesystem__pb2.ListRequest, **opts
- ) -> envd_dot_filesystem_dot_v1_dot_filesystem__pb2.ListResponse:
- return self._list.call_unary(req, **opts)
-
- def watch(
- self, req: envd_dot_filesystem_dot_v1_dot_filesystem__pb2.WatchRequest, **opts
- ) -> Generator[
- envd_dot_filesystem_dot_v1_dot_filesystem__pb2.WatchResponse, Any, None
- ]:
- return self._watch.call_server_stream(req, **opts)
-
- def remove(
- self, req: envd_dot_filesystem_dot_v1_dot_filesystem__pb2.RemoveRequest, **opts
- ) -> envd_dot_filesystem_dot_v1_dot_filesystem__pb2.RemoveResponse:
- return self._remove.call_unary(req, **opts)
diff --git a/packages/python-sdk/envd/filesystem/v1/filesystem_pb2.py b/packages/python-sdk/envd/filesystem/v1/filesystem_pb2.py
deleted file mode 100644
index dbf76b845..000000000
--- a/packages/python-sdk/envd/filesystem/v1/filesystem_pb2.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: envd/filesystem/v1/filesystem.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#envd/filesystem/v1/filesystem.proto\x12\x12\x65nvd.filesystem.v1"#\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"C\n\x0cStatResponse\x12\x33\n\x05\x65ntry\x18\x01 \x01(\x0b\x32\x1d.envd.filesystem.v1.EntryInfoR\x05\x65ntry"Q\n\tEntryInfo\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x30\n\x04type\x18\x02 \x01(\x0e\x32\x1c.envd.filesystem.v1.FileTypeR\x04type"!\n\x0bListRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path"G\n\x0cListResponse\x12\x37\n\x07\x65ntries\x18\x01 \x03(\x0b\x32\x1d.envd.filesystem.v1.EntryInfoR\x07\x65ntries""\n\x0cWatchRequest\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path"J\n\rWatchResponse\x12\x39\n\x05\x65vent\x18\x01 \x01(\x0b\x32#.envd.filesystem.v1.FilesystemEventR\x05\x65vent"X\n\x0f\x46ilesystemEvent\x12\x12\n\x04path\x18\x01 \x01(\tR\x04path\x12\x31\n\x04type\x18\x02 \x01(\x0e\x32\x1d.envd.filesystem.v1.EventTypeR\x04type*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\xca\x02\n\x11\x46ilesystemService\x12I\n\x04Stat\x12\x1f.envd.filesystem.v1.StatRequest\x1a .envd.filesystem.v1.StatResponse\x12I\n\x04List\x12\x1f.envd.filesystem.v1.ListRequest\x1a .envd.filesystem.v1.ListResponse\x12N\n\x05Watch\x12 .envd.filesystem.v1.WatchRequest\x1a!.envd.filesystem.v1.WatchResponse0\x01\x12O\n\x06Remove\x12!.envd.filesystem.v1.RemoveRequest\x1a".envd.filesystem.v1.RemoveResponseB\x93\x01\n\x16\x63om.envd.filesystem.v1B\x0f\x46ilesystemProtoP\x01\xa2\x02\x03\x45\x46X\xaa\x02\x12\x45nvd.Filesystem.V1\xca\x02\x12\x45nvd\\Filesystem\\V1\xe2\x02\x1e\x45nvd\\Filesystem\\V1\\GPBMetadata\xea\x02\x14\x45nvd::Filesystem::V1b\x06proto3'
-)
-
-_globals = globals()
-_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
-_builder.BuildTopDescriptorsAndMessages(
- DESCRIPTOR, "envd.filesystem.v1.filesystem_pb2", _globals
-)
-if not _descriptor._USE_C_DESCRIPTORS:
- _globals["DESCRIPTOR"]._loaded_options = None
- _globals[
- "DESCRIPTOR"
- ]._serialized_options = b"\n\026com.envd.filesystem.v1B\017FilesystemProtoP\001\242\002\003EFX\252\002\022Envd.Filesystem.V1\312\002\022Envd\\Filesystem\\V1\342\002\036Envd\\Filesystem\\V1\\GPBMetadata\352\002\024Envd::Filesystem::V1"
- _globals["_FILETYPE"]._serialized_start = 611
- _globals["_FILETYPE"]._serialized_end = 693
- _globals["_EVENTTYPE"]._serialized_start = 696
- _globals["_EVENTTYPE"]._serialized_end = 848
- _globals["_REMOVEREQUEST"]._serialized_start = 59
- _globals["_REMOVEREQUEST"]._serialized_end = 94
- _globals["_REMOVERESPONSE"]._serialized_start = 96
- _globals["_REMOVERESPONSE"]._serialized_end = 112
- _globals["_STATREQUEST"]._serialized_start = 114
- _globals["_STATREQUEST"]._serialized_end = 147
- _globals["_STATRESPONSE"]._serialized_start = 149
- _globals["_STATRESPONSE"]._serialized_end = 216
- _globals["_ENTRYINFO"]._serialized_start = 218
- _globals["_ENTRYINFO"]._serialized_end = 299
- _globals["_LISTREQUEST"]._serialized_start = 301
- _globals["_LISTREQUEST"]._serialized_end = 334
- _globals["_LISTRESPONSE"]._serialized_start = 336
- _globals["_LISTRESPONSE"]._serialized_end = 407
- _globals["_WATCHREQUEST"]._serialized_start = 409
- _globals["_WATCHREQUEST"]._serialized_end = 443
- _globals["_WATCHRESPONSE"]._serialized_start = 445
- _globals["_WATCHRESPONSE"]._serialized_end = 519
- _globals["_FILESYSTEMEVENT"]._serialized_start = 521
- _globals["_FILESYSTEMEVENT"]._serialized_end = 609
- _globals["_FILESYSTEMSERVICE"]._serialized_start = 851
- _globals["_FILESYSTEMSERVICE"]._serialized_end = 1181
-# @@protoc_insertion_point(module_scope)
diff --git a/packages/python-sdk/envd/permissions/permissions_pb2.py b/packages/python-sdk/envd/permissions/permissions_pb2.py
new file mode 100644
index 000000000..2e6563659
--- /dev/null
+++ b/packages/python-sdk/envd/permissions/permissions_pb2.py
@@ -0,0 +1,27 @@
+# -*- coding: utf-8 -*-
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: envd/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\"envd/permissions/permissions.proto\x12\x10\x65nvd.permissions\"0\n\x04User\x12\x1c\n\x08username\x18\x01 \x01(\tH\x00R\x08usernameB\n\n\x08selectorB\x89\x01\n\x14\x63om.envd.permissionsB\x10PermissionsProtoP\x01\xa2\x02\x03\x45PX\xaa\x02\x10\x45nvd.Permissions\xca\x02\x10\x45nvd\\Permissions\xe2\x02\x1c\x45nvd\\Permissions\\GPBMetadata\xea\x02\x11\x45nvd::Permissionsb\x06proto3')
+
+_globals = globals()
+_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'envd.permissions.permissions_pb2', _globals)
+if not _descriptor._USE_C_DESCRIPTORS:
+ _globals['DESCRIPTOR']._loaded_options = None
+ _globals['DESCRIPTOR']._serialized_options = b'\n\024com.envd.permissionsB\020PermissionsProtoP\001\242\002\003EPX\252\002\020Envd.Permissions\312\002\020Envd\\Permissions\342\002\034Envd\\Permissions\\GPBMetadata\352\002\021Envd::Permissions'
+ _globals['_USER']._serialized_start=56
+ _globals['_USER']._serialized_end=104
+# @@protoc_insertion_point(module_scope)
diff --git a/packages/python-sdk/envd/permissions/permissions_pb2.pyi b/packages/python-sdk/envd/permissions/permissions_pb2.pyi
new file mode 100644
index 000000000..6adb3f58a
--- /dev/null
+++ b/packages/python-sdk/envd/permissions/permissions_pb2.pyi
@@ -0,0 +1,11 @@
+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/envd/process/process_connect.py b/packages/python-sdk/envd/process/process_connect.py
new file mode 100644
index 000000000..76b7108c1
--- /dev/null
+++ b/packages/python-sdk/envd/process/process_connect.py
@@ -0,0 +1,89 @@
+# Code generated by protoc-gen-connect-python 0.1.0.dev2, DO NOT EDIT.
+from typing import Any, Generator
+
+import connect
+
+from envd.process import process_pb2 as envd_dot_process_dot_process__pb2
+
+ProcessServiceName = "envd.process.ProcessService"
+
+
+class ProcessServiceClient:
+ def __init__(self, base_url, *, pool=None, compressor=None, json=False, **opts):
+ self._list = connect.Client(
+ pool=pool,
+ url=f"{base_url}/{ProcessServiceName}/List",
+ response_type=envd_dot_process_dot_process__pb2.ListResponse,
+ compressor=compressor,
+ json=json,
+ **opts
+ )
+ self._connect = connect.Client(
+ pool=pool,
+ url=f"{base_url}/{ProcessServiceName}/Connect",
+ response_type=envd_dot_process_dot_process__pb2.ConnectResponse,
+ compressor=compressor,
+ json=json,
+ **opts
+ )
+ self._start = connect.Client(
+ pool=pool,
+ url=f"{base_url}/{ProcessServiceName}/Start",
+ response_type=envd_dot_process_dot_process__pb2.StartResponse,
+ compressor=compressor,
+ json=json,
+ **opts
+ )
+ self._update = connect.Client(
+ pool=pool,
+ url=f"{base_url}/{ProcessServiceName}/Update",
+ response_type=envd_dot_process_dot_process__pb2.UpdateResponse,
+ compressor=compressor,
+ json=json,
+ **opts
+ )
+ self._stream_input = connect.Client(
+ pool=pool,
+ url=f"{base_url}/{ProcessServiceName}/StreamInput",
+ response_type=envd_dot_process_dot_process__pb2.StreamInputResponse,
+ compressor=compressor,
+ json=json,
+ **opts
+ )
+ self._send_input = connect.Client(
+ pool=pool,
+ url=f"{base_url}/{ProcessServiceName}/SendInput",
+ response_type=envd_dot_process_dot_process__pb2.SendInputResponse,
+ compressor=compressor,
+ json=json,
+ **opts
+ )
+ self._send_signal = connect.Client(
+ pool=pool,
+ url=f"{base_url}/{ProcessServiceName}/SendSignal",
+ response_type=envd_dot_process_dot_process__pb2.SendSignalResponse,
+ compressor=compressor,
+ json=json,
+ **opts
+ )
+
+ def list(self, req: envd_dot_process_dot_process__pb2.ListRequest, **opts) -> envd_dot_process_dot_process__pb2.ListResponse:
+ return self._list.call_unary(req, **opts)
+
+ def connect(self, req: envd_dot_process_dot_process__pb2.ConnectRequest , **opts) -> Generator[envd_dot_process_dot_process__pb2.ConnectResponse, Any, None]:
+ return self._connect.call_server_stream(req, **opts)
+
+ def start(self, req: envd_dot_process_dot_process__pb2.StartRequest , **opts) -> Generator[envd_dot_process_dot_process__pb2.StartResponse, Any, None]:
+ return self._start.call_server_stream(req, **opts)
+
+ def update(self, req: envd_dot_process_dot_process__pb2.UpdateRequest, **opts) -> envd_dot_process_dot_process__pb2.UpdateResponse:
+ return self._update.call_unary(req, **opts)
+
+ def stream_input(self, req: envd_dot_process_dot_process__pb2.StreamInputRequest, **opts) -> envd_dot_process_dot_process__pb2.StreamInputResponse:
+ return self._stream_input.call_client_stream(req, **opts)
+
+ def send_input(self, req: envd_dot_process_dot_process__pb2.SendInputRequest, **opts) -> envd_dot_process_dot_process__pb2.SendInputResponse:
+ return self._send_input.call_unary(req, **opts)
+
+ def send_signal(self, req: envd_dot_process_dot_process__pb2.SendSignalRequest, **opts) -> envd_dot_process_dot_process__pb2.SendSignalResponse:
+ return self._send_signal.call_unary(req, **opts)
diff --git a/packages/python-sdk/envd/process/process_pb2.py b/packages/python-sdk/envd/process/process_pb2.py
new file mode 100644
index 000000000..a5ee91b98
--- /dev/null
+++ b/packages/python-sdk/envd/process/process_pb2.py
@@ -0,0 +1,86 @@
+# -*- coding: utf-8 -*-
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: envd/process/process.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()
+
+
+from envd.permissions import permissions_pb2 as envd_dot_permissions_dot_permissions__pb2
+
+
+DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1a\x65nvd/process/process.proto\x12\x0c\x65nvd.process\x1a\"envd/permissions/permissions.proto\"a\n\x03PTY\x12*\n\x04size\x18\x01 \x01(\x0b\x32\x16.envd.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\"\xc8\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\x39\n\x04\x65nvs\x18\x03 \x03(\x0b\x32%.envd.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\"s\n\x0bProcessInfo\x12\x33\n\x06\x63onfig\x18\x01 \x01(\x0b\x32\x1b.envd.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\"G\n\x0cListResponse\x12\x37\n\tprocesses\x18\x01 \x03(\x0b\x32\x19.envd.process.ProcessInfoR\tprocesses\"\xc2\x01\n\x0cStartRequest\x12\x35\n\x07process\x18\x01 \x01(\x0b\x32\x1b.envd.process.ProcessConfigR\x07process\x12(\n\x03pty\x18\x02 \x01(\x0b\x32\x11.envd.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\x16.envd.permissions.UserR\x04userB\x06\n\x04_ptyB\x06\n\x04_tag\"z\n\rUpdateRequest\x12\x37\n\x07process\x18\x01 \x01(\x0b\x32\x1d.envd.process.ProcessSelectorR\x07process\x12(\n\x03pty\x18\x02 \x01(\x0b\x32\x11.envd.process.PTYH\x00R\x03pty\x88\x01\x01\x42\x06\n\x04_pty\"\x10\n\x0eUpdateResponse\"\xd1\x03\n\x0cProcessEvent\x12=\n\x05start\x18\x01 \x01(\x0b\x32%.envd.process.ProcessEvent.StartEventH\x00R\x05start\x12:\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32$.envd.process.ProcessEvent.DataEventH\x00R\x04\x64\x61ta\x12\x37\n\x03\x65nd\x18\x03 \x01(\x0b\x32#.envd.process.ProcessEvent.EndEventH\x00R\x03\x65nd\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\x84\x01\n\x08\x45ndEvent\x12\x1b\n\texit_code\x18\x01 \x01(\x11R\x08\x65xitCode\x12\x1e\n\nterminated\x18\x02 \x01(\x08R\nterminated\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_errorB\x07\n\x05\x65vent\"A\n\rStartResponse\x12\x30\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x1a.envd.process.ProcessEventR\x05\x65vent\"C\n\x0f\x43onnectResponse\x12\x30\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x1a.envd.process.ProcessEventR\x05\x65vent\"}\n\x10SendInputRequest\x12\x37\n\x07process\x18\x01 \x01(\x0b\x32\x1d.envd.process.ProcessSelectorR\x07process\x12\x30\n\x05input\x18\x02 \x01(\x0b\x32\x1a.envd.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\"\xaa\x02\n\x12StreamInputRequest\x12\x43\n\x05start\x18\x01 \x01(\x0b\x32+.envd.process.StreamInputRequest.StartEventH\x00R\x05start\x12@\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32*.envd.process.StreamInputRequest.DataEventH\x00R\x04\x64\x61ta\x1a\x45\n\nStartEvent\x12\x37\n\x07process\x18\x01 \x01(\x0b\x32\x1d.envd.process.ProcessSelectorR\x07process\x1a=\n\tDataEvent\x12\x30\n\x05input\x18\x02 \x01(\x0b\x32\x1a.envd.process.ProcessInputR\x05inputB\x07\n\x05\x65vent\"\x15\n\x13StreamInputResponse\"z\n\x11SendSignalRequest\x12\x37\n\x07process\x18\x01 \x01(\x0b\x32\x1d.envd.process.ProcessSelectorR\x07process\x12,\n\x06signal\x18\x02 \x01(\x0e\x32\x14.envd.process.SignalR\x06signal\"\x14\n\x12SendSignalResponse\"I\n\x0e\x43onnectRequest\x12\x37\n\x07process\x18\x01 \x01(\x0b\x32\x1d.envd.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\x97\x04\n\x0eProcessService\x12=\n\x04List\x12\x19.envd.process.ListRequest\x1a\x1a.envd.process.ListResponse\x12H\n\x07\x43onnect\x12\x1c.envd.process.ConnectRequest\x1a\x1d.envd.process.ConnectResponse0\x01\x12\x42\n\x05Start\x12\x1a.envd.process.StartRequest\x1a\x1b.envd.process.StartResponse0\x01\x12\x43\n\x06Update\x12\x1b.envd.process.UpdateRequest\x1a\x1c.envd.process.UpdateResponse\x12T\n\x0bStreamInput\x12 .envd.process.StreamInputRequest\x1a!.envd.process.StreamInputResponse(\x01\x12L\n\tSendInput\x12\x1e.envd.process.SendInputRequest\x1a\x1f.envd.process.SendInputResponse\x12O\n\nSendSignal\x12\x1f.envd.process.SendSignalRequest\x1a .envd.process.SendSignalResponseBq\n\x10\x63om.envd.processB\x0cProcessProtoP\x01\xa2\x02\x03\x45PX\xaa\x02\x0c\x45nvd.Process\xca\x02\x0c\x45nvd\\Process\xe2\x02\x18\x45nvd\\Process\\GPBMetadata\xea\x02\rEnvd::Processb\x06proto3')
+
+_globals = globals()
+_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
+_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'envd.process.process_pb2', _globals)
+if not _descriptor._USE_C_DESCRIPTORS:
+ _globals['DESCRIPTOR']._loaded_options = None
+ _globals['DESCRIPTOR']._serialized_options = b'\n\020com.envd.processB\014ProcessProtoP\001\242\002\003EPX\252\002\014Envd.Process\312\002\014Envd\\Process\342\002\030Envd\\Process\\GPBMetadata\352\002\rEnvd::Process'
+ _globals['_PROCESSCONFIG_ENVSENTRY']._loaded_options = None
+ _globals['_PROCESSCONFIG_ENVSENTRY']._serialized_options = b'8\001'
+ _globals['_SIGNAL']._serialized_start=2363
+ _globals['_SIGNAL']._serialized_end=2435
+ _globals['_PTY']._serialized_start=80
+ _globals['_PTY']._serialized_end=177
+ _globals['_PTY_SIZE']._serialized_start=131
+ _globals['_PTY_SIZE']._serialized_end=177
+ _globals['_PROCESSCONFIG']._serialized_start=180
+ _globals['_PROCESSCONFIG']._serialized_end=380
+ _globals['_PROCESSCONFIG_ENVSENTRY']._serialized_start=317
+ _globals['_PROCESSCONFIG_ENVSENTRY']._serialized_end=372
+ _globals['_LISTREQUEST']._serialized_start=382
+ _globals['_LISTREQUEST']._serialized_end=395
+ _globals['_PROCESSINFO']._serialized_start=397
+ _globals['_PROCESSINFO']._serialized_end=512
+ _globals['_LISTRESPONSE']._serialized_start=514
+ _globals['_LISTRESPONSE']._serialized_end=585
+ _globals['_STARTREQUEST']._serialized_start=588
+ _globals['_STARTREQUEST']._serialized_end=782
+ _globals['_UPDATEREQUEST']._serialized_start=784
+ _globals['_UPDATEREQUEST']._serialized_end=906
+ _globals['_UPDATERESPONSE']._serialized_start=908
+ _globals['_UPDATERESPONSE']._serialized_end=924
+ _globals['_PROCESSEVENT']._serialized_start=927
+ _globals['_PROCESSEVENT']._serialized_end=1392
+ _globals['_PROCESSEVENT_STARTEVENT']._serialized_start=1123
+ _globals['_PROCESSEVENT_STARTEVENT']._serialized_end=1153
+ _globals['_PROCESSEVENT_DATAEVENT']._serialized_start=1155
+ _globals['_PROCESSEVENT_DATAEVENT']._serialized_end=1248
+ _globals['_PROCESSEVENT_ENDEVENT']._serialized_start=1251
+ _globals['_PROCESSEVENT_ENDEVENT']._serialized_end=1383
+ _globals['_STARTRESPONSE']._serialized_start=1394
+ _globals['_STARTRESPONSE']._serialized_end=1459
+ _globals['_CONNECTRESPONSE']._serialized_start=1461
+ _globals['_CONNECTRESPONSE']._serialized_end=1528
+ _globals['_SENDINPUTREQUEST']._serialized_start=1530
+ _globals['_SENDINPUTREQUEST']._serialized_end=1655
+ _globals['_SENDINPUTRESPONSE']._serialized_start=1657
+ _globals['_SENDINPUTRESPONSE']._serialized_end=1676
+ _globals['_PROCESSINPUT']._serialized_start=1678
+ _globals['_PROCESSINPUT']._serialized_end=1745
+ _globals['_STREAMINPUTREQUEST']._serialized_start=1748
+ _globals['_STREAMINPUTREQUEST']._serialized_end=2046
+ _globals['_STREAMINPUTREQUEST_STARTEVENT']._serialized_start=1905
+ _globals['_STREAMINPUTREQUEST_STARTEVENT']._serialized_end=1974
+ _globals['_STREAMINPUTREQUEST_DATAEVENT']._serialized_start=1976
+ _globals['_STREAMINPUTREQUEST_DATAEVENT']._serialized_end=2037
+ _globals['_STREAMINPUTRESPONSE']._serialized_start=2048
+ _globals['_STREAMINPUTRESPONSE']._serialized_end=2069
+ _globals['_SENDSIGNALREQUEST']._serialized_start=2071
+ _globals['_SENDSIGNALREQUEST']._serialized_end=2193
+ _globals['_SENDSIGNALRESPONSE']._serialized_start=2195
+ _globals['_SENDSIGNALRESPONSE']._serialized_end=2215
+ _globals['_CONNECTREQUEST']._serialized_start=2217
+ _globals['_CONNECTREQUEST']._serialized_end=2290
+ _globals['_PROCESSSELECTOR']._serialized_start=2292
+ _globals['_PROCESSSELECTOR']._serialized_end=2361
+ _globals['_PROCESSSERVICE']._serialized_start=2438
+ _globals['_PROCESSSERVICE']._serialized_end=2973
+# @@protoc_insertion_point(module_scope)
diff --git a/packages/python-sdk/envd/process/v1/process_pb2.pyi b/packages/python-sdk/envd/process/process_pb2.pyi
similarity index 60%
rename from packages/python-sdk/envd/process/v1/process_pb2.pyi
rename to packages/python-sdk/envd/process/process_pb2.pyi
index 6338afd33..f2719f51c 100644
--- a/packages/python-sdk/envd/process/v1/process_pb2.pyi
+++ b/packages/python-sdk/envd/process/process_pb2.pyi
@@ -1,14 +1,9 @@
+from 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
@@ -17,39 +12,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]
@@ -58,46 +46,39 @@ 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__ = ()
def __init__(self) -> None: ...
+class ProcessInfo(_message.Message):
+ __slots__ = ("config", "pid", "tag")
+ CONFIG_FIELD_NUMBER: _ClassVar[int]
+ PID_FIELD_NUMBER: _ClassVar[int]
+ TAG_FIELD_NUMBER: _ClassVar[int]
+ config: ProcessConfig
+ pid: int
+ tag: str
+ 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[ProcessConfig]
- def __init__(
- self, processes: _Optional[_Iterable[_Union[ProcessConfig, _Mapping]]] = ...
- ) -> None: ...
-
-class Credential(_message.Message):
- __slots__ = ("username",)
- USERNAME_FIELD_NUMBER: _ClassVar[int]
- username: str
- def __init__(self, username: _Optional[str] = ...) -> None: ...
+ processes: _containers.RepeatedCompositeFieldContainer[ProcessInfo]
+ def __init__(self, processes: _Optional[_Iterable[_Union[ProcessInfo, _Mapping]]] = ...) -> None: ...
class StartRequest(_message.Message):
- __slots__ = ("process", "pty", "owner")
+ __slots__ = ("process", "pty", "tag", "user")
PROCESS_FIELD_NUMBER: _ClassVar[int]
PTY_FIELD_NUMBER: _ClassVar[int]
- OWNER_FIELD_NUMBER: _ClassVar[int]
+ TAG_FIELD_NUMBER: _ClassVar[int]
+ USER_FIELD_NUMBER: _ClassVar[int]
process: ProcessConfig
pty: PTY
- owner: Credential
- def __init__(
- self,
- process: _Optional[_Union[ProcessConfig, _Mapping]] = ...,
- pty: _Optional[_Union[PTY, _Mapping]] = ...,
- owner: _Optional[_Union[Credential, _Mapping]] = ...,
- ) -> None: ...
+ 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: ...
class UpdateRequest(_message.Message):
__slots__ = ("process", "pty")
@@ -105,11 +86,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__ = ()
@@ -117,13 +94,11 @@ class UpdateResponse(_message.Message):
class ProcessEvent(_message.Message):
__slots__ = ("start", "data", "end")
-
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]
@@ -132,13 +107,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", "terminated", "status", "error")
EXIT_CODE_FIELD_NUMBER: _ClassVar[int]
@@ -149,41 +118,26 @@ class ProcessEvent(_message.Message):
terminated: bool
status: str
error: str
- def __init__(
- self,
- exit_code: _Optional[int] = ...,
- terminated: bool = ...,
- status: _Optional[str] = ...,
- error: _Optional[str] = ...,
- ) -> None: ...
+ def __init__(self, exit_code: _Optional[int] = ..., terminated: bool = ..., status: _Optional[str] = ..., error: _Optional[str] = ...) -> None: ...
START_FIELD_NUMBER: _ClassVar[int]
DATA_FIELD_NUMBER: _ClassVar[int]
END_FIELD_NUMBER: _ClassVar[int]
start: ProcessEvent.StartEvent
data: ProcessEvent.DataEvent
end: ProcessEvent.EndEvent
- def __init__(
- self,
- start: _Optional[_Union[ProcessEvent.StartEvent, _Mapping]] = ...,
- data: _Optional[_Union[ProcessEvent.DataEvent, _Mapping]] = ...,
- end: _Optional[_Union[ProcessEvent.EndEvent, _Mapping]] = ...,
- ) -> None: ...
+ def __init__(self, start: _Optional[_Union[ProcessEvent.StartEvent, _Mapping]] = ..., data: _Optional[_Union[ProcessEvent.DataEvent, _Mapping]] = ..., end: _Optional[_Union[ProcessEvent.EndEvent, _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")
@@ -191,11 +145,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__ = ()
@@ -207,37 +157,25 @@ 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")
-
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: ...
START_FIELD_NUMBER: _ClassVar[int]
DATA_FIELD_NUMBER: _ClassVar[int]
start: StreamInputRequest.StartEvent
data: StreamInputRequest.DataEvent
- def __init__(
- self,
- start: _Optional[_Union[StreamInputRequest.StartEvent, _Mapping]] = ...,
- data: _Optional[_Union[StreamInputRequest.DataEvent, _Mapping]] = ...,
- ) -> None: ...
+ def __init__(self, start: _Optional[_Union[StreamInputRequest.StartEvent, _Mapping]] = ..., data: _Optional[_Union[StreamInputRequest.DataEvent, _Mapping]] = ...) -> None: ...
class StreamInputResponse(_message.Message):
__slots__ = ()
@@ -249,11 +187,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__ = ()
@@ -263,12 +197,12 @@ 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",)
+ __slots__ = ("pid", "tag")
PID_FIELD_NUMBER: _ClassVar[int]
+ TAG_FIELD_NUMBER: _ClassVar[int]
pid: int
- def __init__(self, pid: _Optional[int] = ...) -> None: ...
+ tag: str
+ def __init__(self, pid: _Optional[int] = ..., tag: _Optional[str] = ...) -> None: ...
diff --git a/packages/python-sdk/envd/process/v1/process_connect.py b/packages/python-sdk/envd/process/v1/process_connect.py
deleted file mode 100644
index cd99291bf..000000000
--- a/packages/python-sdk/envd/process/v1/process_connect.py
+++ /dev/null
@@ -1,103 +0,0 @@
-# Code generated by protoc-gen-connect-python 0.1.0.dev2, DO NOT EDIT.
-from typing import Any, Generator
-
-import connect
-
-from envd.process.v1 import process_pb2 as envd_dot_process_dot_v1_dot_process__pb2
-
-ProcessServiceName = "envd.process.v1.ProcessService"
-
-
-class ProcessServiceClient:
- def __init__(self, base_url, *, pool=None, compressor=None, json=False, **opts):
- self._list = connect.Client(
- pool=pool,
- url=f"{base_url}/{ProcessServiceName}/List",
- response_type=envd_dot_process_dot_v1_dot_process__pb2.ListResponse,
- compressor=compressor,
- json=json,
- **opts,
- )
- self._connect = connect.Client(
- pool=pool,
- url=f"{base_url}/{ProcessServiceName}/Connect",
- response_type=envd_dot_process_dot_v1_dot_process__pb2.ConnectResponse,
- compressor=compressor,
- json=json,
- **opts,
- )
- self._start = connect.Client(
- pool=pool,
- url=f"{base_url}/{ProcessServiceName}/Start",
- response_type=envd_dot_process_dot_v1_dot_process__pb2.StartResponse,
- compressor=compressor,
- json=json,
- **opts,
- )
- self._update = connect.Client(
- pool=pool,
- url=f"{base_url}/{ProcessServiceName}/Update",
- response_type=envd_dot_process_dot_v1_dot_process__pb2.UpdateResponse,
- compressor=compressor,
- json=json,
- **opts,
- )
- self._stream_input = connect.Client(
- pool=pool,
- url=f"{base_url}/{ProcessServiceName}/StreamInput",
- response_type=envd_dot_process_dot_v1_dot_process__pb2.StreamInputResponse,
- compressor=compressor,
- json=json,
- **opts,
- )
- self._send_input = connect.Client(
- pool=pool,
- url=f"{base_url}/{ProcessServiceName}/SendInput",
- response_type=envd_dot_process_dot_v1_dot_process__pb2.SendInputResponse,
- compressor=compressor,
- json=json,
- **opts,
- )
- self._send_signal = connect.Client(
- pool=pool,
- url=f"{base_url}/{ProcessServiceName}/SendSignal",
- response_type=envd_dot_process_dot_v1_dot_process__pb2.SendSignalResponse,
- compressor=compressor,
- json=json,
- **opts,
- )
-
- def list(
- self, req: envd_dot_process_dot_v1_dot_process__pb2.ListRequest, **opts
- ) -> envd_dot_process_dot_v1_dot_process__pb2.ListResponse:
- return self._list.call_unary(req, **opts)
-
- def connect(
- self, req: envd_dot_process_dot_v1_dot_process__pb2.ConnectRequest, **opts
- ) -> Generator[envd_dot_process_dot_v1_dot_process__pb2.ConnectResponse, Any, None]:
- return self._connect.call_server_stream(req, **opts)
-
- def start(
- self, req: envd_dot_process_dot_v1_dot_process__pb2.StartRequest, **opts
- ) -> Generator[envd_dot_process_dot_v1_dot_process__pb2.StartResponse, Any, None]:
- return self._start.call_server_stream(req, **opts)
-
- def update(
- self, req: envd_dot_process_dot_v1_dot_process__pb2.UpdateRequest, **opts
- ) -> envd_dot_process_dot_v1_dot_process__pb2.UpdateResponse:
- return self._update.call_unary(req, **opts)
-
- def stream_input(
- self, req: envd_dot_process_dot_v1_dot_process__pb2.StreamInputRequest, **opts
- ) -> envd_dot_process_dot_v1_dot_process__pb2.StreamInputResponse:
- return self._stream_input.call_client_stream(req, **opts)
-
- def send_input(
- self, req: envd_dot_process_dot_v1_dot_process__pb2.SendInputRequest, **opts
- ) -> envd_dot_process_dot_v1_dot_process__pb2.SendInputResponse:
- return self._send_input.call_unary(req, **opts)
-
- def send_signal(
- self, req: envd_dot_process_dot_v1_dot_process__pb2.SendSignalRequest, **opts
- ) -> envd_dot_process_dot_v1_dot_process__pb2.SendSignalResponse:
- return self._send_signal.call_unary(req, **opts)
diff --git a/packages/python-sdk/envd/process/v1/process_pb2.py b/packages/python-sdk/envd/process/v1/process_pb2.py
deleted file mode 100644
index 81f2ac42d..000000000
--- a/packages/python-sdk/envd/process/v1/process_pb2.py
+++ /dev/null
@@ -1,90 +0,0 @@
-# -*- coding: utf-8 -*-
-# Generated by the protocol buffer compiler. DO NOT EDIT!
-# source: envd/process/v1/process.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\x1d\x65nvd/process/v1/process.proto\x12\x0f\x65nvd.process.v1"d\n\x03PTY\x12-\n\x04size\x18\x01 \x01(\x0b\x32\x19.envd.process.v1.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"\xcb\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<\n\x04\x65nvs\x18\x03 \x03(\x0b\x32(.envd.process.v1.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"L\n\x0cListResponse\x12<\n\tprocesses\x18\x01 \x03(\x0b\x32\x1e.envd.process.v1.ProcessConfigR\tprocesses"8\n\nCredential\x12\x1c\n\x08username\x18\x01 \x01(\tH\x00R\x08usernameB\x0c\n\ncredential"\xb0\x01\n\x0cStartRequest\x12\x38\n\x07process\x18\x01 \x01(\x0b\x32\x1e.envd.process.v1.ProcessConfigR\x07process\x12+\n\x03pty\x18\x02 \x01(\x0b\x32\x14.envd.process.v1.PTYH\x00R\x03pty\x88\x01\x01\x12\x31\n\x05owner\x18\x03 \x01(\x0b\x32\x1b.envd.process.v1.CredentialR\x05ownerB\x06\n\x04_pty"\x80\x01\n\rUpdateRequest\x12:\n\x07process\x18\x01 \x01(\x0b\x32 .envd.process.v1.ProcessSelectorR\x07process\x12+\n\x03pty\x18\x02 \x01(\x0b\x32\x14.envd.process.v1.PTYH\x00R\x03pty\x88\x01\x01\x42\x06\n\x04_pty"\x10\n\x0eUpdateResponse"\xda\x03\n\x0cProcessEvent\x12@\n\x05start\x18\x01 \x01(\x0b\x32(.envd.process.v1.ProcessEvent.StartEventH\x00R\x05start\x12=\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32\'.envd.process.v1.ProcessEvent.DataEventH\x00R\x04\x64\x61ta\x12:\n\x03\x65nd\x18\x03 \x01(\x0b\x32&.envd.process.v1.ProcessEvent.EndEventH\x00R\x03\x65nd\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\x84\x01\n\x08\x45ndEvent\x12\x1b\n\texit_code\x18\x01 \x01(\x11R\x08\x65xitCode\x12\x1e\n\nterminated\x18\x02 \x01(\x08R\nterminated\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_errorB\x07\n\x05\x65vent"D\n\rStartResponse\x12\x33\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x1d.envd.process.v1.ProcessEventR\x05\x65vent"F\n\x0f\x43onnectResponse\x12\x33\n\x05\x65vent\x18\x01 \x01(\x0b\x32\x1d.envd.process.v1.ProcessEventR\x05\x65vent"\x83\x01\n\x10SendInputRequest\x12:\n\x07process\x18\x01 \x01(\x0b\x32 .envd.process.v1.ProcessSelectorR\x07process\x12\x33\n\x05input\x18\x02 \x01(\x0b\x32\x1d.envd.process.v1.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"\xb6\x02\n\x12StreamInputRequest\x12\x46\n\x05start\x18\x01 \x01(\x0b\x32..envd.process.v1.StreamInputRequest.StartEventH\x00R\x05start\x12\x43\n\x04\x64\x61ta\x18\x02 \x01(\x0b\x32-.envd.process.v1.StreamInputRequest.DataEventH\x00R\x04\x64\x61ta\x1aH\n\nStartEvent\x12:\n\x07process\x18\x01 \x01(\x0b\x32 .envd.process.v1.ProcessSelectorR\x07process\x1a@\n\tDataEvent\x12\x33\n\x05input\x18\x02 \x01(\x0b\x32\x1d.envd.process.v1.ProcessInputR\x05inputB\x07\n\x05\x65vent"\x15\n\x13StreamInputResponse"\x80\x01\n\x11SendSignalRequest\x12:\n\x07process\x18\x01 \x01(\x0b\x32 .envd.process.v1.ProcessSelectorR\x07process\x12/\n\x06signal\x18\x02 \x01(\x0e\x32\x17.envd.process.v1.SignalR\x06signal"\x14\n\x12SendSignalResponse"L\n\x0e\x43onnectRequest\x12:\n\x07process\x18\x01 \x01(\x0b\x32 .envd.process.v1.ProcessSelectorR\x07process"1\n\x0fProcessSelector\x12\x12\n\x03pid\x18\x01 \x01(\rH\x00R\x03pidB\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\xc1\x04\n\x0eProcessService\x12\x43\n\x04List\x12\x1c.envd.process.v1.ListRequest\x1a\x1d.envd.process.v1.ListResponse\x12N\n\x07\x43onnect\x12\x1f.envd.process.v1.ConnectRequest\x1a .envd.process.v1.ConnectResponse0\x01\x12H\n\x05Start\x12\x1d.envd.process.v1.StartRequest\x1a\x1e.envd.process.v1.StartResponse0\x01\x12I\n\x06Update\x12\x1e.envd.process.v1.UpdateRequest\x1a\x1f.envd.process.v1.UpdateResponse\x12Z\n\x0bStreamInput\x12#.envd.process.v1.StreamInputRequest\x1a$.envd.process.v1.StreamInputResponse(\x01\x12R\n\tSendInput\x12!.envd.process.v1.SendInputRequest\x1a".envd.process.v1.SendInputResponse\x12U\n\nSendSignal\x12".envd.process.v1.SendSignalRequest\x1a#.envd.process.v1.SendSignalResponseB\x81\x01\n\x13\x63om.envd.process.v1B\x0cProcessProtoP\x01\xa2\x02\x03\x45PX\xaa\x02\x0f\x45nvd.Process.V1\xca\x02\x0f\x45nvd\\Process\\V1\xe2\x02\x1b\x45nvd\\Process\\V1\\GPBMetadata\xea\x02\x11\x45nvd::Process::V1b\x06proto3'
-)
-
-_globals = globals()
-_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
-_builder.BuildTopDescriptorsAndMessages(
- DESCRIPTOR, "envd.process.v1.process_pb2", _globals
-)
-if not _descriptor._USE_C_DESCRIPTORS:
- _globals["DESCRIPTOR"]._loaded_options = None
- _globals[
- "DESCRIPTOR"
- ]._serialized_options = b"\n\023com.envd.process.v1B\014ProcessProtoP\001\242\002\003EPX\252\002\017Envd.Process.V1\312\002\017Envd\\Process\\V1\342\002\033Envd\\Process\\V1\\GPBMetadata\352\002\021Envd::Process::V1"
- _globals["_PROCESSCONFIG_ENVSENTRY"]._loaded_options = None
- _globals["_PROCESSCONFIG_ENVSENTRY"]._serialized_options = b"8\001"
- _globals["_SIGNAL"]._serialized_start = 2298
- _globals["_SIGNAL"]._serialized_end = 2370
- _globals["_PTY"]._serialized_start = 50
- _globals["_PTY"]._serialized_end = 150
- _globals["_PTY_SIZE"]._serialized_start = 104
- _globals["_PTY_SIZE"]._serialized_end = 150
- _globals["_PROCESSCONFIG"]._serialized_start = 153
- _globals["_PROCESSCONFIG"]._serialized_end = 356
- _globals["_PROCESSCONFIG_ENVSENTRY"]._serialized_start = 293
- _globals["_PROCESSCONFIG_ENVSENTRY"]._serialized_end = 348
- _globals["_LISTREQUEST"]._serialized_start = 358
- _globals["_LISTREQUEST"]._serialized_end = 371
- _globals["_LISTRESPONSE"]._serialized_start = 373
- _globals["_LISTRESPONSE"]._serialized_end = 449
- _globals["_CREDENTIAL"]._serialized_start = 451
- _globals["_CREDENTIAL"]._serialized_end = 507
- _globals["_STARTREQUEST"]._serialized_start = 510
- _globals["_STARTREQUEST"]._serialized_end = 686
- _globals["_UPDATEREQUEST"]._serialized_start = 689
- _globals["_UPDATEREQUEST"]._serialized_end = 817
- _globals["_UPDATERESPONSE"]._serialized_start = 819
- _globals["_UPDATERESPONSE"]._serialized_end = 835
- _globals["_PROCESSEVENT"]._serialized_start = 838
- _globals["_PROCESSEVENT"]._serialized_end = 1312
- _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 = 1171
- _globals["_PROCESSEVENT_ENDEVENT"]._serialized_end = 1303
- _globals["_STARTRESPONSE"]._serialized_start = 1314
- _globals["_STARTRESPONSE"]._serialized_end = 1382
- _globals["_CONNECTRESPONSE"]._serialized_start = 1384
- _globals["_CONNECTRESPONSE"]._serialized_end = 1454
- _globals["_SENDINPUTREQUEST"]._serialized_start = 1457
- _globals["_SENDINPUTREQUEST"]._serialized_end = 1588
- _globals["_SENDINPUTRESPONSE"]._serialized_start = 1590
- _globals["_SENDINPUTRESPONSE"]._serialized_end = 1609
- _globals["_PROCESSINPUT"]._serialized_start = 1611
- _globals["_PROCESSINPUT"]._serialized_end = 1678
- _globals["_STREAMINPUTREQUEST"]._serialized_start = 1681
- _globals["_STREAMINPUTREQUEST"]._serialized_end = 1991
- _globals["_STREAMINPUTREQUEST_STARTEVENT"]._serialized_start = 1844
- _globals["_STREAMINPUTREQUEST_STARTEVENT"]._serialized_end = 1916
- _globals["_STREAMINPUTREQUEST_DATAEVENT"]._serialized_start = 1918
- _globals["_STREAMINPUTREQUEST_DATAEVENT"]._serialized_end = 1982
- _globals["_STREAMINPUTRESPONSE"]._serialized_start = 1993
- _globals["_STREAMINPUTRESPONSE"]._serialized_end = 2014
- _globals["_SENDSIGNALREQUEST"]._serialized_start = 2017
- _globals["_SENDSIGNALREQUEST"]._serialized_end = 2145
- _globals["_SENDSIGNALRESPONSE"]._serialized_start = 2147
- _globals["_SENDSIGNALRESPONSE"]._serialized_end = 2167
- _globals["_CONNECTREQUEST"]._serialized_start = 2169
- _globals["_CONNECTREQUEST"]._serialized_end = 2245
- _globals["_PROCESSSELECTOR"]._serialized_start = 2247
- _globals["_PROCESSSELECTOR"]._serialized_end = 2296
- _globals["_PROCESSSERVICE"]._serialized_start = 2373
- _globals["_PROCESSSERVICE"]._serialized_end = 2950
-# @@protoc_insertion_point(module_scope)
diff --git a/packages/python-sdk/poetry.lock b/packages/python-sdk/poetry.lock
index 83de720cf..6b2dbdf09 100644
--- a/packages/python-sdk/poetry.lock
+++ b/packages/python-sdk/poetry.lock
@@ -72,17 +72,6 @@ d = ["aiohttp (>=3.7.4)", "aiohttp (>=3.7.4,!=3.9.0)"]
jupyter = ["ipython (>=7.8.0)", "tokenize-rt (>=3.2.0)"]
uvloop = ["uvloop (>=0.15.2)"]
-[[package]]
-name = "certifi"
-version = "2024.2.2"
-description = "Python package for providing Mozilla's CA Bundle."
-optional = false
-python-versions = ">=3.6"
-files = [
- {file = "certifi-2024.2.2-py3-none-any.whl", hash = "sha256:dc383c07b76109f368f6106eee2b593b04a011ea4d55f652c6ca24a754d1cdd1"},
- {file = "certifi-2024.2.2.tar.gz", hash = "sha256:0569859f95fc761b18b45ef421b1290a0f65f147e92a1e5eb3e635f9a5e4e66f"},
-]
-
[[package]]
name = "click"
version = "8.1.7"
@@ -136,38 +125,6 @@ files = [
[package.extras]
testing = ["hatch", "pre-commit", "pytest", "tox"]
-[[package]]
-name = "h11"
-version = "0.14.0"
-description = "A pure-Python, bring-your-own-I/O implementation of HTTP/1.1"
-optional = false
-python-versions = ">=3.7"
-files = [
- {file = "h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761"},
- {file = "h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d"},
-]
-
-[[package]]
-name = "httpcore"
-version = "1.0.5"
-description = "A minimal low-level HTTP client."
-optional = false
-python-versions = ">=3.8"
-files = [
- {file = "httpcore-1.0.5-py3-none-any.whl", hash = "sha256:421f18bac248b25d310f3cacd198d55b8e6125c107797b609ff9b7a6ba7991b5"},
- {file = "httpcore-1.0.5.tar.gz", hash = "sha256:34a38e2f9291467ee3b44e89dd52615370e152954ba21721378a87b2960f7a61"},
-]
-
-[package.dependencies]
-certifi = "*"
-h11 = ">=0.13,<0.15"
-
-[package.extras]
-asyncio = ["anyio (>=4.0,<5.0)"]
-http2 = ["h2 (>=3,<5)"]
-socks = ["socksio (==1.*)"]
-trio = ["trio (>=0.22.0,<0.26.0)"]
-
[[package]]
name = "iniconfig"
version = "2.0.0"
@@ -179,16 +136,6 @@ files = [
{file = "iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3"},
]
-[[package]]
-name = "multidispatch"
-version = "0.2"
-description = "Create multi-dispatch functions."
-optional = false
-python-versions = "*"
-files = [
- {file = "multidispatch-0.2.tar.gz", hash = "sha256:85883632d08f7226091e488d0a070e3a21365367b9abd66281dd0e1839e4edcf"},
-]
-
[[package]]
name = "mypy-extensions"
version = "1.0.0"
@@ -521,4 +468,4 @@ zstd = ["zstandard (>=0.18.0)"]
[metadata]
lock-version = "2.0"
python-versions = "^3.8"
-content-hash = "a4ccfb4673be77d73b4e1319aed403aa821ca4c2bf850cadc2a4c5b27e796c9b"
+content-hash = "eb838071e30927583aeaa8ccca676513cfc2c095e715505e0b949627fdf32011"
diff --git a/packages/python-sdk/pyproject.toml b/packages/python-sdk/pyproject.toml
index 2b66fb367..e3607b394 100644
--- a/packages/python-sdk/pyproject.toml
+++ b/packages/python-sdk/pyproject.toml
@@ -17,9 +17,7 @@ python-dateutil = ">=2.8.2"
pydantic = "*"
aenum = ">=3.1.11"
typing-extensions = ">=4.8.0"
-httpcore = "^1.0.5"
protobuf = "^5.26.1"
-multidispatch = "^0.2"
[tool.poetry.group.dev.dependencies]
black = "^23.7.0"
diff --git a/spec/envd/envd.yaml b/spec/envd/envd.yaml
index 89d7b61e8..63def5218 100644
--- a/spec/envd/envd.yaml
+++ b/spec/envd/envd.yaml
@@ -63,9 +63,10 @@ components:
name: user
in: query
required: true
- description: User owning the file
+ description: User used for setting the owner, or resolving relative paths.
schema:
type: string
+ pattern: "^(root|user)$"
requestBodies:
File:
diff --git a/spec/envd/process/process.proto b/spec/envd/process/process.proto
index ccb6be3ff..9e9dbb619 100644
--- a/spec/envd/process/process.proto
+++ b/spec/envd/process/process.proto
@@ -37,15 +37,23 @@ message ProcessConfig {
message ListRequest {}
+
+message ProcessInfo {
+ ProcessConfig config = 1;
+ uint32 pid = 2;
+ optional string tag = 3;
+}
+
message ListResponse {
- repeated ProcessConfig processes = 1;
+ repeated ProcessInfo processes = 1;
}
message StartRequest {
ProcessConfig process = 1;
optional PTY pty = 2;
+ optional string tag = 3;
- permissions.User user = 3;
+ permissions.User user = 4;
}
message UpdateRequest {
@@ -144,5 +152,6 @@ message ConnectRequest {
message ProcessSelector {
oneof selector {
uint32 pid = 1;
+ string tag = 2;
}
}