An open-source, faster Devin alternative
TypeScript
File upload and download Signed urls - include streaming with chunks for larger files support (#74)
Mohamed Habib2727a5f389e4
diff --git a/deploy/ec2/deploy-aws-dev.sh b/deploy/ec2/deploy-aws-dev.shindex b277103c..f9b05d6d 100755--- a/deploy/ec2/deploy-aws-dev.sh+++ b/deploy/ec2/deploy-aws-dev.sh@@ -355,6 +355,7 @@ cmd_deploy() {CGO_ENABLED=0 go build -o bin/opensandbox-worker ./cmd/worker/echo ' Building osb-agent...'CGO_ENABLED=0 go build -o bin/osb-agent ./cmd/agent/+ sudo systemctl stop opensandbox-server opensandbox-worker 2>/dev/null || truesudo cp bin/opensandbox-server /usr/local/bin/opensandbox-serversudo cp bin/opensandbox-worker /usr/local/bin/opensandbox-workersudo cp bin/osb-agent /usr/local/bin/osb-agentdiff --git a/docs/api-reference/files/generate-download-url.mdx b/docs/api-reference/files/generate-download-url.mdxnew file mode 100644index 00000000..4fe7a7d0--- /dev/null+++ b/docs/api-reference/files/generate-download-url.mdx@@ -0,0 +1,27 @@+---+title: 'Generate Download URL'+api: 'POST /api/sandboxes/{id}/files/download-url'+---++Generates a signed URL for downloading a file without an API key. See [Signed URLs](/sandboxes/signed-urls) for usage guide.++<ParamField path="id" type="string" required>+ Sandbox ID+</ParamField>++<ParamField body="path" type="string" required>+ Absolute path to the file+</ParamField>++<ParamField body="expiresIn" type="number" default="3600">+ URL lifetime in seconds (max: 86400)+</ParamField>++<ResponseExample>+```json 200+{+ "url": "https://app.opencomputer.dev/api/sandboxes/sb-xxx/files/download?path=%2Fapp%2Foutput.zip&expires=1773906434&signature=abc123",+ "expiresAt": "2025-01-01T01:00:00Z"+}+```+</ResponseExample>diff --git a/docs/api-reference/files/generate-upload-url.mdx b/docs/api-reference/files/generate-upload-url.mdxnew file mode 100644index 00000000..d00f5227--- /dev/null+++ b/docs/api-reference/files/generate-upload-url.mdx@@ -0,0 +1,27 @@+---+title: 'Generate Upload URL'+api: 'POST /api/sandboxes/{id}/files/upload-url'+---++Generates a signed URL for uploading a file without an API key. See [Signed URLs](/sandboxes/signed-urls) for usage guide.++<ParamField path="id" type="string" required>+ Sandbox ID+</ParamField>++<ParamField body="path" type="string" required>+ Absolute path for the destination file+</ParamField>++<ParamField body="expiresIn" type="number" default="3600">+ URL lifetime in seconds (max: 86400)+</ParamField>++<ResponseExample>+```json 200+{+ "url": "https://app.opencomputer.dev/api/sandboxes/sb-xxx/files/upload?path=%2Fapp%2Finput.csv&expires=1773906434&signature=abc123",+ "expiresAt": "2025-01-01T01:00:00Z"+}+```+</ResponseExample>diff --git a/docs/api-reference/files/signed-download.mdx b/docs/api-reference/files/signed-download.mdxnew file mode 100644index 00000000..e7f32af0--- /dev/null+++ b/docs/api-reference/files/signed-download.mdx@@ -0,0 +1,36 @@+---+title: 'Signed Download'+api: 'GET /api/sandboxes/{id}/files/download'+---++Download a file using a signed URL. No authentication required — the signature and expiry are validated from query parameters.++Generate a signed URL first via [Generate Download URL](/api-reference/files/generate-download-url).++<ParamField path="id" type="string" required>+ Sandbox ID+</ParamField>++<ParamField query="path" type="string" required>+ Absolute path to the file+</ParamField>++<ParamField query="expires" type="string" required>+ Unix timestamp when the URL expires+</ParamField>++<ParamField query="signature" type="string" required>+ HMAC-SHA256 signature+</ParamField>++<ResponseExample>+```text 200+(file content with Content-Length header)+```++```json 403+{+ "error": "signed URL has expired"+}+```+</ResponseExample>diff --git a/docs/api-reference/files/signed-upload.mdx b/docs/api-reference/files/signed-upload.mdxnew file mode 100644index 00000000..42da0049--- /dev/null+++ b/docs/api-reference/files/signed-upload.mdx@@ -0,0 +1,36 @@+---+title: 'Signed Upload'+api: 'PUT /api/sandboxes/{id}/files/upload'+---++Upload a file using a signed URL. No authentication required — the signature and expiry are validated from query parameters. Send file content as the request body.++Generate a signed URL first via [Generate Upload URL](/api-reference/files/generate-upload-url).++<ParamField path="id" type="string" required>+ Sandbox ID+</ParamField>++<ParamField query="path" type="string" required>+ Absolute path for the destination file+</ParamField>++<ParamField query="expires" type="string" required>+ Unix timestamp when the URL expires+</ParamField>++<ParamField query="signature" type="string" required>+ HMAC-SHA256 signature+</ParamField>++<ResponseExample>+```text 204+(no content)+```++```json 403+{+ "error": "invalid signature"+}+```+</ResponseExample>diff --git a/docs/mint.json b/docs/mint.jsonindex 9b2cb696..fd5d9711 100644--- a/docs/mint.json+++ b/docs/mint.json@@ -81,6 +81,7 @@"sandboxes/overview","sandboxes/running-commands","sandboxes/working-with-files",+ "sandboxes/signed-urls","sandboxes/interactive-terminals","sandboxes/checkpoints","sandboxes/templates",@@ -189,7 +190,11 @@"api-reference/files/write","api-reference/files/list-directory","api-reference/files/mkdir",- "api-reference/files/delete"+ "api-reference/files/delete",+ "api-reference/files/generate-download-url",+ "api-reference/files/generate-upload-url",+ "api-reference/files/signed-download",+ "api-reference/files/signed-upload"]},{diff --git a/docs/reference/python-sdk/filesystem.mdx b/docs/reference/python-sdk/filesystem.mdxindex fc9b8f8f..384bf138 100644--- a/docs/reference/python-sdk/filesystem.mdx+++ b/docs/reference/python-sdk/filesystem.mdx@@ -93,6 +93,34 @@ Check if a path exists. Client-side wrapper — attempts a read and returns `Fal---+## `await sandbox.files.read_stream(path)`++Stream a file as async byte chunks. Avoids buffering the full file in memory — ideal for large files (50MB+).++<ParamField body="path" type="str" required>+ Absolute path to the file+</ParamField>++**Returns:** `AsyncIterator[bytes]`++---++## `await sandbox.files.write_stream(path, stream)`++Stream content to a file from an async iterator. Avoids buffering the full file in memory.++<ParamField body="path" type="str" required>+ Absolute path for the destination file+</ParamField>++<ParamField body="stream" type="AsyncIterator[bytes]" required>+ Async iterator yielding byte chunks+</ParamField>++**Returns:** `None`++---+## Types<Accordion title="EntryInfo">diff --git a/docs/reference/python-sdk/sandbox.mdx b/docs/reference/python-sdk/sandbox.mdxindex 5aef5c8a..d844b2bd 100644--- a/docs/reference/python-sdk/sandbox.mdx+++ b/docs/reference/python-sdk/sandbox.mdx@@ -180,6 +180,34 @@ Revert in-place to a checkpoint. [HTTP API →](/api-reference/checkpoints/resto[HTTP API →](/api-reference/checkpoints/delete) — **Returns:** `None`+### `await sandbox.download_url(path, *, expires_in=3600)`++Generate a signed download URL. [HTTP API →](/api-reference/files/generate-download-url) · [Guide →](/sandboxes/signed-urls)++<ParamField body="path" type="str" required>+ Absolute path to the file+</ParamField>++<ParamField body="expires_in" type="int" default="3600">+ URL lifetime in seconds (max: 86400)+</ParamField>++**Returns:** `str`++### `await sandbox.upload_url(path, *, expires_in=3600)`++Generate a signed upload URL. [HTTP API →](/api-reference/files/generate-upload-url) · [Guide →](/sandboxes/signed-urls)++<ParamField body="path" type="str" required>+ Absolute path for the destination file+</ParamField>++<ParamField body="expires_in" type="int" default="3600">+ URL lifetime in seconds (max: 86400)+</ParamField>++**Returns:** `str`+### `await sandbox.create_preview_url(port, domain?, auth_config?)`[HTTP API →](/api-reference/preview/create)diff --git a/docs/reference/typescript-sdk/filesystem.mdx b/docs/reference/typescript-sdk/filesystem.mdxindex f37b85bd..3cd39d1e 100644--- a/docs/reference/typescript-sdk/filesystem.mdx+++ b/docs/reference/typescript-sdk/filesystem.mdx@@ -81,6 +81,34 @@ Delete a file or directory. [HTTP API →](/api-reference/files/delete)---+## `sandbox.files.readStream(path)`++Stream a file as a `ReadableStream`. Avoids buffering the entire file in memory — ideal for large files (50MB+).++<ParamField body="path" type="string" required>+ Absolute path to the file+</ParamField>++**Returns:** `Promise<ReadableStream<Uint8Array>>`++---++## `sandbox.files.writeStream(path, stream)`++Stream content to a file. Accepts a `ReadableStream` or `Uint8Array` without buffering an extra copy in memory.++<ParamField body="path" type="string" required>+ Absolute path for the destination file+</ParamField>++<ParamField body="stream" type="ReadableStream<Uint8Array> | Uint8Array" required>+ File content as a stream or byte array+</ParamField>++**Returns:** `Promise<void>`++---+## `sandbox.files.exists(path)`Check if a path exists. Client-side wrapper — attempts a read and returns `false` on error.diff --git a/docs/reference/typescript-sdk/sandbox.mdx b/docs/reference/typescript-sdk/sandbox.mdxindex 52166fc7..94895baa 100644--- a/docs/reference/typescript-sdk/sandbox.mdx+++ b/docs/reference/typescript-sdk/sandbox.mdx@@ -209,6 +209,34 @@ Revert in-place to a checkpoint. [HTTP API →](/api-reference/checkpoints/resto[HTTP API →](/api-reference/checkpoints/delete) — **Returns:** `Promise<void>`+### `sandbox.downloadUrl(path, opts?)`++Generate a signed download URL. [HTTP API →](/api-reference/files/generate-download-url) · [Guide →](/sandboxes/signed-urls)++<ParamField body="path" type="string" required>+ Absolute path to the file+</ParamField>++<ParamField body="opts.expiresIn" type="number" default="3600">+ URL lifetime in seconds (max: 86400)+</ParamField>++**Returns:** `Promise<string>`++### `sandbox.uploadUrl(path, opts?)`++Generate a signed upload URL. [HTTP API →](/api-reference/files/generate-upload-url) · [Guide →](/sandboxes/signed-urls)++<ParamField body="path" type="string" required>+ Absolute path for the destination file+</ParamField>++<ParamField body="opts.expiresIn" type="number" default="3600">+ URL lifetime in seconds (max: 86400)+</ParamField>++**Returns:** `Promise<string>`+### `sandbox.createPreviewURL(opts)`[HTTP API →](/api-reference/preview/create)diff --git a/docs/sandboxes/signed-urls.mdx b/docs/sandboxes/signed-urls.mdxnew file mode 100644index 00000000..45af346b--- /dev/null+++ b/docs/sandboxes/signed-urls.mdx@@ -0,0 +1,162 @@+---+title: "Signed URLs"+description: "Generate pre-signed URLs for direct file uploads and downloads without API keys"+---++Signed URLs let you upload or download files from a sandbox without exposing your API key. This is useful for:++- Letting browsers download files directly from a sandbox+- Sharing temporary download links with users+- Uploading files from untrusted clients (e.g. a frontend app)++## How It Works++1. Your backend generates a signed URL using your API key+2. The URL contains an HMAC signature and expiry timestamp+3. Anyone with the URL can upload/download — no API key needed+4. The URL expires automatically (default: 1 hour, max: 24 hours)++## Generating URLs++<CodeGroup>++```typescript TypeScript+import { Sandbox } from "@opencomputer/sdk";++const sandbox = await Sandbox.create();++// Generate a download URL (default: 1 hour expiry)+const downloadUrl = await sandbox.downloadUrl("/app/output.zip");++// Generate an upload URL+const uploadUrl = await sandbox.uploadUrl("/app/input.csv");++// Custom expiry (in seconds)+const shortUrl = await sandbox.downloadUrl("/app/output.zip", { expiresIn: 300 }); // 5 minutes+```++```python Python+from opencomputer import Sandbox++sandbox = await Sandbox.create()++# Generate a download URL (default: 1 hour expiry)+download_url = await sandbox.download_url("/app/output.zip")++# Generate an upload URL+upload_url = await sandbox.upload_url("/app/input.csv")++# Custom expiry (in seconds)+short_url = await sandbox.download_url("/app/output.zip", expires_in=300) # 5 minutes+```++</CodeGroup>++## Downloading Files++Use the signed download URL with a plain GET request — no headers required:++<CodeGroup>++```typescript TypeScript+const url = await sandbox.downloadUrl("/app/results.csv");++// Fetch from browser or server — no API key needed+const resp = await fetch(url);+const data = await resp.arrayBuffer();+```++```python Python+import httpx++url = await sandbox.download_url("/app/results.csv")++async with httpx.AsyncClient() as http:+ resp = await http.get(url)+ data = resp.content+```++```bash cURL+# The URL is self-contained — just GET it+curl -o results.csv "https://app.opencomputer.dev/api/sandboxes/sb-xxx/files/download?path=%2Fapp%2Fresults.csv&expires=1773906434&signature=abc123"+```++</CodeGroup>++## Uploading Files++Use the signed upload URL with a PUT request:++<CodeGroup>++```typescript TypeScript+const url = await sandbox.uploadUrl("/app/data.csv");++// Upload from browser or server — no API key needed+await fetch(url, {+ method: "PUT",+ body: fileContent, // string, Uint8Array, Blob, etc.+});+```++```python Python+import httpx++url = await sandbox.upload_url("/app/data.csv")++async with httpx.AsyncClient() as http:+ await http.put(url, content=file_bytes)+```++```bash cURL+curl -X PUT --data-binary @data.csv "https://app.opencomputer.dev/api/sandboxes/sb-xxx/files/upload?path=%2Fapp%2Fdata.csv&expires=1773906434&signature=abc123"+```++</CodeGroup>++## Large Files++Signed URLs support files of any size — the entire pipeline streams data in 256KB chunks without buffering. Files up to 200MB+ have been tested at ~20 MB/s throughput.++<CodeGroup>++```typescript TypeScript+// Upload a 100MB file via signed URL+const data = new Uint8Array(100 * 1024 * 1024);+const uploadUrl = await sandbox.uploadUrl("/data/model.bin");+await fetch(uploadUrl, { method: "PUT", body: data });++// Download it back+const downloadUrl = await sandbox.downloadUrl("/data/model.bin");+const resp = await fetch(downloadUrl);+const downloaded = new Uint8Array(await resp.arrayBuffer());+```++```python Python+import httpx++# Upload a 100MB file via signed URL+data = b"\x00" * (100 * 1024 * 1024)+upload_url = await sandbox.upload_url("/data/model.bin")+async with httpx.AsyncClient(timeout=120.0) as http:+ await http.put(upload_url, content=data)++# Download it back+download_url = await sandbox.download_url("/data/model.bin")+async with httpx.AsyncClient(timeout=120.0) as http:+ resp = await http.get(download_url)+ downloaded = resp.content+```++</CodeGroup>++## Security++- **Tamper-proof:** URLs are signed with HMAC-SHA256. Changing the path, sandbox ID, or expiry invalidates the signature.+- **Time-limited:** URLs expire after the specified duration (default 1 hour, max 24 hours). Expired URLs return `403`.+- **Operation-scoped:** Download URLs cannot be used for uploads and vice versa.+- **Path-scoped:** Each URL is bound to a specific file path. Changing the path in the URL returns `403`.++<Tip>+ Full reference: [TypeScript SDK](/reference/typescript-sdk#filesystem) · [Python SDK](/reference/python-sdk#filesystem) · [HTTP API](/api-reference/files/generate-download-url).+</Tip>diff --git a/docs/sandboxes/working-with-files.mdx b/docs/sandboxes/working-with-files.mdxindex 7ae8b655..16a94a6d 100644--- a/docs/sandboxes/working-with-files.mdx+++ b/docs/sandboxes/working-with-files.mdx@@ -157,6 +157,52 @@ if await sandbox.files.exists("/app/config.json"):`exists()` is a client-side convenience — it attempts a file read and returns `false` on error. There is no dedicated HTTP endpoint for existence checks.</Note>+## Large Files++All file operations are streamed end-to-end using 256KB chunks — there is no file size limit beyond available disk space. Files up to 200MB+ transfer reliably at ~20 MB/s.++The standard `read()`, `readBytes()`, and `write()` methods work for large files, but they buffer the full content in memory on the client side. For very large files, use the streaming methods to avoid high memory usage:++<CodeGroup>++```typescript TypeScript+// Stream a large file download — returns a ReadableStream, not a buffer+const stream = await sandbox.files.readStream("/data/model.bin");++// Pipe to a file, or process chunks incrementally+const reader = stream.getReader();+while (true) {+ const { done, value } = await reader.read();+ if (done) break;+ // process each Uint8Array chunk...+}++// Stream a large file upload — accepts ReadableStream or Uint8Array+const fileStream = someReadableStream; // e.g. from fs.createReadStream+await sandbox.files.writeStream("/data/model.bin", fileStream);++// Uint8Array also works (sent without buffering a copy)+await sandbox.files.writeStream("/data/output.bin", largeUint8Array);+```++```python Python+# Stream a large file download — returns an async byte iterator+stream = await sandbox.files.read_stream("/data/model.bin")+async for chunk in stream:+ # process each bytes chunk...+ pass++# Stream a large file upload — accepts an async iterator+async def file_chunks():+ with open("local_model.bin", "rb") as f:+ while chunk := f.read(256 * 1024):+ yield chunk++await sandbox.files.write_stream("/data/model.bin", file_chunks())+```++</CodeGroup>+## Examples### Upload and Run a Scriptdiff --git a/internal/agent/filesystem.go b/internal/agent/filesystem.goindex bd28d492..eaa04b3f 100644--- a/internal/agent/filesystem.go+++ b/internal/agent/filesystem.go@@ -3,12 +3,15 @@ package agentimport ("context""fmt"+ "io""os""path/filepath"pb "github.com/opensandbox/opensandbox/proto/agent")+const streamChunkSize = 256 * 1024 // 256KB per gRPC chunk+// ReadFile reads a file from the VM filesystem.func (s *Server) ReadFile(ctx context.Context, req *pb.ReadFileRequest) (*pb.ReadFileResponse, error) {path := resolvePath(req.Path)@@ -106,6 +109,100 @@ func (s *Server) Stat(ctx context.Context, req *pb.StatRequest) (*pb.StatRespons}, nil}+// ReadFileStream streams a file in 256KB chunks over gRPC.+func (s *Server) ReadFileStream(req *pb.ReadFileStreamRequest, stream pb.SandboxAgent_ReadFileStreamServer) error {+ path := resolvePath(req.Path)+ f, err := os.Open(path)+ if err != nil {+ return fmt.Errorf("open %s: %w", path, err)+ }+ defer f.Close()++ info, err := f.Stat()+ if err != nil {+ return fmt.Errorf("stat %s: %w", path, err)+ }++ buf := make([]byte, streamChunkSize)+ first := true+ for {+ n, err := f.Read(buf)+ if n > 0 {+ chunk := &pb.FileChunk{Data: buf[:n]}+ if first {+ chunk.TotalSize = info.Size()+ first = false+ }+ if sendErr := stream.Send(chunk); sendErr != nil {+ return fmt.Errorf("send chunk: %w", sendErr)+ }+ }+ if err == io.EOF {+ break+ }+ if err != nil {+ return fmt.Errorf("read %s: %w", path, err)+ }+ }+ return nil+}++// WriteFileStream receives a file in chunks over gRPC and writes it to disk.+func (s *Server) WriteFileStream(stream pb.SandboxAgent_WriteFileStreamServer) error {+ // First message carries path and mode+ msg, err := stream.Recv()+ if err != nil {+ return fmt.Errorf("recv first chunk: %w", err)+ }++ path := resolvePath(msg.Path)+ mode := os.FileMode(msg.Mode)+ if mode == 0 {+ mode = 0644+ }++ dir := filepath.Dir(path)+ if err := os.MkdirAll(dir, 0755); err != nil {+ return fmt.Errorf("mkdir %s: %w", dir, err)+ }++ f, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, mode)+ if err != nil {+ return fmt.Errorf("create %s: %w", path, err)+ }+ defer f.Close()++ var total int64+ // Write first message's data+ if len(msg.Data) > 0 {+ n, err := f.Write(msg.Data)+ if err != nil {+ return fmt.Errorf("write %s: %w", path, err)+ }+ total += int64(n)+ }++ // Receive remaining chunks+ for {+ msg, err := stream.Recv()+ if err == io.EOF {+ break+ }+ if err != nil {+ return fmt.Errorf("recv chunk: %w", err)+ }+ if len(msg.Data) > 0 {+ n, err := f.Write(msg.Data)+ if err != nil {+ return fmt.Errorf("write %s: %w", path, err)+ }+ total += int64(n)+ }+ }++ return stream.SendAndClose(&pb.WriteFileStreamResponse{BytesWritten: total})+}+// resolvePath ensures paths are rooted in /root for relative paths.func resolvePath(path string) string {if filepath.IsAbs(path) {diff --git a/internal/api/filesystem.go b/internal/api/filesystem.goindex 7964f883..7f786414 100644--- a/internal/api/filesystem.go+++ b/internal/api/filesystem.go@@ -2,6 +2,7 @@ package apiimport ("context"+ "fmt""io""net/http"@@ -22,11 +23,12 @@ func (s *Server) readFile(c echo.Context) error {})}- var content string+ var reader io.ReadCloser+ var totalSize int64routeOp := func(ctx context.Context) error {var err error- content, err = s.manager.ReadFile(ctx, id, path)+ reader, totalSize, err = s.manager.ReadFileStream(ctx, id, path)return err}@@ -43,8 +45,16 @@ func (s *Server) readFile(c echo.Context) error {})}}+ defer reader.Close()- return c.String(http.StatusOK, content)+ resp := c.Response()+ resp.Header().Set("Content-Type", "application/octet-stream")+ if totalSize > 0 {+ resp.Header().Set("Content-Length", fmt.Sprintf("%d", totalSize))+ }+ resp.WriteHeader(http.StatusOK)+ _, err := io.Copy(resp.Writer, reader)+ return err}func (s *Server) writeFile(c echo.Context) error {@@ -60,15 +70,9 @@ func (s *Server) writeFile(c echo.Context) error {})}- body, err := io.ReadAll(c.Request().Body)- if err != nil {- return c.JSON(http.StatusBadRequest, map[string]string{- "error": "failed to read request body: " + err.Error(),- })- }-routeOp := func(ctx context.Context) error {- return s.manager.WriteFile(ctx, id, path, string(body))+ _, err := s.manager.WriteFileStream(ctx, id, path, 0644, c.Request().Body)+ return err}if s.router != nil {diff --git a/internal/api/router.go b/internal/api/router.goindex 42ebb0ed..2d62eb19 100644--- a/internal/api/router.go+++ b/internal/api/router.go@@ -145,6 +145,10 @@ func NewServer(mgr sandbox.Manager, ptyMgr *sandbox.PTYManager, apiKey string, oreturn c.JSON(http.StatusOK, map[string]string{"status": "ok"})})+ // Signed URL endpoints (self-authenticated via HMAC, no API key required)+ e.GET("/api/sandboxes/:id/files/download", s.signedDownload)+ e.PUT("/api/sandboxes/:id/files/upload", s.signedUpload)+// API routes (with API key auth)api := e.Group("/api")api.Use(auth.PGAPIKeyMiddleware(s.store, apiKey))@@ -171,6 +175,10 @@ func NewServer(mgr sandbox.Manager, ptyMgr *sandbox.PTYManager, apiKey string, oapi.GET("/sandboxes/checkpoints/:checkpointId/patches", s.listCheckpointPatches)api.DELETE("/sandboxes/checkpoints/:checkpointId/patches/:patchId", s.deleteCheckpointPatch)+ // Signed file URLs+ api.POST("/sandboxes/:id/files/download-url", s.createDownloadURL)+ api.POST("/sandboxes/:id/files/upload-url", s.createUploadURL)+// Preview URLs (on-demand port-based)api.POST("/sandboxes/:id/preview", s.createPreviewURL)api.GET("/sandboxes/:id/preview", s.listPreviewURLs)diff --git a/internal/api/signed_urls.go b/internal/api/signed_urls.gonew file mode 100644index 00000000..d77834d9--- /dev/null+++ b/internal/api/signed_urls.go@@ -0,0 +1,207 @@+package api++import (+ "fmt"+ "net/http"+ "net/url"+ "time"++ "github.com/labstack/echo/v4"+ "github.com/opensandbox/opensandbox/internal/auth"+)++const (+ defaultSignedURLExpiry = 3600 // 1 hour in seconds+ maxSignedURLExpiry = 86400 // 24 hours in seconds+)++// signedURLSecret returns the HMAC secret or an error if not configured.+func (s *Server) signedURLSecret() ([]byte, error) {+ if s.jwtIssuer == nil {+ return nil, fmt.Errorf("signed URLs require OPENSANDBOX_JWT_SECRET to be configured")+ }+ return s.jwtIssuer.SigningSecret(), nil+}++// createDownloadURL generates a signed download URL for a sandbox file.+// POST /api/sandboxes/:id/files/download-url (API key authenticated)+func (s *Server) createDownloadURL(c echo.Context) error {+ return s.createSignedURL(c, "download")+}++// createUploadURL generates a signed upload URL for a sandbox file.+// POST /api/sandboxes/:id/files/upload-url (API key authenticated)+func (s *Server) createUploadURL(c echo.Context) error {+ return s.createSignedURL(c, "upload")+}++type signedURLRequest struct {+ Path string `json:"path"`+ ExpiresIn int `json:"expiresIn"` // seconds, optional+}++type signedURLResponse struct {+ URL string `json:"url"`+ ExpiresAt string `json:"expiresAt"`+}++func (s *Server) createSignedURL(c echo.Context, operation string) error {+ secret, err := s.signedURLSecret()+ if err != nil {+ return c.JSON(http.StatusServiceUnavailable, map[string]string{"error": err.Error()})+ }++ sandboxID := c.Param("id")++ var req signedURLRequest+ if err := c.Bind(&req); err != nil {+ return c.JSON(http.StatusBadRequest, map[string]string{"error": "invalid request body"})+ }+ if req.Path == "" {+ return c.JSON(http.StatusBadRequest, map[string]string{"error": "path is required"})+ }++ expiresIn := req.ExpiresIn+ if expiresIn <= 0 {+ expiresIn = defaultSignedURLExpiry+ }+ if expiresIn > maxSignedURLExpiry {+ expiresIn = maxSignedURLExpiry+ }++ expiresAt := time.Now().Add(time.Duration(expiresIn) * time.Second)++ params := auth.SignedURLParams{+ SandboxID: sandboxID,+ Path: req.Path,+ Operation: operation,+ ExpiresAt: expiresAt,+ }++ signature := auth.SignURL(secret, params)++ // Build the URL pointing back at this control plane+ scheme := "https"+ if c.Request().TLS == nil {+ // Check X-Forwarded-Proto for ALB+ if proto := c.Request().Header.Get("X-Forwarded-Proto"); proto != "" {+ scheme = proto+ } else {+ scheme = "http"+ }+ }+ host := c.Request().Host++ var endpoint string+ if operation == "download" {+ endpoint = "download"+ } else {+ endpoint = "upload"+ }++ signedURL := fmt.Sprintf("%s://%s/api/sandboxes/%s/files/%s?path=%s&expires=%s&signature=%s",+ scheme, host, sandboxID, endpoint,+ urlEncode(req.Path), params.ExpiresAtUnix(), signature,+ )++ return c.JSON(http.StatusOK, signedURLResponse{+ URL: signedURL,+ ExpiresAt: expiresAt.UTC().Format(time.RFC3339),+ })+}++// signedDownload serves a file download using a signed URL (no API key required).+// GET /api/sandboxes/:id/files/download?path=...&expires=...&signature=...+func (s *Server) signedDownload(c echo.Context) error {+ secret, err := s.signedURLSecret()+ if err != nil {+ return c.JSON(http.StatusServiceUnavailable, map[string]string{"error": err.Error()})+ }++ sandboxID := c.Param("id")+ path := c.QueryParam("path")+ expiresStr := c.QueryParam("expires")+ signature := c.QueryParam("signature")++ if path == "" || expiresStr == "" || signature == "" {+ return c.JSON(http.StatusBadRequest, map[string]string{"error": "path, expires, and signature are required"})+ }++ expiresAt, err := auth.ParseExpiresUnix(expiresStr)+ if err != nil {+ return c.JSON(http.StatusBadRequest, map[string]string{"error": err.Error()})+ }++ params := auth.SignedURLParams{+ SandboxID: sandboxID,+ Path: path,+ Operation: "download",+ ExpiresAt: expiresAt,+ }++ if err := auth.VerifyURL(secret, params, signature); err != nil {+ return c.JSON(http.StatusForbidden, map[string]string{"error": err.Error()})+ }++ // Delegate to the existing file read logic.+ // Rewrite query params so readFile/proxy picks up the right path.+ c.QueryParams().Set("path", path)++ if s.sandboxAPIProxy != nil {+ // Server mode: proxy to worker. Rewrite the request path so the proxy+ // strips /api and forwards to the worker's /sandboxes/:id/files endpoint.+ c.Request().URL.Path = fmt.Sprintf("/api/sandboxes/%s/files", sandboxID)+ return s.sandboxAPIProxy.ProxyHandler(c)+ }++ // Combined mode: handle locally+ return s.readFile(c)+}++// signedUpload handles a file upload using a signed URL (no API key required).+// PUT /api/sandboxes/:id/files/upload?path=...&expires=...&signature=...+func (s *Server) signedUpload(c echo.Context) error {+ secret, err := s.signedURLSecret()+ if err != nil {+ return c.JSON(http.StatusServiceUnavailable, map[string]string{"error": err.Error()})+ }++ sandboxID := c.Param("id")+ path := c.QueryParam("path")+ expiresStr := c.QueryParam("expires")+ signature := c.QueryParam("signature")++ if path == "" || expiresStr == "" || signature == "" {+ return c.JSON(http.StatusBadRequest, map[string]string{"error": "path, expires, and signature are required"})+ }++ expiresAt, err := auth.ParseExpiresUnix(expiresStr)+ if err != nil {+ return c.JSON(http.StatusBadRequest, map[string]string{"error": err.Error()})+ }++ params := auth.SignedURLParams{+ SandboxID: sandboxID,+ Path: path,+ Operation: "upload",+ ExpiresAt: expiresAt,+ }++ if err := auth.VerifyURL(secret, params, signature); err != nil {+ return c.JSON(http.StatusForbidden, map[string]string{"error": err.Error()})+ }++ // Delegate to the existing file write logic.+ c.QueryParams().Set("path", path)++ if s.sandboxAPIProxy != nil {+ c.Request().URL.Path = fmt.Sprintf("/api/sandboxes/%s/files", sandboxID)+ return s.sandboxAPIProxy.ProxyHandler(c)+ }++ return s.writeFile(c)+}++func urlEncode(s string) string {+ return url.QueryEscape(s)+}diff --git a/internal/auth/jwt.go b/internal/auth/jwt.goindex 99bcbed0..f1910173 100644--- a/internal/auth/jwt.go+++ b/internal/auth/jwt.go@@ -45,6 +45,9 @@ func (j *JWTIssuer) IssueSandboxToken(orgID uuid.UUID, sandboxID, workerID strinreturn token.SignedString(j.secret)}+// SigningSecret returns the raw HMAC secret for use by other signing functions (e.g. signed URLs).+func (j *JWTIssuer) SigningSecret() []byte { return j.secret }+// ValidateSandboxToken parses and validates a sandbox-scoped JWT.func (j *JWTIssuer) ValidateSandboxToken(tokenStr string) (*SandboxClaims, error) {token, err := jwt.ParseWithClaims(tokenStr, &SandboxClaims{}, func(t *jwt.Token) (interface{}, error) {diff --git a/internal/auth/signed_url.go b/internal/auth/signed_url.gonew file mode 100644index 00000000..ad1cf644--- /dev/null+++ b/internal/auth/signed_url.go@@ -0,0 +1,69 @@+package auth++import (+ "crypto/hmac"+ "crypto/sha256"+ "encoding/hex"+ "fmt"+ "strconv"+ "time"+)++// SignedURLParams holds the parameters for generating or verifying a signed URL.+type SignedURLParams struct {+ SandboxID string+ Path string+ Operation string // "download" or "upload"+ ExpiresAt time.Time+}++// SignURL produces an HMAC-SHA256 hex signature for the given parameters.+// The signing payload uses a domain-separated canonical format to prevent+// parameter substitution attacks.+func SignURL(secret []byte, params SignedURLParams) string {+ mac := hmac.New(sha256.New, secret)+ mac.Write([]byte(signPayload(params)))+ return hex.EncodeToString(mac.Sum(nil))+}++// VerifyURL checks the HMAC signature and expiration.+func VerifyURL(secret []byte, params SignedURLParams, signature string) error {+ if time.Now().After(params.ExpiresAt) {+ return fmt.Errorf("signed URL expired")+ }++ expected := SignURL(secret, params)+ sigBytes, err := hex.DecodeString(signature)+ if err != nil {+ return fmt.Errorf("invalid signature encoding")+ }+ expectedBytes, _ := hex.DecodeString(expected)++ if !hmac.Equal(sigBytes, expectedBytes) {+ return fmt.Errorf("invalid signature")+ }++ return nil+}++// ExpiresAtUnix returns the expiration as a Unix timestamp string.+func (p SignedURLParams) ExpiresAtUnix() string {+ return strconv.FormatInt(p.ExpiresAt.Unix(), 10)+}++// ParseExpiresUnix parses a Unix timestamp string into a time.Time.+func ParseExpiresUnix(s string) (time.Time, error) {+ unix, err := strconv.ParseInt(s, 10, 64)+ if err != nil {+ return time.Time{}, fmt.Errorf("invalid expiration: %w", err)+ }+ return time.Unix(unix, 0), nil+}++func signPayload(params SignedURLParams) string {+ return "opensandbox-signed-url\n" ++ params.SandboxID + "\n" ++ params.Path + "\n" ++ params.Operation + "\n" ++ params.ExpiresAtUnix()+}diff --git a/internal/firecracker/agent_client.go b/internal/firecracker/agent_client.goindex 7d4c2364..d4db7811 100644--- a/internal/firecracker/agent_client.go+++ b/internal/firecracker/agent_client.go@@ -4,6 +4,7 @@ import ("bufio""context""fmt"+ "io""net""strings""time"@@ -14,6 +15,8 @@ import ("google.golang.org/grpc/credentials/insecure")+const streamChunkSize = 256 * 1024 // 256KB per gRPC chunk+// AgentClient is the host-side gRPC client that connects to the// osb-agent running inside a Firecracker VM via vsock.type AgentClient struct {@@ -265,6 +268,91 @@ func (c *AgentClient) ExecSessionKill(ctx context.Context, sessionID string, sigreturn err}+// ReadFileStream opens a server-streaming gRPC call and returns an io.ReadCloser+// that yields the file contents in 256KB chunks, plus the total file size.+func (c *AgentClient) ReadFileStream(ctx context.Context, path string) (io.ReadCloser, int64, error) {+ stream, err := c.client.ReadFileStream(ctx, &pb.ReadFileStreamRequest{Path: path})+ if err != nil {+ return nil, 0, err+ }++ pr, pw := io.Pipe()+ var totalSize int64++ // Read first chunk to get total_size+ first, err := stream.Recv()+ if err != nil {+ pw.Close()+ pr.Close()+ return nil, 0, fmt.Errorf("recv first chunk: %w", err)+ }+ totalSize = first.TotalSize++ go func() {+ // Write first chunk data+ if _, err := pw.Write(first.Data); err != nil {+ pw.CloseWithError(err)+ return+ }+ // Read remaining chunks+ for {+ chunk, err := stream.Recv()+ if err == io.EOF {+ pw.Close()+ return+ }+ if err != nil {+ pw.CloseWithError(err)+ return+ }+ if _, err := pw.Write(chunk.Data); err != nil {+ pw.CloseWithError(err)+ return+ }+ }+ }()++ return pr, totalSize, nil+}++// WriteFileStream sends a file in 256KB chunks via client-streaming gRPC.+// Returns the total bytes written.+func (c *AgentClient) WriteFileStream(ctx context.Context, path string, mode uint32, r io.Reader) (int64, error) {+ stream, err := c.client.WriteFileStream(ctx)+ if err != nil {+ return 0, err+ }++ buf := make([]byte, streamChunkSize)+ first := true+ for {+ n, err := r.Read(buf)+ if n > 0 {+ msg := &pb.WriteFileStreamRequest{Data: buf[:n]}+ if first {+ msg.Path = path+ msg.Mode = mode+ first = false+ }+ if sendErr := stream.Send(msg); sendErr != nil {+ return 0, fmt.Errorf("send chunk: %w", sendErr)+ }+ }+ if err == io.EOF {+ break+ }+ if err != nil {+ return 0, fmt.Errorf("read source: %w", err)+ }+ }++ resp, err := stream.CloseAndRecv()+ if err != nil {+ return 0, err+ }+ return resp.BytesWritten, nil+}+// ConnectPTYData connects to the PTY data stream on the given vsock port.// Returns a raw TCP-like connection for bidirectional PTY I/O.func (c *AgentClient) ConnectPTYData(vsockPath string, dataPort uint32) (net.Conn, error) {diff --git a/internal/firecracker/manager.go b/internal/firecracker/manager.goindex cc08f7b0..d640f929 100644--- a/internal/firecracker/manager.go+++ b/internal/firecracker/manager.go@@ -7,6 +7,7 @@ import ("context""encoding/json""fmt"+ "io""log""os""os/exec"@@ -825,6 +826,24 @@ func (m *Manager) WriteFile(ctx context.Context, sandboxID, path, content stringreturn vm.agent.WriteFile(ctx, path, []byte(content))}+// ReadFileStream streams a file from the VM as an io.ReadCloser.+func (m *Manager) ReadFileStream(ctx context.Context, sandboxID, path string) (io.ReadCloser, int64, error) {+ vm, err := m.getReadyVM(ctx, sandboxID)+ if err != nil {+ return nil, 0, err+ }+ return vm.agent.ReadFileStream(ctx, path)+}++// WriteFileStream streams a file into the VM from an io.Reader.+func (m *Manager) WriteFileStream(ctx context.Context, sandboxID, path string, mode uint32, r io.Reader) (int64, error) {+ vm, err := m.getReadyVM(ctx, sandboxID)+ if err != nil {+ return 0, err+ }+ return vm.agent.WriteFileStream(ctx, path, mode, r)+}+// ListDir lists a directory in the VM.func (m *Manager) ListDir(ctx context.Context, sandboxID, path string) ([]types.EntryInfo, error) {vm, err := m.getReadyVM(ctx, sandboxID)diff --git a/internal/proxy/sandbox_api_proxy.go b/internal/proxy/sandbox_api_proxy.goindex 6cf8302a..f68a72fa 100644--- a/internal/proxy/sandbox_api_proxy.go+++ b/internal/proxy/sandbox_api_proxy.go@@ -132,6 +132,8 @@ func (p *SandboxAPIProxy) forward(c echo.Context, sandboxID, workerURL, workerID}// doHTTP reverse-proxies a normal HTTP request to the worker.+// Streams the response directly to the client without buffering, enabling+// large file downloads via signed URLs.func (p *SandboxAPIProxy) doHTTP(c echo.Context, sandboxID, workerURL, token string) error {target, err := url.Parse(workerURL)if err != nil {@@ -141,6 +143,7 @@ func (p *SandboxAPIProxy) doHTTP(c echo.Context, sandboxID, workerURL, token str}proxy := httputil.NewSingleHostReverseProxy(target)+ proxy.FlushInterval = -1 // flush chunks immediatelyproxy.Transport = &http.Transport{DialContext: (&net.Dialer{Timeout: 5 * time.Second,@@ -149,9 +152,12 @@ func (p *SandboxAPIProxy) doHTTP(c echo.Context, sandboxID, workerURL, token strMaxIdleConnsPerHost: 10,}- var proxyErr errorproxy.ErrorHandler = func(w http.ResponseWriter, r *http.Request, err error) {- proxyErr = err+ log.Printf("sandbox-api-proxy: error proxying sandbox %s to %s: %v", sandboxID, workerURL, err)+ // Write error JSON directly — headers may not have been sent yet+ w.Header().Set("Content-Type", "application/json")+ w.WriteHeader(http.StatusBadGateway)+ fmt.Fprintf(w, `{"error":"sandbox %s: upstream unavailable"}`, sandboxID)}// Rewrite request to target worker, preserving the original path@@ -170,19 +176,8 @@ func (p *SandboxAPIProxy) doHTTP(c echo.Context, sandboxID, workerURL, token str}}- rec := &responseRecorder{- header: make(http.Header),- }- proxy.ServeHTTP(rec, c.Request())-- if proxyErr != nil {- log.Printf("sandbox-api-proxy: error proxying sandbox %s to %s: %v", sandboxID, workerURL, proxyErr)- return c.JSON(http.StatusBadGateway, map[string]string{- "error": fmt.Sprintf("sandbox %s: upstream unavailable", sandboxID),- })- }-- rec.writeTo(c.Response())+ // Serve directly to the client ResponseWriter — no buffering+ proxy.ServeHTTP(c.Response().Writer, c.Request())return nil}diff --git a/internal/sandbox/interface.go b/internal/sandbox/interface.goindex 733b6e24..e47b5e95 100644--- a/internal/sandbox/interface.go+++ b/internal/sandbox/interface.go@@ -2,6 +2,7 @@ package sandboximport ("context"+ "io""github.com/opensandbox/opensandbox/internal/storage""github.com/opensandbox/opensandbox/pkg/types"@@ -43,6 +44,8 @@ type Manager interface {// FilesystemReadFile(ctx context.Context, sandboxID, path string) (string, error)WriteFile(ctx context.Context, sandboxID, path, content string) error+ ReadFileStream(ctx context.Context, sandboxID, path string) (io.ReadCloser, int64, error)+ WriteFileStream(ctx context.Context, sandboxID, path string, mode uint32, r io.Reader) (int64, error)ListDir(ctx context.Context, sandboxID, path string) ([]types.EntryInfo, error)MakeDir(ctx context.Context, sandboxID, path string) errorRemove(ctx context.Context, sandboxID, path string) errordiff --git a/internal/worker/handlers.go b/internal/worker/handlers.goindex c90bead5..64ee6be3 100644--- a/internal/worker/handlers.go+++ b/internal/worker/handlers.go@@ -4,6 +4,7 @@ import ("context""encoding/binary""encoding/json"+ "fmt""io""net/http""time"@@ -319,10 +320,11 @@ func (s *HTTPServer) readFile(c echo.Context) error {return c.JSON(http.StatusBadRequest, map[string]string{"error": "path query parameter is required"})}- var content string+ var reader io.ReadCloser+ var totalSize int64routeOp := func(ctx context.Context) error {var err error- content, err = s.manager.ReadFile(ctx, id, path)+ reader, totalSize, err = s.manager.ReadFileStream(ctx, id, path)return err}@@ -335,8 +337,16 @@ func (s *HTTPServer) readFile(c echo.Context) error {return c.JSON(http.StatusInternalServerError, map[string]string{"error": err.Error()})}}+ defer reader.Close()- return c.String(http.StatusOK, content)+ resp := c.Response()+ resp.Header().Set("Content-Type", "application/octet-stream")+ if totalSize > 0 {+ resp.Header().Set("Content-Length", fmt.Sprintf("%d", totalSize))+ }+ resp.WriteHeader(http.StatusOK)+ _, err := io.Copy(resp.Writer, reader)+ return err}func (s *HTTPServer) writeFile(c echo.Context) error {@@ -345,13 +355,10 @@ func (s *HTTPServer) writeFile(c echo.Context) error {if path == "" {return c.JSON(http.StatusBadRequest, map[string]string{"error": "path query parameter is required"})}- body, err := io.ReadAll(c.Request().Body)- if err != nil {- return c.JSON(http.StatusBadRequest, map[string]string{"error": "failed to read request body: " + err.Error()})- }routeOp := func(ctx context.Context) error {- return s.manager.WriteFile(ctx, id, path, string(body))+ _, err := s.manager.WriteFileStream(ctx, id, path, 0644, c.Request().Body)+ return err}if s.router != nil {diff --git a/proto/agent/agent.pb.go b/proto/agent/agent.pb.goindex fcf8e4c2..84e94321 100644--- a/proto/agent/agent.pb.go+++ b/proto/agent/agent.pb.go@@ -116,7 +116,7 @@ func (x ExecSessionOutput_Type) Number() protoreflect.EnumNumber {// Deprecated: Use ExecSessionOutput_Type.Descriptor instead.func (ExecSessionOutput_Type) EnumDescriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{31, 0}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{35, 0}}type ExecRequest struct {@@ -491,6 +491,206 @@ func (*WriteFileResponse) Descriptor() ([]byte, []int) {return file_proto_agent_agent_proto_rawDescGZIP(), []int{6}}+type ReadFileStreamRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *ReadFileStreamRequest) Reset() {+ *x = ReadFileStreamRequest{}+ mi := &file_proto_agent_agent_proto_msgTypes[7]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *ReadFileStreamRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*ReadFileStreamRequest) ProtoMessage() {}++func (x *ReadFileStreamRequest) ProtoReflect() protoreflect.Message {+ mi := &file_proto_agent_agent_proto_msgTypes[7]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use ReadFileStreamRequest.ProtoReflect.Descriptor instead.+func (*ReadFileStreamRequest) Descriptor() ([]byte, []int) {+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{7}+}++func (x *ReadFileStreamRequest) GetPath() string {+ if x != nil {+ return x.Path+ }+ return ""+}++type FileChunk struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`+ TotalSize int64 `protobuf:"varint,2,opt,name=total_size,json=totalSize,proto3" json:"total_size,omitempty"` // set on first chunk only (0 on subsequent chunks)+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *FileChunk) Reset() {+ *x = FileChunk{}+ mi := &file_proto_agent_agent_proto_msgTypes[8]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *FileChunk) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*FileChunk) ProtoMessage() {}++func (x *FileChunk) ProtoReflect() protoreflect.Message {+ mi := &file_proto_agent_agent_proto_msgTypes[8]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use FileChunk.ProtoReflect.Descriptor instead.+func (*FileChunk) Descriptor() ([]byte, []int) {+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{8}+}++func (x *FileChunk) GetData() []byte {+ if x != nil {+ return x.Data+ }+ return nil+}++func (x *FileChunk) GetTotalSize() int64 {+ if x != nil {+ return x.TotalSize+ }+ return 0+}++type WriteFileStreamRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"` // set on first message only+ Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`+ Mode uint32 `protobuf:"varint,3,opt,name=mode,proto3" json:"mode,omitempty"` // set on first message only (0 = default 0644)+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *WriteFileStreamRequest) Reset() {+ *x = WriteFileStreamRequest{}+ mi := &file_proto_agent_agent_proto_msgTypes[9]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *WriteFileStreamRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*WriteFileStreamRequest) ProtoMessage() {}++func (x *WriteFileStreamRequest) ProtoReflect() protoreflect.Message {+ mi := &file_proto_agent_agent_proto_msgTypes[9]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use WriteFileStreamRequest.ProtoReflect.Descriptor instead.+func (*WriteFileStreamRequest) Descriptor() ([]byte, []int) {+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{9}+}++func (x *WriteFileStreamRequest) GetPath() string {+ if x != nil {+ return x.Path+ }+ return ""+}++func (x *WriteFileStreamRequest) GetData() []byte {+ if x != nil {+ return x.Data+ }+ return nil+}++func (x *WriteFileStreamRequest) GetMode() uint32 {+ if x != nil {+ return x.Mode+ }+ return 0+}++type WriteFileStreamResponse struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ BytesWritten int64 `protobuf:"varint,1,opt,name=bytes_written,json=bytesWritten,proto3" json:"bytes_written,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *WriteFileStreamResponse) Reset() {+ *x = WriteFileStreamResponse{}+ mi := &file_proto_agent_agent_proto_msgTypes[10]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *WriteFileStreamResponse) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*WriteFileStreamResponse) ProtoMessage() {}++func (x *WriteFileStreamResponse) ProtoReflect() protoreflect.Message {+ mi := &file_proto_agent_agent_proto_msgTypes[10]+ if x != nil {+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ if ms.LoadMessageInfo() == nil {+ ms.StoreMessageInfo(mi)+ }+ return ms+ }+ return mi.MessageOf(x)+}++// Deprecated: Use WriteFileStreamResponse.ProtoReflect.Descriptor instead.+func (*WriteFileStreamResponse) Descriptor() ([]byte, []int) {+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{10}+}++func (x *WriteFileStreamResponse) GetBytesWritten() int64 {+ if x != nil {+ return x.BytesWritten+ }+ return 0+}+type ListDirRequest struct {state protoimpl.MessageState `protogen:"open.v1"`Path string `protobuf:"bytes,1,opt,name=path,proto3" json:"path,omitempty"`@@ -500,7 +700,7 @@ type ListDirRequest struct {func (x *ListDirRequest) Reset() {*x = ListDirRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[7]+ mi := &file_proto_agent_agent_proto_msgTypes[11]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -512,7 +712,7 @@ func (x *ListDirRequest) String() string {func (*ListDirRequest) ProtoMessage() {}func (x *ListDirRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[7]+ mi := &file_proto_agent_agent_proto_msgTypes[11]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -525,7 +725,7 @@ func (x *ListDirRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ListDirRequest.ProtoReflect.Descriptor instead.func (*ListDirRequest) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{7}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{11}}func (x *ListDirRequest) GetPath() string {@@ -547,7 +747,7 @@ type DirEntry struct {func (x *DirEntry) Reset() {*x = DirEntry{}- mi := &file_proto_agent_agent_proto_msgTypes[8]+ mi := &file_proto_agent_agent_proto_msgTypes[12]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -559,7 +759,7 @@ func (x *DirEntry) String() string {func (*DirEntry) ProtoMessage() {}func (x *DirEntry) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[8]+ mi := &file_proto_agent_agent_proto_msgTypes[12]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -572,7 +772,7 @@ func (x *DirEntry) ProtoReflect() protoreflect.Message {// Deprecated: Use DirEntry.ProtoReflect.Descriptor instead.func (*DirEntry) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{8}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{12}}func (x *DirEntry) GetName() string {@@ -612,7 +812,7 @@ type ListDirResponse struct {func (x *ListDirResponse) Reset() {*x = ListDirResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[9]+ mi := &file_proto_agent_agent_proto_msgTypes[13]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -624,7 +824,7 @@ func (x *ListDirResponse) String() string {func (*ListDirResponse) ProtoMessage() {}func (x *ListDirResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[9]+ mi := &file_proto_agent_agent_proto_msgTypes[13]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -637,7 +837,7 @@ func (x *ListDirResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use ListDirResponse.ProtoReflect.Descriptor instead.func (*ListDirResponse) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{9}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{13}}func (x *ListDirResponse) GetEntries() []*DirEntry {@@ -656,7 +856,7 @@ type MakeDirRequest struct {func (x *MakeDirRequest) Reset() {*x = MakeDirRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[10]+ mi := &file_proto_agent_agent_proto_msgTypes[14]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -668,7 +868,7 @@ func (x *MakeDirRequest) String() string {func (*MakeDirRequest) ProtoMessage() {}func (x *MakeDirRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[10]+ mi := &file_proto_agent_agent_proto_msgTypes[14]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -681,7 +881,7 @@ func (x *MakeDirRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use MakeDirRequest.ProtoReflect.Descriptor instead.func (*MakeDirRequest) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{10}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{14}}func (x *MakeDirRequest) GetPath() string {@@ -699,7 +899,7 @@ type MakeDirResponse struct {func (x *MakeDirResponse) Reset() {*x = MakeDirResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[11]+ mi := &file_proto_agent_agent_proto_msgTypes[15]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -711,7 +911,7 @@ func (x *MakeDirResponse) String() string {func (*MakeDirResponse) ProtoMessage() {}func (x *MakeDirResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[11]+ mi := &file_proto_agent_agent_proto_msgTypes[15]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -724,7 +924,7 @@ func (x *MakeDirResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use MakeDirResponse.ProtoReflect.Descriptor instead.func (*MakeDirResponse) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{11}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{15}}type RemoveRequest struct {@@ -736,7 +936,7 @@ type RemoveRequest struct {func (x *RemoveRequest) Reset() {*x = RemoveRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[12]+ mi := &file_proto_agent_agent_proto_msgTypes[16]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -748,7 +948,7 @@ func (x *RemoveRequest) String() string {func (*RemoveRequest) ProtoMessage() {}func (x *RemoveRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[12]+ mi := &file_proto_agent_agent_proto_msgTypes[16]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -761,7 +961,7 @@ func (x *RemoveRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use RemoveRequest.ProtoReflect.Descriptor instead.func (*RemoveRequest) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{12}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{16}}func (x *RemoveRequest) GetPath() string {@@ -779,7 +979,7 @@ type RemoveResponse struct {func (x *RemoveResponse) Reset() {*x = RemoveResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[13]+ mi := &file_proto_agent_agent_proto_msgTypes[17]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -791,7 +991,7 @@ func (x *RemoveResponse) String() string {func (*RemoveResponse) ProtoMessage() {}func (x *RemoveResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[13]+ mi := &file_proto_agent_agent_proto_msgTypes[17]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -804,7 +1004,7 @@ func (x *RemoveResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use RemoveResponse.ProtoReflect.Descriptor instead.func (*RemoveResponse) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{13}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{17}}type ExistsRequest struct {@@ -816,7 +1016,7 @@ type ExistsRequest struct {func (x *ExistsRequest) Reset() {*x = ExistsRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[14]+ mi := &file_proto_agent_agent_proto_msgTypes[18]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -828,7 +1028,7 @@ func (x *ExistsRequest) String() string {func (*ExistsRequest) ProtoMessage() {}func (x *ExistsRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[14]+ mi := &file_proto_agent_agent_proto_msgTypes[18]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -841,7 +1041,7 @@ func (x *ExistsRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ExistsRequest.ProtoReflect.Descriptor instead.func (*ExistsRequest) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{14}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{18}}func (x *ExistsRequest) GetPath() string {@@ -860,7 +1060,7 @@ type ExistsResponse struct {func (x *ExistsResponse) Reset() {*x = ExistsResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[15]+ mi := &file_proto_agent_agent_proto_msgTypes[19]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -872,7 +1072,7 @@ func (x *ExistsResponse) String() string {func (*ExistsResponse) ProtoMessage() {}func (x *ExistsResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[15]+ mi := &file_proto_agent_agent_proto_msgTypes[19]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -885,7 +1085,7 @@ func (x *ExistsResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use ExistsResponse.ProtoReflect.Descriptor instead.func (*ExistsResponse) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{15}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{19}}func (x *ExistsResponse) GetExists() bool {@@ -904,7 +1104,7 @@ type StatRequest struct {func (x *StatRequest) Reset() {*x = StatRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[16]+ mi := &file_proto_agent_agent_proto_msgTypes[20]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -916,7 +1116,7 @@ func (x *StatRequest) String() string {func (*StatRequest) ProtoMessage() {}func (x *StatRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[16]+ mi := &file_proto_agent_agent_proto_msgTypes[20]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -929,7 +1129,7 @@ func (x *StatRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use StatRequest.ProtoReflect.Descriptor instead.func (*StatRequest) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{16}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{20}}func (x *StatRequest) GetPath() string {@@ -953,7 +1153,7 @@ type StatResponse struct {func (x *StatResponse) Reset() {*x = StatResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[17]+ mi := &file_proto_agent_agent_proto_msgTypes[21]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -965,7 +1165,7 @@ func (x *StatResponse) String() string {func (*StatResponse) ProtoMessage() {}func (x *StatResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[17]+ mi := &file_proto_agent_agent_proto_msgTypes[21]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -978,7 +1178,7 @@ func (x *StatResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use StatResponse.ProtoReflect.Descriptor instead.func (*StatResponse) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{17}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{21}}func (x *StatResponse) GetName() string {@@ -1031,7 +1231,7 @@ type StatsRequest struct {func (x *StatsRequest) Reset() {*x = StatsRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[18]+ mi := &file_proto_agent_agent_proto_msgTypes[22]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1043,7 +1243,7 @@ func (x *StatsRequest) String() string {func (*StatsRequest) ProtoMessage() {}func (x *StatsRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[18]+ mi := &file_proto_agent_agent_proto_msgTypes[22]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1056,7 +1256,7 @@ func (x *StatsRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use StatsRequest.ProtoReflect.Descriptor instead.func (*StatsRequest) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{18}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{22}}type StatsResponse struct {@@ -1073,7 +1273,7 @@ type StatsResponse struct {func (x *StatsResponse) Reset() {*x = StatsResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[19]+ mi := &file_proto_agent_agent_proto_msgTypes[23]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1085,7 +1285,7 @@ func (x *StatsResponse) String() string {func (*StatsResponse) ProtoMessage() {}func (x *StatsResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[19]+ mi := &file_proto_agent_agent_proto_msgTypes[23]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1098,7 +1298,7 @@ func (x *StatsResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use StatsResponse.ProtoReflect.Descriptor instead.func (*StatsResponse) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{19}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{23}}func (x *StatsResponse) GetCpuPercent() float64 {@@ -1151,7 +1351,7 @@ type PingRequest struct {func (x *PingRequest) Reset() {*x = PingRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[20]+ mi := &file_proto_agent_agent_proto_msgTypes[24]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1163,7 +1363,7 @@ func (x *PingRequest) String() string {func (*PingRequest) ProtoMessage() {}func (x *PingRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[20]+ mi := &file_proto_agent_agent_proto_msgTypes[24]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1176,7 +1376,7 @@ func (x *PingRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use PingRequest.ProtoReflect.Descriptor instead.func (*PingRequest) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{20}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{24}}type PingResponse struct {@@ -1189,7 +1389,7 @@ type PingResponse struct {func (x *PingResponse) Reset() {*x = PingResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[21]+ mi := &file_proto_agent_agent_proto_msgTypes[25]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1201,7 +1401,7 @@ func (x *PingResponse) String() string {func (*PingResponse) ProtoMessage() {}func (x *PingResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[21]+ mi := &file_proto_agent_agent_proto_msgTypes[25]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1214,7 +1414,7 @@ func (x *PingResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use PingResponse.ProtoReflect.Descriptor instead.func (*PingResponse) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{21}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{25}}func (x *PingResponse) GetVersion() string {@@ -1242,7 +1442,7 @@ type PTYCreateRequest struct {func (x *PTYCreateRequest) Reset() {*x = PTYCreateRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[22]+ mi := &file_proto_agent_agent_proto_msgTypes[26]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1254,7 +1454,7 @@ func (x *PTYCreateRequest) String() string {func (*PTYCreateRequest) ProtoMessage() {}func (x *PTYCreateRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[22]+ mi := &file_proto_agent_agent_proto_msgTypes[26]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1267,7 +1467,7 @@ func (x *PTYCreateRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use PTYCreateRequest.ProtoReflect.Descriptor instead.func (*PTYCreateRequest) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{22}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{26}}func (x *PTYCreateRequest) GetCols() int32 {@@ -1301,7 +1501,7 @@ type PTYCreateResponse struct {func (x *PTYCreateResponse) Reset() {*x = PTYCreateResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[23]+ mi := &file_proto_agent_agent_proto_msgTypes[27]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1313,7 +1513,7 @@ func (x *PTYCreateResponse) String() string {func (*PTYCreateResponse) ProtoMessage() {}func (x *PTYCreateResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[23]+ mi := &file_proto_agent_agent_proto_msgTypes[27]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1326,7 +1526,7 @@ func (x *PTYCreateResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use PTYCreateResponse.ProtoReflect.Descriptor instead.func (*PTYCreateResponse) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{23}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{27}}func (x *PTYCreateResponse) GetSessionId() string {@@ -1354,7 +1554,7 @@ type PTYResizeRequest struct {func (x *PTYResizeRequest) Reset() {*x = PTYResizeRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[24]+ mi := &file_proto_agent_agent_proto_msgTypes[28]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1366,7 +1566,7 @@ func (x *PTYResizeRequest) String() string {func (*PTYResizeRequest) ProtoMessage() {}func (x *PTYResizeRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[24]+ mi := &file_proto_agent_agent_proto_msgTypes[28]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1379,7 +1579,7 @@ func (x *PTYResizeRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use PTYResizeRequest.ProtoReflect.Descriptor instead.func (*PTYResizeRequest) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{24}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{28}}func (x *PTYResizeRequest) GetSessionId() string {@@ -1411,7 +1611,7 @@ type PTYResizeResponse struct {func (x *PTYResizeResponse) Reset() {*x = PTYResizeResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[25]+ mi := &file_proto_agent_agent_proto_msgTypes[29]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1423,7 +1623,7 @@ func (x *PTYResizeResponse) String() string {func (*PTYResizeResponse) ProtoMessage() {}func (x *PTYResizeResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[25]+ mi := &file_proto_agent_agent_proto_msgTypes[29]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1436,7 +1636,7 @@ func (x *PTYResizeResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use PTYResizeResponse.ProtoReflect.Descriptor instead.func (*PTYResizeResponse) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{25}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{29}}type PTYKillRequest struct {@@ -1448,7 +1648,7 @@ type PTYKillRequest struct {func (x *PTYKillRequest) Reset() {*x = PTYKillRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[26]+ mi := &file_proto_agent_agent_proto_msgTypes[30]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1460,7 +1660,7 @@ func (x *PTYKillRequest) String() string {func (*PTYKillRequest) ProtoMessage() {}func (x *PTYKillRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[26]+ mi := &file_proto_agent_agent_proto_msgTypes[30]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1473,7 +1673,7 @@ func (x *PTYKillRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use PTYKillRequest.ProtoReflect.Descriptor instead.func (*PTYKillRequest) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{26}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{30}}func (x *PTYKillRequest) GetSessionId() string {@@ -1491,7 +1691,7 @@ type PTYKillResponse struct {func (x *PTYKillResponse) Reset() {*x = PTYKillResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[27]+ mi := &file_proto_agent_agent_proto_msgTypes[31]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1503,7 +1703,7 @@ func (x *PTYKillResponse) String() string {func (*PTYKillResponse) ProtoMessage() {}func (x *PTYKillResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[27]+ mi := &file_proto_agent_agent_proto_msgTypes[31]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1516,7 +1716,7 @@ func (x *PTYKillResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use PTYKillResponse.ProtoReflect.Descriptor instead.func (*PTYKillResponse) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{27}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{31}}type ExecSessionCreateRequest struct {@@ -1534,7 +1734,7 @@ type ExecSessionCreateRequest struct {func (x *ExecSessionCreateRequest) Reset() {*x = ExecSessionCreateRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[28]+ mi := &file_proto_agent_agent_proto_msgTypes[32]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1546,7 +1746,7 @@ func (x *ExecSessionCreateRequest) String() string {func (*ExecSessionCreateRequest) ProtoMessage() {}func (x *ExecSessionCreateRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[28]+ mi := &file_proto_agent_agent_proto_msgTypes[32]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1559,7 +1759,7 @@ func (x *ExecSessionCreateRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ExecSessionCreateRequest.ProtoReflect.Descriptor instead.func (*ExecSessionCreateRequest) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{28}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{32}}func (x *ExecSessionCreateRequest) GetCommand() string {@@ -1620,7 +1820,7 @@ type ExecSessionCreateResponse struct {func (x *ExecSessionCreateResponse) Reset() {*x = ExecSessionCreateResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[29]+ mi := &file_proto_agent_agent_proto_msgTypes[33]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1632,7 +1832,7 @@ func (x *ExecSessionCreateResponse) String() string {func (*ExecSessionCreateResponse) ProtoMessage() {}func (x *ExecSessionCreateResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[29]+ mi := &file_proto_agent_agent_proto_msgTypes[33]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1645,7 +1845,7 @@ func (x *ExecSessionCreateResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use ExecSessionCreateResponse.ProtoReflect.Descriptor instead.func (*ExecSessionCreateResponse) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{29}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{33}}func (x *ExecSessionCreateResponse) GetSessionId() string {@@ -1665,7 +1865,7 @@ type ExecSessionInput struct {func (x *ExecSessionInput) Reset() {*x = ExecSessionInput{}- mi := &file_proto_agent_agent_proto_msgTypes[30]+ mi := &file_proto_agent_agent_proto_msgTypes[34]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1677,7 +1877,7 @@ func (x *ExecSessionInput) String() string {func (*ExecSessionInput) ProtoMessage() {}func (x *ExecSessionInput) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[30]+ mi := &file_proto_agent_agent_proto_msgTypes[34]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1690,7 +1890,7 @@ func (x *ExecSessionInput) ProtoReflect() protoreflect.Message {// Deprecated: Use ExecSessionInput.ProtoReflect.Descriptor instead.func (*ExecSessionInput) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{30}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{34}}func (x *ExecSessionInput) GetSessionId() string {@@ -1718,7 +1918,7 @@ type ExecSessionOutput struct {func (x *ExecSessionOutput) Reset() {*x = ExecSessionOutput{}- mi := &file_proto_agent_agent_proto_msgTypes[31]+ mi := &file_proto_agent_agent_proto_msgTypes[35]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1730,7 +1930,7 @@ func (x *ExecSessionOutput) String() string {func (*ExecSessionOutput) ProtoMessage() {}func (x *ExecSessionOutput) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[31]+ mi := &file_proto_agent_agent_proto_msgTypes[35]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1743,7 +1943,7 @@ func (x *ExecSessionOutput) ProtoReflect() protoreflect.Message {// Deprecated: Use ExecSessionOutput.ProtoReflect.Descriptor instead.func (*ExecSessionOutput) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{31}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{35}}func (x *ExecSessionOutput) GetType() ExecSessionOutput_Type {@@ -1775,7 +1975,7 @@ type ExecSessionListRequest struct {func (x *ExecSessionListRequest) Reset() {*x = ExecSessionListRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[32]+ mi := &file_proto_agent_agent_proto_msgTypes[36]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1787,7 +1987,7 @@ func (x *ExecSessionListRequest) String() string {func (*ExecSessionListRequest) ProtoMessage() {}func (x *ExecSessionListRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[32]+ mi := &file_proto_agent_agent_proto_msgTypes[36]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1800,7 +2000,7 @@ func (x *ExecSessionListRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ExecSessionListRequest.ProtoReflect.Descriptor instead.func (*ExecSessionListRequest) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{32}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{36}}type ExecSessionListResponse struct {@@ -1812,7 +2012,7 @@ type ExecSessionListResponse struct {func (x *ExecSessionListResponse) Reset() {*x = ExecSessionListResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[33]+ mi := &file_proto_agent_agent_proto_msgTypes[37]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1824,7 +2024,7 @@ func (x *ExecSessionListResponse) String() string {func (*ExecSessionListResponse) ProtoMessage() {}func (x *ExecSessionListResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[33]+ mi := &file_proto_agent_agent_proto_msgTypes[37]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1837,7 +2037,7 @@ func (x *ExecSessionListResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use ExecSessionListResponse.ProtoReflect.Descriptor instead.func (*ExecSessionListResponse) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{33}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{37}}func (x *ExecSessionListResponse) GetSessions() []*ExecSessionInfo {@@ -1862,7 +2062,7 @@ type ExecSessionInfo struct {func (x *ExecSessionInfo) Reset() {*x = ExecSessionInfo{}- mi := &file_proto_agent_agent_proto_msgTypes[34]+ mi := &file_proto_agent_agent_proto_msgTypes[38]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1874,7 +2074,7 @@ func (x *ExecSessionInfo) String() string {func (*ExecSessionInfo) ProtoMessage() {}func (x *ExecSessionInfo) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[34]+ mi := &file_proto_agent_agent_proto_msgTypes[38]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1887,7 +2087,7 @@ func (x *ExecSessionInfo) ProtoReflect() protoreflect.Message {// Deprecated: Use ExecSessionInfo.ProtoReflect.Descriptor instead.func (*ExecSessionInfo) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{34}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{38}}func (x *ExecSessionInfo) GetSessionId() string {@@ -1949,7 +2149,7 @@ type ExecSessionKillRequest struct {func (x *ExecSessionKillRequest) Reset() {*x = ExecSessionKillRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[35]+ mi := &file_proto_agent_agent_proto_msgTypes[39]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -1961,7 +2161,7 @@ func (x *ExecSessionKillRequest) String() string {func (*ExecSessionKillRequest) ProtoMessage() {}func (x *ExecSessionKillRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[35]+ mi := &file_proto_agent_agent_proto_msgTypes[39]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -1974,7 +2174,7 @@ func (x *ExecSessionKillRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ExecSessionKillRequest.ProtoReflect.Descriptor instead.func (*ExecSessionKillRequest) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{35}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{39}}func (x *ExecSessionKillRequest) GetSessionId() string {@@ -1999,7 +2199,7 @@ type ExecSessionKillResponse struct {func (x *ExecSessionKillResponse) Reset() {*x = ExecSessionKillResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[36]+ mi := &file_proto_agent_agent_proto_msgTypes[40]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2011,7 +2211,7 @@ func (x *ExecSessionKillResponse) String() string {func (*ExecSessionKillResponse) ProtoMessage() {}func (x *ExecSessionKillResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[36]+ mi := &file_proto_agent_agent_proto_msgTypes[40]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2024,7 +2224,7 @@ func (x *ExecSessionKillResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use ExecSessionKillResponse.ProtoReflect.Descriptor instead.func (*ExecSessionKillResponse) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{36}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{40}}type SetEnvsRequest struct {@@ -2036,7 +2236,7 @@ type SetEnvsRequest struct {func (x *SetEnvsRequest) Reset() {*x = SetEnvsRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[37]+ mi := &file_proto_agent_agent_proto_msgTypes[41]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2048,7 +2248,7 @@ func (x *SetEnvsRequest) String() string {func (*SetEnvsRequest) ProtoMessage() {}func (x *SetEnvsRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[37]+ mi := &file_proto_agent_agent_proto_msgTypes[41]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2061,7 +2261,7 @@ func (x *SetEnvsRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use SetEnvsRequest.ProtoReflect.Descriptor instead.func (*SetEnvsRequest) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{37}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{41}}func (x *SetEnvsRequest) GetEnvs() map[string]string {@@ -2079,7 +2279,7 @@ type SetEnvsResponse struct {func (x *SetEnvsResponse) Reset() {*x = SetEnvsResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[38]+ mi := &file_proto_agent_agent_proto_msgTypes[42]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2091,7 +2291,7 @@ func (x *SetEnvsResponse) String() string {func (*SetEnvsResponse) ProtoMessage() {}func (x *SetEnvsResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[38]+ mi := &file_proto_agent_agent_proto_msgTypes[42]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2104,7 +2304,7 @@ func (x *SetEnvsResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use SetEnvsResponse.ProtoReflect.Descriptor instead.func (*SetEnvsResponse) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{38}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{42}}type ShutdownRequest struct {@@ -2115,7 +2315,7 @@ type ShutdownRequest struct {func (x *ShutdownRequest) Reset() {*x = ShutdownRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[39]+ mi := &file_proto_agent_agent_proto_msgTypes[43]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2127,7 +2327,7 @@ func (x *ShutdownRequest) String() string {func (*ShutdownRequest) ProtoMessage() {}func (x *ShutdownRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[39]+ mi := &file_proto_agent_agent_proto_msgTypes[43]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2140,7 +2340,7 @@ func (x *ShutdownRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use ShutdownRequest.ProtoReflect.Descriptor instead.func (*ShutdownRequest) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{39}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{43}}type ShutdownResponse struct {@@ -2151,7 +2351,7 @@ type ShutdownResponse struct {func (x *ShutdownResponse) Reset() {*x = ShutdownResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[40]+ mi := &file_proto_agent_agent_proto_msgTypes[44]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2163,7 +2363,7 @@ func (x *ShutdownResponse) String() string {func (*ShutdownResponse) ProtoMessage() {}func (x *ShutdownResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[40]+ mi := &file_proto_agent_agent_proto_msgTypes[44]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2176,7 +2376,7 @@ func (x *ShutdownResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use ShutdownResponse.ProtoReflect.Descriptor instead.func (*ShutdownResponse) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{40}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{44}}type SyncFSRequest struct {@@ -2187,7 +2387,7 @@ type SyncFSRequest struct {func (x *SyncFSRequest) Reset() {*x = SyncFSRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[41]+ mi := &file_proto_agent_agent_proto_msgTypes[45]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2199,7 +2399,7 @@ func (x *SyncFSRequest) String() string {func (*SyncFSRequest) ProtoMessage() {}func (x *SyncFSRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[41]+ mi := &file_proto_agent_agent_proto_msgTypes[45]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2212,7 +2412,7 @@ func (x *SyncFSRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use SyncFSRequest.ProtoReflect.Descriptor instead.func (*SyncFSRequest) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{41}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{45}}type SyncFSResponse struct {@@ -2223,7 +2423,7 @@ type SyncFSResponse struct {func (x *SyncFSResponse) Reset() {*x = SyncFSResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[42]+ mi := &file_proto_agent_agent_proto_msgTypes[46]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2235,7 +2435,7 @@ func (x *SyncFSResponse) String() string {func (*SyncFSResponse) ProtoMessage() {}func (x *SyncFSResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[42]+ mi := &file_proto_agent_agent_proto_msgTypes[46]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2248,7 +2448,7 @@ func (x *SyncFSResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use SyncFSResponse.ProtoReflect.Descriptor instead.func (*SyncFSResponse) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{42}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{46}}var File_proto_agent_agent_proto protoreflect.FileDescriptor@@ -2285,7 +2485,19 @@ const file_proto_agent_agent_proto_rawDesc = "" +"\x04path\x18\x01 \x01(\tR\x04path\x12\x18\n" +"\acontent\x18\x02 \x01(\fR\acontent\x12\x12\n" +"\x04mode\x18\x03 \x01(\rR\x04mode\"\x13\n" +- "\x11WriteFileResponse\"$\n" ++ "\x11WriteFileResponse\"+\n" ++ "\x15ReadFileStreamRequest\x12\x12\n" ++ "\x04path\x18\x01 \x01(\tR\x04path\">\n" ++ "\tFileChunk\x12\x12\n" ++ "\x04data\x18\x01 \x01(\fR\x04data\x12\x1d\n" ++ "\n" ++ "total_size\x18\x02 \x01(\x03R\ttotalSize\"T\n" ++ "\x16WriteFileStreamRequest\x12\x12\n" ++ "\x04path\x18\x01 \x01(\tR\x04path\x12\x12\n" ++ "\x04data\x18\x02 \x01(\fR\x04data\x12\x12\n" ++ "\x04mode\x18\x03 \x01(\rR\x04mode\">\n" ++ "\x17WriteFileStreamResponse\x12#\n" ++ "\rbytes_written\x18\x01 \x01(\x03R\fbytesWritten\"$\n" +"\x0eListDirRequest\x12\x12\n" +"\x04path\x18\x01 \x01(\tR\x04path\"]\n" +"\bDirEntry\x12\x12\n" +@@ -2402,14 +2614,15 @@ const file_proto_agent_agent_proto_rawDesc = "" +"\x0fShutdownRequest\"\x12\n" +"\x10ShutdownResponse\"\x0f\n" +"\rSyncFSRequest\"\x10\n" +- "\x0eSyncFSResponse2\xa0\n" +- "\n" ++ "\x0eSyncFSResponse2\xb8\v\n" +"\fSandboxAgent\x12/\n" +"\x04Exec\x12\x12.agent.ExecRequest\x1a\x13.agent.ExecResponse\x12:\n" +"\n" +"ExecStream\x12\x12.agent.ExecRequest\x1a\x16.agent.ExecOutputChunk0\x01\x12;\n" +"\bReadFile\x12\x16.agent.ReadFileRequest\x1a\x17.agent.ReadFileResponse\x12>\n" +- "\tWriteFile\x12\x17.agent.WriteFileRequest\x1a\x18.agent.WriteFileResponse\x128\n" ++ "\tWriteFile\x12\x17.agent.WriteFileRequest\x1a\x18.agent.WriteFileResponse\x12B\n" ++ "\x0eReadFileStream\x12\x1c.agent.ReadFileStreamRequest\x1a\x10.agent.FileChunk0\x01\x12R\n" ++ "\x0fWriteFileStream\x12\x1d.agent.WriteFileStreamRequest\x1a\x1e.agent.WriteFileStreamResponse(\x01\x128\n" +"\aListDir\x12\x15.agent.ListDirRequest\x1a\x16.agent.ListDirResponse\x128\n" +"\aMakeDir\x12\x15.agent.MakeDirRequest\x1a\x16.agent.MakeDirResponse\x125\n" +"\x06Remove\x12\x14.agent.RemoveRequest\x1a\x15.agent.RemoveResponse\x125\n" +@@ -2441,7 +2654,7 @@ func file_proto_agent_agent_proto_rawDescGZIP() []byte {}var file_proto_agent_agent_proto_enumTypes = make([]protoimpl.EnumInfo, 2)-var file_proto_agent_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 46)+var file_proto_agent_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 50)var file_proto_agent_agent_proto_goTypes = []any{(ExecOutputChunk_Stream)(0), // 0: agent.ExecOutputChunk.Stream(ExecSessionOutput_Type)(0), // 1: agent.ExecSessionOutput.Type@@ -2452,98 +2665,106 @@ var file_proto_agent_agent_proto_goTypes = []any{(*ReadFileResponse)(nil), // 6: agent.ReadFileResponse(*WriteFileRequest)(nil), // 7: agent.WriteFileRequest(*WriteFileResponse)(nil), // 8: agent.WriteFileResponse- (*ListDirRequest)(nil), // 9: agent.ListDirRequest- (*DirEntry)(nil), // 10: agent.DirEntry- (*ListDirResponse)(nil), // 11: agent.ListDirResponse- (*MakeDirRequest)(nil), // 12: agent.MakeDirRequest- (*MakeDirResponse)(nil), // 13: agent.MakeDirResponse- (*RemoveRequest)(nil), // 14: agent.RemoveRequest- (*RemoveResponse)(nil), // 15: agent.RemoveResponse- (*ExistsRequest)(nil), // 16: agent.ExistsRequest- (*ExistsResponse)(nil), // 17: agent.ExistsResponse- (*StatRequest)(nil), // 18: agent.StatRequest- (*StatResponse)(nil), // 19: agent.StatResponse- (*StatsRequest)(nil), // 20: agent.StatsRequest- (*StatsResponse)(nil), // 21: agent.StatsResponse- (*PingRequest)(nil), // 22: agent.PingRequest- (*PingResponse)(nil), // 23: agent.PingResponse- (*PTYCreateRequest)(nil), // 24: agent.PTYCreateRequest- (*PTYCreateResponse)(nil), // 25: agent.PTYCreateResponse- (*PTYResizeRequest)(nil), // 26: agent.PTYResizeRequest- (*PTYResizeResponse)(nil), // 27: agent.PTYResizeResponse- (*PTYKillRequest)(nil), // 28: agent.PTYKillRequest- (*PTYKillResponse)(nil), // 29: agent.PTYKillResponse- (*ExecSessionCreateRequest)(nil), // 30: agent.ExecSessionCreateRequest- (*ExecSessionCreateResponse)(nil), // 31: agent.ExecSessionCreateResponse- (*ExecSessionInput)(nil), // 32: agent.ExecSessionInput- (*ExecSessionOutput)(nil), // 33: agent.ExecSessionOutput- (*ExecSessionListRequest)(nil), // 34: agent.ExecSessionListRequest- (*ExecSessionListResponse)(nil), // 35: agent.ExecSessionListResponse- (*ExecSessionInfo)(nil), // 36: agent.ExecSessionInfo- (*ExecSessionKillRequest)(nil), // 37: agent.ExecSessionKillRequest- (*ExecSessionKillResponse)(nil), // 38: agent.ExecSessionKillResponse- (*SetEnvsRequest)(nil), // 39: agent.SetEnvsRequest- (*SetEnvsResponse)(nil), // 40: agent.SetEnvsResponse- (*ShutdownRequest)(nil), // 41: agent.ShutdownRequest- (*ShutdownResponse)(nil), // 42: agent.ShutdownResponse- (*SyncFSRequest)(nil), // 43: agent.SyncFSRequest- (*SyncFSResponse)(nil), // 44: agent.SyncFSResponse- nil, // 45: agent.ExecRequest.EnvsEntry- nil, // 46: agent.ExecSessionCreateRequest.EnvsEntry- nil, // 47: agent.SetEnvsRequest.EnvsEntry+ (*ReadFileStreamRequest)(nil), // 9: agent.ReadFileStreamRequest+ (*FileChunk)(nil), // 10: agent.FileChunk+ (*WriteFileStreamRequest)(nil), // 11: agent.WriteFileStreamRequest+ (*WriteFileStreamResponse)(nil), // 12: agent.WriteFileStreamResponse+ (*ListDirRequest)(nil), // 13: agent.ListDirRequest+ (*DirEntry)(nil), // 14: agent.DirEntry+ (*ListDirResponse)(nil), // 15: agent.ListDirResponse+ (*MakeDirRequest)(nil), // 16: agent.MakeDirRequest+ (*MakeDirResponse)(nil), // 17: agent.MakeDirResponse+ (*RemoveRequest)(nil), // 18: agent.RemoveRequest+ (*RemoveResponse)(nil), // 19: agent.RemoveResponse+ (*ExistsRequest)(nil), // 20: agent.ExistsRequest+ (*ExistsResponse)(nil), // 21: agent.ExistsResponse+ (*StatRequest)(nil), // 22: agent.StatRequest+ (*StatResponse)(nil), // 23: agent.StatResponse+ (*StatsRequest)(nil), // 24: agent.StatsRequest+ (*StatsResponse)(nil), // 25: agent.StatsResponse+ (*PingRequest)(nil), // 26: agent.PingRequest+ (*PingResponse)(nil), // 27: agent.PingResponse+ (*PTYCreateRequest)(nil), // 28: agent.PTYCreateRequest+ (*PTYCreateResponse)(nil), // 29: agent.PTYCreateResponse+ (*PTYResizeRequest)(nil), // 30: agent.PTYResizeRequest+ (*PTYResizeResponse)(nil), // 31: agent.PTYResizeResponse+ (*PTYKillRequest)(nil), // 32: agent.PTYKillRequest+ (*PTYKillResponse)(nil), // 33: agent.PTYKillResponse+ (*ExecSessionCreateRequest)(nil), // 34: agent.ExecSessionCreateRequest+ (*ExecSessionCreateResponse)(nil), // 35: agent.ExecSessionCreateResponse+ (*ExecSessionInput)(nil), // 36: agent.ExecSessionInput+ (*ExecSessionOutput)(nil), // 37: agent.ExecSessionOutput+ (*ExecSessionListRequest)(nil), // 38: agent.ExecSessionListRequest+ (*ExecSessionListResponse)(nil), // 39: agent.ExecSessionListResponse+ (*ExecSessionInfo)(nil), // 40: agent.ExecSessionInfo+ (*ExecSessionKillRequest)(nil), // 41: agent.ExecSessionKillRequest+ (*ExecSessionKillResponse)(nil), // 42: agent.ExecSessionKillResponse+ (*SetEnvsRequest)(nil), // 43: agent.SetEnvsRequest+ (*SetEnvsResponse)(nil), // 44: agent.SetEnvsResponse+ (*ShutdownRequest)(nil), // 45: agent.ShutdownRequest+ (*ShutdownResponse)(nil), // 46: agent.ShutdownResponse+ (*SyncFSRequest)(nil), // 47: agent.SyncFSRequest+ (*SyncFSResponse)(nil), // 48: agent.SyncFSResponse+ nil, // 49: agent.ExecRequest.EnvsEntry+ nil, // 50: agent.ExecSessionCreateRequest.EnvsEntry+ nil, // 51: agent.SetEnvsRequest.EnvsEntry}var file_proto_agent_agent_proto_depIdxs = []int32{- 45, // 0: agent.ExecRequest.envs:type_name -> agent.ExecRequest.EnvsEntry+ 49, // 0: agent.ExecRequest.envs:type_name -> agent.ExecRequest.EnvsEntry0, // 1: agent.ExecOutputChunk.stream:type_name -> agent.ExecOutputChunk.Stream- 10, // 2: agent.ListDirResponse.entries:type_name -> agent.DirEntry- 46, // 3: agent.ExecSessionCreateRequest.envs:type_name -> agent.ExecSessionCreateRequest.EnvsEntry+ 14, // 2: agent.ListDirResponse.entries:type_name -> agent.DirEntry+ 50, // 3: agent.ExecSessionCreateRequest.envs:type_name -> agent.ExecSessionCreateRequest.EnvsEntry1, // 4: agent.ExecSessionOutput.type:type_name -> agent.ExecSessionOutput.Type- 36, // 5: agent.ExecSessionListResponse.sessions:type_name -> agent.ExecSessionInfo- 47, // 6: agent.SetEnvsRequest.envs:type_name -> agent.SetEnvsRequest.EnvsEntry+ 40, // 5: agent.ExecSessionListResponse.sessions:type_name -> agent.ExecSessionInfo+ 51, // 6: agent.SetEnvsRequest.envs:type_name -> agent.SetEnvsRequest.EnvsEntry2, // 7: agent.SandboxAgent.Exec:input_type -> agent.ExecRequest2, // 8: agent.SandboxAgent.ExecStream:input_type -> agent.ExecRequest5, // 9: agent.SandboxAgent.ReadFile:input_type -> agent.ReadFileRequest7, // 10: agent.SandboxAgent.WriteFile:input_type -> agent.WriteFileRequest- 9, // 11: agent.SandboxAgent.ListDir:input_type -> agent.ListDirRequest- 12, // 12: agent.SandboxAgent.MakeDir:input_type -> agent.MakeDirRequest- 14, // 13: agent.SandboxAgent.Remove:input_type -> agent.RemoveRequest- 16, // 14: agent.SandboxAgent.Exists:input_type -> agent.ExistsRequest- 18, // 15: agent.SandboxAgent.Stat:input_type -> agent.StatRequest- 20, // 16: agent.SandboxAgent.Stats:input_type -> agent.StatsRequest- 22, // 17: agent.SandboxAgent.Ping:input_type -> agent.PingRequest- 24, // 18: agent.SandboxAgent.PTYCreate:input_type -> agent.PTYCreateRequest- 26, // 19: agent.SandboxAgent.PTYResize:input_type -> agent.PTYResizeRequest- 28, // 20: agent.SandboxAgent.PTYKill:input_type -> agent.PTYKillRequest- 30, // 21: agent.SandboxAgent.ExecSessionCreate:input_type -> agent.ExecSessionCreateRequest- 32, // 22: agent.SandboxAgent.ExecSessionAttach:input_type -> agent.ExecSessionInput- 34, // 23: agent.SandboxAgent.ExecSessionList:input_type -> agent.ExecSessionListRequest- 37, // 24: agent.SandboxAgent.ExecSessionKill:input_type -> agent.ExecSessionKillRequest- 39, // 25: agent.SandboxAgent.SetEnvs:input_type -> agent.SetEnvsRequest- 41, // 26: agent.SandboxAgent.Shutdown:input_type -> agent.ShutdownRequest- 43, // 27: agent.SandboxAgent.SyncFS:input_type -> agent.SyncFSRequest- 3, // 28: agent.SandboxAgent.Exec:output_type -> agent.ExecResponse- 4, // 29: agent.SandboxAgent.ExecStream:output_type -> agent.ExecOutputChunk- 6, // 30: agent.SandboxAgent.ReadFile:output_type -> agent.ReadFileResponse- 8, // 31: agent.SandboxAgent.WriteFile:output_type -> agent.WriteFileResponse- 11, // 32: agent.SandboxAgent.ListDir:output_type -> agent.ListDirResponse- 13, // 33: agent.SandboxAgent.MakeDir:output_type -> agent.MakeDirResponse- 15, // 34: agent.SandboxAgent.Remove:output_type -> agent.RemoveResponse- 17, // 35: agent.SandboxAgent.Exists:output_type -> agent.ExistsResponse- 19, // 36: agent.SandboxAgent.Stat:output_type -> agent.StatResponse- 21, // 37: agent.SandboxAgent.Stats:output_type -> agent.StatsResponse- 23, // 38: agent.SandboxAgent.Ping:output_type -> agent.PingResponse- 25, // 39: agent.SandboxAgent.PTYCreate:output_type -> agent.PTYCreateResponse- 27, // 40: agent.SandboxAgent.PTYResize:output_type -> agent.PTYResizeResponse- 29, // 41: agent.SandboxAgent.PTYKill:output_type -> agent.PTYKillResponse- 31, // 42: agent.SandboxAgent.ExecSessionCreate:output_type -> agent.ExecSessionCreateResponse- 33, // 43: agent.SandboxAgent.ExecSessionAttach:output_type -> agent.ExecSessionOutput- 35, // 44: agent.SandboxAgent.ExecSessionList:output_type -> agent.ExecSessionListResponse- 38, // 45: agent.SandboxAgent.ExecSessionKill:output_type -> agent.ExecSessionKillResponse- 40, // 46: agent.SandboxAgent.SetEnvs:output_type -> agent.SetEnvsResponse- 42, // 47: agent.SandboxAgent.Shutdown:output_type -> agent.ShutdownResponse- 44, // 48: agent.SandboxAgent.SyncFS:output_type -> agent.SyncFSResponse- 28, // [28:49] is the sub-list for method output_type- 7, // [7:28] is the sub-list for method input_type+ 9, // 11: agent.SandboxAgent.ReadFileStream:input_type -> agent.ReadFileStreamRequest+ 11, // 12: agent.SandboxAgent.WriteFileStream:input_type -> agent.WriteFileStreamRequest+ 13, // 13: agent.SandboxAgent.ListDir:input_type -> agent.ListDirRequest+ 16, // 14: agent.SandboxAgent.MakeDir:input_type -> agent.MakeDirRequest+ 18, // 15: agent.SandboxAgent.Remove:input_type -> agent.RemoveRequest+ 20, // 16: agent.SandboxAgent.Exists:input_type -> agent.ExistsRequest+ 22, // 17: agent.SandboxAgent.Stat:input_type -> agent.StatRequest+ 24, // 18: agent.SandboxAgent.Stats:input_type -> agent.StatsRequest+ 26, // 19: agent.SandboxAgent.Ping:input_type -> agent.PingRequest+ 28, // 20: agent.SandboxAgent.PTYCreate:input_type -> agent.PTYCreateRequest+ 30, // 21: agent.SandboxAgent.PTYResize:input_type -> agent.PTYResizeRequest+ 32, // 22: agent.SandboxAgent.PTYKill:input_type -> agent.PTYKillRequest+ 34, // 23: agent.SandboxAgent.ExecSessionCreate:input_type -> agent.ExecSessionCreateRequest+ 36, // 24: agent.SandboxAgent.ExecSessionAttach:input_type -> agent.ExecSessionInput+ 38, // 25: agent.SandboxAgent.ExecSessionList:input_type -> agent.ExecSessionListRequest+ 41, // 26: agent.SandboxAgent.ExecSessionKill:input_type -> agent.ExecSessionKillRequest+ 43, // 27: agent.SandboxAgent.SetEnvs:input_type -> agent.SetEnvsRequest+ 45, // 28: agent.SandboxAgent.Shutdown:input_type -> agent.ShutdownRequest+ 47, // 29: agent.SandboxAgent.SyncFS:input_type -> agent.SyncFSRequest+ 3, // 30: agent.SandboxAgent.Exec:output_type -> agent.ExecResponse+ 4, // 31: agent.SandboxAgent.ExecStream:output_type -> agent.ExecOutputChunk+ 6, // 32: agent.SandboxAgent.ReadFile:output_type -> agent.ReadFileResponse+ 8, // 33: agent.SandboxAgent.WriteFile:output_type -> agent.WriteFileResponse+ 10, // 34: agent.SandboxAgent.ReadFileStream:output_type -> agent.FileChunk+ 12, // 35: agent.SandboxAgent.WriteFileStream:output_type -> agent.WriteFileStreamResponse+ 15, // 36: agent.SandboxAgent.ListDir:output_type -> agent.ListDirResponse+ 17, // 37: agent.SandboxAgent.MakeDir:output_type -> agent.MakeDirResponse+ 19, // 38: agent.SandboxAgent.Remove:output_type -> agent.RemoveResponse+ 21, // 39: agent.SandboxAgent.Exists:output_type -> agent.ExistsResponse+ 23, // 40: agent.SandboxAgent.Stat:output_type -> agent.StatResponse+ 25, // 41: agent.SandboxAgent.Stats:output_type -> agent.StatsResponse+ 27, // 42: agent.SandboxAgent.Ping:output_type -> agent.PingResponse+ 29, // 43: agent.SandboxAgent.PTYCreate:output_type -> agent.PTYCreateResponse+ 31, // 44: agent.SandboxAgent.PTYResize:output_type -> agent.PTYResizeResponse+ 33, // 45: agent.SandboxAgent.PTYKill:output_type -> agent.PTYKillResponse+ 35, // 46: agent.SandboxAgent.ExecSessionCreate:output_type -> agent.ExecSessionCreateResponse+ 37, // 47: agent.SandboxAgent.ExecSessionAttach:output_type -> agent.ExecSessionOutput+ 39, // 48: agent.SandboxAgent.ExecSessionList:output_type -> agent.ExecSessionListResponse+ 42, // 49: agent.SandboxAgent.ExecSessionKill:output_type -> agent.ExecSessionKillResponse+ 44, // 50: agent.SandboxAgent.SetEnvs:output_type -> agent.SetEnvsResponse+ 46, // 51: agent.SandboxAgent.Shutdown:output_type -> agent.ShutdownResponse+ 48, // 52: agent.SandboxAgent.SyncFS:output_type -> agent.SyncFSResponse+ 30, // [30:53] is the sub-list for method output_type+ 7, // [7:30] is the sub-list for method input_type7, // [7:7] is the sub-list for extension type_name7, // [7:7] is the sub-list for extension extendee0, // [0:7] is the sub-list for field type_name@@ -2560,7 +2781,7 @@ func file_proto_agent_agent_proto_init() {GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_agent_agent_proto_rawDesc), len(file_proto_agent_agent_proto_rawDesc)),NumEnums: 2,- NumMessages: 46,+ NumMessages: 50,NumExtensions: 0,NumServices: 1,},diff --git a/proto/agent/agent.proto b/proto/agent/agent.protoindex d5cfaf65..797d31da 100644--- a/proto/agent/agent.proto+++ b/proto/agent/agent.proto@@ -16,6 +16,10 @@ service SandboxAgent {// Filesystem operationsrpc ReadFile(ReadFileRequest) returns (ReadFileResponse);rpc WriteFile(WriteFileRequest) returns (WriteFileResponse);++ // Streaming file operations for large files (256KB chunks over vsock gRPC)+ rpc ReadFileStream(ReadFileStreamRequest) returns (stream FileChunk);+ rpc WriteFileStream(stream WriteFileStreamRequest) returns (WriteFileStreamResponse);rpc ListDir(ListDirRequest) returns (ListDirResponse);rpc MakeDir(MakeDirRequest) returns (MakeDirResponse);rpc Remove(RemoveRequest) returns (RemoveResponse);@@ -95,6 +99,27 @@ message WriteFileRequest {message WriteFileResponse {}+// --- Streaming Filesystem ---++message ReadFileStreamRequest {+ string path = 1;+}++message FileChunk {+ bytes data = 1;+ int64 total_size = 2; // set on first chunk only (0 on subsequent chunks)+}++message WriteFileStreamRequest {+ string path = 1; // set on first message only+ bytes data = 2;+ uint32 mode = 3; // set on first message only (0 = default 0644)+}++message WriteFileStreamResponse {+ int64 bytes_written = 1;+}+message ListDirRequest {string path = 1;}diff --git a/proto/agent/agent_grpc.pb.go b/proto/agent/agent_grpc.pb.goindex 088622da..79386db8 100644--- a/proto/agent/agent_grpc.pb.go+++ b/proto/agent/agent_grpc.pb.go@@ -23,6 +23,8 @@ const (SandboxAgent_ExecStream_FullMethodName = "/agent.SandboxAgent/ExecStream"SandboxAgent_ReadFile_FullMethodName = "/agent.SandboxAgent/ReadFile"SandboxAgent_WriteFile_FullMethodName = "/agent.SandboxAgent/WriteFile"+ SandboxAgent_ReadFileStream_FullMethodName = "/agent.SandboxAgent/ReadFileStream"+ SandboxAgent_WriteFileStream_FullMethodName = "/agent.SandboxAgent/WriteFileStream"SandboxAgent_ListDir_FullMethodName = "/agent.SandboxAgent/ListDir"SandboxAgent_MakeDir_FullMethodName = "/agent.SandboxAgent/MakeDir"SandboxAgent_Remove_FullMethodName = "/agent.SandboxAgent/Remove"@@ -56,6 +58,9 @@ type SandboxAgentClient interface {// Filesystem operationsReadFile(ctx context.Context, in *ReadFileRequest, opts ...grpc.CallOption) (*ReadFileResponse, error)WriteFile(ctx context.Context, in *WriteFileRequest, opts ...grpc.CallOption) (*WriteFileResponse, error)+ // Streaming file operations for large files (256KB chunks over vsock gRPC)+ ReadFileStream(ctx context.Context, in *ReadFileStreamRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[FileChunk], error)+ WriteFileStream(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[WriteFileStreamRequest, WriteFileStreamResponse], error)ListDir(ctx context.Context, in *ListDirRequest, opts ...grpc.CallOption) (*ListDirResponse, error)MakeDir(ctx context.Context, in *MakeDirRequest, opts ...grpc.CallOption) (*MakeDirResponse, error)Remove(ctx context.Context, in *RemoveRequest, opts ...grpc.CallOption) (*RemoveResponse, error)@@ -142,6 +147,38 @@ func (c *sandboxAgentClient) WriteFile(ctx context.Context, in *WriteFileRequestreturn out, nil}+func (c *sandboxAgentClient) ReadFileStream(ctx context.Context, in *ReadFileStreamRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[FileChunk], error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ stream, err := c.cc.NewStream(ctx, &SandboxAgent_ServiceDesc.Streams[1], SandboxAgent_ReadFileStream_FullMethodName, cOpts...)+ if err != nil {+ return nil, err+ }+ x := &grpc.GenericClientStream[ReadFileStreamRequest, FileChunk]{ClientStream: stream}+ if err := x.ClientStream.SendMsg(in); err != nil {+ return nil, err+ }+ if err := x.ClientStream.CloseSend(); err != nil {+ return nil, err+ }+ return x, nil+}++// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.+type SandboxAgent_ReadFileStreamClient = grpc.ServerStreamingClient[FileChunk]++func (c *sandboxAgentClient) WriteFileStream(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[WriteFileStreamRequest, WriteFileStreamResponse], error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ stream, err := c.cc.NewStream(ctx, &SandboxAgent_ServiceDesc.Streams[2], SandboxAgent_WriteFileStream_FullMethodName, cOpts...)+ if err != nil {+ return nil, err+ }+ x := &grpc.GenericClientStream[WriteFileStreamRequest, WriteFileStreamResponse]{ClientStream: stream}+ return x, nil+}++// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.+type SandboxAgent_WriteFileStreamClient = grpc.ClientStreamingClient[WriteFileStreamRequest, WriteFileStreamResponse]+func (c *sandboxAgentClient) ListDir(ctx context.Context, in *ListDirRequest, opts ...grpc.CallOption) (*ListDirResponse, error) {cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)out := new(ListDirResponse)@@ -254,7 +291,7 @@ func (c *sandboxAgentClient) ExecSessionCreate(ctx context.Context, in *ExecSessfunc (c *sandboxAgentClient) ExecSessionAttach(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ExecSessionInput, ExecSessionOutput], error) {cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)- stream, err := c.cc.NewStream(ctx, &SandboxAgent_ServiceDesc.Streams[1], SandboxAgent_ExecSessionAttach_FullMethodName, cOpts...)+ stream, err := c.cc.NewStream(ctx, &SandboxAgent_ServiceDesc.Streams[3], SandboxAgent_ExecSessionAttach_FullMethodName, cOpts...)if err != nil {return nil, err}@@ -329,6 +366,9 @@ type SandboxAgentServer interface {// Filesystem operationsReadFile(context.Context, *ReadFileRequest) (*ReadFileResponse, error)WriteFile(context.Context, *WriteFileRequest) (*WriteFileResponse, error)+ // Streaming file operations for large files (256KB chunks over vsock gRPC)+ ReadFileStream(*ReadFileStreamRequest, grpc.ServerStreamingServer[FileChunk]) error+ WriteFileStream(grpc.ClientStreamingServer[WriteFileStreamRequest, WriteFileStreamResponse]) errorListDir(context.Context, *ListDirRequest) (*ListDirResponse, error)MakeDir(context.Context, *MakeDirRequest) (*MakeDirResponse, error)Remove(context.Context, *RemoveRequest) (*RemoveResponse, error)@@ -378,6 +418,12 @@ func (UnimplementedSandboxAgentServer) ReadFile(context.Context, *ReadFileRequesfunc (UnimplementedSandboxAgentServer) WriteFile(context.Context, *WriteFileRequest) (*WriteFileResponse, error) {return nil, status.Error(codes.Unimplemented, "method WriteFile not implemented")}+func (UnimplementedSandboxAgentServer) ReadFileStream(*ReadFileStreamRequest, grpc.ServerStreamingServer[FileChunk]) error {+ return status.Error(codes.Unimplemented, "method ReadFileStream not implemented")+}+func (UnimplementedSandboxAgentServer) WriteFileStream(grpc.ClientStreamingServer[WriteFileStreamRequest, WriteFileStreamResponse]) error {+ return status.Error(codes.Unimplemented, "method WriteFileStream not implemented")+}func (UnimplementedSandboxAgentServer) ListDir(context.Context, *ListDirRequest) (*ListDirResponse, error) {return nil, status.Error(codes.Unimplemented, "method ListDir not implemented")}@@ -515,6 +561,24 @@ func _SandboxAgent_WriteFile_Handler(srv interface{}, ctx context.Context, dec freturn interceptor(ctx, in, info, handler)}+func _SandboxAgent_ReadFileStream_Handler(srv interface{}, stream grpc.ServerStream) error {+ m := new(ReadFileStreamRequest)+ if err := stream.RecvMsg(m); err != nil {+ return err+ }+ return srv.(SandboxAgentServer).ReadFileStream(m, &grpc.GenericServerStream[ReadFileStreamRequest, FileChunk]{ServerStream: stream})+}++// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.+type SandboxAgent_ReadFileStreamServer = grpc.ServerStreamingServer[FileChunk]++func _SandboxAgent_WriteFileStream_Handler(srv interface{}, stream grpc.ServerStream) error {+ return srv.(SandboxAgentServer).WriteFileStream(&grpc.GenericServerStream[WriteFileStreamRequest, WriteFileStreamResponse]{ServerStream: stream})+}++// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.+type SandboxAgent_WriteFileStreamServer = grpc.ClientStreamingServer[WriteFileStreamRequest, WriteFileStreamResponse]+func _SandboxAgent_ListDir_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {in := new(ListDirRequest)if err := dec(in); err != nil {@@ -900,6 +964,16 @@ var SandboxAgent_ServiceDesc = grpc.ServiceDesc{Handler: _SandboxAgent_ExecStream_Handler,ServerStreams: true,},+ {+ StreamName: "ReadFileStream",+ Handler: _SandboxAgent_ReadFileStream_Handler,+ ServerStreams: true,+ },+ {+ StreamName: "WriteFileStream",+ Handler: _SandboxAgent_WriteFileStream_Handler,+ ClientStreams: true,+ },{StreamName: "ExecSessionAttach",Handler: _SandboxAgent_ExecSessionAttach_Handler,diff --git a/sdks/python/examples/test_large_files.py b/sdks/python/examples/test_large_files.pynew file mode 100644index 00000000..559a007c--- /dev/null+++ b/sdks/python/examples/test_large_files.py@@ -0,0 +1,219 @@+#!/usr/bin/env python3+"""+Large File Streaming Test++Tests:+ 1. Write/read 100MB file via SDK+ 2. Download 100MB file via signed URL+ 3. Upload 100MB file via signed URL+ 4. read_stream / write_stream 50MB++Usage:+ python examples/test_large_files.py+"""++import asyncio+import hashlib+import sys+import time++import httpx++from opencomputer import Sandbox++GREEN = "\033[32m"+RED = "\033[31m"+BOLD = "\033[1m"+DIM = "\033[2m"+RESET = "\033[0m"++passed = 0+failed = 0+++def green(msg: str) -> None:+ print(f"{GREEN}✓ {msg}{RESET}")+++def red(msg: str) -> None:+ print(f"{RED}✗ {msg}{RESET}")+++def bold(msg: str) -> None:+ print(f"{BOLD}{msg}{RESET}")+++def dim(msg: str) -> None:+ print(f"{DIM} {msg}{RESET}")+++def check(desc: str, condition: bool, detail: str = "") -> None:+ global passed, failed+ if condition:+ green(desc)+ passed += 1+ else:+ red(f"{desc} ({detail})" if detail else desc)+ failed += 1+++def generate_data(size_mb: int) -> bytes:+ """Generate deterministic data: repeating 256-byte pattern."""+ pattern = bytes(range(256))+ repeats = (size_mb * 1024 * 1024) // 256+ return pattern * repeats+++def sha256(data: bytes) -> str:+ return hashlib.sha256(data).hexdigest()+++async def collect_stream(stream) -> bytes:+ """Collect an async byte iterator into a single bytes object."""+ chunks = []+ async for chunk in stream:+ chunks.append(chunk)+ return b"".join(chunks)+++async def byte_chunks(data: bytes, chunk_size: int = 256 * 1024):+ """Yield data in chunks as an async iterator."""+ for i in range(0, len(data), chunk_size):+ yield data[i : i + chunk_size]+++async def main() -> None:+ global passed, failed++ bold("\n╔══════════════════════════════════════════════════╗")+ bold("║ Large File Streaming Test (Python) ║")+ bold("╚══════════════════════════════════════════════════╝\n")++ sandbox = None++ try:+ sandbox = await Sandbox.create(template="base", timeout=300)+ green(f"Created sandbox: {sandbox.sandbox_id}")+ print()++ # ── Test 1: Write/read 100MB ─────────────────────────────+ bold("━━━ Test 1: Write/read 100MB file via SDK ━━━\n")++ data100 = generate_data(100)+ hash100 = sha256(data100)+ dim(f"Generated 100MB data, SHA-256: {hash100[:16]}...")++ t0 = time.time()+ await sandbox.files.write("/root/large100.bin", data100)+ write_s = time.time() - t0+ dim(f"Write took {write_s:.1f}s ({100 / write_s:.1f} MB/s)")+ green("100MB write completed")++ t1 = time.time()+ read_back = await sandbox.files.read_bytes("/root/large100.bin")+ read_s = time.time() - t1+ dim(f"Read took {read_s:.1f}s ({100 / read_s:.1f} MB/s)")++ check(+ "Read returns correct size",+ len(read_back) == len(data100),+ f"got {len(read_back)}, expected {len(data100)}",+ )+ read_hash = sha256(read_back)+ check("SHA-256 matches after read", read_hash == hash100)+ print()++ # ── Test 2: Download 100MB via signed URL ────────────────+ bold("━━━ Test 2: Download 100MB via signed URL ━━━\n")++ dl_url = await sandbox.download_url("/root/large100.bin", expires_in=300)+ dim("Download URL generated")++ t2 = time.time()+ async with httpx.AsyncClient(timeout=120.0) as http:+ dl_resp = await http.get(dl_url)+ check("Signed URL returns 200", dl_resp.status_code == 200)++ content_length = dl_resp.headers.get("content-length")+ dim(f"Content-Length: {content_length}")+ check("Content-Length is 100MB", content_length == str(len(data100)))++ dl_data = dl_resp.content+ dl_s = time.time() - t2+ dim(f"Download took {dl_s:.1f}s ({100 / dl_s:.1f} MB/s)")++ check("Downloaded size correct", len(dl_data) == len(data100))+ dl_hash = sha256(dl_data)+ check("SHA-256 matches via signed URL download", dl_hash == hash100)+ print()++ # ── Test 3: Upload 100MB via signed URL ──────────────────+ bold("━━━ Test 3: Upload 100MB via signed URL ━━━\n")++ up_url = await sandbox.upload_url("/root/uploaded100.bin")+ dim("Upload URL generated")++ t3 = time.time()+ async with httpx.AsyncClient(timeout=120.0) as http:+ up_resp = await http.put(up_url, content=data100)+ up_s = time.time() - t3+ dim(f"Upload took {up_s:.1f}s ({100 / up_s:.1f} MB/s)")+ check("Upload returns 204", up_resp.status_code == 204)++ up_read_back = await sandbox.files.read_bytes("/root/uploaded100.bin")+ check("Uploaded file size correct", len(up_read_back) == len(data100))+ up_hash = sha256(up_read_back)+ check("SHA-256 matches after signed URL upload", up_hash == hash100)+ print()++ # ── Test 4: read_stream / write_stream (50MB) ────────────+ bold("━━━ Test 4: read_stream / write_stream 50MB ━━━\n")++ data50 = generate_data(50)+ hash50 = sha256(data50)+ dim(f"Generated 50MB data, SHA-256: {hash50[:16]}...")++ # write_stream+ t4 = time.time()+ await sandbox.files.write_stream("/root/stream50.bin", byte_chunks(data50))+ ws_s = time.time() - t4+ dim(f"write_stream took {ws_s:.1f}s")+ green("50MB write_stream completed")++ # read_stream+ t5 = time.time()+ stream = await sandbox.files.read_stream("/root/stream50.bin")+ stream_data = await collect_stream(stream)+ rs_s = time.time() - t5+ dim(f"read_stream took {rs_s:.1f}s")++ check(+ "read_stream returns correct size",+ len(stream_data) == len(data50),+ f"got {len(stream_data)}, expected {len(data50)}",+ )+ stream_hash = sha256(stream_data)+ check("SHA-256 matches via read_stream", stream_hash == hash50)+ print()++ except Exception as e:+ red(f"Fatal error: {e}")+ import traceback++ traceback.print_exc()+ failed += 1+ finally:+ if sandbox:+ await sandbox.kill()+ green("Sandbox killed")++ # --- Summary ---+ bold("========================================")+ bold(f" Results: {passed} passed, {failed} failed")+ bold("========================================\n")+ if failed > 0:+ sys.exit(1)+++if __name__ == "__main__":+ asyncio.run(main())diff --git a/sdks/python/opencomputer/filesystem.py b/sdks/python/opencomputer/filesystem.pyindex b4451a46..3da34b47 100644--- a/sdks/python/opencomputer/filesystem.py+++ b/sdks/python/opencomputer/filesystem.py@@ -3,6 +3,7 @@from __future__ import annotationsfrom dataclasses import dataclass+from typing import AsyncIteratorimport httpx@@ -88,6 +89,26 @@ class Filesystem:)resp.raise_for_status()+ async def read_stream(self, path: str) -> AsyncIterator[bytes]:+ """Stream a file as async byte chunks. Avoids buffering the full file in memory."""+ req = self._client.build_request(+ "GET",+ f"/sandboxes/{self._sandbox_id}/files",+ params={"path": path},+ )+ resp = await self._client.send(req, stream=True)+ resp.raise_for_status()+ return resp.aiter_bytes()++ async def write_stream(self, path: str, stream: AsyncIterator[bytes]) -> None:+ """Stream content to a file from an async iterator. Avoids buffering the full file in memory."""+ resp = await self._client.put(+ f"/sandboxes/{self._sandbox_id}/files",+ params={"path": path},+ content=stream,+ )+ resp.raise_for_status()+async def exists(self, path: str) -> bool:"""Check if a path exists."""try:diff --git a/sdks/python/opencomputer/sandbox.py b/sdks/python/opencomputer/sandbox.pyindex 1317b3b3..28caebea 100644--- a/sdks/python/opencomputer/sandbox.py+++ b/sdks/python/opencomputer/sandbox.py@@ -217,6 +217,38 @@ class Sandbox:)resp.raise_for_status()+ async def download_url(self, path: str, *, expires_in: int = 3600) -> str:+ """Generate a signed download URL for a sandbox file.++ The URL can be used by anyone (e.g. in a browser) without an API key.++ Args:+ path: Absolute path inside the sandbox.+ expires_in: URL validity in seconds (default: 3600, max: 86400).+ """+ resp = await self._client.post(+ f"/sandboxes/{self.sandbox_id}/files/download-url",+ json={"path": path, "expiresIn": expires_in},+ )+ resp.raise_for_status()+ return resp.json()["url"]++ async def upload_url(self, path: str, *, expires_in: int = 3600) -> str:+ """Generate a signed upload URL for a sandbox file.++ The URL can be used by anyone to PUT file content without an API key.++ Args:+ path: Absolute path inside the sandbox.+ expires_in: URL validity in seconds (default: 3600, max: 86400).+ """+ resp = await self._client.post(+ f"/sandboxes/{self.sandbox_id}/files/upload-url",+ json={"path": path, "expiresIn": expires_in},+ )+ resp.raise_for_status()+ return resp.json()["url"]+@propertydef agent(self) -> Agent:"""Access Claude Agent SDK sessions."""diff --git a/sdks/typescript/examples/test-large-files.ts b/sdks/typescript/examples/test-large-files.tsnew file mode 100644index 00000000..c9a7cf83--- /dev/null+++ b/sdks/typescript/examples/test-large-files.ts@@ -0,0 +1,199 @@+/**+ * Large File Streaming Test+ *+ * Tests:+ * 1. Write a 100MB file via SDK, read back and verify size+ * 2. Download 100MB file via signed URL, verify content integrity (SHA-256)+ * 3. Upload 100MB file via signed URL, verify content integrity+ * 4. Write 50MB via writeStream, read back via readStream+ *+ * Usage:+ * npx tsx examples/test-large-files.ts+ */++import { createHash } from "crypto";+import { Sandbox } from "../src/index";++function green(msg: string) { console.log(`\x1b[32m✓ ${msg}\x1b[0m`); }+function red(msg: string) { console.log(`\x1b[31m✗ ${msg}\x1b[0m`); }+function bold(msg: string) { console.log(`\x1b[1m${msg}\x1b[0m`); }+function dim(msg: string) { console.log(`\x1b[2m ${msg}\x1b[0m`); }++let passed = 0;+let failed = 0;++function check(desc: string, condition: boolean, detail?: string) {+ if (condition) {+ green(desc);+ passed++;+ } else {+ red(`${desc}${detail ? ` (${detail})` : ""}`);+ failed++;+ }+}++/** Generate deterministic data: repeating pattern so we can verify integrity */+function generateData(sizeMB: number): Uint8Array {+ const size = sizeMB * 1024 * 1024;+ const buf = new Uint8Array(size);+ // Fill with repeating 256-byte pattern+ for (let i = 0; i < size; i++) {+ buf[i] = i % 256;+ }+ return buf;+}++function sha256(data: Uint8Array): string {+ return createHash("sha256").update(data).digest("hex");+}++async function streamToBuffer(stream: ReadableStream<Uint8Array>): Promise<Uint8Array> {+ const reader = stream.getReader();+ const chunks: Uint8Array[] = [];+ let totalLen = 0;+ while (true) {+ const { done, value } = await reader.read();+ if (done) break;+ chunks.push(value);+ totalLen += value.length;+ }+ const result = new Uint8Array(totalLen);+ let offset = 0;+ for (const chunk of chunks) {+ result.set(chunk, offset);+ offset += chunk.length;+ }+ return result;+}++async function main() {+ bold("\n╔══════════════════════════════════════════════════╗");+ bold("║ Large File Streaming Test ║");+ bold("╚══════════════════════════════════════════════════╝\n");++ let sandbox: Sandbox | null = null;++ try {+ sandbox = await Sandbox.create({ template: "base", timeout: 300 });+ green(`Created sandbox: ${sandbox.sandboxId}`);+ console.log();++ // ── Test 1: Write and read 100MB file via SDK ────────────────+ bold("━━━ Test 1: Write/read 100MB file via SDK ━━━\n");++ const data100 = generateData(100);+ const hash100 = sha256(data100);+ dim(`Generated 100MB data, SHA-256: ${hash100.slice(0, 16)}...`);++ const t0 = Date.now();+ await sandbox.files.write("/root/large100.bin", data100);+ const writeMs = Date.now() - t0;+ dim(`Write took ${writeMs}ms (${(100 * 1000 / writeMs).toFixed(1)} MB/s)`);+ green("100MB write completed");++ const t1 = Date.now();+ const readBack = await sandbox.files.readBytes("/root/large100.bin");+ const readMs = Date.now() - t1;+ dim(`Read took ${readMs}ms (${(100 * 1000 / readMs).toFixed(1)} MB/s)`);++ check("Read returns correct size", readBack.length === data100.length,+ `got ${readBack.length}, expected ${data100.length}`);+ const readHash = sha256(readBack);+ check("SHA-256 matches after read", readHash === hash100,+ `got ${readHash.slice(0, 16)}...`);+ console.log();++ // ── Test 2: Download 100MB via signed URL ────────────────────+ bold("━━━ Test 2: Download 100MB via signed URL ━━━\n");++ const dlUrl = await sandbox.downloadUrl("/root/large100.bin", { expiresIn: 300 });+ dim(`Download URL generated`);++ const t2 = Date.now();+ const dlRes = await fetch(dlUrl);+ check("Signed URL returns 200", dlRes.status === 200);++ const contentLength = dlRes.headers.get("content-length");+ dim(`Content-Length: ${contentLength}`);+ check("Content-Length is 100MB", contentLength === String(data100.length));++ const dlData = new Uint8Array(await dlRes.arrayBuffer());+ const dlMs = Date.now() - t2;+ dim(`Download took ${dlMs}ms (${(100 * 1000 / dlMs).toFixed(1)} MB/s)`);++ check("Downloaded size correct", dlData.length === data100.length);+ const dlHash = sha256(dlData);+ check("SHA-256 matches via signed URL download", dlHash === hash100);+ console.log();++ // ── Test 3: Upload 100MB via signed URL ──────────────────────+ bold("━━━ Test 3: Upload 100MB via signed URL ━━━\n");++ const upUrl = await sandbox.uploadUrl("/root/uploaded100.bin");+ dim(`Upload URL generated`);++ const t3 = Date.now();+ const upRes = await fetch(upUrl, {+ method: "PUT",+ body: data100,+ });+ const upMs = Date.now() - t3;+ dim(`Upload took ${upMs}ms (${(100 * 1000 / upMs).toFixed(1)} MB/s)`);+ check("Upload returns 204", upRes.status === 204);++ // Verify via SDK readBytes+ const upReadBack = await sandbox.files.readBytes("/root/uploaded100.bin");+ check("Uploaded file size correct", upReadBack.length === data100.length);+ const upHash = sha256(upReadBack);+ check("SHA-256 matches after signed URL upload", upHash === hash100);+ console.log();++ // ── Test 4: readStream / writeStream (50MB) ──────────────────+ bold("━━━ Test 4: readStream / writeStream 50MB ━━━\n");++ const data50 = generateData(50);+ const hash50 = sha256(data50);+ dim(`Generated 50MB data, SHA-256: ${hash50.slice(0, 16)}...`);++ // writeStream+ const t4 = Date.now();+ await sandbox.files.writeStream("/root/stream50.bin", data50);+ const wsMs = Date.now() - t4;+ dim(`writeStream took ${wsMs}ms`);+ green("50MB writeStream completed");++ // readStream+ const t5 = Date.now();+ const readStream = await sandbox.files.readStream("/root/stream50.bin");+ const streamData = await streamToBuffer(readStream);+ const rsMs = Date.now() - t5;+ dim(`readStream took ${rsMs}ms`);++ check("readStream returns correct size", streamData.length === data50.length,+ `got ${streamData.length}, expected ${data50.length}`);+ const streamHash = sha256(streamData);+ check("SHA-256 matches via readStream", streamHash === hash50);+ console.log();++ } catch (err: any) {+ red(`Fatal error: ${err.message}`);+ if (err.stack) dim(err.stack);+ failed++;+ } finally {+ if (sandbox) {+ await sandbox.kill();+ green("Sandbox killed");+ }+ }++ // --- Summary ---+ bold("========================================");+ bold(` Results: ${passed} passed, ${failed} failed`);+ bold("========================================\n");+ if (failed > 0) process.exit(1);+}++main().catch((err) => {+ console.error("Fatal error:", err);+ process.exit(1);+});diff --git a/sdks/typescript/examples/test-signed-urls.ts b/sdks/typescript/examples/test-signed-urls.tsnew file mode 100644index 00000000..41bc0202--- /dev/null+++ b/sdks/typescript/examples/test-signed-urls.ts@@ -0,0 +1,220 @@+/**+ * Signed Download/Upload URL Test+ *+ * Tests:+ * 1. Generate a signed download URL and fetch file content without API key+ * 2. Modify file after URL generation — verify URL serves live content+ * 3. Generate a signed upload URL and PUT new content without API key+ * 4. Verify uploaded content via SDK read+ * 5. Expired URL returns 403+ * 6. Tampered signature returns 403+ *+ * Usage:+ * npx tsx examples/test-signed-urls.ts+ */++import { Sandbox } from "../src/index";++function green(msg: string) { console.log(`\x1b[32m✓ ${msg}\x1b[0m`); }+function red(msg: string) { console.log(`\x1b[31m✗ ${msg}\x1b[0m`); }+function bold(msg: string) { console.log(`\x1b[1m${msg}\x1b[0m`); }+function dim(msg: string) { console.log(`\x1b[2m ${msg}\x1b[0m`); }++let passed = 0;+let failed = 0;++function check(desc: string, condition: boolean, detail?: string) {+ if (condition) {+ green(desc);+ passed++;+ } else {+ red(`${desc}${detail ? ` (${detail})` : ""}`);+ failed++;+ }+}++async function main() {+ bold("\n╔══════════════════════════════════════════════════╗");+ bold("║ Signed Download/Upload URL Test ║");+ bold("╚══════════════════════════════════════════════════╝\n");++ let sandbox: Sandbox | null = null;++ try {+ sandbox = await Sandbox.create({ template: "base", timeout: 120 });+ green(`Created sandbox: ${sandbox.sandboxId}`);+ console.log();++ // ── Test 1: Signed download URL ────────────────────────────────+ bold("━━━ Test 1: Signed download URL ━━━\n");++ const originalContent = "ORIGINAL CONTENT - written before signed URL generation";+ await sandbox.files.write("/tmp/hello.txt", originalContent);+ dim("Wrote /tmp/hello.txt with original content");++ const downloadUrl = await sandbox.downloadUrl("/tmp/hello.txt");+ dim(`Download URL: ${downloadUrl}`);++ // Inspect URL structure+ const urlObj = new URL(downloadUrl);+ dim(`Host: ${urlObj.host}`);+ dim(`Path: ${urlObj.pathname}`);+ check("URL contains sandbox ID", downloadUrl.includes(sandbox.sandboxId));+ check("URL contains signature param", urlObj.searchParams.has("signature"));+ check("URL contains expires param", urlObj.searchParams.has("expires"));++ // Fetch without API key — just a plain GET+ const res1 = await fetch(downloadUrl);+ const body1 = await res1.text();+ dim(`Status: ${res1.status}`);+ dim(`Body: "${body1.trim()}"`);+ check("Download URL returns 200", res1.status === 200);+ check("Content matches original", body1 === originalContent);+ console.log();++ // ── Test 2: URL serves live content (not a snapshot) ───────────+ bold("━━━ Test 2: Live content (not snapshot) ━━━\n");++ const modifiedContent = "MODIFIED CONTENT - written AFTER signed URL generation";+ await sandbox.files.write("/tmp/hello.txt", modifiedContent);+ dim("Overwrote /tmp/hello.txt with modified content");++ // Fetch the SAME URL again+ const res2 = await fetch(downloadUrl);+ const body2 = await res2.text();+ dim(`Same URL body: "${body2.trim()}"`);++ check("Same URL returns modified content (live, not snapshot)", body2 === modifiedContent);++ // Generate a new URL — should also work+ const downloadUrl2 = await sandbox.downloadUrl("/tmp/hello.txt");+ const res3 = await fetch(downloadUrl2);+ const body3 = await res3.text();+ check("New URL also returns modified content", body3 === modifiedContent);+ console.log();++ // ── Test 3: Signed upload URL ──────────────────────────────────+ bold("━━━ Test 3: Signed upload URL ━━━\n");++ const uploadUrl = await sandbox.uploadUrl("/tmp/uploaded.txt");+ dim(`Upload URL: ${uploadUrl}`);++ const uploadContent = "UPLOADED VIA SIGNED URL - no API key needed";+ const uploadRes = await fetch(uploadUrl, {+ method: "PUT",+ body: uploadContent,+ });+ dim(`Upload status: ${uploadRes.status}`);+ check("Upload returns 204", uploadRes.status === 204);++ // Verify via SDK read+ const readBack = await sandbox.files.read("/tmp/uploaded.txt");+ dim(`Readback: "${readBack}"`);+ check("Uploaded content readable via SDK", readBack === uploadContent);+ console.log();++ // ── Test 4: Upload overwrite via signed URL ────────────────────+ bold("━━━ Test 4: Upload overwrite ━━━\n");++ const overwriteContent = "OVERWRITTEN VIA SIGNED URL";+ const uploadUrl2 = await sandbox.uploadUrl("/tmp/uploaded.txt");+ const overwriteRes = await fetch(uploadUrl2, {+ method: "PUT",+ body: overwriteContent,+ });+ check("Overwrite upload returns 204", overwriteRes.status === 204);++ const readBack2 = await sandbox.files.read("/tmp/uploaded.txt");+ check("Overwritten content correct", readBack2 === overwriteContent);+ console.log();++ // ── Test 5: Download uploaded file via signed URL ───────────────+ bold("━━━ Test 5: Round-trip: upload then download via signed URLs ━━━\n");++ const roundtripContent = "round-trip test content 🎉";+ const upUrl = await sandbox.uploadUrl("/tmp/roundtrip.txt");+ await fetch(upUrl, { method: "PUT", body: roundtripContent });++ const dlUrl = await sandbox.downloadUrl("/tmp/roundtrip.txt");+ const dlRes = await fetch(dlUrl);+ const dlBody = await dlRes.text();+ check("Round-trip content intact", dlBody === roundtripContent);+ console.log();++ // ── Test 6: Expired URL ────────────────────────────────────────+ bold("━━━ Test 6: Expired URL ━━━\n");++ const shortUrl = await sandbox.downloadUrl("/tmp/hello.txt", { expiresIn: 1 });+ dim("Generated URL with 1s expiry, waiting 2s...");+ await new Promise((r) => setTimeout(r, 2000));++ const expiredRes = await fetch(shortUrl);+ dim(`Expired URL status: ${expiredRes.status}`);+ check("Expired URL returns 403", expiredRes.status === 403);++ if (expiredRes.status === 403) {+ const errBody = await expiredRes.json();+ dim(`Error: ${JSON.stringify(errBody)}`);+ check("Error message mentions expiry", errBody.error?.includes("expired"));+ }+ console.log();++ // ── Test 7: Tampered signature ─────────────────────────────────+ bold("━━━ Test 7: Tampered signature ━━━\n");++ const validUrl = await sandbox.downloadUrl("/tmp/hello.txt");+ const tampered = validUrl.replace(/signature=[^&]+/, "signature=deadbeef0000");+ const tamperedRes = await fetch(tampered);+ dim(`Tampered URL status: ${tamperedRes.status}`);+ check("Tampered signature returns 403", tamperedRes.status === 403);+ console.log();++ // ── Test 8: Tampered path ──────────────────────────────────────+ bold("━━━ Test 8: Tampered path ━━━\n");++ // Write a secret file, then try to access it by tampering the path param+ await sandbox.files.write("/tmp/secret.txt", "TOP SECRET");+ const legitUrl = await sandbox.downloadUrl("/tmp/hello.txt");+ const pathTampered = legitUrl.replace(+ /path=[^&]+/,+ `path=${encodeURIComponent("/tmp/secret.txt")}`,+ );+ const pathTamperedRes = await fetch(pathTampered);+ dim(`Path-tampered URL status: ${pathTamperedRes.status}`);+ check("Path-tampered URL returns 403 (signature mismatch)", pathTamperedRes.status === 403);+ console.log();++ // ── Test 9: Custom expiry ──────────────────────────────────────+ bold("━━━ Test 9: Custom expiry (5 min) ━━━\n");++ const customUrl = await sandbox.downloadUrl("/tmp/hello.txt", { expiresIn: 300 });+ const customUrlObj = new URL(customUrl);+ const expires = parseInt(customUrlObj.searchParams.get("expires") || "0");+ const now = Math.floor(Date.now() / 1000);+ const diff = expires - now;+ dim(`Expires in ${diff}s (expected ~300s)`);+ check("Expiry is approximately 5 minutes", diff >= 295 && diff <= 305, `${diff}s`);+ console.log();++ } catch (err: any) {+ red(`Fatal error: ${err.message}`);+ if (err.stack) dim(err.stack);+ failed++;+ } finally {+ if (sandbox) {+ await sandbox.kill();+ green("Sandbox killed");+ }+ }++ // --- Summary ---+ bold("========================================");+ bold(` Results: ${passed} passed, ${failed} failed`);+ bold("========================================\n");+ if (failed > 0) process.exit(1);+}++main().catch((err) => {+ console.error("Fatal error:", err);+ process.exit(1);+});diff --git a/sdks/typescript/src/filesystem.ts b/sdks/typescript/src/filesystem.tsindex 9b4f6941..433a66c8 100644--- a/sdks/typescript/src/filesystem.ts+++ b/sdks/typescript/src/filesystem.ts@@ -74,6 +74,42 @@ export class Filesystem {if (!resp.ok) throw new Error(`Failed to remove ${path}: ${resp.status}`);}+ /**+ * Returns the raw response body as a ReadableStream for large file downloads.+ * Avoids buffering the entire file in memory.+ */+ async readStream(path: string): Promise<ReadableStream<Uint8Array>> {+ const resp = await fetch(+ `${this.apiUrl}/sandboxes/${this.sandboxId}/files?path=${encodeURIComponent(path)}`,+ { headers: this.headers },+ );+ if (!resp.ok) throw new Error(`Failed to read ${path}: ${resp.status}`);+ if (!resp.body) throw new Error(`No response body for ${path}`);+ return resp.body;+ }++ /**+ * Streams a ReadableStream or Uint8Array as the request body for large file uploads.+ * Avoids buffering the entire file in memory when given a ReadableStream.+ */+ async writeStream(path: string, stream: ReadableStream<Uint8Array> | Uint8Array): Promise<void> {+ const opts: RequestInit & Record<string, unknown> = {+ method: "PUT",+ headers: this.headers,+ body: stream as BodyInit,+ };+ // duplex: "half" is required for ReadableStream bodies in Node.js fetch,+ // but must NOT be set for Uint8Array/Buffer bodies.+ if (stream instanceof ReadableStream) {+ opts.duplex = "half";+ }+ const resp = await fetch(+ `${this.apiUrl}/sandboxes/${this.sandboxId}/files?path=${encodeURIComponent(path)}`,+ opts,+ );+ if (!resp.ok) throw new Error(`Failed to write ${path}: ${resp.status}`);+ }+async exists(path: string): Promise<boolean> {try {const resp = await fetch(diff --git a/sdks/typescript/src/sandbox.ts b/sdks/typescript/src/sandbox.tsindex 027ca564..6e95aedc 100644--- a/sdks/typescript/src/sandbox.ts+++ b/sdks/typescript/src/sandbox.ts@@ -433,6 +433,62 @@ export class Sandbox {}}+ /**+ * Generate a signed download URL for a file in the sandbox.+ * The URL can be used by anyone (e.g. in a browser) without an API key.+ * @param path - absolute path inside the sandbox+ * @param opts.expiresIn - URL validity in seconds (default: 3600, max: 86400)+ */+ async downloadUrl(path: string, opts?: { expiresIn?: number }): Promise<string> {+ const resp = await fetch(+ `${this.apiUrl}/sandboxes/${this.sandboxId}/files/download-url`,+ {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ ...(this.apiKey ? { "X-API-Key": this.apiKey } : {}),+ },+ body: JSON.stringify({ path, expiresIn: opts?.expiresIn ?? 3600 }),+ },+ );++ if (!resp.ok) {+ const text = await resp.text();+ throw new Error(`Failed to get download URL: ${resp.status} ${text}`);+ }++ const data: { url: string } = await resp.json();+ return data.url;+ }++ /**+ * Generate a signed upload URL for a file in the sandbox.+ * The URL can be used by anyone (e.g. in a browser) to PUT file content without an API key.+ * @param path - absolute path inside the sandbox+ * @param opts.expiresIn - URL validity in seconds (default: 3600, max: 86400)+ */+ async uploadUrl(path: string, opts?: { expiresIn?: number }): Promise<string> {+ const resp = await fetch(+ `${this.apiUrl}/sandboxes/${this.sandboxId}/files/upload-url`,+ {+ method: "POST",+ headers: {+ "Content-Type": "application/json",+ ...(this.apiKey ? { "X-API-Key": this.apiKey } : {}),+ },+ body: JSON.stringify({ path, expiresIn: opts?.expiresIn ?? 3600 }),+ },+ );++ if (!resp.ok) {+ const text = await resp.text();+ throw new Error(`Failed to get upload URL: ${resp.status} ${text}`);+ }++ const data: { url: string } = await resp.json();+ return data.url;+ }+async createPreviewURL(opts: { port: number; domain?: string; authConfig?: Record<string, unknown> }): Promise<PreviewURLResult> {const resp = await fetch(`${this.apiUrl}/sandboxes/${this.sandboxId}/preview`, {method: "POST",diff --git a/test-preview-urls.ts b/test-preview-urls.tsdeleted file mode 100644index ce249519..00000000--- a/test-preview-urls.ts+++ /dev/null@@ -1,165 +0,0 @@-/**- * Test script for preview URLs with hibernate/wake cycle.- * Tests idempotent creation, custom domain support, and hibernate persistence.- *- * Usage:- * OPENCOMPUTER_API_KEY=<key> npx tsx test-preview-urls.ts- *- * Optional env vars:- * CUSTOM_DOMAIN=mycompany.com — test custom domain preview URLs- */--import { Sandbox, type PreviewURLResult } from "./sdks/typescript/src/sandbox";-import * as readline from "readline";--function assert(cond: boolean, msg: string) {- if (!cond) { console.error(` FAIL: ${msg}`); process.exit(1); }- console.log(` PASS: ${msg}`);-}--function waitForEnter(prompt: string): Promise<void> {- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });- return new Promise(resolve => {- rl.question(prompt, () => { rl.close(); resolve(); });- });-}--const PORTS = [3000, 8080, 5173];-const CUSTOM_DOMAIN = process.env.CUSTOM_DOMAIN || "";--async function startServers(sandbox: Sandbox) {- for (const port of PORTS) {- await sandbox.commands.run(- `sh -c 'mkdir -p /tmp/www-${port} && cat > /tmp/www-${port}/index.html << "HTMLEOF"-<!DOCTYPE html><html><head><title>Port ${port}</title></head>-<body style="font-family:system-ui;display:flex;align-items:center;justify-content:center;height:100vh;margin:0;background:#0f172a;color:#e2e8f0">-<div style="text-align:center">-<h1 style="color:#3b82f6">Port ${port}</h1>-<p style="color:#64748b;font-size:0.875rem">Each port gets its own preview URL</p>-</div></body></html>-HTMLEOF'`,- );- await sandbox.commands.run(`busybox httpd -p ${port} -h /tmp/www-${port}`);- console.log(` PASS: server started on port ${port}`);- }-}--async function main() {- let sandbox: Sandbox | null = null;-- try {- // ── 1. Create sandbox ──────────────────────────────────────────────- console.log("\n1. Creating sandbox...");- sandbox = await Sandbox.create({ template: "base", timeout: 300 });- console.log(` sandboxId = ${sandbox.sandboxId}`);- assert(sandbox.status === "running", `status = ${sandbox.status}`);-- // ── 2. Start HTTP servers ──────────────────────────────────────────- console.log(`\n2. Starting HTTP servers on ports ${PORTS.join(", ")}...`);- await startServers(sandbox);-- // ── 3. Create preview URLs ─────────────────────────────────────────- console.log("\n3. Creating preview URLs...");- const previews: PreviewURLResult[] = [];- for (const port of PORTS) {- const opts: { port: number; domain?: string } = { port };- if (CUSTOM_DOMAIN) opts.domain = CUSTOM_DOMAIN;- const pv = await sandbox.createPreviewURL(opts);- assert(pv.port === port, `port = ${pv.port}`);- assert(pv.hostname.includes(sandbox.sandboxId), `hostname contains sandbox ID`);- if (CUSTOM_DOMAIN) {- assert(pv.hostname.endsWith(CUSTOM_DOMAIN), `hostname ends with custom domain`);- }- if (pv.customHostname) {- console.log(` customHostname: ${pv.customHostname}`);- }- previews.push(pv);- }-- // ── 4. Idempotent re-creation ──────────────────────────────────────- console.log("\n4. Re-creating same preview URLs (idempotent)...");- for (const port of PORTS) {- const opts: { port: number; domain?: string } = { port };- if (CUSTOM_DOMAIN) opts.domain = CUSTOM_DOMAIN;- const pv = await sandbox.createPreviewURL(opts);- assert(pv.port === port, `idempotent: port ${port} returned`);- const original = previews.find(p => p.port === port)!;- assert(pv.id === original.id, `idempotent: same id for port ${port}`);- assert(pv.hostname === original.hostname, `idempotent: same hostname for port ${port}`);- }-- console.log(`\n${"=".repeat(60)}`);- console.log(" Preview URLs:\n");- for (const pv of previews) {- const displayHost = pv.customHostname || pv.hostname;- console.log(` port ${pv.port} → https://${displayHost}`);- }- console.log(`\n Dashboard: https://app.opencomputer.dev/sessions/${sandbox.sandboxId}`);- console.log(`${"=".repeat(60)}\n`);-- // ── 5. List preview URLs ───────────────────────────────────────────- console.log("5. Listing preview URLs...");- const listed = await sandbox.listPreviewURLs();- assert(listed.length === PORTS.length, `list returns ${PORTS.length} URLs`);- for (const u of listed) {- if (CUSTOM_DOMAIN) {- assert(!!u.customHostname, `list: customHostname present for port ${u.port}`);- }- }-- await waitForEnter("Check dashboard shows preview URLs, then press Enter to hibernate...\n");-- // ── 6. Hibernate ───────────────────────────────────────────────────- console.log("\n6. Hibernating sandbox...");- await sandbox.hibernate();- console.log(" PASS: hibernated");-- // Verify preview URLs still in DB- const listHibernated = await sandbox.listPreviewURLs();- assert(listHibernated.length === PORTS.length, `preview URLs after hibernate = ${listHibernated.length}`);-- await waitForEnter("Check dashboard shows preview URLs while hibernated, then press Enter to wake...\n");-- // ── 7. Wake ────────────────────────────────────────────────────────- console.log("\n7. Waking sandbox...");- await sandbox.wake({ timeout: 300 });- console.log(" PASS: woken");-- // Verify preview URLs still persist- const listWoken = await sandbox.listPreviewURLs();- assert(listWoken.length === PORTS.length, `preview URLs after wake = ${listWoken.length}`);-- // Restart servers (processes don't survive hibernate on base template)- console.log("\n8. Restarting HTTP servers...");- await startServers(sandbox);-- console.log(`\n${"=".repeat(60)}`);- console.log(" URLs should still work after wake:\n");- for (const pv of previews) {- const displayHost = pv.customHostname || pv.hostname;- console.log(` port ${pv.port} → https://${displayHost}`);- }- console.log(`\n Dashboard: https://app.opencomputer.dev/sessions/${sandbox.sandboxId}`);- console.log(`${"=".repeat(60)}\n`);-- await waitForEnter("Check dashboard + URLs after wake, then press Enter to kill...\n");-- // ── 9. Kill ────────────────────────────────────────────────────────- console.log("\n9. Killing sandbox...");- await sandbox.kill();- sandbox = null;- console.log(" PASS: sandbox killed");-- console.log("\n All tests passed!\n");- } catch (err) {- console.error("\nTest error:", err);- process.exit(1);- } finally {- if (sandbox) {- console.log(`\nCleaning up sandbox ${sandbox.sandboxId}...`);- await sandbox.kill().catch(() => {});- }- }-}--main();