agentsessions

package
v0.0.0-...-8acab51 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProfileVerifyMessageCodeProfileVerified = publicagentcore.ProfileVerifyMessageCodeProfileVerified
	ProfileHealthMessageCodeRuntimeHealthy  = publicagentcore.ProfileHealthMessageCodeRuntimeHealthy
)

Variables

View Source
var (
	ErrBuiltinProfileDeleteDenied = errors.New("built-in profiles cannot be deleted")
	ErrProfileInUse               = errors.New("agent profile is still used by one or more sessions")
)
View Source
var (
	ErrUnsupportedProtocol = publicagentcore.ErrUnsupportedProtocol
	ErrProfileNotFound     = publicagentcore.ErrProfileNotFound
	ErrSessionNotFound     = publicagentcore.ErrSessionNotFound
	ErrRunNotFound         = publicagentcore.ErrRunNotFound
)

Functions

This section is empty.

Types

type A2ARuntime

type A2ARuntime struct {
	// contains filtered or unexported fields
}

func NewA2ARuntime

func NewA2ARuntime(logger *zap.Logger) *A2ARuntime

func (*A2ARuntime) CancelRun

func (r *A2ARuntime) CancelRun(ctx context.Context, session ExternalSession, run ExternalRun) error

func (*A2ARuntime) CloseSession

func (r *A2ARuntime) CloseSession(_ context.Context, _ AgentProfile, session ExternalSession) error

func (*A2ARuntime) EnsureSession

func (*A2ARuntime) Health

func (r *A2ARuntime) Health(ctx context.Context, profile AgentProfile) (*ProfileHealthResult, error)

func (*A2ARuntime) StreamRun

func (*A2ARuntime) SubmitRun

func (r *A2ARuntime) SubmitRun(ctx context.Context, req SubmitRunRequest) (*SubmitRunResult, error)

func (*A2ARuntime) VerifyProfile

func (r *A2ARuntime) VerifyProfile(ctx context.Context, profile AgentProfile) (*ProfileVerifyResult, error)

type ACPRuntime

type ACPRuntime struct {
	// contains filtered or unexported fields
}

func NewACPRuntime

func NewACPRuntime(authority ClientAuthority, logger *zap.Logger, credentials CredentialResolver) *ACPRuntime

func (*ACPRuntime) CancelRun

func (r *ACPRuntime) CancelRun(ctx context.Context, session ExternalSession, _ ExternalRun) error

func (*ACPRuntime) CloseSession

func (r *ACPRuntime) CloseSession(_ context.Context, _ AgentProfile, session ExternalSession) error

func (*ACPRuntime) EnsureSession

func (*ACPRuntime) Health

func (r *ACPRuntime) Health(ctx context.Context, profile AgentProfile) (*ProfileHealthResult, error)

func (*ACPRuntime) StreamRun

func (*ACPRuntime) SubmitRun

func (r *ACPRuntime) SubmitRun(ctx context.Context, req SubmitRunRequest) (*SubmitRunResult, error)

func (*ACPRuntime) VerifyProfile

func (r *ACPRuntime) VerifyProfile(ctx context.Context, profile AgentProfile) (*ProfileVerifyResult, error)

type AgentProfile

type AgentProfile = publicagentcore.AgentProfile

type ClientAuthority

type ClientAuthority = publicagentcore.ClientAuthority

type CreateSessionParams

type CreateSessionParams struct {
	ProfileID      string                 `json:"profile_id"`
	UserID         string                 `json:"user_id,omitempty"`
	Name           string                 `json:"name,omitempty"`
	CWD            string                 `json:"cwd,omitempty"`
	InitialMessage string                 `json:"initial_message,omitempty"`
	Metadata       map[string]interface{} `json:"metadata,omitempty"`
}

type CredentialResolver

type CredentialResolver interface {
	Materialize(ctx context.Context, profile AgentProfile) (*MaterializedCredentials, error)
}

type EnsureSessionRequest

type EnsureSessionRequest = publicagentcore.EnsureSessionRequest

type EnsureSessionResult

type EnsureSessionResult = publicagentcore.EnsureSessionResult

type ExternalRun

type ExternalRun = publicagentcore.ExternalRun

type ExternalSession

type ExternalSession = publicagentcore.ExternalSession

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(service *Service) *Handler

