agentstorage

package
v0.0.54 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DefaultAgentRunner string `json:"default_agent_runner"`
	DefaultModel       string `json:"default_model"`
	LastSession        string `json:"last_session"`
}

Config persisted at config.json under the store home.

type Message

type Message struct {
	ID        string `json:"id"`
	Text      string `json:"text"`
	SessionID string `json:"session_id"`
	CreatedAt string `json:"created_at"`
}

Message is a queued user follow-up in messages.jsonl.

type Session

type Session struct {
	Meta SessionMeta
}

Session wraps session metadata for API consumers.

type SessionMeta

type SessionMeta struct {
	Runner            string `json:"runner"`
	SessionID         string `json:"session_id"`
	InitialPrompt     string `json:"initial_prompt,omitempty"`
	RunnerSessionID   string `json:"runner_session_id,omitempty"`
	TerminalSessionID string `json:"terminal_session_id,omitempty"`
	Status            string `json:"status"`
	Workspace         string `json:"workspace,omitempty"`
	Model             string `json:"model,omitempty"`
	CreatedAt         string `json:"created_at,omitempty"`
	UpdatedAt         string `json:"updated_at,omitempty"`
}

SessionMeta is stored in sessions/<runner>/<session_id>/meta.json.

func (*SessionMeta) UnmarshalJSON added in v0.0.43

func (m *SessionMeta) UnmarshalJSON(data []byte) error

type Store

type Store interface {
	Home() string
	Config() (Config, error)
	SaveConfig(Config) error
	ListSessions(runner string) ([]SessionMeta, error)
	ClearAllSessions() error
	GetSession(runner, sessionID string) (*Session, error)
	CreateSession(runner, sessionID string, meta SessionMeta) error
	UpdateSessionStatus(runner, sessionID, status string) error
	UpdateSessionRunnerSessionID(runner, sessionID, runnerSessionID string) error
	UpdateSessionTerminalSessionID(runner, sessionID, terminalSessionID string) error
	AppendEvent(runner, sessionID string, ev types.AgentEvent) error
	ReadEvents(runner, sessionID string, afterOffset int64) ([]types.AgentEvent, int64, error)
	AppendMessage(runner, sessionID, text string) (Message, error)
	PopMessages(runner, sessionID string) ([]Message, error)
	ListMessages(runner, sessionID string) ([]Message, error)
}

Store is the durable agent-run storage contract.

func NewFileStore

func NewFileStore(home string) (Store, error)

NewFileStore opens the default file-backed store. AGENT_RUN_HOME overrides home.

Jump to

Keyboard shortcuts

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