An open-source, faster Devin alternative
TypeScript
feat(logship): phase 0 — config + ConfigureLogship RPC plumbing
Igor Zalutskif49de82f8c5c
diff --git a/cmd/worker/main.go b/cmd/worker/main.goindex fcb7e6b6..a0063077 100644--- a/cmd/worker/main.go+++ b/cmd/worker/main.go@@ -368,6 +368,11 @@ func main() {// gRPC server (nil builder — template building via podman not needed for QEMU)grpcServer := worker.NewGRPCServer(mgr, ptyMgr, execMgr, sandboxDBMgr, checkpointStore, sbRouter, nil, store)+ // Wire up Axiom log-shipping. Empty token disables shipping (kill-switch).+ grpcServer.SetAxiomConfig(cfg.AxiomIngestToken, cfg.AxiomDataset)+ if cfg.AxiomIngestToken != "" {+ log.Printf("opensandbox-worker: sandbox session log shipping enabled (dataset=%s)", cfg.AxiomDataset)+ }// Wire up live migration if using QEMU managerif migrator, ok := mgr.(worker.LiveMigrator); ok {grpcServer.SetMigrator(migrator)diff --git a/internal/agent/logship.go b/internal/agent/logship.gonew file mode 100644index 00000000..a56fbd7d--- /dev/null+++ b/internal/agent/logship.go@@ -0,0 +1,52 @@+package agent++import (+ "context"+ "log"++ pb "github.com/opensandbox/opensandbox/proto/agent"+)++// LogshipConfig captures the parameters needed to ship sandbox session+// logs to the configured backend (Axiom). The forwarder reads this at+// flush time so it can stamp each event with the right sandbox/org IDs.+//+// IngestToken empty = log shipping disabled. The worker decides whether+// to call ConfigureLogship at all based on its own AXIOM_INGEST_TOKEN+// env; passing an empty token here is a defensive no-op path.+type LogshipConfig struct {+ IngestToken string+ Dataset string+ SandboxID string+ OrgID string+}++// ConfigureLogship is called by the worker once per sandbox boot to+// hand the agent its log-shipping configuration. Phase 0 just stores+// the config; Phase 1 wires it into the forwarder's Activate path.+func (s *Server) ConfigureLogship(ctx context.Context, req *pb.ConfigureLogshipRequest) (*pb.ConfigureLogshipResponse, error) {+ cfg := LogshipConfig{+ IngestToken: req.IngestToken,+ Dataset: req.Dataset,+ SandboxID: req.SandboxId,+ OrgID: req.OrgId,+ }+ s.logshipMu.Lock()+ s.logshipCfg = cfg+ s.logshipMu.Unlock()++ if cfg.IngestToken == "" {+ log.Printf("agent: ConfigureLogship received empty ingest_token (kill-switch); shipping disabled")+ } else {+ log.Printf("agent: ConfigureLogship received (sandbox_id=%s, dataset=%s)", cfg.SandboxID, cfg.Dataset)+ }+ return &pb.ConfigureLogshipResponse{}, nil+}++// LogshipConfig returns the current log-shipping configuration.+// Returns the zero value if ConfigureLogship has not yet been called.+func (s *Server) GetLogshipConfig() LogshipConfig {+ s.logshipMu.RLock()+ defer s.logshipMu.RUnlock()+ return s.logshipCfg+}diff --git a/internal/agent/server.go b/internal/agent/server.goindex 2f32fb82..99548b46 100644--- a/internal/agent/server.go+++ b/internal/agent/server.go@@ -56,6 +56,12 @@ type Server struct {ptySessions map[string]*ptySessionnextPTYPort uint32+ // Sandbox session log shipping configuration. Set once via the+ // ConfigureLogship RPC, called by the worker right after VM boot.+ // If never set, the forwarder stays dormant.+ logshipMu sync.RWMutex+ logshipCfg LogshipConfig+// gRPC server reference for hibernate GracefulStopmu sync.MutexgrpcServer *grpc.Serverdiff --git a/internal/config/config.go b/internal/config/config.goindex a9e57ca4..9cd751d9 100644--- a/internal/config/config.go+++ b/internal/config/config.go@@ -122,6 +122,13 @@ type Config struct {// Segment analytics — if set, GB-minute usage events are shipped per org.SegmentWriteKey string+ // Axiom — log shipping for sandbox session logs.+ // AxiomIngestToken empty = log shipping disabled (kill-switch).+ // Only the worker needs these; the agent receives them via the+ // ConfigureLogship RPC at sandbox boot.+ AxiomIngestToken string+ AxiomDataset string+// AWS Secrets Manager — if set, secrets are fetched at startup using IAM credentials.// The secret should be a JSON object with keys matching env var names (e.g. OPENSANDBOX_JWT_SECRET).// Env vars take precedence over secret values (for local overrides).@@ -227,6 +234,9 @@ func Load() (*Config, error) {SegmentWriteKey: os.Getenv("SEGMENT_WRITE_KEY"),+ AxiomIngestToken: os.Getenv("AXIOM_INGEST_TOKEN"),+ AxiomDataset: envOrDefault("AXIOM_DATASET", "oc-sandbox-logs"),+SecretsARN: os.Getenv("OPENSANDBOX_SECRETS_ARN"),SecretEncryptionKey: os.Getenv("OPENSANDBOX_SECRET_ENCRYPTION_KEY"),diff --git a/internal/qemu/agent_client.go b/internal/qemu/agent_client.goindex 9f85e6a0..cc8db1e6 100644--- a/internal/qemu/agent_client.go+++ b/internal/qemu/agent_client.go@@ -195,6 +195,18 @@ func (c *AgentClient) SetEnvs(ctx context.Context, envs map[string]string) errorreturn err}+// ConfigureLogship hands the in-VM agent its log-shipping configuration.+// Empty ingestToken is a no-op on the agent side (kill-switch).+func (c *AgentClient) ConfigureLogship(ctx context.Context, ingestToken, dataset, sandboxID, orgID string) error {+ _, err := c.client.ConfigureLogship(ctx, &pb.ConfigureLogshipRequest{+ IngestToken: ingestToken,+ Dataset: dataset,+ SandboxId: sandboxID,+ OrgId: orgID,+ })+ return err+}+// Ping verifies the agent is responsive.func (c *AgentClient) Ping(ctx context.Context) (*pb.PingResponse, error) {return c.client.Ping(ctx, &pb.PingRequest{})diff --git a/internal/qemu/manager.go b/internal/qemu/manager.goindex 2280f54b..a2e64011 100644--- a/internal/qemu/manager.go+++ b/internal/qemu/manager.go@@ -3169,6 +3169,22 @@ func (m *Manager) GetAgent(sandboxID string) (*AgentClient, error) {return vm.agent, nil}+// ConfigureLogship hands the in-VM agent its sandbox session log-shipping+// configuration. Called by the worker right after a sandbox is created+// (or warm-forked from a checkpoint) so the agent's forwarder knows+// where to ship and how to tag events. Empty ingestToken disables+// shipping for this sandbox (kill-switch).+func (m *Manager) ConfigureLogship(ctx context.Context, sandboxID, ingestToken, dataset, orgID string) error {+ agent, err := m.GetAgent(sandboxID)+ if err != nil {+ return err+ }+ if agent == nil {+ return fmt.Errorf("agent client not ready for sandbox %s", sandboxID)+ }+ return agent.ConfigureLogship(ctx, ingestToken, dataset, sandboxID, orgID)+}+// GetWorkspacePath returns the host path to a sandbox's workspace qcow2.// Used by the autosave loop to gate SyncFS on mtime — no point syncing if// the workspace hasn't been touched since the last successful sync.diff --git a/internal/worker/grpc_server.go b/internal/worker/grpc_server.goindex 6806bae7..02fbb303 100644--- a/internal/worker/grpc_server.go+++ b/internal/worker/grpc_server.go@@ -57,6 +57,15 @@ type GoldenRebuilder interface {GoldenVersion() string}+// LogshipConfigurator is implemented by VM managers that can deliver+// log-shipping configuration to the in-VM agent over the existing+// worker→agent gRPC channel. Managers without an agent channel just+// don't implement this — the worker silently skips configuration for+// those sandboxes.+type LogshipConfigurator interface {+ ConfigureLogship(ctx context.Context, sandboxID, ingestToken, dataset, orgID string) error+}+type GRPCServer struct {pb.UnimplementedSandboxWorkerServermanager sandbox.Manager@@ -69,6 +78,20 @@ type GRPCServer struct {checkpointStore *storage.CheckpointStorestore *db.Store // nil if no DB configuredserver *grpc.Server++ // Axiom log-shipping config. Empty token = log shipping disabled+ // (kill-switch). Set via SetAxiomConfig at startup.+ axiomIngestToken string+ axiomDataset string+}++// SetAxiomConfig wires Axiom log-shipping credentials. The worker+// passes them down to each sandbox's agent on create via the+// LogshipConfigurator interface (implemented by the QEMU manager).+// Empty token disables shipping for every sandbox this worker boots.+func (s *GRPCServer) SetAxiomConfig(ingestToken, dataset string) {+ s.axiomIngestToken = ingestToken+ s.axiomDataset = dataset}// NewGRPCServer creates a new gRPC server wrapping the sandbox manager.@@ -127,6 +150,28 @@ func (s *GRPCServer) Stop() {s.server.GracefulStop()}+// configureLogshipForSandbox delivers Axiom log-shipping configuration+// to the in-VM agent. Best-effort: a failure here does not fail the+// sandbox-create — log shipping just stays dormant for this sandbox.+// No-op if the worker has no Axiom token set or the manager doesn't+// implement LogshipConfigurator.+func (s *GRPCServer) configureLogshipForSandbox(ctx context.Context, sandboxID string) {+ if s.axiomIngestToken == "" {+ return+ }+ cfger, ok := s.manager.(LogshipConfigurator)+ if !ok {+ return+ }+ var orgID string+ if s.store != nil {+ orgID, _ = s.store.GetSandboxOrgID(ctx, sandboxID)+ }+ if err := cfger.ConfigureLogship(ctx, sandboxID, s.axiomIngestToken, s.axiomDataset, orgID); err != nil {+ log.Printf("grpc: ConfigureLogship for %s failed: %v (logs disabled for this sandbox)", sandboxID, err)+ }+}+// parseSecretAllowedHosts converts the proto map (env var → comma-separated hosts)// to the internal map (env var → host slice). Returns nil if input is empty.func parseSecretAllowedHosts(m map[string]string) map[string][]string {@@ -176,6 +221,7 @@ func (s *GRPCServer) CreateSandbox(ctx context.Context, req *pb.CreateSandboxReq}s.router.Register(sb.ID, time.Duration(timeout)*time.Second)}+ s.configureLogshipForSandbox(ctx, sb.ID)return &pb.CreateSandboxResponse{SandboxId: sb.ID,Status: string(sb.Status),@@ -198,6 +244,7 @@ func (s *GRPCServer) CreateSandbox(ctx context.Context, req *pb.CreateSandboxReq}s.router.Register(sb.ID, time.Duration(timeout)*time.Second)}+ s.configureLogshipForSandbox(ctx, sb.ID)return &pb.CreateSandboxResponse{SandboxId: sb.ID,Status: string(sb.Status),@@ -269,6 +316,8 @@ func (s *GRPCServer) CreateSandbox(ctx context.Context, req *pb.CreateSandboxReq}}+ s.configureLogshipForSandbox(ctx, sb.ID)+return &pb.CreateSandboxResponse{SandboxId: sb.ID,Status: string(sb.Status),diff --git a/proto/agent/agent.pb.go b/proto/agent/agent.pb.goindex faacfcc5..15c37d4c 100644--- a/proto/agent/agent.pb.go+++ b/proto/agent/agent.pb.go@@ -1,7 +1,7 @@// Code generated by protoc-gen-go. DO NOT EDIT.// versions:// protoc-gen-go v1.36.11-// protoc v6.33.4+// protoc v5.29.3// source: proto/agent/agent.protopackage agent@@ -2445,6 +2445,110 @@ func (*SetEnvsResponse) Descriptor() ([]byte, []int) {return file_proto_agent_agent_proto_rawDescGZIP(), []int{44}}+type ConfigureLogshipRequest struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ IngestToken string `protobuf:"bytes,1,opt,name=ingest_token,json=ingestToken,proto3" json:"ingest_token,omitempty"`+ Dataset string `protobuf:"bytes,2,opt,name=dataset,proto3" json:"dataset,omitempty"`+ SandboxId string `protobuf:"bytes,3,opt,name=sandbox_id,json=sandboxId,proto3" json:"sandbox_id,omitempty"`+ OrgId string `protobuf:"bytes,4,opt,name=org_id,json=orgId,proto3" json:"org_id,omitempty"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *ConfigureLogshipRequest) Reset() {+ *x = ConfigureLogshipRequest{}+ mi := &file_proto_agent_agent_proto_msgTypes[45]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *ConfigureLogshipRequest) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*ConfigureLogshipRequest) ProtoMessage() {}++func (x *ConfigureLogshipRequest) ProtoReflect() protoreflect.Message {+ mi := &file_proto_agent_agent_proto_msgTypes[45]+ 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 ConfigureLogshipRequest.ProtoReflect.Descriptor instead.+func (*ConfigureLogshipRequest) Descriptor() ([]byte, []int) {+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{45}+}++func (x *ConfigureLogshipRequest) GetIngestToken() string {+ if x != nil {+ return x.IngestToken+ }+ return ""+}++func (x *ConfigureLogshipRequest) GetDataset() string {+ if x != nil {+ return x.Dataset+ }+ return ""+}++func (x *ConfigureLogshipRequest) GetSandboxId() string {+ if x != nil {+ return x.SandboxId+ }+ return ""+}++func (x *ConfigureLogshipRequest) GetOrgId() string {+ if x != nil {+ return x.OrgId+ }+ return ""+}++type ConfigureLogshipResponse struct {+ state protoimpl.MessageState `protogen:"open.v1"`+ unknownFields protoimpl.UnknownFields+ sizeCache protoimpl.SizeCache+}++func (x *ConfigureLogshipResponse) Reset() {+ *x = ConfigureLogshipResponse{}+ mi := &file_proto_agent_agent_proto_msgTypes[46]+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))+ ms.StoreMessageInfo(mi)+}++func (x *ConfigureLogshipResponse) String() string {+ return protoimpl.X.MessageStringOf(x)+}++func (*ConfigureLogshipResponse) ProtoMessage() {}++func (x *ConfigureLogshipResponse) ProtoReflect() protoreflect.Message {+ mi := &file_proto_agent_agent_proto_msgTypes[46]+ 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 ConfigureLogshipResponse.ProtoReflect.Descriptor instead.+func (*ConfigureLogshipResponse) Descriptor() ([]byte, []int) {+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{46}+}+type ShutdownRequest struct {state protoimpl.MessageState `protogen:"open.v1"`unknownFields protoimpl.UnknownFields@@ -2453,7 +2557,7 @@ type ShutdownRequest struct {func (x *ShutdownRequest) Reset() {*x = ShutdownRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[45]+ mi := &file_proto_agent_agent_proto_msgTypes[47]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2465,7 +2569,7 @@ func (x *ShutdownRequest) String() string {func (*ShutdownRequest) ProtoMessage() {}func (x *ShutdownRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[45]+ mi := &file_proto_agent_agent_proto_msgTypes[47]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2478,7 +2582,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{45}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{47}}type ShutdownResponse struct {@@ -2489,7 +2593,7 @@ type ShutdownResponse struct {func (x *ShutdownResponse) Reset() {*x = ShutdownResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[46]+ mi := &file_proto_agent_agent_proto_msgTypes[48]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2501,7 +2605,7 @@ func (x *ShutdownResponse) String() string {func (*ShutdownResponse) ProtoMessage() {}func (x *ShutdownResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[46]+ mi := &file_proto_agent_agent_proto_msgTypes[48]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2514,7 +2618,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{46}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{48}}type SyncFSRequest struct {@@ -2525,7 +2629,7 @@ type SyncFSRequest struct {func (x *SyncFSRequest) Reset() {*x = SyncFSRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[47]+ mi := &file_proto_agent_agent_proto_msgTypes[49]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2537,7 +2641,7 @@ func (x *SyncFSRequest) String() string {func (*SyncFSRequest) ProtoMessage() {}func (x *SyncFSRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[47]+ mi := &file_proto_agent_agent_proto_msgTypes[49]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2550,7 +2654,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{47}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{49}}type SyncFSResponse struct {@@ -2561,7 +2665,7 @@ type SyncFSResponse struct {func (x *SyncFSResponse) Reset() {*x = SyncFSResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[48]+ mi := &file_proto_agent_agent_proto_msgTypes[50]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2573,7 +2677,7 @@ func (x *SyncFSResponse) String() string {func (*SyncFSResponse) ProtoMessage() {}func (x *SyncFSResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[48]+ mi := &file_proto_agent_agent_proto_msgTypes[50]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2586,7 +2690,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{48}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{50}}type PrepareHibernateRequest struct {@@ -2597,7 +2701,7 @@ type PrepareHibernateRequest struct {func (x *PrepareHibernateRequest) Reset() {*x = PrepareHibernateRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[49]+ mi := &file_proto_agent_agent_proto_msgTypes[51]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2609,7 +2713,7 @@ func (x *PrepareHibernateRequest) String() string {func (*PrepareHibernateRequest) ProtoMessage() {}func (x *PrepareHibernateRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[49]+ mi := &file_proto_agent_agent_proto_msgTypes[51]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2622,7 +2726,7 @@ func (x *PrepareHibernateRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use PrepareHibernateRequest.ProtoReflect.Descriptor instead.func (*PrepareHibernateRequest) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{49}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{51}}type PrepareHibernateResponse struct {@@ -2633,7 +2737,7 @@ type PrepareHibernateResponse struct {func (x *PrepareHibernateResponse) Reset() {*x = PrepareHibernateResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[50]+ mi := &file_proto_agent_agent_proto_msgTypes[52]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2645,7 +2749,7 @@ func (x *PrepareHibernateResponse) String() string {func (*PrepareHibernateResponse) ProtoMessage() {}func (x *PrepareHibernateResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[50]+ mi := &file_proto_agent_agent_proto_msgTypes[52]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2658,7 +2762,7 @@ func (x *PrepareHibernateResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use PrepareHibernateResponse.ProtoReflect.Descriptor instead.func (*PrepareHibernateResponse) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{50}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{52}}type SetResourceLimitsRequest struct {@@ -2673,7 +2777,7 @@ type SetResourceLimitsRequest struct {func (x *SetResourceLimitsRequest) Reset() {*x = SetResourceLimitsRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[51]+ mi := &file_proto_agent_agent_proto_msgTypes[53]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2685,7 +2789,7 @@ func (x *SetResourceLimitsRequest) String() string {func (*SetResourceLimitsRequest) ProtoMessage() {}func (x *SetResourceLimitsRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[51]+ mi := &file_proto_agent_agent_proto_msgTypes[53]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2698,7 +2802,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{51}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{53}}func (x *SetResourceLimitsRequest) GetMaxPids() int32 {@@ -2737,7 +2841,7 @@ type SetResourceLimitsResponse struct {func (x *SetResourceLimitsResponse) Reset() {*x = SetResourceLimitsResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[52]+ mi := &file_proto_agent_agent_proto_msgTypes[54]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2749,7 +2853,7 @@ func (x *SetResourceLimitsResponse) String() string {func (*SetResourceLimitsResponse) ProtoMessage() {}func (x *SetResourceLimitsResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[52]+ mi := &file_proto_agent_agent_proto_msgTypes[54]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2762,7 +2866,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{52}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{54}}type GetVersionRequest struct {@@ -2773,7 +2877,7 @@ type GetVersionRequest struct {func (x *GetVersionRequest) Reset() {*x = GetVersionRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[53]+ mi := &file_proto_agent_agent_proto_msgTypes[55]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2785,7 +2889,7 @@ func (x *GetVersionRequest) String() string {func (*GetVersionRequest) ProtoMessage() {}func (x *GetVersionRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[53]+ mi := &file_proto_agent_agent_proto_msgTypes[55]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2798,7 +2902,7 @@ func (x *GetVersionRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use GetVersionRequest.ProtoReflect.Descriptor instead.func (*GetVersionRequest) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{53}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{55}}type GetVersionResponse struct {@@ -2810,7 +2914,7 @@ type GetVersionResponse struct {func (x *GetVersionResponse) Reset() {*x = GetVersionResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[54]+ mi := &file_proto_agent_agent_proto_msgTypes[56]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2822,7 +2926,7 @@ func (x *GetVersionResponse) String() string {func (*GetVersionResponse) ProtoMessage() {}func (x *GetVersionResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[54]+ mi := &file_proto_agent_agent_proto_msgTypes[56]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2835,7 +2939,7 @@ func (x *GetVersionResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use GetVersionResponse.ProtoReflect.Descriptor instead.func (*GetVersionResponse) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{54}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{56}}func (x *GetVersionResponse) GetVersion() string {@@ -2854,7 +2958,7 @@ type UpgradeRequest struct {func (x *UpgradeRequest) Reset() {*x = UpgradeRequest{}- mi := &file_proto_agent_agent_proto_msgTypes[55]+ mi := &file_proto_agent_agent_proto_msgTypes[57]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2866,7 +2970,7 @@ func (x *UpgradeRequest) String() string {func (*UpgradeRequest) ProtoMessage() {}func (x *UpgradeRequest) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[55]+ mi := &file_proto_agent_agent_proto_msgTypes[57]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2879,7 +2983,7 @@ func (x *UpgradeRequest) ProtoReflect() protoreflect.Message {// Deprecated: Use UpgradeRequest.ProtoReflect.Descriptor instead.func (*UpgradeRequest) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{55}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{57}}func (x *UpgradeRequest) GetBinaryPath() string {@@ -2898,7 +3002,7 @@ type UpgradeResponse struct {func (x *UpgradeResponse) Reset() {*x = UpgradeResponse{}- mi := &file_proto_agent_agent_proto_msgTypes[56]+ mi := &file_proto_agent_agent_proto_msgTypes[58]ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))ms.StoreMessageInfo(mi)}@@ -2910,7 +3014,7 @@ func (x *UpgradeResponse) String() string {func (*UpgradeResponse) ProtoMessage() {}func (x *UpgradeResponse) ProtoReflect() protoreflect.Message {- mi := &file_proto_agent_agent_proto_msgTypes[56]+ mi := &file_proto_agent_agent_proto_msgTypes[58]if x != nil {ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))if ms.LoadMessageInfo() == nil {@@ -2923,7 +3027,7 @@ func (x *UpgradeResponse) ProtoReflect() protoreflect.Message {// Deprecated: Use UpgradeResponse.ProtoReflect.Descriptor instead.func (*UpgradeResponse) Descriptor() ([]byte, []int) {- return file_proto_agent_agent_proto_rawDescGZIP(), []int{56}+ return file_proto_agent_agent_proto_rawDescGZIP(), []int{58}}func (x *UpgradeResponse) GetOk() bool {@@ -3103,7 +3207,14 @@ const file_proto_agent_agent_proto_rawDesc = "" +"\tEnvsEntry\x12\x10\n" +"\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n" +"\x05value\x18\x02 \x01(\tR\x05value:\x028\x01\"\x11\n" +- "\x0fSetEnvsResponse\"\x11\n" ++ "\x0fSetEnvsResponse\"\x8c\x01\n" ++ "\x17ConfigureLogshipRequest\x12!\n" ++ "\fingest_token\x18\x01 \x01(\tR\vingestToken\x12\x18\n" ++ "\adataset\x18\x02 \x01(\tR\adataset\x12\x1d\n" ++ "\n" ++ "sandbox_id\x18\x03 \x01(\tR\tsandboxId\x12\x15\n" ++ "\x06org_id\x18\x04 \x01(\tR\x05orgId\"\x1a\n" ++ "\x18ConfigureLogshipResponse\"\x11\n" +"\x0fShutdownRequest\"\x12\n" +"\x10ShutdownResponse\"\x0f\n" +"\rSyncFSRequest\"\x10\n" +@@ -3124,7 +3235,7 @@ const file_proto_agent_agent_proto_rawDesc = "" +"\vbinary_path\x18\x01 \x01(\tR\n" +"binaryPath\"!\n" +"\x0fUpgradeResponse\x12\x0e\n" +- "\x02ok\x18\x01 \x01(\bR\x02ok2\x96\x0e\n" ++ "\x02ok\x18\x01 \x01(\bR\x02ok2\xeb\x0e\n" +"\fSandboxAgent\x12/\n" +"\x04Exec\x12\x12.agent.ExecRequest\x1a\x13.agent.ExecResponse\x12:\n" +"\n" +@@ -3148,7 +3259,8 @@ const file_proto_agent_agent_proto_rawDesc = "" +"\x11ExecSessionAttach\x12\x17.agent.ExecSessionInput\x1a\x18.agent.ExecSessionOutput(\x010\x01\x12P\n" +"\x0fExecSessionList\x12\x1d.agent.ExecSessionListRequest\x1a\x1e.agent.ExecSessionListResponse\x12P\n" +"\x0fExecSessionKill\x12\x1d.agent.ExecSessionKillRequest\x1a\x1e.agent.ExecSessionKillResponse\x128\n" +- "\aSetEnvs\x12\x15.agent.SetEnvsRequest\x1a\x16.agent.SetEnvsResponse\x12;\n" ++ "\aSetEnvs\x12\x15.agent.SetEnvsRequest\x1a\x16.agent.SetEnvsResponse\x12S\n" ++ "\x10ConfigureLogship\x12\x1e.agent.ConfigureLogshipRequest\x1a\x1f.agent.ConfigureLogshipResponse\x12;\n" +"\bShutdown\x12\x16.agent.ShutdownRequest\x1a\x17.agent.ShutdownResponse\x125\n" +"\x06SyncFS\x12\x14.agent.SyncFSRequest\x1a\x15.agent.SyncFSResponse\x12S\n" +"\x10PrepareHibernate\x12\x1e.agent.PrepareHibernateRequest\x1a\x1f.agent.PrepareHibernateResponse\x12V\n" +@@ -3170,7 +3282,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, 60)+var file_proto_agent_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 62)var file_proto_agent_agent_proto_goTypes = []any{(ExecOutputChunk_Stream)(0), // 0: agent.ExecOutputChunk.Stream(ExecSessionOutput_Type)(0), // 1: agent.ExecSessionOutput.Type@@ -3219,30 +3331,32 @@ var file_proto_agent_agent_proto_goTypes = []any{(*ExecSessionKillResponse)(nil), // 44: agent.ExecSessionKillResponse(*SetEnvsRequest)(nil), // 45: agent.SetEnvsRequest(*SetEnvsResponse)(nil), // 46: agent.SetEnvsResponse- (*ShutdownRequest)(nil), // 47: agent.ShutdownRequest- (*ShutdownResponse)(nil), // 48: agent.ShutdownResponse- (*SyncFSRequest)(nil), // 49: agent.SyncFSRequest- (*SyncFSResponse)(nil), // 50: agent.SyncFSResponse- (*PrepareHibernateRequest)(nil), // 51: agent.PrepareHibernateRequest- (*PrepareHibernateResponse)(nil), // 52: agent.PrepareHibernateResponse- (*SetResourceLimitsRequest)(nil), // 53: agent.SetResourceLimitsRequest- (*SetResourceLimitsResponse)(nil), // 54: agent.SetResourceLimitsResponse- (*GetVersionRequest)(nil), // 55: agent.GetVersionRequest- (*GetVersionResponse)(nil), // 56: agent.GetVersionResponse- (*UpgradeRequest)(nil), // 57: agent.UpgradeRequest- (*UpgradeResponse)(nil), // 58: agent.UpgradeResponse- nil, // 59: agent.ExecRequest.EnvsEntry- nil, // 60: agent.ExecSessionCreateRequest.EnvsEntry- nil, // 61: agent.SetEnvsRequest.EnvsEntry+ (*ConfigureLogshipRequest)(nil), // 47: agent.ConfigureLogshipRequest+ (*ConfigureLogshipResponse)(nil), // 48: agent.ConfigureLogshipResponse+ (*ShutdownRequest)(nil), // 49: agent.ShutdownRequest+ (*ShutdownResponse)(nil), // 50: agent.ShutdownResponse+ (*SyncFSRequest)(nil), // 51: agent.SyncFSRequest+ (*SyncFSResponse)(nil), // 52: agent.SyncFSResponse+ (*PrepareHibernateRequest)(nil), // 53: agent.PrepareHibernateRequest+ (*PrepareHibernateResponse)(nil), // 54: agent.PrepareHibernateResponse+ (*SetResourceLimitsRequest)(nil), // 55: agent.SetResourceLimitsRequest+ (*SetResourceLimitsResponse)(nil), // 56: agent.SetResourceLimitsResponse+ (*GetVersionRequest)(nil), // 57: agent.GetVersionRequest+ (*GetVersionResponse)(nil), // 58: agent.GetVersionResponse+ (*UpgradeRequest)(nil), // 59: agent.UpgradeRequest+ (*UpgradeResponse)(nil), // 60: agent.UpgradeResponse+ nil, // 61: agent.ExecRequest.EnvsEntry+ nil, // 62: agent.ExecSessionCreateRequest.EnvsEntry+ nil, // 63: agent.SetEnvsRequest.EnvsEntry}var file_proto_agent_agent_proto_depIdxs = []int32{- 59, // 0: agent.ExecRequest.envs:type_name -> agent.ExecRequest.EnvsEntry+ 61, // 0: agent.ExecRequest.envs:type_name -> agent.ExecRequest.EnvsEntry0, // 1: agent.ExecOutputChunk.stream:type_name -> agent.ExecOutputChunk.Stream14, // 2: agent.ListDirResponse.entries:type_name -> agent.DirEntry- 60, // 3: agent.ExecSessionCreateRequest.envs:type_name -> agent.ExecSessionCreateRequest.EnvsEntry+ 62, // 3: agent.ExecSessionCreateRequest.envs:type_name -> agent.ExecSessionCreateRequest.EnvsEntry1, // 4: agent.ExecSessionOutput.type:type_name -> agent.ExecSessionOutput.Type42, // 5: agent.ExecSessionListResponse.sessions:type_name -> agent.ExecSessionInfo- 61, // 6: agent.SetEnvsRequest.envs:type_name -> agent.SetEnvsRequest.EnvsEntry+ 63, // 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.ReadFileRequest@@ -3265,42 +3379,44 @@ var file_proto_agent_agent_proto_depIdxs = []int32{40, // 26: agent.SandboxAgent.ExecSessionList:input_type -> agent.ExecSessionListRequest43, // 27: agent.SandboxAgent.ExecSessionKill:input_type -> agent.ExecSessionKillRequest45, // 28: agent.SandboxAgent.SetEnvs:input_type -> agent.SetEnvsRequest- 47, // 29: agent.SandboxAgent.Shutdown:input_type -> agent.ShutdownRequest- 49, // 30: agent.SandboxAgent.SyncFS:input_type -> agent.SyncFSRequest- 51, // 31: agent.SandboxAgent.PrepareHibernate:input_type -> agent.PrepareHibernateRequest- 53, // 32: agent.SandboxAgent.SetResourceLimits:input_type -> agent.SetResourceLimitsRequest- 55, // 33: agent.SandboxAgent.GetVersion:input_type -> agent.GetVersionRequest- 57, // 34: agent.SandboxAgent.Upgrade:input_type -> agent.UpgradeRequest- 3, // 35: agent.SandboxAgent.Exec:output_type -> agent.ExecResponse- 4, // 36: agent.SandboxAgent.ExecStream:output_type -> agent.ExecOutputChunk- 6, // 37: agent.SandboxAgent.ReadFile:output_type -> agent.ReadFileResponse- 8, // 38: agent.SandboxAgent.WriteFile:output_type -> agent.WriteFileResponse- 10, // 39: agent.SandboxAgent.ReadFileStream:output_type -> agent.FileChunk- 12, // 40: agent.SandboxAgent.WriteFileStream:output_type -> agent.WriteFileStreamResponse- 15, // 41: agent.SandboxAgent.ListDir:output_type -> agent.ListDirResponse- 17, // 42: agent.SandboxAgent.MakeDir:output_type -> agent.MakeDirResponse- 19, // 43: agent.SandboxAgent.Remove:output_type -> agent.RemoveResponse- 21, // 44: agent.SandboxAgent.Exists:output_type -> agent.ExistsResponse- 23, // 45: agent.SandboxAgent.Stat:output_type -> agent.StatResponse- 25, // 46: agent.SandboxAgent.Stats:output_type -> agent.StatsResponse- 27, // 47: agent.SandboxAgent.Ping:output_type -> agent.PingResponse- 29, // 48: agent.SandboxAgent.PTYCreate:output_type -> agent.PTYCreateResponse- 31, // 49: agent.SandboxAgent.PTYResize:output_type -> agent.PTYResizeResponse- 33, // 50: agent.SandboxAgent.PTYKill:output_type -> agent.PTYKillResponse- 35, // 51: agent.SandboxAgent.PTYAttach:output_type -> agent.PTYOutput- 37, // 52: agent.SandboxAgent.ExecSessionCreate:output_type -> agent.ExecSessionCreateResponse- 39, // 53: agent.SandboxAgent.ExecSessionAttach:output_type -> agent.ExecSessionOutput- 41, // 54: agent.SandboxAgent.ExecSessionList:output_type -> agent.ExecSessionListResponse- 44, // 55: agent.SandboxAgent.ExecSessionKill:output_type -> agent.ExecSessionKillResponse- 46, // 56: agent.SandboxAgent.SetEnvs:output_type -> agent.SetEnvsResponse- 48, // 57: agent.SandboxAgent.Shutdown:output_type -> agent.ShutdownResponse- 50, // 58: agent.SandboxAgent.SyncFS:output_type -> agent.SyncFSResponse- 52, // 59: agent.SandboxAgent.PrepareHibernate:output_type -> agent.PrepareHibernateResponse- 54, // 60: agent.SandboxAgent.SetResourceLimits:output_type -> agent.SetResourceLimitsResponse- 56, // 61: agent.SandboxAgent.GetVersion:output_type -> agent.GetVersionResponse- 58, // 62: agent.SandboxAgent.Upgrade:output_type -> agent.UpgradeResponse- 35, // [35:63] is the sub-list for method output_type- 7, // [7:35] is the sub-list for method input_type+ 47, // 29: agent.SandboxAgent.ConfigureLogship:input_type -> agent.ConfigureLogshipRequest+ 49, // 30: agent.SandboxAgent.Shutdown:input_type -> agent.ShutdownRequest+ 51, // 31: agent.SandboxAgent.SyncFS:input_type -> agent.SyncFSRequest+ 53, // 32: agent.SandboxAgent.PrepareHibernate:input_type -> agent.PrepareHibernateRequest+ 55, // 33: agent.SandboxAgent.SetResourceLimits:input_type -> agent.SetResourceLimitsRequest+ 57, // 34: agent.SandboxAgent.GetVersion:input_type -> agent.GetVersionRequest+ 59, // 35: agent.SandboxAgent.Upgrade:input_type -> agent.UpgradeRequest+ 3, // 36: agent.SandboxAgent.Exec:output_type -> agent.ExecResponse+ 4, // 37: agent.SandboxAgent.ExecStream:output_type -> agent.ExecOutputChunk+ 6, // 38: agent.SandboxAgent.ReadFile:output_type -> agent.ReadFileResponse+ 8, // 39: agent.SandboxAgent.WriteFile:output_type -> agent.WriteFileResponse+ 10, // 40: agent.SandboxAgent.ReadFileStream:output_type -> agent.FileChunk+ 12, // 41: agent.SandboxAgent.WriteFileStream:output_type -> agent.WriteFileStreamResponse+ 15, // 42: agent.SandboxAgent.ListDir:output_type -> agent.ListDirResponse+ 17, // 43: agent.SandboxAgent.MakeDir:output_type -> agent.MakeDirResponse+ 19, // 44: agent.SandboxAgent.Remove:output_type -> agent.RemoveResponse+ 21, // 45: agent.SandboxAgent.Exists:output_type -> agent.ExistsResponse+ 23, // 46: agent.SandboxAgent.Stat:output_type -> agent.StatResponse+ 25, // 47: agent.SandboxAgent.Stats:output_type -> agent.StatsResponse+ 27, // 48: agent.SandboxAgent.Ping:output_type -> agent.PingResponse+ 29, // 49: agent.SandboxAgent.PTYCreate:output_type -> agent.PTYCreateResponse+ 31, // 50: agent.SandboxAgent.PTYResize:output_type -> agent.PTYResizeResponse+ 33, // 51: agent.SandboxAgent.PTYKill:output_type -> agent.PTYKillResponse+ 35, // 52: agent.SandboxAgent.PTYAttach:output_type -> agent.PTYOutput+ 37, // 53: agent.SandboxAgent.ExecSessionCreate:output_type -> agent.ExecSessionCreateResponse+ 39, // 54: agent.SandboxAgent.ExecSessionAttach:output_type -> agent.ExecSessionOutput+ 41, // 55: agent.SandboxAgent.ExecSessionList:output_type -> agent.ExecSessionListResponse+ 44, // 56: agent.SandboxAgent.ExecSessionKill:output_type -> agent.ExecSessionKillResponse+ 46, // 57: agent.SandboxAgent.SetEnvs:output_type -> agent.SetEnvsResponse+ 48, // 58: agent.SandboxAgent.ConfigureLogship:output_type -> agent.ConfigureLogshipResponse+ 50, // 59: agent.SandboxAgent.Shutdown:output_type -> agent.ShutdownResponse+ 52, // 60: agent.SandboxAgent.SyncFS:output_type -> agent.SyncFSResponse+ 54, // 61: agent.SandboxAgent.PrepareHibernate:output_type -> agent.PrepareHibernateResponse+ 56, // 62: agent.SandboxAgent.SetResourceLimits:output_type -> agent.SetResourceLimitsResponse+ 58, // 63: agent.SandboxAgent.GetVersion:output_type -> agent.GetVersionResponse+ 60, // 64: agent.SandboxAgent.Upgrade:output_type -> agent.UpgradeResponse+ 36, // [36:65] is the sub-list for method output_type+ 7, // [7:36] 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@@ -3317,7 +3433,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: 60,+ NumMessages: 62,NumExtensions: 0,NumServices: 1,},diff --git a/proto/agent/agent.proto b/proto/agent/agent.protoindex d99d3c6f..99130d67 100644--- a/proto/agent/agent.proto+++ b/proto/agent/agent.proto@@ -78,6 +78,13 @@ service SandboxAgent {// between the base OS env and per-command envs.rpc SetEnvs(SetEnvsRequest) returns (SetEnvsResponse);+ // ConfigureLogship sets sandbox session log-shipping configuration.+ // Worker calls this immediately after VM boot, before any user-facing+ // operations. Empty ingest_token disables shipping (kill-switch).+ // If never called, the agent's forwarder stays dormant — log events+ // queue in a bounded ring and are dropped oldest-first.+ rpc ConfigureLogship(ConfigureLogshipRequest) returns (ConfigureLogshipResponse);+// Shutdown gracefully terminates the agent and syncs disks.rpc Shutdown(ShutdownRequest) returns (ShutdownResponse);@@ -342,6 +349,17 @@ message SetEnvsRequest {message SetEnvsResponse {}+// --- Logship ---++message ConfigureLogshipRequest {+ string ingest_token = 1;+ string dataset = 2;+ string sandbox_id = 3;+ string org_id = 4;+}++message ConfigureLogshipResponse {}+// --- Shutdown ---message ShutdownRequest {}diff --git a/proto/agent/agent_grpc.pb.go b/proto/agent/agent_grpc.pb.goindex 39d04b42..a5396637 100644--- a/proto/agent/agent_grpc.pb.go+++ b/proto/agent/agent_grpc.pb.go@@ -1,7 +1,7 @@// Code generated by protoc-gen-go-grpc. DO NOT EDIT.// versions:// - protoc-gen-go-grpc v1.6.1-// - protoc v6.33.4+// - protoc v5.29.3// source: proto/agent/agent.protopackage agent@@ -41,6 +41,7 @@ const (SandboxAgent_ExecSessionList_FullMethodName = "/agent.SandboxAgent/ExecSessionList"SandboxAgent_ExecSessionKill_FullMethodName = "/agent.SandboxAgent/ExecSessionKill"SandboxAgent_SetEnvs_FullMethodName = "/agent.SandboxAgent/SetEnvs"+ SandboxAgent_ConfigureLogship_FullMethodName = "/agent.SandboxAgent/ConfigureLogship"SandboxAgent_Shutdown_FullMethodName = "/agent.SandboxAgent/Shutdown"SandboxAgent_SyncFS_FullMethodName = "/agent.SandboxAgent/SyncFS"SandboxAgent_PrepareHibernate_FullMethodName = "/agent.SandboxAgent/PrepareHibernate"@@ -53,8 +54,34 @@ const (//// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.//-// SandboxAgent runs inside each Firecracker microVM and handles-// exec, file ops, PTY, and stats over gRPC via vsock.+// SandboxAgent is the in-guest RPC surface. It runs as PID 1 (or under+// systemd) inside every sandbox VM and is reachable from the host worker+// over virtio-serial (Unix domain socket) or vsock.+//+// === STABILITY CONTRACT ===+// This proto is a stable, backward-compatible public API. Long-running+// sandboxes can live for weeks or months; their in-guest agent continues+// running whatever version was baked into the rootfs at sandbox-creation+// time. The worker must be able to talk to those old agents indefinitely.+//+// Allowed changes:+// - Adding new RPCs+// - Adding new optional fields to existing messages (with new field numbers)+// - Adding new enum values+//+// FORBIDDEN changes:+// - Removing or renaming RPCs, messages, fields, or enum values+// - Repurposing existing field numbers for different semantics+// - Making previously-optional fields required+// - Changing field types in a non-wire-compatible way+//+// New capabilities should prefer being implemented worker-side, composing+// Exec + file primitives, rather than adding a new agent RPC. An agent+// binary update requires the sandbox to be destroyed and recreated; there+// is intentionally no runtime upgrade path.+//+// See internal/qemu/manager.go "Runtime agent upgrade" comment for the+// full rationale on why we don't hot-upgrade.type SandboxAgentClient interface {// Exec runs a command and returns the result after completion.Exec(ctx context.Context, in *ExecRequest, opts ...grpc.CallOption) (*ExecResponse, error)@@ -91,6 +118,12 @@ type SandboxAgentClient interface {// These are injected into every subsequent Exec/ExecStream call,// between the base OS env and per-command envs.SetEnvs(ctx context.Context, in *SetEnvsRequest, opts ...grpc.CallOption) (*SetEnvsResponse, error)+ // ConfigureLogship sets sandbox session log-shipping configuration.+ // Worker calls this immediately after VM boot, before any user-facing+ // operations. Empty ingest_token disables shipping (kill-switch).+ // If never called, the agent's forwarder stays dormant — log events+ // queue in a bounded ring and are dropped oldest-first.+ ConfigureLogship(ctx context.Context, in *ConfigureLogshipRequest, opts ...grpc.CallOption) (*ConfigureLogshipResponse, error)// Shutdown gracefully terminates the agent and syncs disks.Shutdown(ctx context.Context, in *ShutdownRequest, opts ...grpc.CallOption) (*ShutdownResponse, error)// SyncFS flushes all filesystem buffers without exiting.@@ -366,6 +399,16 @@ func (c *sandboxAgentClient) SetEnvs(ctx context.Context, in *SetEnvsRequest, opreturn out, nil}+func (c *sandboxAgentClient) ConfigureLogship(ctx context.Context, in *ConfigureLogshipRequest, opts ...grpc.CallOption) (*ConfigureLogshipResponse, error) {+ cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)+ out := new(ConfigureLogshipResponse)+ err := c.cc.Invoke(ctx, SandboxAgent_ConfigureLogship_FullMethodName, in, out, cOpts...)+ if err != nil {+ return nil, err+ }+ return out, nil+}+func (c *sandboxAgentClient) Shutdown(ctx context.Context, in *ShutdownRequest, opts ...grpc.CallOption) (*ShutdownResponse, error) {cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)out := new(ShutdownResponse)@@ -430,8 +473,34 @@ func (c *sandboxAgentClient) Upgrade(ctx context.Context, in *UpgradeRequest, op// All implementations must embed UnimplementedSandboxAgentServer// for forward compatibility.//-// SandboxAgent runs inside each Firecracker microVM and handles-// exec, file ops, PTY, and stats over gRPC via vsock.+// SandboxAgent is the in-guest RPC surface. It runs as PID 1 (or under+// systemd) inside every sandbox VM and is reachable from the host worker+// over virtio-serial (Unix domain socket) or vsock.+//+// === STABILITY CONTRACT ===+// This proto is a stable, backward-compatible public API. Long-running+// sandboxes can live for weeks or months; their in-guest agent continues+// running whatever version was baked into the rootfs at sandbox-creation+// time. The worker must be able to talk to those old agents indefinitely.+//+// Allowed changes:+// - Adding new RPCs+// - Adding new optional fields to existing messages (with new field numbers)+// - Adding new enum values+//+// FORBIDDEN changes:+// - Removing or renaming RPCs, messages, fields, or enum values+// - Repurposing existing field numbers for different semantics+// - Making previously-optional fields required+// - Changing field types in a non-wire-compatible way+//+// New capabilities should prefer being implemented worker-side, composing+// Exec + file primitives, rather than adding a new agent RPC. An agent+// binary update requires the sandbox to be destroyed and recreated; there+// is intentionally no runtime upgrade path.+//+// See internal/qemu/manager.go "Runtime agent upgrade" comment for the+// full rationale on why we don't hot-upgrade.type SandboxAgentServer interface {// Exec runs a command and returns the result after completion.Exec(context.Context, *ExecRequest) (*ExecResponse, error)@@ -468,6 +537,12 @@ type SandboxAgentServer interface {// These are injected into every subsequent Exec/ExecStream call,// between the base OS env and per-command envs.SetEnvs(context.Context, *SetEnvsRequest) (*SetEnvsResponse, error)+ // ConfigureLogship sets sandbox session log-shipping configuration.+ // Worker calls this immediately after VM boot, before any user-facing+ // operations. Empty ingest_token disables shipping (kill-switch).+ // If never called, the agent's forwarder stays dormant — log events+ // queue in a bounded ring and are dropped oldest-first.+ ConfigureLogship(context.Context, *ConfigureLogshipRequest) (*ConfigureLogshipResponse, error)// Shutdown gracefully terminates the agent and syncs disks.Shutdown(context.Context, *ShutdownRequest) (*ShutdownResponse, error)// SyncFS flushes all filesystem buffers without exiting.@@ -562,6 +637,9 @@ func (UnimplementedSandboxAgentServer) ExecSessionKill(context.Context, *ExecSesfunc (UnimplementedSandboxAgentServer) SetEnvs(context.Context, *SetEnvsRequest) (*SetEnvsResponse, error) {return nil, status.Error(codes.Unimplemented, "method SetEnvs not implemented")}+func (UnimplementedSandboxAgentServer) ConfigureLogship(context.Context, *ConfigureLogshipRequest) (*ConfigureLogshipResponse, error) {+ return nil, status.Error(codes.Unimplemented, "method ConfigureLogship not implemented")+}func (UnimplementedSandboxAgentServer) Shutdown(context.Context, *ShutdownRequest) (*ShutdownResponse, error) {return nil, status.Error(codes.Unimplemented, "method Shutdown not implemented")}@@ -950,6 +1028,24 @@ func _SandboxAgent_SetEnvs_Handler(srv interface{}, ctx context.Context, dec funreturn interceptor(ctx, in, info, handler)}+func _SandboxAgent_ConfigureLogship_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {+ in := new(ConfigureLogshipRequest)+ if err := dec(in); err != nil {+ return nil, err+ }+ if interceptor == nil {+ return srv.(SandboxAgentServer).ConfigureLogship(ctx, in)+ }+ info := &grpc.UnaryServerInfo{+ Server: srv,+ FullMethod: SandboxAgent_ConfigureLogship_FullMethodName,+ }+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {+ return srv.(SandboxAgentServer).ConfigureLogship(ctx, req.(*ConfigureLogshipRequest))+ }+ return interceptor(ctx, in, info, handler)+}+func _SandboxAgent_Shutdown_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {in := new(ShutdownRequest)if err := dec(in); err != nil {@@ -1133,6 +1229,10 @@ var SandboxAgent_ServiceDesc = grpc.ServiceDesc{MethodName: "SetEnvs",Handler: _SandboxAgent_SetEnvs_Handler,},+ {+ MethodName: "ConfigureLogship",+ Handler: _SandboxAgent_ConfigureLogship_Handler,+ },{MethodName: "Shutdown",Handler: _SandboxAgent_Shutdown_Handler,