func (*Handler) CancelSession

func (h *Handler) CancelSession(c echo.Context) error

func (*Handler) CloseSession

func (h *Handler) CloseSession(c echo.Context) error

func (*Handler) CreateSession

func (h *Handler) CreateSession(c echo.Context) error

func (*Handler) DeleteProfile

func (h *Handler) DeleteProfile(c echo.Context) error

func (*Handler) GetHistory

func (h *Handler) GetHistory(c echo.Context) error

func (*Handler) GetSession

func (h *Handler) GetSession(c echo.Context) error

func (*Handler) HealthProfile

func (h *Handler) HealthProfile(c echo.Context) error

func (*Handler) ListProfiles

func (h *Handler) ListProfiles(c echo.Context) error

func (*Handler) ListSessions

func (h *Handler) ListSessions(c echo.Context) error

func (*Handler) RegisterProfileRoutes

func (h *Handler) RegisterProfileRoutes(g *echo.Group)

func (*Handler) RegisterRoutes

func (h *Handler) RegisterRoutes(g *echo.Group)

func (*Handler) RegisterSessionRoutes

func (h *Handler) RegisterSessionRoutes(g *echo.Group)

func (*Handler) SaveProfile

func (h *Handler) SaveProfile(c echo.Context) error

func (*Handler) SendMessage

func (h *Handler) SendMessage(c echo.Context) error

func (*Handler) StreamEvents

func (h *Handler) StreamEvents(c echo.Context) error

func (*Handler) VerifyProfile

func (h *Handler) VerifyProfile(c echo.Context) error

type MaterializedCredentials

type MaterializedCredentials struct {
	Env     map[string]string
	Cleanup func() error
}

type OAuthCredentialSource

type OAuthCredentialSource interface {
	GetTokens(providerID string) ([]*oauth.Token, error)
	GetAccessTokenByID(providerID, tokenID string) (string, error)
}

type ProfileHealthResult

type ProfileHealthResult = publicagentcore.ProfileHealthResult

type ProfileVerifyResult

type ProfileVerifyResult = publicagentcore.ProfileVerifyResult

type ProtocolKind

type ProtocolKind = publicagentcore.ProtocolKind

func ParseProtocolKind

func ParseProtocolKind(raw string) (ProtocolKind, error)

type ProtocolRuntime

type ProtocolRuntime = publicagentcore.ProtocolAdapter

type ProviderPoolCredentialResolver

type ProviderPoolCredentialResolver struct {
	// contains filtered or unexported fields
}

func NewProviderPoolCredentialResolver

func NewProviderPoolCredentialResolver(
	getOAuthSource func() OAuthCredentialSource,
	lookupAPIKey func(providerID string) (string, error),
	logger *zap.Logger,
) *ProviderPoolCredentialResolver

func (*ProviderPoolCredentialResolver) Materialize

type RunEvent

type RunEvent = publicagentcore.RunEvent

type RuntimeEvent

type RuntimeEvent = publicagentcore.RuntimeEvent

type RuntimeStream

type RuntimeStream = publicagentcore.RuntimeStream

type SQLiteStore

type SQLiteStore struct {
	// contains filtered or unexported fields
}

func NewSQLiteStore

func NewSQLiteStore(db *sql.DB) (*SQLiteStore, error)

func NewSQLiteStoreWithReadDB

func NewSQLiteStoreWithReadDB(writeDB, readDB *sql.DB) (*SQLiteStore, error)

func (*SQLiteStore) AppendEvent

func (s *SQLiteStore) AppendEvent(sessionID, runID, eventType string, payload interface{}) (*RunEvent, error)

func (*SQLiteStore) BuildHistory

func (s *SQLiteStore) BuildHistory(sessionID string, limit int) ([]SessionHistoryItem, error)

func (*SQLiteStore) DeleteProfile

func (s *SQLiteStore) DeleteProfile(id string) error

func (*SQLiteStore) GetProfile

func (s *SQLiteStore) GetProfile(id string) (*AgentProfile, error)

func (*SQLiteStore) GetRun

func (s *SQLiteStore) GetRun(id string) (*ExternalRun, error)

func (*SQLiteStore) GetSession

func (s *SQLiteStore) GetSession(id string) (*ExternalSession, error)

func (*SQLiteStore) LatestActiveRun

