server

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApprovalResult

type ApprovalResult struct {
	Approved bool
	Remember bool
	Reason   string
}

ApprovalResult is the outcome of an approval decision.

type ContextHandleData

type ContextHandleData struct {
	HandleID  string
	Type      string
	Data      []byte
	CreatedAt time.Time
}

ContextHandleData stores the actual data for a context handle.

type PendingApproval

type PendingApproval struct {
	ExecutionID string
	AgentID     string
	Tool        string
	Parameters  map[string]string
	CreatedAt   time.Time
	ResultChan  chan ApprovalResult
}

PendingApproval represents a tool execution awaiting approval.

type Server

type Server struct {
	acppb.UnimplementedAgentCommunicationServer
	// contains filtered or unexported fields
}

Server implements the Zed ACP gRPC service.

func NewServer

func NewServer(coord *coordinator.Coordinator, models *model.Manager, cfg *config.Config, store *storage.Store) (*Server, error)

NewServer creates a new ACP gRPC server

func (*Server) ApplyEdits

ApplyEdits applies editor-supplied text edits to files under the project root.

func (*Server) ApproveToolExecution

func (s *Server) ApproveToolExecution(_ context.Context, req *acppb.ToolApproval) (*emptypb.Empty, error)

ApproveToolExecution approves a pending tool execution request.

func (*Server) CreateContextHandle

func (s *Server) CreateContextHandle(_ context.Context, req *acppb.ContextHandleRequest) (*acppb.ContextHandle, error)

CreateContextHandle stores context data and returns a handle for later retrieval.

func (*Server) CreatePendingApproval

func (s *Server) CreatePendingApproval(executionID, agentID, tool string, params map[string]string) chan ApprovalResult

CreatePendingApproval creates a pending approval entry for human-in-the-loop tool execution. The executionID should be cryptographically random to prevent guessing attacks.

func (*Server) CreateSession

func (s *Server) CreateSession(_ context.Context, req *acppb.CreateSessionRequest) (*acppb.Session, error)

CreateSession creates a lightweight session record for chat routing.

func (*Server) DeleteContextHandle

func (s *Server) DeleteContextHandle(handleID string) bool

DeleteContextHandle removes a context handle from storage.

func (*Server) DiscoverAgents

DiscoverAgents proxies to the coordinator.

func (*Server) EstablishP2PConnection

func (s *Server) EstablishP2PConnection(ctx context.Context, req *acppb.P2PHandshake) (*acppb.P2PConnectionInfo, error)

EstablishP2PConnection sets up a P2P communication channel between agents.

func (*Server) GetAgentInfo

func (s *Server) GetAgentInfo(ctx context.Context, req *acppb.GetAgentInfoRequest) (*acppb.AgentInfo, error)

GetAgentInfo returns info about a registered agent.

func (*Server) GetP2PEndpoint

func (s *Server) GetP2PEndpoint(ctx context.Context, req *acppb.P2PEndpointRequest) (*acppb.P2PEndpoint, error)

GetP2PEndpoint returns the message bus endpoint for direct agent communication.

func (*Server) GetPendingApprovals

func (s *Server) GetPendingApprovals() []*PendingApproval

GetPendingApprovals returns all pending approval requests (useful for UI).

func (*Server) GetServerCapabilities

func (s *Server) GetServerCapabilities(_ context.Context, _ *emptypb.Empty) (*acppb.ServerCapabilities, error)

GetServerCapabilities returns advertised capabilities.

func (*Server) ProposeEdits

ProposeEdits generates editor-ready edits using the execution model. Strategy: focus on the active document/selection; return a single ProposedEdit that either replaces the current selection or the whole file.

func (*Server) RegisterAgent

RegisterAgent handles agent registration requests

func (*Server) RejectToolExecution

func (s *Server) RejectToolExecution(_ context.Context, req *acppb.ToolRejection) (*emptypb.Empty, error)

RejectToolExecution rejects a pending tool execution request.

func (*Server) RequestCapabilities

func (s *Server) RequestCapabilities(ctx context.Context, req *acppb.CapabilityRequest) (*acppb.CapabilityGrant, error)

RequestCapabilities grants requested capabilities and stores the grant for later revocation.

func (*Server) RequestToolExecution

RequestToolExecution acknowledges tool execution requests.

func (*Server) ResolveContextHandle

func (s *Server) ResolveContextHandle(_ context.Context, req *acppb.ContextHandle) (*acppb.ContextData, error)

ResolveContextHandle retrieves the stored data for a context handle.

func (*Server) RevokeCapabilities

func (s *Server) RevokeCapabilities(_ context.Context, req *acppb.CapabilityRevocation) (*emptypb.Empty, error)

RevokeCapabilities revokes a previously issued capability grant.

func (*Server) SendMessage

SendMessage handles a simple request/response for editor integrations.

func (*Server) SetMessageBus

func (s *Server) SetMessageBus(b bus.MessageBus)

SetMessageBus configures the server to use a specific message bus.

func (*Server) SetTaskHistory

func (s *Server) SetTaskHistory(h agent.TaskHistory)

SetTaskHistory configures the server to use a specific task history store.

func (*Server) StreamAuthInterceptor

func (s *Server) StreamAuthInterceptor(srv interface{}, stream grpc.ServerStream, _ *grpc.StreamServerInfo, handler grpc.StreamHandler) error

StreamAuthInterceptor enforces mTLS identity for streaming RPCs.

func (*Server) StreamInlineCompletions

StreamInlineCompletions streams inline suggestions using the execution model.

func (*Server) StreamTask

StreamTask returns a simple streamed response for Zed bridge.

func (*Server) SubscribeTaskEvents

SubscribeTaskEvents streams task events from the message bus.

func (*Server) UnaryAuthInterceptor

func (s *Server) UnaryAuthInterceptor(ctx context.Context, req interface{}, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error)

UnaryAuthInterceptor enforces mTLS identity and injects claims.

func (*Server) UnregisterAgent

func (s *Server) UnregisterAgent(ctx context.Context, req *acppb.UnregisterAgentRequest) (*emptypb.Empty, error)

UnregisterAgent handles agent unregistration

func (*Server) UpdateEditorState

UpdateEditorState returns lightweight status for editor gutters/status bars.

func (*Server) UpdateSessionContext

func (s *Server) UpdateSessionContext(_ context.Context, req *acppb.ContextDelta) (*emptypb.Empty, error)

UpdateSessionContext stores context delta (added/removed files and metadata) for a session.

type SessionContext

type SessionContext struct {
	SessionID string
	Files     map[string]bool // file paths currently in context
	Metadata  map[string]string
	UpdatedAt time.Time
}

SessionContext tracks files and metadata for a session.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL