Documentation
¶
Index ¶
- Constants
- func NewCommands(_ CommandsConfig, deps CommandsDeps) (agentkit.CommandProvider, error)
- func NewJSONL(cfg JSONLConfig) (agentkit.Session, error)
- func NewMemory(cfg MemoryConfig) (agentkit.Session, error)
- func NewStatic(_ StaticConfig, deps StaticDeps) (agentkit.SessionStore, error)
- func NewStore(cfg StoreConfig, deps StoreDeps) (agentkit.SessionStore, error)
- func ScanSessionFile(path string, maxLoadedEvents int) ([]agentkit.SessionEvent, agentkit.EventSeq, bool, error)
- func TrimCompacted(s agentkit.Session, agentID agentkit.AgentID, beforeSeq agentkit.EventSeq)
- func WorkDir(storeDir string, id agentkit.SessionID) (string, error)
- type ActiveSessionData
- type Commands
- type CommandsConfig
- type CommandsDeps
- type FileBacked
- type JSONL
- func (s *JSONL) Append(ctx context.Context, event agentkit.SessionEvent) (agentkit.EventSeq, error)
- func (s *JSONL) DeriveMessages(ctx context.Context) ([]agentkit.ModelMessage, error)
- func (s *JSONL) FilePath() string
- func (s *JSONL) ID() agentkit.SessionID
- func (s *JSONL) LatestSeq() agentkit.EventSeq
- func (s *JSONL) Read(ctx context.Context, from agentkit.EventSeq) ([]agentkit.SessionEvent, error)
- type JSONLConfig
- type Memory
- func (s *Memory) Append(_ context.Context, event agentkit.SessionEvent) (agentkit.EventSeq, error)
- func (s *Memory) DeriveMessages(ctx context.Context) ([]agentkit.ModelMessage, error)
- func (s *Memory) ID() agentkit.SessionID
- func (s *Memory) LatestSeq() agentkit.EventSeq
- func (s *Memory) Read(_ context.Context, from agentkit.EventSeq) ([]agentkit.SessionEvent, error)
- type MemoryConfig
- type SessionRuntimeData
- type StaticConfig
- type StaticDeps
- type StaticStore
- func (s *StaticStore) ActiveSession(ctx context.Context, id agentkit.SessionID) (agentkit.SessionID, error)
- func (s *StaticStore) AgentBind(ctx context.Context, id agentkit.SessionID) (agentkit.AgentID, error)
- func (s *StaticStore) Get(_ context.Context, id agentkit.SessionID) (agentkit.Session, error)
- func (s *StaticStore) ModelBind(ctx context.Context, id agentkit.SessionID) (string, error)
- func (s *StaticStore) SetActiveSession(ctx context.Context, id, active agentkit.SessionID) error
- func (s *StaticStore) SetAgentBind(ctx context.Context, id agentkit.SessionID, agent agentkit.AgentID) error
- func (s *StaticStore) SetModelBind(ctx context.Context, id agentkit.SessionID, model string) error
- type Store
- func (s *Store) ActiveSession(ctx context.Context, id agentkit.SessionID) (agentkit.SessionID, error)
- func (s *Store) AgentBind(ctx context.Context, id agentkit.SessionID) (agentkit.AgentID, error)
- func (s *Store) Get(ctx context.Context, id agentkit.SessionID) (agentkit.Session, error)
- func (s *Store) ModelBind(ctx context.Context, id agentkit.SessionID) (string, error)
- func (s *Store) SetActiveSession(ctx context.Context, id, active agentkit.SessionID) error
- func (s *Store) SetAgentBind(ctx context.Context, id agentkit.SessionID, agent agentkit.AgentID) error
- func (s *Store) SetModelBind(ctx context.Context, id agentkit.SessionID, model string) error
- type StoreConfig
- type StoreDeps
Constants ¶
const TenantToolWorkDir = "work"
TenantToolWorkDir is the L0 default work subtree name; runtime code should use workspace.Layout.
Variables ¶
This section is empty.
Functions ¶
func NewCommands ¶
func NewCommands(_ CommandsConfig, deps CommandsDeps) (agentkit.CommandProvider, error)
NewCommands registers session/commands: Session lifecycle slash commands backed by SessionStore.
func NewJSONL ¶
func NewJSONL(cfg JSONLConfig) (agentkit.Session, error)
NewJSONL registers session/jsonl: Append-only JSONL event log for one session.
Best practices:
- Reopening a file resumes event sequence numbering, so seq stays unique across restarts.
func NewMemory ¶
func NewMemory(cfg MemoryConfig) (agentkit.Session, error)
NewMemory registers session/memory: Ephemeral in-memory session. Nothing survives the process.
func NewStatic ¶
func NewStatic(_ StaticConfig, deps StaticDeps) (agentkit.SessionStore, error)
NewStatic registers session/static: Wrap one pre-built Session as a store that returns it for every id.
Best practices:
- For tests and single-session hosts; every session id maps to the same log.
func NewStore ¶
func NewStore(cfg StoreConfig, deps StoreDeps) (agentkit.SessionStore, error)
NewStore registers session/store: Resolve durable JSONL sessions by id.
func ScanSessionFile ¶
func ScanSessionFile(path string, maxLoadedEvents int) ([]agentkit.SessionEvent, agentkit.EventSeq, bool, error)
ScanSessionFile loads one session JSONL file, folding compacted history the same way the store does. maxLoadedEvents <= 0 loads every retained event. Exported for the session index, which reads the same on-disk format.
func TrimCompacted ¶
TrimCompacted drops model-visible history superseded by a compaction marker.
Types ¶
type ActiveSessionData ¶
type Commands ¶
type Commands struct {
// contains filtered or unexported fields
}
Commands contributes session lifecycle slash commands (/new, /session).
type CommandsConfig ¶
type CommandsConfig struct{}
type CommandsDeps ¶
type CommandsDeps struct {
SessionStore agentkit.SessionStore `json:"sessionStore"`
}
type FileBacked ¶
type FileBacked interface {
FilePath() string
}
FileBacked is implemented by sessions that persist to a file path.
type JSONL ¶
type JSONL struct {
// contains filtered or unexported fields
}
JSONL persists session events as append-only JSON lines.
func (*JSONL) DeriveMessages ¶
type JSONLConfig ¶
type JSONLConfig struct {
// Path is the log file itself, not a directory.
Path string `json:"path"`
// ID is fixed session id.
ID agentkit.SessionID `json:"id"`
// MaxLoadedEvents limits non-compaction events kept in memory on load. Zero loads the full file.
MaxLoadedEvents int `json:"maxLoadedEvents"`
}
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
Memory is an in-memory session backend for tests and ephemeral runs.
func (*Memory) DeriveMessages ¶
type MemoryConfig ¶
type SessionRuntimeData ¶
type SessionRuntimeData struct {
AgentID agentkit.AgentID `json:"agentId,omitempty"`
Model string `json:"model,omitempty"`
}
SessionRuntimeData holds per-session dynamic overrides (agent route, LLM model).
type StaticConfig ¶
type StaticConfig struct{}
type StaticDeps ¶
type StaticStore ¶
type StaticStore struct {
// contains filtered or unexported fields
}
StaticStore returns one Session for matching IDs. Useful for CLI presets and tests where a single session instance is wired through pluginkit.
func NewStaticStore ¶
func NewStaticStore(sess agentkit.Session) *StaticStore
func (*StaticStore) ActiveSession ¶
func (*StaticStore) SetActiveSession ¶
func (*StaticStore) SetAgentBind ¶
func (*StaticStore) SetModelBind ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store opens one JSONL session file per SessionID under Dir. Suitable for IM platforms where each channel/thread maps to a distinct session.
func (*Store) ActiveSession ¶
func (*Store) SetActiveSession ¶
func (*Store) SetAgentBind ¶
type StoreConfig ¶
type StoreConfig struct {
// Dir is root directory holding one file per session, resolved through the workspace.
Dir string `json:"dir"`
// MaxCachedSessions limits in-memory hot sessions (LRU). Zero keeps every opened session cached.
MaxCachedSessions int `json:"maxCachedSessions"`
// CacheIdleTTL evicts sessions unused for this duration (for example "30m"). Empty disables idle eviction.
CacheIdleTTL string `json:"cacheIdleTTL"`
// MaxLoadedEvents limits non-compaction events kept in memory per session on load. Zero loads the full file.
MaxLoadedEvents int `json:"maxLoadedEvents"`
}