func (s *SQLiteStore) LatestActiveRun(sessionID string) (*ExternalRun, error)

func (*SQLiteStore) ListEvents

func (s *SQLiteStore) ListEvents(sessionID string, limit int, afterID int64) ([]RunEvent, error)

func (*SQLiteStore) ListProfiles

func (s *SQLiteStore) ListProfiles() ([]AgentProfile, error)

func (*SQLiteStore) ListRuns

func (s *SQLiteStore) ListRuns(sessionID string, limit int) ([]ExternalRun, error)

func (*SQLiteStore) ListSessions

func (s *SQLiteStore) ListSessions(limit, offset int, userID string, protocol ProtocolKind) ([]ExternalSession, error)

func (*SQLiteStore) ListSessionsByProfileID

func (s *SQLiteStore) ListSessionsByProfileID(profileID string) ([]ExternalSession, error)

func (*SQLiteStore) SaveProfile

func (s *SQLiteStore) SaveProfile(profile *AgentProfile) error

func (*SQLiteStore) SaveRun

func (s *SQLiteStore) SaveRun(run *ExternalRun) error

func (*SQLiteStore) SaveSession

func (s *SQLiteStore) SaveSession(session *ExternalSession) error

func (*SQLiteStore) WithTx

func (s *SQLiteStore) WithTx(ctx context.Context, fn func(tx *sql.Tx) error) error

type SendMessageParams

type SendMessageParams struct {
	SessionID string `json:"session_id"`
	Message   string `json:"message"`
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(store *SQLiteStore, logger *zap.Logger, runtimes map[ProtocolKind]ProtocolRuntime) (*Service, error)

func (*Service) CancelSession

func (s *Service) CancelSession(ctx context.Context, sessionID string) error

func (*Service) CloseSession

func (s *Service) CloseSession(ctx context.Context, sessionID string) error

func (*Service) CreateSession

func (s *Service) CreateSession(ctx context.Context, params CreateSessionParams) (*SessionDetail, error)

func (*Service) DeleteProfile

func (s *Service) DeleteProfile(id string) error

func (*Service) GetProfile

func (s *Service) GetProfile(id string) (*AgentProfile, error)

func (*Service) GetSessionDetail

func (s *Service) GetSessionDetail(sessionID string, historyLimit int) (*SessionDetail, error)

func (*Service) GetSessionHistory

func (s *Service) GetSessionHistory(sessionID string, limit int) ([]SessionHistoryItem, error)

func (*Service) HealthProfile

func (s *Service) HealthProfile(ctx context.Context, id string) (*ProfileHealthResult, error)

func (*Service) ListEvents

func (s *Service) ListEvents(sessionID string, limit int, afterID int64) ([]RunEvent, error)

func (*Service) ListProfiles

func (s *Service) ListProfiles() ([]AgentProfile, error)

func (*Service) ListSessions

func (s *Service) ListSessions(limit, offset int, userID string, protocol ProtocolKind) ([]ExternalSession, error)

func (*Service) SaveProfile

func (s *Service) SaveProfile(profile *AgentProfile) error

func (*Service) SeedBuiltinProfiles

func (s *Service) SeedBuiltinProfiles() error

func (*Service) SendMessage

func (s *Service) SendMessage(ctx context.Context, params SendMessageParams) (*ExternalRun, error)

func (*Service) SubscribeSession

func (s *Service) SubscribeSession(sessionID string) (<-chan RunEvent, func())

func (*Service) VerifyProfile

func (s *Service) VerifyProfile(ctx context.Context, id string, candidate *AgentProfile) (*ProfileVerifyResult, error)

type SessionDetail

type SessionDetail struct {
	Session   ExternalSession      `json:"session"`
	Profile   *AgentProfile        `json:"profile,omitempty"`
	ActiveRun *ExternalRun         `json:"active_run,omitempty"`
	History   []SessionHistoryItem `json:"history,omitempty"`
}

type SessionHistoryItem

type SessionHistoryItem = publicagentcore.SessionHistoryItem

type StreamRunRequest

type StreamRunRequest = publicagentcore.StreamRunRequest

type SubmitRunRequest

type SubmitRunRequest = publicagentcore.SubmitRunRequest

type SubmitRunResult

type SubmitRunResult = publicagentcore.SubmitRunResult

Jump to

Keyboard shortcuts

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