Skip to content

An open-source, faster Devin alternative

TypeScript

fixes, pty over grpc, new endpoint

Brian Reardon2b5894bb3461
diff --git a/cmd/agent/main.go b/cmd/agent/main.go
index cec35eb3..968e7bbc 100644
--- a/cmd/agent/main.go
+++ b/cmd/agent/main.go
@@ -32,7 +32,11 @@ func main() {
}
srv := agent.NewServer(version)
- srv.ListenPort = listenPortForPTY
+ // Only set ListenPort for vsock-based backends (Firecracker).
+ // For virtio-serial (QEMU), PTY I/O flows over gRPC PTYAttach instead.
+ if _, isVirtioSerial := lis.(*virtioSerialListener); !isVirtioSerial {
+ srv.ListenPort = listenPortForPTY
+ }
// Signal handling:
// SIGTERM/SIGINT: clean shutdown (exit)
diff --git a/cmd/worker/main.go b/cmd/worker/main.go
index 418b1847..0731435c 100644
--- a/cmd/worker/main.go
+++ b/cmd/worker/main.go
@@ -8,6 +8,7 @@ import (
"os"
"os/signal"
"path/filepath"
+ "sync"
"syscall"
"time"
@@ -116,11 +117,7 @@ func main() {
if err != nil {
return nil, fmt.Errorf("get agent for %s: %w", sandboxID, err)
}
- guestCID, err := qmMgr.GetGuestCID(sandboxID)
- if err != nil {
- return nil, fmt.Errorf("get guest CID for %s: %w", sandboxID, err)
- }
- return createPTYSessionQEMU(agent, guestCID, sandboxID, req)
+ return createPTYSessionQEMU(agent, sandboxID, req)
}
doGracefulShutdown = func(checkpointStore *storage.CheckpointStore, store *db.Store) {
@@ -482,8 +479,59 @@ func consumeExecOutput(stream agentpb.SandboxAgent_ExecSessionAttachClient, scro
}
}
-// createPTYSessionQEMU creates a PTY session using AF_VSOCK (QEMU backend).
-func createPTYSessionQEMU(agent *qm.AgentClient, guestCID uint32, sandboxID string, req types.PTYCreateRequest) (*sandbox.PTYSessionHandle, error) {
+// grpcPTYConn adapts a PTYAttach bidi gRPC stream into an io.ReadWriteCloser
+// with a Resize method, suitable for PTYSessionHandle.PTY.
+type grpcPTYConn struct {
+ stream agentpb.SandboxAgent_PTYAttachClient
+ buf []byte
+ cancel context.CancelFunc
+ closeOnce sync.Once
+ exited bool
+ exitCode int
+}
+
+func (c *grpcPTYConn) Read(p []byte) (int, error) {
+ if len(c.buf) > 0 {
+ n := copy(p, c.buf)
+ c.buf = c.buf[n:]
+ return n, nil
+ }
+ msg, err := c.stream.Recv()
+ if err != nil {
+ return 0, err
+ }
+ if msg.Exited {
+ c.exited = true
+ c.exitCode = int(msg.ExitCode)
+ return 0, io.EOF
+ }
+ n := copy(p, msg.Data)
+ if n < len(msg.Data) {
+ c.buf = msg.Data[n:]
+ }
+ return n, nil
+}
+
+func (c *grpcPTYConn) Write(p []byte) (int, error) {
+ data := make([]byte, len(p))
+ copy(data, p)
+ if err := c.stream.Send(&agentpb.PTYInput{Stdin: data}); err != nil {
+ return 0, err
+ }
+ return len(p), nil
+}
+
+func (c *grpcPTYConn) Resize(cols, rows int) error {
+ return c.stream.Send(&agentpb.PTYInput{Cols: int32(cols), Rows: int32(rows)})
+}
+
+func (c *grpcPTYConn) Close() error {
+ c.closeOnce.Do(func() { c.cancel() })
+ return nil
+}
+
+// createPTYSessionQEMU creates a PTY session using gRPC PTYAttach (QEMU backend).
+func createPTYSessionQEMU(agent *qm.AgentClient, sandboxID string, req types.PTYCreateRequest) (*sandbox.PTYSessionHandle, error) {
cols := int32(req.Cols)
if cols <= 0 {
cols = 80
@@ -493,15 +541,32 @@ func createPTYSessionQEMU(agent *qm.AgentClient, guestCID uint32, sandboxID stri
rows = 24
}
- sessionID, dataPort, err := agent.PTYCreate(context.Background(), cols, rows, req.Shell)
+ // 1. Create the PTY session (allocates shell + pty in the VM)
+ sessionID, _, err := agent.PTYCreate(context.Background(), cols, rows, req.Shell)
if err != nil {
return nil, fmt.Errorf("create PTY in VM: %w", err)
}
- conn, err := agent.ConnectPTYData(guestCID, dataPort)
+ // 2. Open bidi gRPC stream for PTY I/O
+ ctx, cancel := context.WithCancel(context.Background())
+ stream, err := agent.PTYAttach(ctx)
if err != nil {
+ cancel()
_ = agent.PTYKill(context.Background(), sessionID)
- return nil, fmt.Errorf("connect PTY data: %w", err)
+ return nil, fmt.Errorf("attach PTY stream: %w", err)
+ }
+
+ // 3. Send first message with session_id to bind the stream
+ if err := stream.Send(&agentpb.PTYInput{SessionId: sessionID}); err != nil {
+ cancel()
+ _ = agent.PTYKill(context.Background(), sessionID)
+ return nil, fmt.Errorf("send PTY session ID: %w", err)
+ }
+
+ // 4. Wrap in grpcPTYConn
+ conn := &grpcPTYConn{
+ stream: stream,
+ cancel: cancel,
}
done := make(chan struct{})
diff --git a/deploy/ec2/build-rootfs-docker.sh b/deploy/ec2/build-rootfs-docker.sh
index 6c259fbe..86637663 100755
--- a/deploy/ec2/build-rootfs-docker.sh
+++ b/deploy/ec2/build-rootfs-docker.sh
@@ -193,6 +193,11 @@ fi
cat >> "$TMPDIR/Dockerfile" << 'INJECT_EOF'
# --- OpenSandbox agent injection ---
+# Create sandbox user (UID 1000) for exec sessions — agent runs as root (PID 1),
+# but user commands run as this non-root user for cgroup/security isolation.
+RUN useradd -m -u 1000 -s /bin/bash sandbox && \
+ echo 'sandbox ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers && \
+ chown sandbox:sandbox /workspace 2>/dev/null || true
COPY osb-agent /usr/local/bin/osb-agent
RUN chmod +x /usr/local/bin/osb-agent
COPY init /sbin/init
diff --git a/internal/agent/exec_session.go b/internal/agent/exec_session.go
index 32c74d68..b2127894 100644
--- a/internal/agent/exec_session.go
+++ b/internal/agent/exec_session.go
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"io"
+ "log"
"os/exec"
"sync"
"syscall"
@@ -54,14 +55,8 @@ func (s *Server) ExecSessionCreate(ctx context.Context, req *pb.ExecSessionCreat
env = append(env, mapToEnv(req.Envs)...)
cmd.Env = env
- // Run as sandbox user in its own process group
- cmd.SysProcAttr = &syscall.SysProcAttr{
- Setpgid: true,
- Credential: &syscall.Credential{
- Uid: sandboxUID,
- Gid: sandboxGID,
- },
- }
+ // Run in its own process group (for clean kill on timeout)
+ cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
stdinPipe, err := cmd.StdinPipe()
if err != nil {
@@ -100,8 +95,10 @@ func (s *Server) ExecSessionCreate(ctx context.Context, req *pb.ExecSessionCreat
sess.maxRunAfterDisc = time.Duration(req.MaxRunAfterDisconnect) * time.Second
}
+ log.Printf("exec-session: starting %s %v (SysProcAttr=%+v, Dir=%s)", req.Command, req.Args, cmd.SysProcAttr, cmd.Dir)
if err := cmd.Start(); err != nil {
cancel()
+ log.Printf("exec-session: start failed: %v (cmd=%s)", err, req.Command)
return nil, fmt.Errorf("start command: %w", err)
}
moveToCgroup(cmd.Process.Pid)
diff --git a/internal/agent/pty.go b/internal/agent/pty.go
index e4424ed8..1386bac1 100644
--- a/internal/agent/pty.go
+++ b/internal/agent/pty.go
@@ -91,6 +91,15 @@ func (s *Server) PTYCreate(ctx context.Context, req *pb.PTYCreateRequest) (*pb.P
s.ptySessions[sessionID] = sess
s.ptyMu.Unlock()
+ // If ListenPort is nil (virtio-serial / QEMU mode), skip the vsock data
+ // listener — the caller will use PTYAttach for I/O instead.
+ if s.ListenPort == nil {
+ return &pb.PTYCreateResponse{
+ SessionId: sessionID,
+ DataPort: 0,
+ }, nil
+ }
+
// Start vsock listener for PTY data on the allocated port.
// We must ensure the listener is ready before returning the port to the
// caller, otherwise the host may CONNECT before we're listening.
@@ -169,6 +178,89 @@ func (s *Server) servePTYData(sess *ptySession, ctx context.Context, ready chan<
s.ptyMu.Unlock()
}
+// PTYAttach opens a bidirectional gRPC stream for PTY I/O.
+// Used by the QEMU backend where vsock data ports are unavailable.
+func (s *Server) PTYAttach(stream pb.SandboxAgent_PTYAttachServer) error {
+ // First message must contain session_id
+ first, err := stream.Recv()
+ if err != nil {
+ return fmt.Errorf("recv first message: %w", err)
+ }
+ sessionID := first.SessionId
+ if sessionID == "" {
+ return fmt.Errorf("first message must contain session_id")
+ }
+
+ s.ptyMu.Lock()
+ sess, ok := s.ptySessions[sessionID]
+ s.ptyMu.Unlock()
+ if !ok {
+ return fmt.Errorf("pty session %s not found", sessionID)
+ }
+
+ // Process any stdin/resize from the first message
+ if len(first.Stdin) > 0 {
+ sess.ptyFile.Write(first.Stdin)
+ }
+ if first.Cols > 0 && first.Rows > 0 {
+ pty.Setsize(sess.ptyFile, &pty.Winsize{
+ Cols: uint16(first.Cols),
+ Rows: uint16(first.Rows),
+ })
+ }
+
+ // Goroutine: read from PTY and send to client
+ sendErr := make(chan error, 1)
+ go func() {
+ buf := make([]byte, 4096)
+ for {
+ n, readErr := sess.ptyFile.Read(buf)
+ if n > 0 {
+ data := make([]byte, n)
+ copy(data, buf[:n])
+ if err := stream.Send(&pb.PTYOutput{Data: data}); err != nil {
+ sendErr <- err
+ return
+ }
+ }
+ if readErr != nil {
+ // PTY closed or process exited — wait for exit code
+ exitCode := 0
+ if sess.cmd != nil {
+ if waitErr := sess.cmd.Wait(); waitErr != nil {
+ if exitErr, ok := waitErr.(*exec.ExitError); ok {
+ exitCode = exitErr.ExitCode()
+ } else {
+ exitCode = 1
+ }
+ }
+ }
+ stream.Send(&pb.PTYOutput{Exited: true, ExitCode: int32(exitCode)})
+ sendErr <- nil
+ return
+ }
+ }
+ }()
+
+ // Main loop: recv from client, write to PTY
+ for {
+ msg, err := stream.Recv()
+ if err != nil {
+ // Client disconnected
+ return nil
+ }
+ if len(msg.Stdin) > 0 {
+ sess.ptyFile.Write(msg.Stdin)
+ }
+ if msg.Cols > 0 && msg.Rows > 0 {
+ pty.Setsize(sess.ptyFile, &pty.Winsize{
+ Cols: uint16(msg.Cols),
+ Rows: uint16(msg.Rows),
+ })
+ }
+ }
+}
+
// PTYResize changes the terminal size for an active PTY session.
func (s *Server) PTYResize(ctx context.Context, req *pb.PTYResizeRequest) (*pb.PTYResizeResponse, error) {
s.ptyMu.Lock()
diff --git a/internal/api/image_builder.go b/internal/api/image_builder.go
index 567228e8..ef6bcb85 100644
--- a/internal/api/image_builder.go
+++ b/internal/api/image_builder.go
@@ -376,19 +376,25 @@ func (s *Server) buildImage(ctx context.Context, orgID uuid.UUID, manifest *Imag
return uuid.Nil, fmt.Errorf("no execution backend available")
}
- // Cleanup: always destroy the build sandbox and mark it stopped in PG
+ // Cleanup: destroy the build sandbox after a delay.
+ // The checkpoint cache (qcow2 files) must survive long enough for the first
+ // ForkFromCheckpoint to copy them. With reflink the fork is instant, but the
+ // server-side create flow is async — the fork gRPC call may arrive seconds later.
defer func() {
- cleanCtx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
- defer cancel()
- if grpcClient != nil {
- _, _ = grpcClient.DestroySandbox(cleanCtx, &pb.DestroySandboxRequest{SandboxId: buildSandboxID})
- } else if s.manager != nil {
- _ = s.manager.Kill(cleanCtx, buildSandboxID)
- }
- if s.store != nil {
- _ = s.store.UpdateSandboxSessionStatus(cleanCtx, buildSandboxID, "stopped", nil)
- }
- log.Printf("image-builder: destroyed build sandbox %s", buildSandboxID)
+ go func() {
+ time.Sleep(30 * time.Second) // give forks time to copy from cache
+ cleanCtx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
+ defer cancel()
+ if grpcClient != nil {
+ _, _ = grpcClient.DestroySandbox(cleanCtx, &pb.DestroySandboxRequest{SandboxId: buildSandboxID})
+ } else if s.manager != nil {
+ _ = s.manager.Kill(cleanCtx, buildSandboxID)
+ }
+ if s.store != nil {
+ _ = s.store.UpdateSandboxSessionStatus(cleanCtx, buildSandboxID, "stopped", nil)
+ }
+ log.Printf("image-builder: destroyed build sandbox %s (delayed)", buildSandboxID)
+ }()
}()
// Record session in PG (so worker can find it)
diff --git a/internal/api/router.go b/internal/api/router.go
index 1bfbc1e4..84f886e9 100644
--- a/internal/api/router.go
+++ b/internal/api/router.go
@@ -157,6 +157,7 @@ func NewServer(mgr sandbox.Manager, ptyMgr *sandbox.PTYManager, apiKey string, o
// Resource limits
api.PUT("/sandboxes/:id/limits", s.setLimits)
+ api.POST("/sandboxes/:id/scale", s.scaleSandbox)
// Checkpoints
api.POST("/sandboxes/:id/checkpoints", s.createCheckpoint)
diff --git a/internal/api/sandbox.go b/internal/api/sandbox.go
index 55c4e175..f4fb74e2 100644
--- a/internal/api/sandbox.go
+++ b/internal/api/sandbox.go
@@ -651,6 +651,43 @@ func (s *Server) setLimits(c echo.Context) error {
})
}
+// scaleSandbox is a simplified scaling endpoint: POST /sandboxes/:id/scale
+// Accepts {"memory_mb": 2048} and auto-calculates CPU (1 vCPU per 1GB).
+func (s *Server) scaleSandbox(c echo.Context) error {
+ id := c.Param("id")
+
+ var req struct {
+ MemoryMB int `json:"memory_mb"`
+ }
+ if err := c.Bind(&req); err != nil || req.MemoryMB <= 0 {
+ return c.JSON(http.StatusBadRequest, map[string]string{"error": "memory_mb is required and must be positive"})
+ }
+
+ // Auto-calculate: 1 vCPU per 1GB = 100% CPU per 1024MB
+ cpuPercent := (req.MemoryMB * 100) / 1024
+ if cpuPercent < 100 {
+ cpuPercent = 100
+ }
+ maxMemoryBytes := int64(req.MemoryMB) * 1024 * 1024
+ cpuMaxUsec := int64(cpuPercent) * 1000
+ cpuPeriodUsec := int64(100000)
+
+ if s.workerRegistry != nil {
+ return s.setLimitsRemote(c, id, 0, maxMemoryBytes, cpuMaxUsec, cpuPeriodUsec)
+ }
+ if s.manager == nil {
+ return c.JSON(http.StatusServiceUnavailable, errSandboxNotAvailable)
+ }
+ if err := s.manager.SetResourceLimits(c.Request().Context(), id, 0, maxMemoryBytes, cpuMaxUsec, cpuPeriodUsec); err != nil {
+ return c.JSON(http.StatusInternalServerError, map[string]string{"error": err.Error()})
+ }
+ return c.JSON(http.StatusOK, map[string]interface{}{
+ "sandboxID": id,
+ "memoryMB": req.MemoryMB,
+ "cpuPercent": cpuPercent,
+ })
+}
+
func (s *Server) setLimitsRemote(c echo.Context, sandboxID string, maxPids int32, maxMemoryBytes, cpuMaxUsec, cpuPeriodUsec int64) error {
if s.store == nil {
return c.JSON(http.StatusServiceUnavailable, map[string]string{
diff --git a/internal/qemu/agent_client.go b/internal/qemu/agent_client.go
index f30234dd..bcc7329c 100644
--- a/internal/qemu/agent_client.go
+++ b/internal/qemu/agent_client.go
@@ -320,6 +320,11 @@ func (c *AgentClient) ExecSessionKill(ctx context.Context, sessionID string, sig
return err
}
+// PTYAttach opens a bidirectional gRPC stream for PTY I/O.
+func (c *AgentClient) PTYAttach(ctx context.Context) (pb.SandboxAgent_PTYAttachClient, error) {
+ return c.client.PTYAttach(ctx)
+}
+
// ConnectPTYData connects to the PTY data stream on the given vsock port.
// Uses AF_VSOCK directly instead of Firecracker's UDS protocol.
func (c *AgentClient) ConnectPTYData(guestCID uint32, dataPort uint32) (net.Conn, error) {
diff --git a/internal/qemu/manager.go b/internal/qemu/manager.go
index abc1f438..b18aae7b 100644
--- a/internal/qemu/manager.go
+++ b/internal/qemu/manager.go
@@ -1547,9 +1547,11 @@ func (m *Manager) TemplateCachePath(templateID, filename string) string {
return ""
}
-// checkpointCacheDir returns the local cache directory for a checkpoint.
+// checkpointCacheDir returns the local cache directory for a checkpoint's qcow2 files.
+// Uses "checkpoint-snapshots/" (not "checkpoints/") to avoid collision with the S3
+// checkpoint cache which stores tar.zst files in the "checkpoints/" directory.
func (m *Manager) checkpointCacheDir(checkpointID string) string {
- return filepath.Join(m.cfg.DataDir, "checkpoints", checkpointID)
+ return filepath.Join(m.cfg.DataDir, "checkpoint-snapshots", checkpointID)
}
// CheckpointCachePath returns the path to a specific file in the checkpoint cache.
@@ -1576,15 +1578,15 @@ func (m *Manager) CreateCheckpoint(ctx context.Context, sandboxID, checkpointID
return "", "", fmt.Errorf("no QMP client for VM %s", sandboxID)
}
- // Sync filesystem and close agent before snapshot. Closing the agent
- // puts it in Accept() mode — when ForkFromCheckpoint restores from this
- // checkpoint, the agent immediately accepts the new connection (~1ms)
- // instead of waiting for the stale gRPC stream to time out (~6s).
+ // Sync filesystem and quiesce agent before snapshot.
+ // SIGUSR1 resets the virtio-serial listener's active flag so that
+ // restores from this checkpoint (loadvm or fork) have a clean agent
+ // that immediately accepts the new host-side connection.
if vm.agent != nil {
syncCtx, cancel := context.WithTimeout(ctx, 10*time.Second)
_, syncErr := vm.agent.Exec(syncCtx, &pb.ExecRequest{
Command: "/bin/sh",
- Args: []string{"-c", "umount /workspace 2>/dev/null; sync"},
+ Args: []string{"-c", "umount /workspace 2>/dev/null; sync; kill -USR1 1"},
})
cancel()
if syncErr != nil {
@@ -1592,6 +1594,7 @@ func (m *Manager) CreateCheckpoint(ctx context.Context, sandboxID, checkpointID
}
vm.agent.Close()
vm.agent = nil
+ time.Sleep(500 * time.Millisecond) // let guest process SIGUSR1
}
// savevm creates an internal snapshot — memory + device state + disk deltas
@@ -1616,20 +1619,16 @@ func (m *Manager) CreateCheckpoint(ctx context.Context, sandboxID, checkpointID
mountCancel()
}
- // Also cache the drive files for ForkFromCheckpoint (which needs a separate QEMU process)
+ // Cache the drive files for ForkFromCheckpoint (which needs a separate QEMU process).
+ // Synchronous: reflink copy is instant (~1ms), and the image builder destroys the
+ // build sandbox immediately after checkpoint — async would race with destruction.
cacheDir := m.checkpointCacheDir(checkpointID)
rootfsKey = fmt.Sprintf("checkpoints/%s/%s/rootfs.tar.zst", sandboxID, checkpointID)
workspaceKey = fmt.Sprintf("checkpoints/%s/%s/workspace.tar.zst", sandboxID, checkpointID)
- go func() {
- if err := os.MkdirAll(filepath.Join(cacheDir, "snapshot"), 0755); err != nil {
- log.Printf("qemu: checkpoint %s: mkdir cache failed: %v", checkpointID, err)
- if onReady != nil {
- onReady()
- }
- return
- }
-
+ if mkErr := os.MkdirAll(filepath.Join(cacheDir, "snapshot"), 0755); mkErr != nil {
+ log.Printf("qemu: checkpoint %s: mkdir cache failed: %v", checkpointID, mkErr)
+ } else {
// Copy qcow2 drives (they contain the snapshot data)
srcRootfs := filepath.Join(vm.sandboxDir, "rootfs.qcow2")
srcWorkspace := filepath.Join(vm.sandboxDir, "workspace.qcow2")
@@ -1654,10 +1653,10 @@ func (m *Manager) CreateCheckpoint(ctx context.Context, sandboxID, checkpointID
_ = os.WriteFile(filepath.Join(cacheDir, "snapshot-name"), []byte(snapshotName), 0644)
log.Printf("qemu: checkpoint %s: cache saved (%dms)", checkpointID, time.Since(t0).Milliseconds())
- if onReady != nil {
- onReady()
- }
- }()
+ }
+ if onReady != nil {
+ onReady()
+ }
return rootfsKey, workspaceKey, nil
}
@@ -1678,14 +1677,11 @@ func (m *Manager) RestoreFromCheckpoint(ctx context.Context, sandboxID, checkpoi
snapshotName := "cp-" + checkpointID
- // Close agent before loadvm (vsock state will revert)
+ // Close agent before loadvm — the checkpoint was created with the agent
+ // in a quiesced state (SIGUSR1 sent during CreateCheckpoint), so after
+ // loadvm the restored agent will immediately accept a new connection.
if vm.agent != nil {
- closeDone := make(chan struct{})
- go func() { vm.agent.Close(); close(closeDone) }()
- select {
- case <-closeDone:
- case <-time.After(2 * time.Second):
- }
+ vm.agent.Close()
vm.agent = nil
}
diff --git a/internal/worker/grpc_server.go b/internal/worker/grpc_server.go
index 6bc16da2..e62237cf 100644
--- a/internal/worker/grpc_server.go
+++ b/internal/worker/grpc_server.go
@@ -594,48 +594,12 @@ func (s *GRPCServer) CreateCheckpoint(ctx context.Context, req *pb.CreateCheckpo
}, nil
}
+// RestoreCheckpoint reverts a running sandbox to a checkpoint using QEMU's loadvm.
+// The snapshot is already stored inside the qcow2 files — no S3 download needed.
func (s *GRPCServer) RestoreCheckpoint(ctx context.Context, req *pb.RestoreCheckpointRequest) (*pb.RestoreCheckpointResponse, error) {
- checkpointID := req.CheckpointId
- if _, err := uuid.Parse(checkpointID); err != nil {
- return nil, fmt.Errorf("invalid checkpoint ID: %w", err)
+ if err := s.manager.RestoreFromCheckpoint(ctx, req.SandboxId, req.CheckpointId); err != nil {
+ return nil, fmt.Errorf("restore checkpoint: %w", err)
}
-
- // Check local cache first; if not available, download from S3
- cachedRootfs := s.manager.CheckpointCachePath(checkpointID, "rootfs.ext4")
- cachedWorkspace := s.manager.CheckpointCachePath(checkpointID, "workspace.ext4")
- if cachedRootfs == "" || cachedWorkspace == "" {
- // Need to download from S3
- if s.checkpointStore == nil {
- return nil, fmt.Errorf("checkpoint not cached locally and no S3 store configured")
- }
- log.Printf("grpc: RestoreCheckpoint %s: not cached locally, downloading from S3", checkpointID)
- rootfsKey := fmt.Sprintf("checkpoints/%s/%s/rootfs.tar.zst", req.SandboxId, checkpointID)
- workspaceKey := fmt.Sprintf("checkpoints/%s/%s/workspace.sparse.zst", req.SandboxId, checkpointID)
-
- cacheDir := filepath.Join(s.manager.DataDir(), "checkpoints", checkpointID)
- if err := os.MkdirAll(cacheDir, 0755); err != nil {
- return nil, fmt.Errorf("create checkpoint cache dir: %w", err)
- }
-
- cachedRootfsPath := filepath.Join(cacheDir, "rootfs.ext4")
- cachedWorkspacePath := filepath.Join(cacheDir, "workspace.ext4")
-
- if err := downloadAndExtract(ctx, s.checkpointStore, rootfsKey, cacheDir, extractArchiveCmd); err != nil {
- os.RemoveAll(cacheDir)
- return nil, fmt.Errorf("download checkpoint rootfs: %w", err)
- }
- if err := downloadAndExtract(ctx, s.checkpointStore, workspaceKey, cachedWorkspacePath, extractSparseCmd); err != nil {
- os.RemoveAll(cacheDir)
- return nil, fmt.Errorf("download checkpoint workspace: %w", err)
- }
- log.Printf("grpc: RestoreCheckpoint %s: cached locally at %s", checkpointID, cacheDir)
- _ = cachedRootfsPath // used implicitly by manager.CheckpointCachePath after download
- }
-
- if err := s.manager.RestoreFromCheckpoint(ctx, req.SandboxId, checkpointID); err != nil {
- return nil, fmt.Errorf("restore from checkpoint failed: %w", err)
- }
-
return &pb.RestoreCheckpointResponse{Success: true}, nil
}
diff --git a/proto/agent/agent.pb.go b/proto/agent/agent.pb.go
index 565f9f6e..6d17cf52 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{33, 0}
}
type ExecRequest struct {
@@ -1519,6 +1519,136 @@ func (*PTYKillResponse) Descriptor() ([]byte, []int) {
return file_proto_agent_agent_proto_rawDescGZIP(), []int{27}
}
+// PTYInput is a client→agent message for the PTYAttach bidi stream.
+type PTYInput struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ SessionId string `protobuf:"bytes,1,opt,name=session_id,json=sessionId,proto3" json:"session_id,omitempty"` // required on first message to identify the session
+ Stdin []byte `protobuf:"bytes,2,opt,name=stdin,proto3" json:"stdin,omitempty"` // raw bytes to write to the PTY
+ Cols int32 `protobuf:"varint,3,opt,name=cols,proto3" json:"cols,omitempty"` // if > 0, resize the PTY
+ Rows int32 `protobuf:"varint,4,opt,name=rows,proto3" json:"rows,omitempty"` // if > 0, resize the PTY
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *PTYInput) Reset() {
+ *x = PTYInput{}
+ mi := &file_proto_agent_agent_proto_msgTypes[28]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *PTYInput) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PTYInput) ProtoMessage() {}
+
+func (x *PTYInput) ProtoReflect() protoreflect.Message {
+ mi := &file_proto_agent_agent_proto_msgTypes[28]
+ 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 PTYInput.ProtoReflect.Descriptor instead.
+func (*PTYInput) Descriptor() ([]byte, []int) {
+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{28}
+}
+
+func (x *PTYInput) GetSessionId() string {
+ if x != nil {
+ return x.SessionId
+ }
+ return ""
+}
+
+func (x *PTYInput) GetStdin() []byte {
+ if x != nil {
+ return x.Stdin
+ }
+ return nil
+}
+
+func (x *PTYInput) GetCols() int32 {
+ if x != nil {
+ return x.Cols
+ }
+ return 0
+}
+
+func (x *PTYInput) GetRows() int32 {
+ if x != nil {
+ return x.Rows
+ }
+ return 0
+}
+
+// PTYOutput is an agent→client message for the PTYAttach bidi stream.
+type PTYOutput struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` // raw bytes read from the PTY
+ Exited bool `protobuf:"varint,2,opt,name=exited,proto3" json:"exited,omitempty"` // true when the PTY process has exited
+ ExitCode int32 `protobuf:"varint,3,opt,name=exit_code,json=exitCode,proto3" json:"exit_code,omitempty"` // only valid when exited = true
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *PTYOutput) Reset() {
+ *x = PTYOutput{}
+ mi := &file_proto_agent_agent_proto_msgTypes[29]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *PTYOutput) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PTYOutput) ProtoMessage() {}
+
+func (x *PTYOutput) ProtoReflect() protoreflect.Message {
+ mi := &file_proto_agent_agent_proto_msgTypes[29]
+ 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 PTYOutput.ProtoReflect.Descriptor instead.
+func (*PTYOutput) Descriptor() ([]byte, []int) {
+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{29}
+}
+
+func (x *PTYOutput) GetData() []byte {
+ if x != nil {
+ return x.Data
+ }
+ return nil
+}
+
+func (x *PTYOutput) GetExited() bool {
+ if x != nil {
+ return x.Exited
+ }
+ return false
+}
+
+func (x *PTYOutput) GetExitCode() int32 {
+ if x != nil {
+ return x.ExitCode
+ }
+ return 0
+}
+
type ExecSessionCreateRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
Command string `protobuf:"bytes,1,opt,name=command,proto3" json:"command,omitempty"`
@@ -1534,7 +1664,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[30]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1546,7 +1676,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[30]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1559,7 +1689,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{30}
}
func (x *ExecSessionCreateRequest) GetCommand() string {
@@ -1620,7 +1750,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[31]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1632,7 +1762,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[31]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1645,7 +1775,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{31}
}
func (x *ExecSessionCreateResponse) GetSessionId() string {
@@ -1665,7 +1795,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[32]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1677,7 +1807,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[32]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1690,7 +1820,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{32}
}
func (x *ExecSessionInput) GetSessionId() string {
@@ -1718,7 +1848,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[33]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1730,7 +1860,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[33]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1743,7 +1873,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{33}
}
func (x *ExecSessionOutput) GetType() ExecSessionOutput_Type {
@@ -1775,7 +1905,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[34]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1787,7 +1917,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[34]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1800,7 +1930,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{34}
}
type ExecSessionListResponse struct {
@@ -1812,7 +1942,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[35]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1824,7 +1954,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[35]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1837,7 +1967,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{35}
}
func (x *ExecSessionListResponse) GetSessions() []*ExecSessionInfo {
@@ -1862,7 +1992,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[36]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1874,7 +2004,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[36]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1887,7 +2017,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{36}
}
func (x *ExecSessionInfo) GetSessionId() string {
@@ -1949,7 +2079,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[37]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1961,7 +2091,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[37]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1974,7 +2104,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{37}
}
func (x *ExecSessionKillRequest) GetSessionId() string {
@@ -1999,7 +2129,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[38]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2011,7 +2141,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[38]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2024,7 +2154,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{38}
}
type SetEnvsRequest struct {
@@ -2036,7 +2166,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[39]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2048,7 +2178,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[39]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2061,7 +2191,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{39}
}
func (x *SetEnvsRequest) GetEnvs() map[string]string {
@@ -2079,7 +2209,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[40]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2091,7 +2221,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[40]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2104,7 +2234,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{40}
}
type ShutdownRequest struct {
@@ -2115,7 +2245,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[41]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2127,7 +2257,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[41]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2140,7 +2270,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{41}
}
type ShutdownResponse struct {
@@ -2151,7 +2281,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[42]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2163,7 +2293,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[42]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2176,7 +2306,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{42}
}
type SyncFSRequest struct {
@@ -2187,7 +2317,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[43]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2199,7 +2329,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[43]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2212,7 +2342,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{43}
}
type SyncFSResponse struct {
@@ -2223,7 +2353,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[44]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2235,7 +2365,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[44]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2248,7 +2378,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{44}
}
type SetResourceLimitsRequest struct {
@@ -2263,7 +2393,7 @@ type SetResourceLimitsRequest struct {
func (x *SetResourceLimitsRequest) Reset() {
*x = SetResourceLimitsRequest{}
- mi := &file_proto_agent_agent_proto_msgTypes[43]
+ mi := &file_proto_agent_agent_proto_msgTypes[45]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2275,7 +2405,7 @@ func (x *SetResourceLimitsRequest) String() string {
func (*SetResourceLimitsRequest) ProtoMessage() {}
func (x *SetResourceLimitsRequest) ProtoReflect() protoreflect.Message {
- mi := &file_proto_agent_agent_proto_msgTypes[43]
+ mi := &file_proto_agent_agent_proto_msgTypes[45]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2288,7 +2418,7 @@ func (x *SetResourceLimitsRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use SetResourceLimitsRequest.ProtoReflect.Descriptor instead.
func (*SetResourceLimitsRequest) Descriptor() ([]byte, []int) {
- return file_proto_agent_agent_proto_rawDescGZIP(), []int{43}
+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{45}
}
func (x *SetResourceLimitsRequest) GetMaxPids() int32 {
@@ -2327,7 +2457,7 @@ type SetResourceLimitsResponse struct {
func (x *SetResourceLimitsResponse) Reset() {
*x = SetResourceLimitsResponse{}
- mi := &file_proto_agent_agent_proto_msgTypes[44]
+ mi := &file_proto_agent_agent_proto_msgTypes[46]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -2339,7 +2469,7 @@ func (x *SetResourceLimitsResponse) String() string {
func (*SetResourceLimitsResponse) ProtoMessage() {}
func (x *SetResourceLimitsResponse) ProtoReflect() protoreflect.Message {
- mi := &file_proto_agent_agent_proto_msgTypes[44]
+ mi := &file_proto_agent_agent_proto_msgTypes[46]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -2352,7 +2482,7 @@ func (x *SetResourceLimitsResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use SetResourceLimitsResponse.ProtoReflect.Descriptor instead.
func (*SetResourceLimitsResponse) Descriptor() ([]byte, []int) {
- return file_proto_agent_agent_proto_rawDescGZIP(), []int{44}
+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{46}
}
var File_proto_agent_agent_proto protoreflect.FileDescriptor
@@ -2449,7 +2579,17 @@ const file_proto_agent_agent_proto_rawDesc = "" +
"\x0ePTYKillRequest\x12\x1d\n" +
"\n" +
"session_id\x18\x01 \x01(\tR\tsessionId\"\x11\n" +
- "\x0fPTYKillResponse\"\xe6\x02\n" +
+ "\x0fPTYKillResponse\"g\n" +
+ "\bPTYInput\x12\x1d\n" +
+ "\n" +
+ "session_id\x18\x01 \x01(\tR\tsessionId\x12\x14\n" +
+ "\x05stdin\x18\x02 \x01(\fR\x05stdin\x12\x12\n" +
+ "\x04cols\x18\x03 \x01(\x05R\x04cols\x12\x12\n" +
+ "\x04rows\x18\x04 \x01(\x05R\x04rows\"T\n" +
+ "\tPTYOutput\x12\x12\n" +
+ "\x04data\x18\x01 \x01(\fR\x04data\x12\x16\n" +
+ "\x06exited\x18\x02 \x01(\bR\x06exited\x12\x1b\n" +
+ "\texit_code\x18\x03 \x01(\x05R\bexitCode\"\xe6\x02\n" +
"\x18ExecSessionCreateRequest\x12\x18\n" +
"\acommand\x18\x01 \x01(\tR\acommand\x12\x12\n" +
"\x04args\x18\x02 \x03(\tR\x04args\x12=\n" +
@@ -2513,8 +2653,7 @@ const file_proto_agent_agent_proto_rawDesc = "" +
"\fcpu_max_usec\x18\x03 \x01(\x03R\n" +
"cpuMaxUsec\x12&\n" +
"\x0fcpu_period_usec\x18\x04 \x01(\x03R\rcpuPeriodUsec\"\x1b\n" +
- "\x19SetResourceLimitsResponse2\xf8\n" +
- "\n" +
+ "\x19SetResourceLimitsResponse2\xac\v\n" +
"\fSandboxAgent\x12/\n" +
"\x04Exec\x12\x12.agent.ExecRequest\x1a\x13.agent.ExecResponse\x12:\n" +
"\n" +
@@ -2530,7 +2669,8 @@ const file_proto_agent_agent_proto_rawDesc = "" +
"\x04Ping\x12\x12.agent.PingRequest\x1a\x13.agent.PingResponse\x12>\n" +
"\tPTYCreate\x12\x17.agent.PTYCreateRequest\x1a\x18.agent.PTYCreateResponse\x12>\n" +
"\tPTYResize\x12\x17.agent.PTYResizeRequest\x1a\x18.agent.PTYResizeResponse\x128\n" +
- "\aPTYKill\x12\x15.agent.PTYKillRequest\x1a\x16.agent.PTYKillResponse\x12V\n" +
+ "\aPTYKill\x12\x15.agent.PTYKillRequest\x1a\x16.agent.PTYKillResponse\x122\n" +
+ "\tPTYAttach\x12\x0f.agent.PTYInput\x1a\x10.agent.PTYOutput(\x010\x01\x12V\n" +
"\x11ExecSessionCreate\x12\x1f.agent.ExecSessionCreateRequest\x1a .agent.ExecSessionCreateResponse\x12J\n" +
"\x11ExecSessionAttach\x12\x17.agent.ExecSessionInput\x1a\x18.agent.ExecSessionOutput(\x010\x01\x12P\n" +
"\x0fExecSessionList\x12\x1d.agent.ExecSessionListRequest\x1a\x1e.agent.ExecSessionListResponse\x12P\n" +
@@ -2553,7 +2693,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, 48)
+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
@@ -2585,35 +2725,37 @@ var file_proto_agent_agent_proto_goTypes = []any{
(*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
- (*SetResourceLimitsRequest)(nil), // 45: agent.SetResourceLimitsRequest
- (*SetResourceLimitsResponse)(nil), // 46: agent.SetResourceLimitsResponse
- nil, // 47: agent.ExecRequest.EnvsEntry
- nil, // 48: agent.ExecSessionCreateRequest.EnvsEntry
- nil, // 49: agent.SetEnvsRequest.EnvsEntry
+ (*PTYInput)(nil), // 30: agent.PTYInput
+ (*PTYOutput)(nil), // 31: agent.PTYOutput
+ (*ExecSessionCreateRequest)(nil), // 32: agent.ExecSessionCreateRequest
+ (*ExecSessionCreateResponse)(nil), // 33: agent.ExecSessionCreateResponse
+ (*ExecSessionInput)(nil), // 34: agent.ExecSessionInput
+ (*ExecSessionOutput)(nil), // 35: agent.ExecSessionOutput
+ (*ExecSessionListRequest)(nil), // 36: agent.ExecSessionListRequest
+ (*ExecSessionListResponse)(nil), // 37: agent.ExecSessionListResponse
+ (*ExecSessionInfo)(nil), // 38: agent.ExecSessionInfo
+ (*ExecSessionKillRequest)(nil), // 39: agent.ExecSessionKillRequest
+ (*ExecSessionKillResponse)(nil), // 40: agent.ExecSessionKillResponse
+ (*SetEnvsRequest)(nil), // 41: agent.SetEnvsRequest
+ (*SetEnvsResponse)(nil), // 42: agent.SetEnvsResponse
+ (*ShutdownRequest)(nil), // 43: agent.ShutdownRequest
+ (*ShutdownResponse)(nil), // 44: agent.ShutdownResponse
+ (*SyncFSRequest)(nil), // 45: agent.SyncFSRequest
+ (*SyncFSResponse)(nil), // 46: agent.SyncFSResponse
+ (*SetResourceLimitsRequest)(nil), // 47: agent.SetResourceLimitsRequest
+ (*SetResourceLimitsResponse)(nil), // 48: agent.SetResourceLimitsResponse
+ nil, // 49: agent.ExecRequest.EnvsEntry
+ nil, // 50: agent.ExecSessionCreateRequest.EnvsEntry
+ nil, // 51: agent.SetEnvsRequest.EnvsEntry
}
var file_proto_agent_agent_proto_depIdxs = []int32{
- 47, // 0: agent.ExecRequest.envs:type_name -> agent.ExecRequest.EnvsEntry
+ 49, // 0: agent.ExecRequest.envs:type_name -> agent.ExecRequest.EnvsEntry
0, // 1: agent.ExecOutputChunk.stream:type_name -> agent.ExecOutputChunk.Stream
10, // 2: agent.ListDirResponse.entries:type_name -> agent.DirEntry
- 48, // 3: agent.ExecSessionCreateRequest.envs:type_name -> agent.ExecSessionCreateRequest.EnvsEntry
+ 50, // 3: agent.ExecSessionCreateRequest.envs:type_name -> agent.ExecSessionCreateRequest.EnvsEntry
1, // 4: agent.ExecSessionOutput.type:type_name -> agent.ExecSessionOutput.Type
- 36, // 5: agent.ExecSessionListResponse.sessions:type_name -> agent.ExecSessionInfo
- 49, // 6: agent.SetEnvsRequest.envs:type_name -> agent.SetEnvsRequest.EnvsEntry
+ 38, // 5: agent.ExecSessionListResponse.sessions:type_name -> agent.ExecSessionInfo
+ 51, // 6: agent.SetEnvsRequest.envs:type_name -> agent.SetEnvsRequest.EnvsEntry
2, // 7: agent.SandboxAgent.Exec:input_type -> agent.ExecRequest
2, // 8: agent.SandboxAgent.ExecStream:input_type -> agent.ExecRequest
5, // 9: agent.SandboxAgent.ReadFile:input_type -> agent.ReadFileRequest
@@ -2628,38 +2770,40 @@ var file_proto_agent_agent_proto_depIdxs = []int32{
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
- 45, // 28: agent.SandboxAgent.SetResourceLimits:input_type -> agent.SetResourceLimitsRequest
- 3, // 29: agent.SandboxAgent.Exec:output_type -> agent.ExecResponse
- 4, // 30: agent.SandboxAgent.ExecStream:output_type -> agent.ExecOutputChunk
- 6, // 31: agent.SandboxAgent.ReadFile:output_type -> agent.ReadFileResponse
- 8, // 32: agent.SandboxAgent.WriteFile:output_type -> agent.WriteFileResponse
- 11, // 33: agent.SandboxAgent.ListDir:output_type -> agent.ListDirResponse
- 13, // 34: agent.SandboxAgent.MakeDir:output_type -> agent.MakeDirResponse
- 15, // 35: agent.SandboxAgent.Remove:output_type -> agent.RemoveResponse
- 17, // 36: agent.SandboxAgent.Exists:output_type -> agent.ExistsResponse
- 19, // 37: agent.SandboxAgent.Stat:output_type -> agent.StatResponse
- 21, // 38: agent.SandboxAgent.Stats:output_type -> agent.StatsResponse
- 23, // 39: agent.SandboxAgent.Ping:output_type -> agent.PingResponse
- 25, // 40: agent.SandboxAgent.PTYCreate:output_type -> agent.PTYCreateResponse
- 27, // 41: agent.SandboxAgent.PTYResize:output_type -> agent.PTYResizeResponse
- 29, // 42: agent.SandboxAgent.PTYKill:output_type -> agent.PTYKillResponse
- 31, // 43: agent.SandboxAgent.ExecSessionCreate:output_type -> agent.ExecSessionCreateResponse
- 33, // 44: agent.SandboxAgent.ExecSessionAttach:output_type -> agent.ExecSessionOutput
- 35, // 45: agent.SandboxAgent.ExecSessionList:output_type -> agent.ExecSessionListResponse
- 38, // 46: agent.SandboxAgent.ExecSessionKill:output_type -> agent.ExecSessionKillResponse
- 40, // 47: agent.SandboxAgent.SetEnvs:output_type -> agent.SetEnvsResponse
- 42, // 48: agent.SandboxAgent.Shutdown:output_type -> agent.ShutdownResponse
- 44, // 49: agent.SandboxAgent.SyncFS:output_type -> agent.SyncFSResponse
- 46, // 50: agent.SandboxAgent.SetResourceLimits:output_type -> agent.SetResourceLimitsResponse
- 29, // [29:51] is the sub-list for method output_type
- 7, // [7:29] is the sub-list for method input_type
+ 30, // 21: agent.SandboxAgent.PTYAttach:input_type -> agent.PTYInput
+ 32, // 22: agent.SandboxAgent.ExecSessionCreate:input_type -> agent.ExecSessionCreateRequest
+ 34, // 23: agent.SandboxAgent.ExecSessionAttach:input_type -> agent.ExecSessionInput
+ 36, // 24: agent.SandboxAgent.ExecSessionList:input_type -> agent.ExecSessionListRequest
+ 39, // 25: agent.SandboxAgent.ExecSessionKill:input_type -> agent.ExecSessionKillRequest
+ 41, // 26: agent.SandboxAgent.SetEnvs:input_type -> agent.SetEnvsRequest
+ 43, // 27: agent.SandboxAgent.Shutdown:input_type -> agent.ShutdownRequest
+ 45, // 28: agent.SandboxAgent.SyncFS:input_type -> agent.SyncFSRequest
+ 47, // 29: agent.SandboxAgent.SetResourceLimits:input_type -> agent.SetResourceLimitsRequest
+ 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
+ 11, // 34: agent.SandboxAgent.ListDir:output_type -> agent.ListDirResponse
+ 13, // 35: agent.SandboxAgent.MakeDir:output_type -> agent.MakeDirResponse
+ 15, // 36: agent.SandboxAgent.Remove:output_type -> agent.RemoveResponse
+ 17, // 37: agent.SandboxAgent.Exists:output_type -> agent.ExistsResponse
+ 19, // 38: agent.SandboxAgent.Stat:output_type -> agent.StatResponse
+ 21, // 39: agent.SandboxAgent.Stats:output_type -> agent.StatsResponse
+ 23, // 40: agent.SandboxAgent.Ping:output_type -> agent.PingResponse
+ 25, // 41: agent.SandboxAgent.PTYCreate:output_type -> agent.PTYCreateResponse
+ 27, // 42: agent.SandboxAgent.PTYResize:output_type -> agent.PTYResizeResponse
+ 29, // 43: agent.SandboxAgent.PTYKill:output_type -> agent.PTYKillResponse
+ 31, // 44: agent.SandboxAgent.PTYAttach:output_type -> agent.PTYOutput
+ 33, // 45: agent.SandboxAgent.ExecSessionCreate:output_type -> agent.ExecSessionCreateResponse
+ 35, // 46: agent.SandboxAgent.ExecSessionAttach:output_type -> agent.ExecSessionOutput
+ 37, // 47: agent.SandboxAgent.ExecSessionList:output_type -> agent.ExecSessionListResponse
+ 40, // 48: agent.SandboxAgent.ExecSessionKill:output_type -> agent.ExecSessionKillResponse
+ 42, // 49: agent.SandboxAgent.SetEnvs:output_type -> agent.SetEnvsResponse
+ 44, // 50: agent.SandboxAgent.Shutdown:output_type -> agent.ShutdownResponse
+ 46, // 51: agent.SandboxAgent.SyncFS:output_type -> agent.SyncFSResponse
+ 48, // 52: agent.SandboxAgent.SetResourceLimits:output_type -> agent.SetResourceLimitsResponse
+ 30, // [30:53] is the sub-list for method output_type
+ 7, // [7:30] is the sub-list for method input_type
7, // [7:7] is the sub-list for extension type_name
7, // [7:7] is the sub-list for extension extendee
0, // [0:7] is the sub-list for field type_name
@@ -2676,7 +2820,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: 48,
+ NumMessages: 50,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/proto/agent/agent.proto b/proto/agent/agent.proto
index ee4f66d4..0b986d92 100644
--- a/proto/agent/agent.proto
+++ b/proto/agent/agent.proto
@@ -33,6 +33,10 @@ service SandboxAgent {
rpc PTYResize(PTYResizeRequest) returns (PTYResizeResponse);
rpc PTYKill(PTYKillRequest) returns (PTYKillResponse);
+ // PTYAttach opens a bidirectional stream for PTY I/O over gRPC.
+ // Used by QEMU backend (virtio-serial) where vsock data ports are unavailable.
+ rpc PTYAttach(stream PTYInput) returns (stream PTYOutput);
+
// Exec sessions — persistent command execution with scrollback and reconnect.
rpc ExecSessionCreate(ExecSessionCreateRequest) returns (ExecSessionCreateResponse);
rpc ExecSessionAttach(stream ExecSessionInput) returns (stream ExecSessionOutput);
@@ -196,6 +200,21 @@ message PTYKillRequest {
message PTYKillResponse {}
+// PTYInput is a client→agent message for the PTYAttach bidi stream.
+message PTYInput {
+ string session_id = 1; // required on first message to identify the session
+ bytes stdin = 2; // raw bytes to write to the PTY
+ int32 cols = 3; // if > 0, resize the PTY
+ int32 rows = 4; // if > 0, resize the PTY
+}
+
+// PTYOutput is an agent→client message for the PTYAttach bidi stream.
+message PTYOutput {
+ bytes data = 1; // raw bytes read from the PTY
+ bool exited = 2; // true when the PTY process has exited
+ int32 exit_code = 3; // only valid when exited = true
+}
+
// --- Exec Sessions ---
message ExecSessionCreateRequest {
diff --git a/proto/agent/agent_grpc.pb.go b/proto/agent/agent_grpc.pb.go
index 75f9493b..dfaad397 100644
--- a/proto/agent/agent_grpc.pb.go
+++ b/proto/agent/agent_grpc.pb.go
@@ -33,6 +33,7 @@ const (
SandboxAgent_PTYCreate_FullMethodName = "/agent.SandboxAgent/PTYCreate"
SandboxAgent_PTYResize_FullMethodName = "/agent.SandboxAgent/PTYResize"
SandboxAgent_PTYKill_FullMethodName = "/agent.SandboxAgent/PTYKill"
+ SandboxAgent_PTYAttach_FullMethodName = "/agent.SandboxAgent/PTYAttach"
SandboxAgent_ExecSessionCreate_FullMethodName = "/agent.SandboxAgent/ExecSessionCreate"
SandboxAgent_ExecSessionAttach_FullMethodName = "/agent.SandboxAgent/ExecSessionAttach"
SandboxAgent_ExecSessionList_FullMethodName = "/agent.SandboxAgent/ExecSessionList"
@@ -70,6 +71,9 @@ type SandboxAgentClient interface {
PTYCreate(ctx context.Context, in *PTYCreateRequest, opts ...grpc.CallOption) (*PTYCreateResponse, error)
PTYResize(ctx context.Context, in *PTYResizeRequest, opts ...grpc.CallOption) (*PTYResizeResponse, error)
PTYKill(ctx context.Context, in *PTYKillRequest, opts ...grpc.CallOption) (*PTYKillResponse, error)
+ // PTYAttach opens a bidirectional stream for PTY I/O over gRPC.
+ // Used by QEMU backend (virtio-serial) where vsock data ports are unavailable.
+ PTYAttach(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[PTYInput, PTYOutput], error)
// Exec sessions — persistent command execution with scrollback and reconnect.
ExecSessionCreate(ctx context.Context, in *ExecSessionCreateRequest, opts ...grpc.CallOption) (*ExecSessionCreateResponse, error)
ExecSessionAttach(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[ExecSessionInput, ExecSessionOutput], error)
@@ -246,6 +250,19 @@ func (c *sandboxAgentClient) PTYKill(ctx context.Context, in *PTYKillRequest, op
return out, nil
}
+func (c *sandboxAgentClient) PTYAttach(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[PTYInput, PTYOutput], error) {
+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
+ stream, err := c.cc.NewStream(ctx, &SandboxAgent_ServiceDesc.Streams[1], SandboxAgent_PTYAttach_FullMethodName, cOpts...)
+ if err != nil {
+ return nil, err
+ }
+ x := &grpc.GenericClientStream[PTYInput, PTYOutput]{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_PTYAttachClient = grpc.BidiStreamingClient[PTYInput, PTYOutput]
+
func (c *sandboxAgentClient) ExecSessionCreate(ctx context.Context, in *ExecSessionCreateRequest, opts ...grpc.CallOption) (*ExecSessionCreateResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ExecSessionCreateResponse)
@@ -258,7 +275,7 @@ func (c *sandboxAgentClient) ExecSessionCreate(ctx context.Context, in *ExecSess
func (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[2], SandboxAgent_ExecSessionAttach_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
@@ -356,6 +373,9 @@ type SandboxAgentServer interface {
PTYCreate(context.Context, *PTYCreateRequest) (*PTYCreateResponse, error)
PTYResize(context.Context, *PTYResizeRequest) (*PTYResizeResponse, error)
PTYKill(context.Context, *PTYKillRequest) (*PTYKillResponse, error)
+ // PTYAttach opens a bidirectional stream for PTY I/O over gRPC.
+ // Used by QEMU backend (virtio-serial) where vsock data ports are unavailable.
+ PTYAttach(grpc.BidiStreamingServer[PTYInput, PTYOutput]) error
// Exec sessions — persistent command execution with scrollback and reconnect.
ExecSessionCreate(context.Context, *ExecSessionCreateRequest) (*ExecSessionCreateResponse, error)
ExecSessionAttach(grpc.BidiStreamingServer[ExecSessionInput, ExecSessionOutput]) error
@@ -425,6 +445,9 @@ func (UnimplementedSandboxAgentServer) PTYResize(context.Context, *PTYResizeRequ
func (UnimplementedSandboxAgentServer) PTYKill(context.Context, *PTYKillRequest) (*PTYKillResponse, error) {
return nil, status.Error(codes.Unimplemented, "method PTYKill not implemented")
}
+func (UnimplementedSandboxAgentServer) PTYAttach(grpc.BidiStreamingServer[PTYInput, PTYOutput]) error {
+ return status.Error(codes.Unimplemented, "method PTYAttach not implemented")
+}
func (UnimplementedSandboxAgentServer) ExecSessionCreate(context.Context, *ExecSessionCreateRequest) (*ExecSessionCreateResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ExecSessionCreate not implemented")
}
@@ -715,6 +738,13 @@ func _SandboxAgent_PTYKill_Handler(srv interface{}, ctx context.Context, dec fun
return interceptor(ctx, in, info, handler)
}
+func _SandboxAgent_PTYAttach_Handler(srv interface{}, stream grpc.ServerStream) error {
+ return srv.(SandboxAgentServer).PTYAttach(&grpc.GenericServerStream[PTYInput, PTYOutput]{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_PTYAttachServer = grpc.BidiStreamingServer[PTYInput, PTYOutput]
+
func _SandboxAgent_ExecSessionCreate_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ExecSessionCreateRequest)
if err := dec(in); err != nil {
@@ -942,6 +972,12 @@ var SandboxAgent_ServiceDesc = grpc.ServiceDesc{
Handler: _SandboxAgent_ExecStream_Handler,
ServerStreams: true,
},
+ {
+ StreamName: "PTYAttach",
+ Handler: _SandboxAgent_PTYAttach_Handler,
+ ServerStreams: true,
+ ClientStreams: true,
+ },
{
StreamName: "ExecSessionAttach",
Handler: _SandboxAgent_ExecSessionAttach_Handler,