Skip to content

An open-source, faster Devin alternative

TypeScript

merged main

Brian Reardona2325b99f445
diff --cc cmd/worker/main.go
index 577b9f39,2d0e930a..29a8c72f
--- a/cmd/worker/main.go
+++ b/cmd/worker/main.go
@@@ -14,7 -15,9 +15,8 @@@ import
"github.com/opensandbox/opensandbox/internal/config"
"github.com/opensandbox/opensandbox/internal/db"
fc "github.com/opensandbox/opensandbox/internal/firecracker"
+ agentpb "github.com/opensandbox/opensandbox/proto/agent"
"github.com/opensandbox/opensandbox/internal/metrics"
- "github.com/opensandbox/opensandbox/internal/podman"
"github.com/opensandbox/opensandbox/internal/proxy"
"github.com/opensandbox/opensandbox/internal/sandbox"
"github.com/opensandbox/opensandbox/internal/storage"
@@@ -231,8 -337,23 +335,8 @@@ func main()
defer metricsSrv.Close()
log.Println("opensandbox-worker: metrics server started on :9091")
- // Initialize template builder (Podman as build tool → ext4 images)
- var builder *template.Builder
- podmanClient, podmanErr := podman.NewClient()
- if podmanErr != nil {
- log.Printf("opensandbox-worker: podman not available: %v (template building disabled)", podmanErr)
- } else {
- imagesDir := fcCfg.ImagesDir
- agentPath := filepath.Join(filepath.Dir(os.Args[0]), "osb-agent")
- if _, err := os.Stat(agentPath); err != nil {
- agentPath = "/usr/local/bin/osb-agent"
- }
- builder = template.NewBuilder(podmanClient, imagesDir, agentPath)
- log.Printf("opensandbox-worker: template builder configured (images=%s, agent=%s)", imagesDir, agentPath)
- }
-
// Start gRPC server for control plane communication
- grpcServer := worker.NewGRPCServer(mgr, ptyMgr, sandboxDBMgr, checkpointStore, sbRouter, store)
- grpcServer := worker.NewGRPCServer(mgr, ptyMgr, execMgr, sandboxDBMgr, checkpointStore, sbRouter, builder, store)
++ grpcServer := worker.NewGRPCServer(mgr, ptyMgr, execMgr, sandboxDBMgr, checkpointStore, sbRouter, store)
grpcAddr := ":9090"
log.Printf("opensandbox-worker: starting gRPC server on %s", grpcAddr)
go func() {
diff --cc internal/worker/grpc_server.go
index 80cb2215,442c424a..9b2d1fd3
--- a/internal/worker/grpc_server.go
+++ b/internal/worker/grpc_server.go
@@@ -29,24 -27,28 +29,26 @@@ import
// GRPCServer implements the SandboxWorker gRPC service for control plane communication.
type GRPCServer struct {
pb.UnimplementedSandboxWorkerServer
- manager sandbox.Manager
- router *sandbox.SandboxRouter
- ptyManager *sandbox.PTYManager
- sandboxDBs *sandbox.SandboxDBManager
- checkpointStore *storage.CheckpointStore
- store *db.Store // nil if no DB configured
- server *grpc.Server
+ manager sandbox.Manager
+ router *sandbox.SandboxRouter
+ ptyManager *sandbox.PTYManager
+ execSessionManager *sandbox.ExecSessionManager
+ sandboxDBs *sandbox.SandboxDBManager
+ checkpointStore *storage.CheckpointStore
- builder *template.Builder
+ store *db.Store // nil if no DB configured
+ server *grpc.Server
}
// NewGRPCServer creates a new gRPC server wrapping the sandbox manager.
- func NewGRPCServer(mgr sandbox.Manager, ptyMgr *sandbox.PTYManager, sandboxDBs *sandbox.SandboxDBManager, checkpointStore *storage.CheckpointStore, router *sandbox.SandboxRouter, store *db.Store) *GRPCServer {
-func NewGRPCServer(mgr sandbox.Manager, ptyMgr *sandbox.PTYManager, execMgr *sandbox.ExecSessionManager, sandboxDBs *sandbox.SandboxDBManager, checkpointStore *storage.CheckpointStore, router *sandbox.SandboxRouter, builder *template.Builder, store *db.Store) *GRPCServer {
++func NewGRPCServer(mgr sandbox.Manager, ptyMgr *sandbox.PTYManager, execMgr *sandbox.ExecSessionManager, sandboxDBs *sandbox.SandboxDBManager, checkpointStore *storage.CheckpointStore, router *sandbox.SandboxRouter, store *db.Store) *GRPCServer {
s := &GRPCServer{
- manager: mgr,
- router: router,
- ptyManager: ptyMgr,
- sandboxDBs: sandboxDBs,
- checkpointStore: checkpointStore,
- store: store,
+ manager: mgr,
+ router: router,
+ ptyManager: ptyMgr,
+ execSessionManager: execMgr,
+ sandboxDBs: sandboxDBs,
+ checkpointStore: checkpointStore,
- builder: builder,
+ store: store,
server: grpc.NewServer(
grpc.KeepaliveEnforcementPolicy(keepalive.EnforcementPolicy{
MinTime: 5 * time.Second,
diff --cc sdks/python/opencomputer/__init__.py
index 5acd20f6,e52d1f77..a06bfd5b
--- a/sdks/python/opencomputer/__init__.py
+++ b/sdks/python/opencomputer/__init__.py
@@@ -1,21 -1,25 +1,27 @@@
"""OpenComputer Python SDK - cloud sandbox platform."""
from opencomputer.sandbox import Sandbox
+ from opencomputer.agent import Agent, AgentEvent, AgentSession, AgentSessionInfo
from opencomputer.filesystem import Filesystem
- from opencomputer.commands import Commands, ProcessResult
+ from opencomputer.exec import Exec, ProcessResult, ExecSessionInfo
+from opencomputer.image import Image
from opencomputer.pty import Pty, PtySession
-from opencomputer.template import Template
+from opencomputer.snapshot import Snapshots
__all__ = [
"Sandbox",
+ "Agent",
+ "AgentEvent",
+ "AgentSession",
+ "AgentSessionInfo",
"Filesystem",
- "Commands",
+ "Exec",
"ProcessResult",
+ "ExecSessionInfo",
+ "Image",
"Pty",
"PtySession",
- "Template",
+ "Snapshots",
]
__version__ = "0.5.0"
diff --cc sdks/python/opencomputer/sandbox.py
index 3ba71f14,82a7968d..da4ad08d
--- a/sdks/python/opencomputer/sandbox.py
+++ b/sdks/python/opencomputer/sandbox.py
@@@ -8,11 -8,10 +8,12 @@@ from typing import Any, Callabl
import httpx
- from opencomputer.commands import Commands
+ from opencomputer.agent import Agent
+ from opencomputer.exec import Exec
from opencomputer.filesystem import Filesystem
+from opencomputer.image import Image
from opencomputer.pty import Pty
+from opencomputer.sse import parse_sse_stream
@dataclass
diff --cc sdks/typescript/src/index.ts
index 37369159,d7f8acaf..5a6b13a2
--- a/sdks/typescript/src/index.ts
+++ b/sdks/typescript/src/index.ts
@@@ -1,6 -1,6 +1,7 @@@
export { Sandbox, type SandboxOpts, type CheckpointInfo, type PatchInfo, type PatchResult } from "./sandbox.js";
+ export { Agent, type AgentEvent, type AgentConfig, type AgentStartOpts, type AgentSession, type McpServerConfig } from "./agent.js";
export { Filesystem, type EntryInfo } from "./filesystem.js";
- export { Commands, type ProcessResult, type RunOpts } from "./commands.js";
+ export { Exec, type ProcessResult, type RunOpts, type ExecSession, type ExecSessionInfo, type ExecStartOpts, type ExecAttachOpts } from "./exec.js";
export { Pty, type PtySession, type PtyOpts } from "./pty.js";
-export { Templates, type TemplateInfo } from "./template.js";
+export { Image, type ImageManifest, type ImageStep } from "./image.js";
+export { Snapshots, type SnapshotInfo, type CreateSnapshotOpts } from "./snapshot.js";
diff --cc sdks/typescript/src/sandbox.ts
index d4e64b1f,7600e42d..83c7871b
--- a/sdks/typescript/src/sandbox.ts
+++ b/sdks/typescript/src/sandbox.ts
@@@ -1,8 -1,7 +1,9 @@@
+ import { Agent } from "./agent.js";
import { Filesystem } from "./filesystem.js";
- import { Commands } from "./commands.js";
+ import { Exec } from "./exec.js";
import { Pty } from "./pty.js";
+import { Image } from "./image.js";
+import { parseSSEStream } from "./sse.js";
function resolveApiUrl(url: string): string {
const base = url.replace(/\/+$/, "");