Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Update spec and JS
Tomas Valentaecf318a3edf6
diff --git a/packages/js-sdk/src/connectionConfig.ts b/packages/js-sdk/src/connectionConfig.tsindex 9af34d6ea..96bab775d 100644--- a/packages/js-sdk/src/connectionConfig.ts+++ b/packages/js-sdk/src/connectionConfig.ts@@ -4,8 +4,6 @@ const API_KEY = process?.env?.E2B_API_KEYconst ACCESS_TOKEN = process?.env?.E2B_ACCESS_TOKENconst REQUEST_TIMEOUT_MS = 30_000 // 30s-// TODO: Add default request timeout that is centralized-export interface ConnectionOpts {apiKey?: stringaccessToken?: string@@ -34,3 +32,5 @@ export class ConnectionConfig {this.apiUrl = this.debug ? 'http://localhost:3000' : `https://api.${this.domain}`}}++export type Username = 'root' | 'user'diff --git a/packages/js-sdk/src/envd/filesystem/v1/filesystem_connect.ts b/packages/js-sdk/src/envd/filesystem/filesystem_connect.tssimilarity index 64%rename from packages/js-sdk/src/envd/filesystem/v1/filesystem_connect.tsrename to packages/js-sdk/src/envd/filesystem/filesystem_connect.tsindex 6bd194472..bf16154a9 100644--- a/packages/js-sdk/src/envd/filesystem/v1/filesystem_connect.ts+++ b/packages/js-sdk/src/envd/filesystem/filesystem_connect.ts@@ -1,5 +1,5 @@// @generated by protoc-gen-connect-es v1.4.0 with parameter "target=ts"-// @generated from file envd/filesystem/v1/filesystem.proto (package envd.filesystem.v1, syntax proto3)+// @generated from file envd/filesystem/filesystem.proto (package envd.filesystem, syntax proto3)/* eslint-disable */// @ts-nocheck@@ -7,13 +7,13 @@ import { ListRequest, ListResponse, RemoveRequest, RemoveResponse, StatRequest,import { MethodKind } from "@bufbuild/protobuf";/**- * @generated from service envd.filesystem.v1.FilesystemService+ * @generated from service envd.filesystem.FilesystemService*/export const FilesystemService = {- typeName: "envd.filesystem.v1.FilesystemService",+ typeName: "envd.filesystem.FilesystemService",methods: {/**- * @generated from rpc envd.filesystem.v1.FilesystemService.Stat+ * @generated from rpc envd.filesystem.FilesystemService.Stat*/stat: {name: "Stat",@@ -22,7 +22,7 @@ export const FilesystemService = {kind: MethodKind.Unary,},/**- * @generated from rpc envd.filesystem.v1.FilesystemService.List+ * @generated from rpc envd.filesystem.FilesystemService.List*/list: {name: "List",@@ -31,7 +31,7 @@ export const FilesystemService = {kind: MethodKind.Unary,},/**- * @generated from rpc envd.filesystem.v1.FilesystemService.Watch+ * @generated from rpc envd.filesystem.FilesystemService.Watch*/watch: {name: "Watch",@@ -40,7 +40,7 @@ export const FilesystemService = {kind: MethodKind.ServerStreaming,},/**- * @generated from rpc envd.filesystem.v1.FilesystemService.Remove+ * @generated from rpc envd.filesystem.FilesystemService.Remove*/remove: {name: "Remove",diff --git a/packages/js-sdk/src/envd/filesystem/v1/filesystem_pb.ts b/packages/js-sdk/src/envd/filesystem/filesystem_pb.tssimilarity index 84%rename from packages/js-sdk/src/envd/filesystem/v1/filesystem_pb.tsrename to packages/js-sdk/src/envd/filesystem/filesystem_pb.tsindex ebfdec853..9b75905d4 100644--- a/packages/js-sdk/src/envd/filesystem/v1/filesystem_pb.ts+++ b/packages/js-sdk/src/envd/filesystem/filesystem_pb.ts@@ -1,13 +1,14 @@// @generated by protoc-gen-es v1.9.0 with parameter "target=ts"-// @generated from file envd/filesystem/v1/filesystem.proto (package envd.filesystem.v1, syntax proto3)+// @generated from file envd/filesystem/filesystem.proto (package envd.filesystem, syntax proto3)/* eslint-disable */// @ts-nocheckimport type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";import { Message, proto3 } from "@bufbuild/protobuf";+import { User } from "../permissions/permissions_pb.js";/**- * @generated from enum envd.filesystem.v1.FileType+ * @generated from enum envd.filesystem.FileType*/export enum FileType {/**@@ -26,14 +27,14 @@ export enum FileType {DIRECTORY = 2,}// Retrieve enum metadata with: proto3.getEnumType(FileType)-proto3.util.setEnumType(FileType, "envd.filesystem.v1.FileType", [+proto3.util.setEnumType(FileType, "envd.filesystem.FileType", [{ no: 0, name: "FILE_TYPE_UNSPECIFIED" },{ no: 1, name: "FILE_TYPE_FILE" },{ no: 2, name: "FILE_TYPE_DIRECTORY" },]);/**- * @generated from enum envd.filesystem.v1.EventType+ * @generated from enum envd.filesystem.EventType*/export enum EventType {/**@@ -67,7 +68,7 @@ export enum EventType {CHMOD = 5,}// Retrieve enum metadata with: proto3.getEnumType(EventType)-proto3.util.setEnumType(EventType, "envd.filesystem.v1.EventType", [+proto3.util.setEnumType(EventType, "envd.filesystem.EventType", [{ no: 0, name: "EVENT_TYPE_UNSPECIFIED" },{ no: 1, name: "EVENT_TYPE_CREATE" },{ no: 2, name: "EVENT_TYPE_WRITE" },@@ -77,7 +78,7 @@ proto3.util.setEnumType(EventType, "envd.filesystem.v1.EventType", []);/**- * @generated from message envd.filesystem.v1.RemoveRequest+ * @generated from message envd.filesystem.RemoveRequest*/export class RemoveRequest extends Message<RemoveRequest> {/**@@ -85,15 +86,21 @@ export class RemoveRequest extends Message<RemoveRequest> {*/path = "";+ /**+ * @generated from field: envd.permissions.User user = 2;+ */+ user?: User;+constructor(data?: PartialMessage<RemoveRequest>) {super();proto3.util.initPartial(data, this);}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.filesystem.v1.RemoveRequest";+ static readonly typeName = "envd.filesystem.RemoveRequest";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "path", kind: "scalar", T: 9 /* ScalarType.STRING */ },+ { no: 2, name: "user", kind: "message", T: User },]);static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): RemoveRequest {@@ -114,7 +121,7 @@ export class RemoveRequest extends Message<RemoveRequest> {}/**- * @generated from message envd.filesystem.v1.RemoveResponse+ * @generated from message envd.filesystem.RemoveResponse*/export class RemoveResponse extends Message<RemoveResponse> {constructor(data?: PartialMessage<RemoveResponse>) {@@ -123,7 +130,7 @@ export class RemoveResponse extends Message<RemoveResponse> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.filesystem.v1.RemoveResponse";+ static readonly typeName = "envd.filesystem.RemoveResponse";static readonly fields: FieldList = proto3.util.newFieldList(() => []);@@ -145,7 +152,7 @@ export class RemoveResponse extends Message<RemoveResponse> {}/**- * @generated from message envd.filesystem.v1.StatRequest+ * @generated from message envd.filesystem.StatRequest*/export class StatRequest extends Message<StatRequest> {/**@@ -153,15 +160,21 @@ export class StatRequest extends Message<StatRequest> {*/path = "";+ /**+ * @generated from field: envd.permissions.User user = 2;+ */+ user?: User;+constructor(data?: PartialMessage<StatRequest>) {super();proto3.util.initPartial(data, this);}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.filesystem.v1.StatRequest";+ static readonly typeName = "envd.filesystem.StatRequest";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "path", kind: "scalar", T: 9 /* ScalarType.STRING */ },+ { no: 2, name: "user", kind: "message", T: User },]);static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): StatRequest {@@ -182,11 +195,11 @@ export class StatRequest extends Message<StatRequest> {}/**- * @generated from message envd.filesystem.v1.StatResponse+ * @generated from message envd.filesystem.StatResponse*/export class StatResponse extends Message<StatResponse> {/**- * @generated from field: envd.filesystem.v1.EntryInfo entry = 1;+ * @generated from field: envd.filesystem.EntryInfo entry = 1;*/entry?: EntryInfo;@@ -196,7 +209,7 @@ export class StatResponse extends Message<StatResponse> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.filesystem.v1.StatResponse";+ static readonly typeName = "envd.filesystem.StatResponse";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "entry", kind: "message", T: EntryInfo },]);@@ -219,7 +232,7 @@ export class StatResponse extends Message<StatResponse> {}/**- * @generated from message envd.filesystem.v1.EntryInfo+ * @generated from message envd.filesystem.EntryInfo*/export class EntryInfo extends Message<EntryInfo> {/**@@ -228,7 +241,7 @@ export class EntryInfo extends Message<EntryInfo> {name = "";/**- * @generated from field: envd.filesystem.v1.FileType type = 2;+ * @generated from field: envd.filesystem.FileType type = 2;*/type = FileType.UNSPECIFIED;@@ -238,7 +251,7 @@ export class EntryInfo extends Message<EntryInfo> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.filesystem.v1.EntryInfo";+ static readonly typeName = "envd.filesystem.EntryInfo";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },{ no: 2, name: "type", kind: "enum", T: proto3.getEnumType(FileType) },@@ -262,7 +275,7 @@ export class EntryInfo extends Message<EntryInfo> {}/**- * @generated from message envd.filesystem.v1.ListRequest+ * @generated from message envd.filesystem.ListRequest*/export class ListRequest extends Message<ListRequest> {/**@@ -270,15 +283,21 @@ export class ListRequest extends Message<ListRequest> {*/path = "";+ /**+ * @generated from field: envd.permissions.User user = 2;+ */+ user?: User;+constructor(data?: PartialMessage<ListRequest>) {super();proto3.util.initPartial(data, this);}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.filesystem.v1.ListRequest";+ static readonly typeName = "envd.filesystem.ListRequest";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "path", kind: "scalar", T: 9 /* ScalarType.STRING */ },+ { no: 2, name: "user", kind: "message", T: User },]);static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): ListRequest {@@ -299,11 +318,11 @@ export class ListRequest extends Message<ListRequest> {}/**- * @generated from message envd.filesystem.v1.ListResponse+ * @generated from message envd.filesystem.ListResponse*/export class ListResponse extends Message<ListResponse> {/**- * @generated from field: repeated envd.filesystem.v1.EntryInfo entries = 1;+ * @generated from field: repeated envd.filesystem.EntryInfo entries = 1;*/entries: EntryInfo[] = [];@@ -313,7 +332,7 @@ export class ListResponse extends Message<ListResponse> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.filesystem.v1.ListResponse";+ static readonly typeName = "envd.filesystem.ListResponse";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "entries", kind: "message", T: EntryInfo, repeated: true },]);@@ -336,7 +355,7 @@ export class ListResponse extends Message<ListResponse> {}/**- * @generated from message envd.filesystem.v1.WatchRequest+ * @generated from message envd.filesystem.WatchRequest*/export class WatchRequest extends Message<WatchRequest> {/**@@ -344,15 +363,21 @@ export class WatchRequest extends Message<WatchRequest> {*/path = "";+ /**+ * @generated from field: envd.permissions.User user = 2;+ */+ user?: User;+constructor(data?: PartialMessage<WatchRequest>) {super();proto3.util.initPartial(data, this);}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.filesystem.v1.WatchRequest";+ static readonly typeName = "envd.filesystem.WatchRequest";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "path", kind: "scalar", T: 9 /* ScalarType.STRING */ },+ { no: 2, name: "user", kind: "message", T: User },]);static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): WatchRequest {@@ -373,11 +398,11 @@ export class WatchRequest extends Message<WatchRequest> {}/**- * @generated from message envd.filesystem.v1.WatchResponse+ * @generated from message envd.filesystem.WatchResponse*/export class WatchResponse extends Message<WatchResponse> {/**- * @generated from field: envd.filesystem.v1.FilesystemEvent event = 1;+ * @generated from field: envd.filesystem.FilesystemEvent event = 1;*/event?: FilesystemEvent;@@ -387,7 +412,7 @@ export class WatchResponse extends Message<WatchResponse> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.filesystem.v1.WatchResponse";+ static readonly typeName = "envd.filesystem.WatchResponse";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "event", kind: "message", T: FilesystemEvent },]);@@ -410,7 +435,7 @@ export class WatchResponse extends Message<WatchResponse> {}/**- * @generated from message envd.filesystem.v1.FilesystemEvent+ * @generated from message envd.filesystem.FilesystemEvent*/export class FilesystemEvent extends Message<FilesystemEvent> {/**@@ -419,7 +444,7 @@ export class FilesystemEvent extends Message<FilesystemEvent> {path = "";/**- * @generated from field: envd.filesystem.v1.EventType type = 2;+ * @generated from field: envd.filesystem.EventType type = 2;*/type = EventType.UNSPECIFIED;@@ -429,7 +454,7 @@ export class FilesystemEvent extends Message<FilesystemEvent> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.filesystem.v1.FilesystemEvent";+ static readonly typeName = "envd.filesystem.FilesystemEvent";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "path", kind: "scalar", T: 9 /* ScalarType.STRING */ },{ no: 2, name: "type", kind: "enum", T: proto3.getEnumType(EventType) },diff --git a/packages/js-sdk/src/envd/permissions/permissions_pb.ts b/packages/js-sdk/src/envd/permissions/permissions_pb.tsnew file mode 100644index 000000000..2de3546a9--- /dev/null+++ b/packages/js-sdk/src/envd/permissions/permissions_pb.ts@@ -0,0 +1,51 @@+// @generated by protoc-gen-es v1.9.0 with parameter "target=ts"+// @generated from file envd/permissions/permissions.proto (package envd.permissions, syntax proto3)+/* eslint-disable */+// @ts-nocheck++import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";+import { Message, proto3 } from "@bufbuild/protobuf";++/**+ * @generated from message envd.permissions.User+ */+export class User extends Message<User> {+ /**+ * @generated from oneof envd.permissions.User.selector+ */+ selector: {+ /**+ * @generated from field: string username = 1;+ */+ value: string;+ case: "username";+ } | { case: undefined; value?: undefined } = { case: undefined };++ constructor(data?: PartialMessage<User>) {+ super();+ proto3.util.initPartial(data, this);+ }++ static readonly runtime: typeof proto3 = proto3;+ static readonly typeName = "envd.permissions.User";+ static readonly fields: FieldList = proto3.util.newFieldList(() => [+ { no: 1, name: "username", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "selector" },+ ]);++ static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): User {+ return new User().fromBinary(bytes, options);+ }++ static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): User {+ return new User().fromJson(jsonValue, options);+ }++ static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): User {+ return new User().fromJsonString(jsonString, options);+ }++ static equals(a: User | PlainMessage<User> | undefined, b: User | PlainMessage<User> | undefined): boolean {+ return proto3.util.equals(User, a, b);+ }+}+diff --git a/packages/js-sdk/src/envd/process/v1/process_connect.ts b/packages/js-sdk/src/envd/process/process_connect.tssimilarity index 70%rename from packages/js-sdk/src/envd/process/v1/process_connect.tsrename to packages/js-sdk/src/envd/process/process_connect.tsindex 7aa7f6d76..e36d3b16a 100644--- a/packages/js-sdk/src/envd/process/v1/process_connect.ts+++ b/packages/js-sdk/src/envd/process/process_connect.ts@@ -1,5 +1,5 @@// @generated by protoc-gen-connect-es v1.4.0 with parameter "target=ts"-// @generated from file envd/process/v1/process.proto (package envd.process.v1, syntax proto3)+// @generated from file envd/process/process.proto (package envd.process, syntax proto3)/* eslint-disable */// @ts-nocheck@@ -7,13 +7,13 @@ import { ConnectRequest, ConnectResponse, ListRequest, ListResponse, SendInputReimport { MethodKind } from "@bufbuild/protobuf";/**- * @generated from service envd.process.v1.ProcessService+ * @generated from service envd.process.ProcessService*/export const ProcessService = {- typeName: "envd.process.v1.ProcessService",+ typeName: "envd.process.ProcessService",methods: {/**- * @generated from rpc envd.process.v1.ProcessService.List+ * @generated from rpc envd.process.ProcessService.List*/list: {name: "List",@@ -22,7 +22,7 @@ export const ProcessService = {kind: MethodKind.Unary,},/**- * @generated from rpc envd.process.v1.ProcessService.Connect+ * @generated from rpc envd.process.ProcessService.Connect*/connect: {name: "Connect",@@ -31,7 +31,7 @@ export const ProcessService = {kind: MethodKind.ServerStreaming,},/**- * @generated from rpc envd.process.v1.ProcessService.Start+ * @generated from rpc envd.process.ProcessService.Start*/start: {name: "Start",@@ -40,7 +40,7 @@ export const ProcessService = {kind: MethodKind.ServerStreaming,},/**- * @generated from rpc envd.process.v1.ProcessService.Update+ * @generated from rpc envd.process.ProcessService.Update*/update: {name: "Update",@@ -51,7 +51,7 @@ export const ProcessService = {/*** Client input stream ensures ordering of messages*- * @generated from rpc envd.process.v1.ProcessService.StreamInput+ * @generated from rpc envd.process.ProcessService.StreamInput*/streamInput: {name: "StreamInput",@@ -60,7 +60,7 @@ export const ProcessService = {kind: MethodKind.ClientStreaming,},/**- * @generated from rpc envd.process.v1.ProcessService.SendInput+ * @generated from rpc envd.process.ProcessService.SendInput*/sendInput: {name: "SendInput",@@ -69,7 +69,7 @@ export const ProcessService = {kind: MethodKind.Unary,},/**- * @generated from rpc envd.process.v1.ProcessService.SendSignal+ * @generated from rpc envd.process.ProcessService.SendSignal*/sendSignal: {name: "SendSignal",diff --git a/packages/js-sdk/src/envd/process/v1/process_pb.ts b/packages/js-sdk/src/envd/process/process_pb.tssimilarity index 83%rename from packages/js-sdk/src/envd/process/v1/process_pb.tsrename to packages/js-sdk/src/envd/process/process_pb.tsindex 8d9d83ef0..01a647bc5 100644--- a/packages/js-sdk/src/envd/process/v1/process_pb.ts+++ b/packages/js-sdk/src/envd/process/process_pb.ts@@ -1,13 +1,14 @@// @generated by protoc-gen-es v1.9.0 with parameter "target=ts"-// @generated from file envd/process/v1/process.proto (package envd.process.v1, syntax proto3)+// @generated from file envd/process/process.proto (package envd.process, syntax proto3)/* eslint-disable */// @ts-nocheckimport type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";import { Message, proto3 } from "@bufbuild/protobuf";+import { User } from "../permissions/permissions_pb.js";/**- * @generated from enum envd.process.v1.Signal+ * @generated from enum envd.process.Signal*/export enum Signal {/**@@ -26,18 +27,18 @@ export enum Signal {SIGKILL = 9,}// Retrieve enum metadata with: proto3.getEnumType(Signal)-proto3.util.setEnumType(Signal, "envd.process.v1.Signal", [+proto3.util.setEnumType(Signal, "envd.process.Signal", [{ no: 0, name: "SIGNAL_UNSPECIFIED" },{ no: 15, name: "SIGNAL_SIGTERM" },{ no: 9, name: "SIGNAL_SIGKILL" },]);/**- * @generated from message envd.process.v1.PTY+ * @generated from message envd.process.PTY*/export class PTY extends Message<PTY> {/**- * @generated from field: envd.process.v1.PTY.Size size = 1;+ * @generated from field: envd.process.PTY.Size size = 1;*/size?: PTY_Size;@@ -47,7 +48,7 @@ export class PTY extends Message<PTY> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.PTY";+ static readonly typeName = "envd.process.PTY";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "size", kind: "message", T: PTY_Size },]);@@ -70,7 +71,7 @@ export class PTY extends Message<PTY> {}/**- * @generated from message envd.process.v1.PTY.Size+ * @generated from message envd.process.PTY.Size*/export class PTY_Size extends Message<PTY_Size> {/**@@ -89,7 +90,7 @@ export class PTY_Size extends Message<PTY_Size> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.PTY.Size";+ static readonly typeName = "envd.process.PTY.Size";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "cols", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },{ no: 2, name: "rows", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },@@ -113,7 +114,7 @@ export class PTY_Size extends Message<PTY_Size> {}/**- * @generated from message envd.process.v1.ProcessConfig+ * @generated from message envd.process.ProcessConfig*/export class ProcessConfig extends Message<ProcessConfig> {/**@@ -142,7 +143,7 @@ export class ProcessConfig extends Message<ProcessConfig> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.ProcessConfig";+ static readonly typeName = "envd.process.ProcessConfig";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "cmd", kind: "scalar", T: 9 /* ScalarType.STRING */ },{ no: 2, name: "args", kind: "scalar", T: 9 /* ScalarType.STRING */, repeated: true },@@ -168,7 +169,7 @@ export class ProcessConfig extends Message<ProcessConfig> {}/**- * @generated from message envd.process.v1.ListRequest+ * @generated from message envd.process.ListRequest*/export class ListRequest extends Message<ListRequest> {constructor(data?: PartialMessage<ListRequest>) {@@ -177,7 +178,7 @@ export class ListRequest extends Message<ListRequest> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.ListRequest";+ static readonly typeName = "envd.process.ListRequest";static readonly fields: FieldList = proto3.util.newFieldList(() => []);@@ -199,11 +200,11 @@ export class ListRequest extends Message<ListRequest> {}/**- * @generated from message envd.process.v1.ListResponse+ * @generated from message envd.process.ListResponse*/export class ListResponse extends Message<ListResponse> {/**- * @generated from field: repeated envd.process.v1.ProcessConfig processes = 1;+ * @generated from field: repeated envd.process.ProcessConfig processes = 1;*/processes: ProcessConfig[] = [];@@ -213,7 +214,7 @@ export class ListResponse extends Message<ListResponse> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.ListResponse";+ static readonly typeName = "envd.process.ListResponse";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "processes", kind: "message", T: ProcessConfig, repeated: true },]);@@ -236,66 +237,23 @@ export class ListResponse extends Message<ListResponse> {}/**- * @generated from message envd.process.v1.Credential- */-export class Credential extends Message<Credential> {- /**- * @generated from oneof envd.process.v1.Credential.credential- */- credential: {- /**- * @generated from field: string username = 1;- */- value: string;- case: "username";- } | { case: undefined; value?: undefined } = { case: undefined };-- constructor(data?: PartialMessage<Credential>) {- super();- proto3.util.initPartial(data, this);- }-- static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.Credential";- static readonly fields: FieldList = proto3.util.newFieldList(() => [- { no: 1, name: "username", kind: "scalar", T: 9 /* ScalarType.STRING */, oneof: "credential" },- ]);-- static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): Credential {- return new Credential().fromBinary(bytes, options);- }-- static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): Credential {- return new Credential().fromJson(jsonValue, options);- }-- static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): Credential {- return new Credential().fromJsonString(jsonString, options);- }-- static equals(a: Credential | PlainMessage<Credential> | undefined, b: Credential | PlainMessage<Credential> | undefined): boolean {- return proto3.util.equals(Credential, a, b);- }-}--/**- * @generated from message envd.process.v1.StartRequest+ * @generated from message envd.process.StartRequest*/export class StartRequest extends Message<StartRequest> {/**- * @generated from field: envd.process.v1.ProcessConfig process = 1;+ * @generated from field: envd.process.ProcessConfig process = 1;*/process?: ProcessConfig;/**- * @generated from field: optional envd.process.v1.PTY pty = 2;+ * @generated from field: optional envd.process.PTY pty = 2;*/pty?: PTY;/**- * @generated from field: envd.process.v1.Credential owner = 3;+ * @generated from field: envd.permissions.User user = 3;*/- owner?: Credential;+ user?: User;constructor(data?: PartialMessage<StartRequest>) {super();@@ -303,11 +261,11 @@ export class StartRequest extends Message<StartRequest> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.StartRequest";+ static readonly typeName = "envd.process.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: "owner", kind: "message", T: Credential },+ { no: 3, name: "user", kind: "message", T: User },]);static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): StartRequest {@@ -328,16 +286,16 @@ export class StartRequest extends Message<StartRequest> {}/**- * @generated from message envd.process.v1.UpdateRequest+ * @generated from message envd.process.UpdateRequest*/export class UpdateRequest extends Message<UpdateRequest> {/**- * @generated from field: envd.process.v1.ProcessSelector process = 1;+ * @generated from field: envd.process.ProcessSelector process = 1;*/process?: ProcessSelector;/**- * @generated from field: optional envd.process.v1.PTY pty = 2;+ * @generated from field: optional envd.process.PTY pty = 2;*/pty?: PTY;@@ -347,7 +305,7 @@ export class UpdateRequest extends Message<UpdateRequest> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.UpdateRequest";+ static readonly typeName = "envd.process.UpdateRequest";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "process", kind: "message", T: ProcessSelector },{ no: 2, name: "pty", kind: "message", T: PTY, opt: true },@@ -371,7 +329,7 @@ export class UpdateRequest extends Message<UpdateRequest> {}/**- * @generated from message envd.process.v1.UpdateResponse+ * @generated from message envd.process.UpdateResponse*/export class UpdateResponse extends Message<UpdateResponse> {constructor(data?: PartialMessage<UpdateResponse>) {@@ -380,7 +338,7 @@ export class UpdateResponse extends Message<UpdateResponse> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.UpdateResponse";+ static readonly typeName = "envd.process.UpdateResponse";static readonly fields: FieldList = proto3.util.newFieldList(() => []);@@ -402,27 +360,27 @@ export class UpdateResponse extends Message<UpdateResponse> {}/**- * @generated from message envd.process.v1.ProcessEvent+ * @generated from message envd.process.ProcessEvent*/export class ProcessEvent extends Message<ProcessEvent> {/**- * @generated from oneof envd.process.v1.ProcessEvent.event+ * @generated from oneof envd.process.ProcessEvent.event*/event: {/**- * @generated from field: envd.process.v1.ProcessEvent.StartEvent start = 1;+ * @generated from field: envd.process.ProcessEvent.StartEvent start = 1;*/value: ProcessEvent_StartEvent;case: "start";} | {/**- * @generated from field: envd.process.v1.ProcessEvent.DataEvent data = 2;+ * @generated from field: envd.process.ProcessEvent.DataEvent data = 2;*/value: ProcessEvent_DataEvent;case: "data";} | {/**- * @generated from field: envd.process.v1.ProcessEvent.EndEvent end = 3;+ * @generated from field: envd.process.ProcessEvent.EndEvent end = 3;*/value: ProcessEvent_EndEvent;case: "end";@@ -434,7 +392,7 @@ export class ProcessEvent extends Message<ProcessEvent> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.ProcessEvent";+ static readonly typeName = "envd.process.ProcessEvent";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "start", kind: "message", T: ProcessEvent_StartEvent, oneof: "event" },{ no: 2, name: "data", kind: "message", T: ProcessEvent_DataEvent, oneof: "event" },@@ -459,7 +417,7 @@ export class ProcessEvent extends Message<ProcessEvent> {}/**- * @generated from message envd.process.v1.ProcessEvent.StartEvent+ * @generated from message envd.process.ProcessEvent.StartEvent*/export class ProcessEvent_StartEvent extends Message<ProcessEvent_StartEvent> {/**@@ -473,7 +431,7 @@ export class ProcessEvent_StartEvent extends Message<ProcessEvent_StartEvent> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.ProcessEvent.StartEvent";+ static readonly typeName = "envd.process.ProcessEvent.StartEvent";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "pid", kind: "scalar", T: 13 /* ScalarType.UINT32 */ },]);@@ -496,11 +454,11 @@ export class ProcessEvent_StartEvent extends Message<ProcessEvent_StartEvent> {}/**- * @generated from message envd.process.v1.ProcessEvent.DataEvent+ * @generated from message envd.process.ProcessEvent.DataEvent*/export class ProcessEvent_DataEvent extends Message<ProcessEvent_DataEvent> {/**- * @generated from oneof envd.process.v1.ProcessEvent.DataEvent.output+ * @generated from oneof envd.process.ProcessEvent.DataEvent.output*/output: {/**@@ -528,7 +486,7 @@ export class ProcessEvent_DataEvent extends Message<ProcessEvent_DataEvent> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.ProcessEvent.DataEvent";+ static readonly typeName = "envd.process.ProcessEvent.DataEvent";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "stdout", kind: "scalar", T: 12 /* ScalarType.BYTES */, oneof: "output" },{ no: 2, name: "stderr", kind: "scalar", T: 12 /* ScalarType.BYTES */, oneof: "output" },@@ -553,7 +511,7 @@ export class ProcessEvent_DataEvent extends Message<ProcessEvent_DataEvent> {}/**- * @generated from message envd.process.v1.ProcessEvent.EndEvent+ * @generated from message envd.process.ProcessEvent.EndEvent*/export class ProcessEvent_EndEvent extends Message<ProcessEvent_EndEvent> {/**@@ -582,7 +540,7 @@ export class ProcessEvent_EndEvent extends Message<ProcessEvent_EndEvent> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.ProcessEvent.EndEvent";+ static readonly typeName = "envd.process.ProcessEvent.EndEvent";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "exit_code", kind: "scalar", T: 17 /* ScalarType.SINT32 */ },{ no: 2, name: "terminated", kind: "scalar", T: 8 /* ScalarType.BOOL */ },@@ -608,11 +566,11 @@ export class ProcessEvent_EndEvent extends Message<ProcessEvent_EndEvent> {}/**- * @generated from message envd.process.v1.StartResponse+ * @generated from message envd.process.StartResponse*/export class StartResponse extends Message<StartResponse> {/**- * @generated from field: envd.process.v1.ProcessEvent event = 1;+ * @generated from field: envd.process.ProcessEvent event = 1;*/event?: ProcessEvent;@@ -622,7 +580,7 @@ export class StartResponse extends Message<StartResponse> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.StartResponse";+ static readonly typeName = "envd.process.StartResponse";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "event", kind: "message", T: ProcessEvent },]);@@ -645,11 +603,11 @@ export class StartResponse extends Message<StartResponse> {}/**- * @generated from message envd.process.v1.ConnectResponse+ * @generated from message envd.process.ConnectResponse*/export class ConnectResponse extends Message<ConnectResponse> {/**- * @generated from field: envd.process.v1.ProcessEvent event = 1;+ * @generated from field: envd.process.ProcessEvent event = 1;*/event?: ProcessEvent;@@ -659,7 +617,7 @@ export class ConnectResponse extends Message<ConnectResponse> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.ConnectResponse";+ static readonly typeName = "envd.process.ConnectResponse";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "event", kind: "message", T: ProcessEvent },]);@@ -682,16 +640,16 @@ export class ConnectResponse extends Message<ConnectResponse> {}/**- * @generated from message envd.process.v1.SendInputRequest+ * @generated from message envd.process.SendInputRequest*/export class SendInputRequest extends Message<SendInputRequest> {/**- * @generated from field: envd.process.v1.ProcessSelector process = 1;+ * @generated from field: envd.process.ProcessSelector process = 1;*/process?: ProcessSelector;/**- * @generated from field: envd.process.v1.ProcessInput input = 2;+ * @generated from field: envd.process.ProcessInput input = 2;*/input?: ProcessInput;@@ -701,7 +659,7 @@ export class SendInputRequest extends Message<SendInputRequest> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.SendInputRequest";+ static readonly typeName = "envd.process.SendInputRequest";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "process", kind: "message", T: ProcessSelector },{ no: 2, name: "input", kind: "message", T: ProcessInput },@@ -725,7 +683,7 @@ export class SendInputRequest extends Message<SendInputRequest> {}/**- * @generated from message envd.process.v1.SendInputResponse+ * @generated from message envd.process.SendInputResponse*/export class SendInputResponse extends Message<SendInputResponse> {constructor(data?: PartialMessage<SendInputResponse>) {@@ -734,7 +692,7 @@ export class SendInputResponse extends Message<SendInputResponse> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.SendInputResponse";+ static readonly typeName = "envd.process.SendInputResponse";static readonly fields: FieldList = proto3.util.newFieldList(() => []);@@ -756,11 +714,11 @@ export class SendInputResponse extends Message<SendInputResponse> {}/**- * @generated from message envd.process.v1.ProcessInput+ * @generated from message envd.process.ProcessInput*/export class ProcessInput extends Message<ProcessInput> {/**- * @generated from oneof envd.process.v1.ProcessInput.input+ * @generated from oneof envd.process.ProcessInput.input*/input: {/**@@ -782,7 +740,7 @@ export class ProcessInput extends Message<ProcessInput> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.ProcessInput";+ static readonly typeName = "envd.process.ProcessInput";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "stdin", kind: "scalar", T: 12 /* ScalarType.BYTES */, oneof: "input" },{ no: 2, name: "pty", kind: "scalar", T: 12 /* ScalarType.BYTES */, oneof: "input" },@@ -806,21 +764,21 @@ export class ProcessInput extends Message<ProcessInput> {}/**- * @generated from message envd.process.v1.StreamInputRequest+ * @generated from message envd.process.StreamInputRequest*/export class StreamInputRequest extends Message<StreamInputRequest> {/**- * @generated from oneof envd.process.v1.StreamInputRequest.event+ * @generated from oneof envd.process.StreamInputRequest.event*/event: {/**- * @generated from field: envd.process.v1.StreamInputRequest.StartEvent start = 1;+ * @generated from field: envd.process.StreamInputRequest.StartEvent start = 1;*/value: StreamInputRequest_StartEvent;case: "start";} | {/**- * @generated from field: envd.process.v1.StreamInputRequest.DataEvent data = 2;+ * @generated from field: envd.process.StreamInputRequest.DataEvent data = 2;*/value: StreamInputRequest_DataEvent;case: "data";@@ -832,7 +790,7 @@ export class StreamInputRequest extends Message<StreamInputRequest> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.StreamInputRequest";+ static readonly typeName = "envd.process.StreamInputRequest";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "start", kind: "message", T: StreamInputRequest_StartEvent, oneof: "event" },{ no: 2, name: "data", kind: "message", T: StreamInputRequest_DataEvent, oneof: "event" },@@ -856,11 +814,11 @@ export class StreamInputRequest extends Message<StreamInputRequest> {}/**- * @generated from message envd.process.v1.StreamInputRequest.StartEvent+ * @generated from message envd.process.StreamInputRequest.StartEvent*/export class StreamInputRequest_StartEvent extends Message<StreamInputRequest_StartEvent> {/**- * @generated from field: envd.process.v1.ProcessSelector process = 1;+ * @generated from field: envd.process.ProcessSelector process = 1;*/process?: ProcessSelector;@@ -870,7 +828,7 @@ export class StreamInputRequest_StartEvent extends Message<StreamInputRequest_St}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.StreamInputRequest.StartEvent";+ static readonly typeName = "envd.process.StreamInputRequest.StartEvent";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "process", kind: "message", T: ProcessSelector },]);@@ -893,11 +851,11 @@ export class StreamInputRequest_StartEvent extends Message<StreamInputRequest_St}/**- * @generated from message envd.process.v1.StreamInputRequest.DataEvent+ * @generated from message envd.process.StreamInputRequest.DataEvent*/export class StreamInputRequest_DataEvent extends Message<StreamInputRequest_DataEvent> {/**- * @generated from field: envd.process.v1.ProcessInput input = 2;+ * @generated from field: envd.process.ProcessInput input = 2;*/input?: ProcessInput;@@ -907,7 +865,7 @@ export class StreamInputRequest_DataEvent extends Message<StreamInputRequest_Dat}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.StreamInputRequest.DataEvent";+ static readonly typeName = "envd.process.StreamInputRequest.DataEvent";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 2, name: "input", kind: "message", T: ProcessInput },]);@@ -930,7 +888,7 @@ export class StreamInputRequest_DataEvent extends Message<StreamInputRequest_Dat}/**- * @generated from message envd.process.v1.StreamInputResponse+ * @generated from message envd.process.StreamInputResponse*/export class StreamInputResponse extends Message<StreamInputResponse> {constructor(data?: PartialMessage<StreamInputResponse>) {@@ -939,7 +897,7 @@ export class StreamInputResponse extends Message<StreamInputResponse> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.StreamInputResponse";+ static readonly typeName = "envd.process.StreamInputResponse";static readonly fields: FieldList = proto3.util.newFieldList(() => []);@@ -961,16 +919,16 @@ export class StreamInputResponse extends Message<StreamInputResponse> {}/**- * @generated from message envd.process.v1.SendSignalRequest+ * @generated from message envd.process.SendSignalRequest*/export class SendSignalRequest extends Message<SendSignalRequest> {/**- * @generated from field: envd.process.v1.ProcessSelector process = 1;+ * @generated from field: envd.process.ProcessSelector process = 1;*/process?: ProcessSelector;/**- * @generated from field: envd.process.v1.Signal signal = 2;+ * @generated from field: envd.process.Signal signal = 2;*/signal = Signal.UNSPECIFIED;@@ -980,7 +938,7 @@ export class SendSignalRequest extends Message<SendSignalRequest> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.SendSignalRequest";+ static readonly typeName = "envd.process.SendSignalRequest";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "process", kind: "message", T: ProcessSelector },{ no: 2, name: "signal", kind: "enum", T: proto3.getEnumType(Signal) },@@ -1004,7 +962,7 @@ export class SendSignalRequest extends Message<SendSignalRequest> {}/**- * @generated from message envd.process.v1.SendSignalResponse+ * @generated from message envd.process.SendSignalResponse*/export class SendSignalResponse extends Message<SendSignalResponse> {constructor(data?: PartialMessage<SendSignalResponse>) {@@ -1013,7 +971,7 @@ export class SendSignalResponse extends Message<SendSignalResponse> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.SendSignalResponse";+ static readonly typeName = "envd.process.SendSignalResponse";static readonly fields: FieldList = proto3.util.newFieldList(() => []);@@ -1035,11 +993,11 @@ export class SendSignalResponse extends Message<SendSignalResponse> {}/**- * @generated from message envd.process.v1.ConnectRequest+ * @generated from message envd.process.ConnectRequest*/export class ConnectRequest extends Message<ConnectRequest> {/**- * @generated from field: envd.process.v1.ProcessSelector process = 1;+ * @generated from field: envd.process.ProcessSelector process = 1;*/process?: ProcessSelector;@@ -1049,7 +1007,7 @@ export class ConnectRequest extends Message<ConnectRequest> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.ConnectRequest";+ static readonly typeName = "envd.process.ConnectRequest";static readonly fields: FieldList = proto3.util.newFieldList(() => [{ no: 1, name: "process", kind: "message", T: ProcessSelector },]);@@ -1072,11 +1030,11 @@ export class ConnectRequest extends Message<ConnectRequest> {}/**- * @generated from message envd.process.v1.ProcessSelector+ * @generated from message envd.process.ProcessSelector*/export class ProcessSelector extends Message<ProcessSelector> {/**- * @generated from oneof envd.process.v1.ProcessSelector.selector+ * @generated from oneof envd.process.ProcessSelector.selector*/selector: {/**@@ -1092,7 +1050,7 @@ export class ProcessSelector extends Message<ProcessSelector> {}static readonly runtime: typeof proto3 = proto3;- static readonly typeName = "envd.process.v1.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" },]);diff --git a/packages/js-sdk/src/envd/schema.gen.ts b/packages/js-sdk/src/envd/schema.gen.tsindex e43f5c4e3..ddde6da99 100644--- a/packages/js-sdk/src/envd/schema.gen.ts+++ b/packages/js-sdk/src/envd/schema.gen.ts@@ -23,7 +23,7 @@ export interface paths {put: {parameters: {query: {- User: components["parameters"]["User"];+ user: components["parameters"]["User"];};path: {path: components["parameters"]["FilePath"];diff --git a/packages/js-sdk/src/index.ts b/packages/js-sdk/src/index.tsindex 1fbe49436..b34334485 100644--- a/packages/js-sdk/src/index.ts+++ b/packages/js-sdk/src/index.ts@@ -5,7 +5,7 @@ export {export type { components, paths } from './api'export { ConnectionConfig } from './connectionConfig'-export type { ConnectionOpts } from './connectionConfig'+export type { ConnectionOpts, Username } from './connectionConfig'export { WatchHandle } from './sandbox/filesystem/watchHandle'export type { FilesystemEvent } from './sandbox/filesystem/watchHandle'@@ -16,20 +16,20 @@ export type {export {EventType,FileType,-} from './envd/filesystem/v1/filesystem_pb'+} from './envd/filesystem/filesystem_pb'export { ProcessHandle } from './sandbox/process/processHandle'export type { ProcessOutput, ProcessResult } from './sandbox/process/processHandle'export type {ProcessConfig,+ ProcessBackgroundRunOpts,+ ProcessRunOpts,} from './sandbox/process'export type {StreamInputHandle,-} from './sandbox/terminal'+} from './sandbox/pty'-import { Sandbox, Logger } from './sandbox'+import { Sandbox } from './sandbox'export { Sandbox, }-export type { Logger }-export default Sandboxdiff --git a/packages/js-sdk/src/sandbox/filesystem/index.ts b/packages/js-sdk/src/sandbox/filesystem/index.tsindex 7d044b7f1..7d3d33f92 100644--- a/packages/js-sdk/src/sandbox/filesystem/index.ts+++ b/packages/js-sdk/src/sandbox/filesystem/index.ts@@ -5,12 +5,12 @@ import {PromiseClient,} from '@connectrpc/connect'-import { ConnectionOpts } from '../../connectionConfig'+import { ConnectionOpts, Username } from '../../connectionConfig'import { EnvdApiClient } from '../../envd/api'-import { FilesystemService } from '../../envd/filesystem/v1/filesystem_connect'+import { FilesystemService } from '../../envd/filesystem/filesystem_connect'import {EntryInfo as FsEntryInfo,-} from '../../envd/filesystem/v1/filesystem_pb'+} from '../../envd/filesystem/filesystem_pb'import { WatchHandle, FilesystemEvent } from './watchHandle'export type EntryInfo = PlainMessage<FsEntryInfo>@@ -18,11 +18,9 @@ export type EntryInfo = PlainMessage<FsEntryInfo>export type FileFormat = 'text' | 'stream' | 'arrayBuffer' | 'blob'export interface WriteOpts extends Pick<ConnectionOpts, 'requestTimeoutMs'> {- username?: 'root' | 'user'+ user?: Username}-// TODO: Resolve cwd and provide sane defaults-// TODO: Enable using watch as iterableexport class Filesystem {private readonly rpc: PromiseClient<typeof FilesystemService>private readonly envdApi: EnvdApiClient@@ -62,8 +60,6 @@ export class Filesystem {async write(path: string, data: ReadableStream, opts?: WriteOpts): Promise<void>async write(path: string, data: string | ArrayBuffer | Blob | ReadableStream, opts?: WriteOpts): Promise<void> {const requestTimeoutMs = opts?.requestTimeoutMs ?? this.connectionConfig.requestTimeoutMs- // TODO: Hnadle the different input types- // TODO: Handle ?? -> or in python tooawait this.envdApi.api.PUT('/files/{path}', {params: {@@ -71,7 +67,7 @@ export class Filesystem {path,},query: {- User: opts?.username ?? 'user',+ user: opts?.user ?? 'user',},},bodySerializer(body) {diff --git a/packages/js-sdk/src/sandbox/filesystem/watchHandle.ts b/packages/js-sdk/src/sandbox/filesystem/watchHandle.tsindex 74343b14d..8d2b36658 100644--- a/packages/js-sdk/src/sandbox/filesystem/watchHandle.ts+++ b/packages/js-sdk/src/sandbox/filesystem/watchHandle.ts@@ -4,7 +4,7 @@ import {FilesystemEvent as FsFilesystemEvent,EntryInfo as FsEntryInfo,WatchResponse,-} from '../../envd/filesystem/v1/filesystem_pb'+} from '../../envd/filesystem/filesystem_pb'export type FilesystemEvent = PlainMessage<FsFilesystemEvent>export type EntryInfo = PlainMessage<FsEntryInfo>diff --git a/packages/js-sdk/src/sandbox/index.ts b/packages/js-sdk/src/sandbox/index.tsindex 6fe5a9ed5..ef5a98059 100644--- a/packages/js-sdk/src/sandbox/index.ts+++ b/packages/js-sdk/src/sandbox/index.ts@@ -3,15 +3,9 @@ import { createConnectTransport } from '@connectrpc/connect-web'import { ConnectionOpts, ConnectionConfig } from '../connectionConfig'import { Filesystem } from './filesystem'import { Process } from './process'-import { Terminal } from './terminal'+import { Pty } from './pty'import { SandboxApi } from './sandboxApi'-export interface Logger {- debug?: (...args: unknown[]) => void- info?: (...args: unknown[]) => void- warn?: (...args: unknown[]) => void- error?: (...args: unknown[]) => void-}export interface RunningSandbox {sandboxID: string@@ -23,17 +17,15 @@ export interface RunningSandbox {export interface SandboxOpts extends ConnectionOpts {metadata?: Record<string, string>- logger?: LoggertimeoutMs?: number}-// TODO: Pass loggers and add logging (interceptors?)export class Sandbox extends SandboxApi {protected static readonly defaultTemplate = 'base-v1'readonly files: Filesystem- readonly process: Process- readonly terminal: Terminal+ readonly commands: Process+ readonly pty: Ptyprotected readonly envdPort = 49982@@ -49,17 +41,13 @@ export class Sandbox extends SandboxApi {const rpcTransport = createConnectTransport({ baseUrl: this.envdApiUrl })this.files = new Filesystem(rpcTransport, this.envdApiUrl, this.connectionConfig)- this.process = new Process(rpcTransport, this.connectionConfig)- this.terminal = new Terminal(rpcTransport, this.connectionConfig)+ this.commands = new Process(rpcTransport, this.connectionConfig)+ this.pty = new Pty(rpcTransport, this.connectionConfig)}get uploadUrl() {- // TODO: Ensure envd handles this well- // TODO: Ensure all user, etc setting are applied here and are escaped-const url = new URL('/files', this.envdApiUrl)url.searchParams.set('user', 'user')- url.searchParams.set('mode', '0644')return url.toString()}@@ -90,3 +78,9 @@ export class Sandbox extends SandboxApi {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.tsindex d8e68dd14..7ccd579f0 100644--- a/packages/js-sdk/src/sandbox/process/index.ts+++ b/packages/js-sdk/src/sandbox/process/index.ts@@ -5,25 +5,34 @@ import {Transport,} from '@connectrpc/connect'-import { ProcessService } from '../../envd/process/v1/process_connect'+import { ProcessService } from '../../envd/process/process_connect'import {ProcessConfig as PsProcessConfig,Signal,StartResponse,-} from '../../envd/process/v1/process_pb'-import { ConnectionOpts } from '../../connectionConfig'-import { ProcessHandle } from './processHandle'+} from '../../envd/process/process_pb'+import { ConnectionOpts, Username } from '../../connectionConfig'+import { ProcessHandle, ProcessOutput } from './processHandle'export type ProcessConfig = PlainMessage<PsProcessConfig>-// TODO: How to handle start + wait-// TODO: Move cwd resolution to envd?-// TODO: Enable using process handle as iterable-// TODO: Solve stream input-// TODO: For watch and other stream ensure the timeout throw is handlable-// TODO: Add iterator returns (python too)-// TODO: Passing timeout to envd context via metadata?-// TODO: Does the abort controller work when we specify the request timeout via connect rpc?+interface ProcessStartOpts extends Partial<Pick<ConnectionOpts, 'requestTimeoutMs'>> {+ background?: boolean+ cwd?: string+ user?: Username+ envs?: Record<string, string>+ onStdout?: ((data: string) => void | Promise<void>)+ onStderr?: ((data: string) => void | Promise<void>)+}++export type ProcessRunOpts = ProcessStartOpts & {+ background?: false+}++export type ProcessBackgroundRunOpts = ProcessStartOpts & {+ background: true+}+export class Process {protected readonly rpc: PromiseClient<typeof ProcessService>@@ -41,15 +50,42 @@ export class Process {return res.processes}- async start(+ async kill(pid: number, opts?: Pick<ConnectionOpts, 'requestTimeoutMs'>): Promise<void> {+ await this.rpc.sendSignal({+ process: {+ selector: {+ case: 'pid',+ value: pid,+ }+ },+ signal: Signal.SIGKILL,+ }, {+ timeoutMs: opts?.requestTimeoutMs ?? this.connectionConfig.requestTimeoutMs,+ })+ }++ async run(+ cmd: string,+ opts?: ProcessRunOpts,+ ): Promise<ProcessOutput>+ async run(+ cmd: string,+ opts?: ProcessBackgroundRunOpts,+ ): Promise<ProcessHandle>+ async run(+ cmd: string,+ opts: ProcessStartOpts = {},+ ): Promise<unknown> {+ const proc = await this.start(cmd, opts)++ return opts?.background+ ? proc+ : proc.wait()+ }++ private async start(cmd: string,- opts: {- cwd?: string,- user?: 'root' | 'user',- envs?: Record<string, string>,- onStdout?: ((data: string) => void | Promise<void>),- onStderr?: ((data: string) => void | Promise<void>),- } & Pick<ConnectionOpts, 'requestTimeoutMs'>+ opts?: ProcessStartOpts,): Promise<ProcessHandle> {const controller = new AbortController()@@ -57,18 +93,18 @@ export class Process {owner: {credential: {case: 'username',- value: opts.user || 'user',+ value: opts?.user || 'user',},},process: {cmd: '/bin/bash',- cwd: opts.cwd,- envs: opts.envs,+ cwd: opts?.cwd,+ envs: opts?.envs,args: ['-l', '-c', cmd],},}, {signal: controller.signal,- timeoutMs: opts.requestTimeoutMs ?? this.connectionConfig.requestTimeoutMs,+ timeoutMs: opts?.requestTimeoutMs ?? this.connectionConfig.requestTimeoutMs,})const startEvent: StartResponse = (await events[Symbol.asyncIterator]().next()).value@@ -79,37 +115,6 @@ export class Process {const pid = startEvent.event.event.value.pid- return new ProcessHandle(- pid,- () => controller.abort(),- () => this.kill(pid),- events,- opts.onStdout,- opts.onStderr,- )- }-- 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(),@@ -119,37 +124,4 @@ export class Process {opts?.onStderr,)}-- async kill(pid: number, opts?: Pick<ConnectionOpts, 'requestTimeoutMs'>): Promise<void> {- await this.rpc.sendSignal({- process: {- selector: {- case: 'pid',- value: pid,- }- },- signal: Signal.SIGKILL,- }, {- timeoutMs: opts?.requestTimeoutMs ?? this.connectionConfig.requestTimeoutMs,- })- }-- async sendStdin(pid: number, data: Uint8Array, opts?: Pick<ConnectionOpts, 'requestTimeoutMs'>): Promise<void> {- await this.rpc.sendInput({- process: {- selector: {- case: 'pid',- value: pid,- }- },- input: {- input: {- case: 'stdin',- value: data,- },- },- }, {- timeoutMs: opts?.requestTimeoutMs ?? this.connectionConfig.requestTimeoutMs,- })- }}diff --git a/packages/js-sdk/src/sandbox/process/processHandle.ts b/packages/js-sdk/src/sandbox/process/processHandle.tsindex fdde714a5..4befa0a7c 100644--- a/packages/js-sdk/src/sandbox/process/processHandle.ts+++ b/packages/js-sdk/src/sandbox/process/processHandle.ts@@ -2,7 +2,7 @@ import {ProcessEvent_EndEvent,ConnectResponse,StartResponse,-} from '../../envd/process/v1/process_pb'+} from '../../envd/process/process_pb'export interface ProcessOutput {stdout?: string@@ -41,10 +41,6 @@ export class ProcessHandle {return result}- disconnect() {- this.handleDisconnect()- }-async wait(): Promise<ProcessResult> {const result = await this.end@@ -57,7 +53,7 @@ export class ProcessHandle {}async kill() {- this.disconnect()+ this.handleDisconnect()await this.handleKill()}diff --git a/packages/js-sdk/src/sandbox/terminal.ts b/packages/js-sdk/src/sandbox/pty.tssimilarity index 89%rename from packages/js-sdk/src/sandbox/terminal.tsrename to packages/js-sdk/src/sandbox/pty.tsindex 2004297b2..97d485ab0 100644--- a/packages/js-sdk/src/sandbox/terminal.ts+++ b/packages/js-sdk/src/sandbox/pty.ts@@ -5,12 +5,12 @@ import {Transport,} from '@connectrpc/connect'-import { ProcessService } from '../envd/process/v1/process_connect'+import { ProcessService } from '../envd/process/process_connect'import {StreamInputRequest,Signal,StartResponse,-} from '../envd/process/v1/process_pb'+} from '../envd/process/process_pb'import { ConnectionConfig, ConnectionOpts } from '../connectionConfig'import { ProcessHandle } from './process/processHandle'@@ -18,7 +18,7 @@ export interface StreamInputHandle {stop: () => void}-export class Terminal {+export class Pty {private readonly service: PromiseClient<typeof ProcessService> = createPromiseClient(ProcessService, this.transport)constructor(private readonly transport: Transport, private readonly connectionConfig: ConnectionConfig) { }@@ -31,8 +31,8 @@ export class Terminal {const controller = new AbortController()const events = this.service.start({- owner: {- credential: {+ user: {+ selector: {case: 'username',value: 'user',},@@ -40,6 +40,9 @@ export class Terminal {process: {cmd: '/bin/bash',args: ['-i', '-l'],+ envs: {+ 'TERM': 'xterm',+ },},pty: {size: {@@ -108,10 +111,6 @@ export class Terminal {}async kill(pid: number, opts?: Pick<ConnectionOpts, 'requestTimeoutMs'>): Promise<void> {-- // TODO: Replace opts.requestTimeout || <- with ?? because null coalest- // TODO: Maybe ither places also have this?- // TODO: Check python for the same problemawait this.service.sendSignal({process: {selector: {diff --git a/packages/js-sdk/src/sandbox/sandboxApi.ts b/packages/js-sdk/src/sandbox/sandboxApi.tsindex c373b45d2..e15a0cf36 100644--- a/packages/js-sdk/src/sandbox/sandboxApi.ts+++ b/packages/js-sdk/src/sandbox/sandboxApi.ts@@ -19,9 +19,6 @@ export class SandboxApi {const config = new ConnectionConfig(opts)const client = new ApiClient(config)- // TODO: Ensure the short id/long id works- // TODO: Check if the errors are thrown properly-await client.api.DELETE('/sandboxes/{sandboxID}', {params: {path: {@@ -74,8 +71,6 @@ export class SandboxApi {const config = new ConnectionConfig(opts)const client = new ApiClient(config)- // TODO: Ensure the short id/long id works-await client.api.POST('/sandboxes/{sandboxID}/timeout', {params: {path: {diff --git a/spec/envd/envd.yaml b/spec/envd/envd.yamlindex d4ce23aa2..89d7b61e8 100644--- a/spec/envd/envd.yaml+++ b/spec/envd/envd.yaml@@ -8,7 +8,7 @@ tags:- name: filespaths:- /host/sync:+ /sync:post:summary: Ensure the time and metadata is synced with the hostresponses:@@ -23,6 +23,7 @@ paths:tags: [files]parameters:- $ref: "#/components/parameters/FilePath"+ - $ref: "#/components/parameters/User"responses:200:$ref: "#/components/responses/DownloadSuccess"@@ -55,11 +56,11 @@ components:in: pathrequired: trueallowEmptyValue: true- description: Absolute path to the file, URL encoded.+ description: Path to the file, URL encoded. Can be relative to user's home directory.schema:type: stringUser:- name: User+ name: userin: queryrequired: truedescription: User owning the filediff --git a/spec/envd/filesystem/v1/filesystem.proto b/spec/envd/filesystem/filesystem.protosimilarity index 84%rename from spec/envd/filesystem/v1/filesystem.protorename to spec/envd/filesystem/filesystem.protoindex a108b8534..aae5da1bf 100644--- a/spec/envd/filesystem/v1/filesystem.proto+++ b/spec/envd/filesystem/filesystem.proto@@ -1,6 +1,8 @@syntax = "proto3";-package envd.filesystem.v1;+import "envd/permissions/permissions.proto";++package envd.filesystem;service FilesystemService {rpc Stat(StatRequest) returns (StatResponse);@@ -11,12 +13,16 @@ service FilesystemService {message RemoveRequest {string path = 1;++ permissions.User user = 2;}message RemoveResponse {}message StatRequest {string path = 1;++ permissions.User user = 2;}message StatResponse {@@ -36,6 +42,8 @@ enum FileType {message ListRequest {string path = 1;++ permissions.User user = 2;}message ListResponse {@@ -44,6 +52,8 @@ message ListResponse {message WatchRequest {string path = 1;++ permissions.User user = 2;}message WatchResponse {diff --git a/spec/envd/permissions/permissions.proto b/spec/envd/permissions/permissions.protonew file mode 100644index 000000000..41a6a76c8--- /dev/null+++ b/spec/envd/permissions/permissions.proto@@ -0,0 +1,9 @@+syntax = "proto3";++package envd.permissions;++message User {+ oneof selector {+ string username = 1;+ }+}diff --git a/spec/envd/process/v1/process.proto b/spec/envd/process/process.protosimilarity index 95%rename from spec/envd/process/v1/process.protorename to spec/envd/process/process.protoindex 33dd62f22..ccb6be3ff 100644--- a/spec/envd/process/v1/process.proto+++ b/spec/envd/process/process.proto@@ -1,6 +1,8 @@syntax = "proto3";-package envd.process.v1;+import "envd/permissions/permissions.proto";++package envd.process;service ProcessService {rpc List(ListRequest) returns (ListResponse);@@ -39,17 +41,11 @@ message ListResponse {repeated ProcessConfig processes = 1;}-message Credential {- oneof credential {- string username = 1;- }-}-message StartRequest {ProcessConfig process = 1;optional PTY pty = 2;- Credential owner = 3;+ permissions.User user = 3;}message UpdateRequest {