Versions in this module Expand all Collapse all v0 v0.5.0 Aug 18, 2026 Changes in this version + const BranchSummaryPreamble + const BranchSummaryPrompt + const SummarizationPrompt + const SummarizationSystemPrompt + const TurnPrefixSummarizationPrompt + const UpdateSummarizationPrompt + var DefaultCompactionSettings = CompactionSettings + func CalculateContextTokens(usage ai.Usage) int64 + func CompleteSimpleWithRetries(ctx context.Context, complete CompleteFunc, model *ai.Model, ...) (*ai.AssistantMessage, error) + func ContextMessages(entries []SessionEntry) engine.AgentMessages + func DecodeSessionV4Header(line []byte) (SessionV4Header, *SessionV4DecodeError) + func DecodeSessionV4Mutation(line []byte) (SessionV4Mutation, *SessionV4DecodeError) + func EstimateTokens(message engine.AgentMessage) int64 + func FindTurnStartIndex(entries []SessionEntry, entryIndex, startIndex int) int + func FormatFileOperations(readFiles, modifiedFiles []string) string + func FormatPromptTemplateInvocation(template PromptTemplate, args []string) string + func FormatSkillInvocation(skill Skill, additionalInstructions string) string + func GenerateSummary(ctx context.Context, messages engine.AgentMessages, model *ai.Model, ...) (string, error) + func LoadSourcedPromptTemplates[T any](env ResourceFileSystem, inputs []SourcedPromptTemplateInput[T], ...) ([]SourcedPromptTemplate[T], []SourcedPromptTemplateDiagnostic[T]) + func LoadSourcedSkills[T any](env ResourceFileSystem, inputs []SourcedSkillInput[T], ...) ([]SourcedSkill[T], []SourcedSkillDiagnostic[T]) + func MarshalSessionJSONL(storage SessionStorage, cwd string) ([]byte, error) + func MarshalSessionTreeEntry(entry SessionTreeEntry) ([]byte, error) + func MarshalSessionV4Header(header SessionV4Header) ([]byte, error) + func MarshalSessionV4Mutation(mutation SessionV4Mutation) ([]byte, error) + func SerializeConversation(messages engine.AgentMessages) string + func ShouldCompact(contextTokens int64, contextWindow float64, settings CompactionSettings) bool + type BashExecutionMessage struct + Cancelled bool + Command string + ExcludeFromContext *bool + ExitCode *int + FullOutputPath *string + Output string + Role string + Timestamp int64 + Truncated bool + type BranchPreparation struct + FileOps FileOperations + Messages engine.AgentMessages + TotalTokens int64 + func PrepareBranchEntries(entries []SessionEntry, tokenBudget float64) BranchPreparation + type BranchSummary struct + Details any + FromHook *bool + Summary string + Usage *ai.Usage + type BranchSummaryDetails struct + ModifiedFiles []string + ReadFiles []string + type BranchSummaryResult struct + ModifiedFiles []string + ReadFiles []string + Summary string + Usage *ai.Usage + func GenerateBranchSummary(ctx context.Context, entries []SessionEntry, ...) (*BranchSummaryResult, error) + type ByteSessionStorage interface + Bytes func() ([]byte, error) + HeaderJSON func() []byte + type CollectEntriesResult struct + CommonAncestorID *string + Entries []SessionEntry + func CollectEntriesForBranchSummary(entries []SessionEntry, oldLeafID *string, targetID string) (CollectEntriesResult, error) + type CompactionDetails struct + ModifiedFiles []string + ReadFiles []string + type CompactionPreparation struct + FileOps FileOperations + FirstKeptEntryID string + IsSplitTurn bool + MessagesToSummarize engine.AgentMessages + PreviousSummary *string + RetainedTail engine.AgentMessages + Settings CompactionSettings + TokensBefore int64 + TurnPrefixMessages engine.AgentMessages + func PrepareCompaction(pathEntries []SessionEntry, settings CompactionSettings) (*CompactionPreparation, error) + func PrepareLegacyCompaction(pathEntries []SessionEntry, settings CompactionSettings) (*CompactionPreparation, error) + func PrepareTreeCompaction(pathEntries []SessionTreeEntry, settings CompactionSettings) (*CompactionPreparation, error) + type CompactionResult struct + Details any + FirstKeptEntryID string + RetainedTail engine.AgentMessages + Summary string + TokensBefore int64 + Usage *ai.Usage + func Compact(ctx context.Context, preparation *CompactionPreparation, model *ai.Model, ...) (*CompactionResult, error) + func (result CompactionResult) MarshalJSON() ([]byte, error) + type CompactionSettings struct + Enabled bool + KeepRecentTokens int64 + ReserveTokens int64 + type CompleteFunc func(context.Context, *ai.Model, ai.Context, *ai.SimpleStreamOptions) (*ai.AssistantMessage, error) + func RetryingCompleteFunc(complete CompleteFunc, retry *ai.RetryPolicy, callbacks *ai.RetryCallbacks) CompleteFunc + type ContextEntryTransform func([]SessionTreeEntry) []SessionTreeEntry + type ContextUsage struct + ContextWindow float64 + Percent *float64 + Tokens *int64 + type ContextUsageEstimate struct + LastUsageIndex *int + Tokens int64 + TrailingTokens int64 + UsageTokens int64 + func EstimateContextTokens(messages engine.AgentMessages) ContextUsageEstimate + type CustomEntryContextMessageProjector func(SessionTreeEntry, int, []SessionTreeEntry) engine.AgentMessages + type CustomMessage struct + Content any + CustomType string + Details any + Display bool + Role string + Timestamp int64 + type CutPointResult struct + FirstKeptEntryIndex int + IsSplitTurn bool + TurnStartIndex int + func FindCutPoint(entries []SessionEntry, startIndex, endIndex int, keepRecentTokens int64) CutPointResult + type Events interface + On func(eventType HarnessEventType, listener HarnessEventListener) (unsubscribe func()) + type ExecOptions struct + CWD string + Env map[string]string + InheritEnv *bool + OnStderr func(string) error + OnStdout func(string) error + TimeoutSeconds *float64 + type ExecResult struct + ExitCode int + Stderr string + Stdout string + type ExecutionEnv interface + type ExecutionError struct + Code ExecutionErrorCode + Err error + func (err *ExecutionError) Error() string + func (err *ExecutionError) Unwrap() error + type ExecutionErrorCode string + const ExecutionErrorAborted + const ExecutionErrorCallback + const ExecutionErrorShellUnavailable + const ExecutionErrorSpawn + const ExecutionErrorTimeout + const ExecutionErrorUnknown + type FileError struct + Code FileErrorCode + Err error + Path string + func (err *FileError) Error() string + func (err *FileError) Unwrap() error + type FileErrorCode string + const FileErrorAborted + const FileErrorInvalid + const FileErrorIsDirectory + const FileErrorNotDirectory + const FileErrorNotFound + const FileErrorNotSupported + const FileErrorPermissionDenied + const FileErrorUnknown + type FileInfo struct + Kind FileKind + MTimeMS float64 + Name string + Path string + Size int64 + type FileKind string + const FileKindDirectory + const FileKindFile + const FileKindSymlink + type FileOperations struct + Edited map[string]struct{} + Read map[string]struct{} + Written map[string]struct{} + type FileSystem interface + AbsolutePath func(context.Context, string) (string, error) + AppendFile func(context.Context, string, []byte) error + CanonicalPath func(context.Context, string) (string, error) + Cleanup func() error + CreateDir func(context.Context, string, bool) error + CreateTempDir func(context.Context, string) (string, error) + CreateTempFile func(context.Context, string, string) (string, error) + Exists func(context.Context, string) (bool, error) + FileInfo func(context.Context, string) (FileInfo, error) + JoinPath func(context.Context, ...string) (string, error) + ListDir func(context.Context, string) ([]FileInfo, error) + ReadBinaryFile func(context.Context, string) ([]byte, error) + ReadTextFile func(context.Context, string) (string, error) + ReadTextLines func(context.Context, string, int) ([]string, error) + Remove func(context.Context, string, bool, bool) error + RenameFile func(context.Context, string, string) error + WorkingDirectory func() string + WriteFile func(context.Context, string, []byte) error + type ForkPosition string + const ForkAt + const ForkBefore + type GenerateBranchSummaryOptions struct + Callbacks *ai.RetryCallbacks + Complete CompleteFunc + CustomInstructions string + Model *ai.Model + ReplaceInstructions bool + ReserveTokens *int64 + Retry *ai.RetryPolicy + type HarnessEvent struct + Lane string + LeafID string + Outcome RunOutcome + RunID string + Type HarnessEventType + type HarnessEventBus struct + func (bus *HarnessEventBus) Emit(event HarnessEvent) + func (bus *HarnessEventBus) On(eventType HarnessEventType, listener HarnessEventListener) func() + type HarnessEventListener func(HarnessEvent) + type HarnessEventType string + const HarnessEventRunEnd + const HarnessEventRunStart + type HarnessEventWatch struct + func WatchHarnessEvents[TSnapshot any](bus *HarnessEventBus, capture func() TSnapshot) (TSnapshot, *HarnessEventWatch) + func (watch *HarnessEventWatch) Start(listener HarnessEventListener) + func (watch *HarnessEventWatch) Unsubscribe() + type HarnessPromptTemplatesResult struct + Diagnostics []PromptTemplateDiagnostic + PromptTemplates []PromptTemplate + func LoadPromptTemplates(env ResourceFileSystem, paths ...string) HarnessPromptTemplatesResult + type HarnessSkillsResult struct + Diagnostics []SkillDiagnostic + Skills []Skill + func LoadSkills(env ResourceFileSystem, dirs ...string) HarnessSkillsResult + type InMemorySessionRepo struct + func NewInMemorySessionRepo() *InMemorySessionRepo + func (repo *InMemorySessionRepo) Create(_ context.Context, options SessionCreateOptions) (*Session, error) + func (repo *InMemorySessionRepo) Delete(_ context.Context, metadata SessionMetadata) error + func (repo *InMemorySessionRepo) Fork(ctx context.Context, sourceMetadata SessionMetadata, ...) (*Session, error) + func (repo *InMemorySessionRepo) List(context.Context, SessionListOptions) ([]SessionMetadata, error) + func (repo *InMemorySessionRepo) Open(_ context.Context, metadata SessionMetadata) (*Session, error) + type InMemorySessionStorage struct + func NewInMemorySessionStorage(entries []SessionTreeEntry, metadata SessionMetadata) (*InMemorySessionStorage, error) + func (storage *InMemorySessionStorage) AppendEntry(entry SessionTreeEntry) error + func (storage *InMemorySessionStorage) CreateEntryID() (string, error) + func (storage *InMemorySessionStorage) Entries(options ...SessionEntryCursorOptions) []SessionTreeEntry + func (storage *InMemorySessionStorage) EntriesByType(entryType string) []SessionTreeEntry + func (storage *InMemorySessionStorage) Entry(id string) (*SessionTreeEntry, bool) + func (storage *InMemorySessionStorage) Label(id string) (string, bool) + func (storage *InMemorySessionStorage) LeafID() (*string, error) + func (storage *InMemorySessionStorage) Metadata() SessionMetadata + func (storage *InMemorySessionStorage) PathToRootOrCompaction(leafID *string) ([]SessionTreeEntry, error) + func (storage *InMemorySessionStorage) SessionName() (string, bool) + func (storage *InMemorySessionStorage) SessionStats() SessionStats + func (storage *InMemorySessionStorage) SetLeafID(leafID *string) error + type InMemorySessionV4Repo struct + Now func() int64 + func NewInMemorySessionV4Repo() *InMemorySessionV4Repo + func (repo *InMemorySessionV4Repo) Create(options SessionV4CreateOptions) (*InMemorySessionV4Storage, error) + func (repo *InMemorySessionV4Repo) Delete(metadata SessionV4Metadata) + func (repo *InMemorySessionV4Repo) Fork(source SessionV4Metadata, options SessionV4RepoForkOptions) (*InMemorySessionV4Storage, error) + func (repo *InMemorySessionV4Repo) List() []SessionV4Metadata + func (repo *InMemorySessionV4Repo) Open(metadata SessionV4Metadata) (*InMemorySessionV4Storage, error) + type InMemorySessionV4Storage struct + Now func() int64 + func NewInMemorySessionV4Storage(metadata SessionV4Metadata) *InMemorySessionV4Storage + func (storage *InMemorySessionV4Storage) AppendEntry(payload json.RawMessage, lane string) (SessionV4Entry, error) + func (storage *InMemorySessionV4Storage) AppendRecord(payload json.RawMessage) (SessionV4Record, error) + func (storage *InMemorySessionV4Storage) ClearName() error + func (storage *InMemorySessionV4Storage) CreateLane(lane string, at *string) error + func (storage *InMemorySessionV4Storage) Entry(id string) (SessionV4Entry, bool) + func (storage *InMemorySessionV4Storage) FindEntries(query SessionV4EntryQuery) ([]SessionV4Entry, error) + func (storage *InMemorySessionV4Storage) FindEntriesOnBranch(query SessionV4BranchQuery) ([]SessionV4Entry, error) + func (storage *InMemorySessionV4Storage) FindOpenOperations(lane string, limit *int) ([]SessionV4Record, error) + func (storage *InMemorySessionV4Storage) FindRecords(query SessionV4RecordQuery) ([]SessionV4Record, error) + func (storage *InMemorySessionV4Storage) Label(id string) (string, bool) + func (storage *InMemorySessionV4Storage) Lanes() []SessionV4LanePointer + func (storage *InMemorySessionV4Storage) Log(options SessionV4LogOptions) ([]SessionV4LogItem, error) + func (storage *InMemorySessionV4Storage) Metadata() SessionV4Metadata + func (storage *InMemorySessionV4Storage) MoveLane(lane string, to *string) error + func (storage *InMemorySessionV4Storage) Name() (string, bool) + func (storage *InMemorySessionV4Storage) SetLabel(id string, label *string) error + func (storage *InMemorySessionV4Storage) SetName(name string) error + func (storage *InMemorySessionV4Storage) Stats() SessionStats + type JSONLSessionRepo struct + FS FileSystem + SessionsRoot string + func NewJSONLSessionRepo(fileSystem FileSystem, sessionsRoot string) *JSONLSessionRepo + func (repo *JSONLSessionRepo) Create(ctx context.Context, options SessionCreateOptions) (*Session, error) + func (repo *JSONLSessionRepo) Delete(ctx context.Context, metadata SessionMetadata) error + func (repo *JSONLSessionRepo) Fork(ctx context.Context, sourceMetadata SessionMetadata, ...) (*Session, error) + func (repo *JSONLSessionRepo) ImportJSONL(ctx context.Context, content []byte) (*Session, error) + func (repo *JSONLSessionRepo) ImportJSONLAt(ctx context.Context, content []byte, path string) (*Session, error) + func (repo *JSONLSessionRepo) List(ctx context.Context, options SessionListOptions) ([]SessionMetadata, error) + func (repo *JSONLSessionRepo) Open(ctx context.Context, metadata SessionMetadata) (*Session, error) + func (repo *JSONLSessionRepo) OpenPath(ctx context.Context, path string) (*Session, error) + func (repo *JSONLSessionRepo) OpenRuntimeBytes(ctx context.Context, path string, content []byte) (*Session, error) + func (repo *JSONLSessionRepo) OpenRuntimePath(ctx context.Context, path, cwd string) (*Session, error) + type JSONLSessionStorage struct + func RehydrateJSONLSession(content []byte, filePath string) (*JSONLSessionStorage, error) + func (storage *JSONLSessionStorage) AppendEntry(entry SessionTreeEntry) error + func (storage *JSONLSessionStorage) Bytes() ([]byte, error) + func (storage *JSONLSessionStorage) CreateEntryID() (string, error) + func (storage *JSONLSessionStorage) Entries(options ...SessionEntryCursorOptions) []SessionTreeEntry + func (storage *JSONLSessionStorage) EntriesByType(entryType string) []SessionTreeEntry + func (storage *JSONLSessionStorage) Entry(id string) (*SessionTreeEntry, bool) + func (storage *JSONLSessionStorage) HeaderJSON() []byte + func (storage *JSONLSessionStorage) IsPersistent() bool + func (storage *JSONLSessionStorage) Label(id string) (string, bool) + func (storage *JSONLSessionStorage) LeafID() (*string, error) + func (storage *JSONLSessionStorage) Metadata() SessionMetadata + func (storage *JSONLSessionStorage) PathToRootOrCompaction(leafID *string) ([]SessionTreeEntry, error) + func (storage *JSONLSessionStorage) SessionName() (string, bool) + func (storage *JSONLSessionStorage) SessionStats() SessionStats + func (storage *JSONLSessionStorage) SessionVersion() float64 + func (storage *JSONLSessionStorage) SetLeafID(leafID *string) error + type JSONLSessionV4CreateOptions struct + CWD string + Metadata json.RawMessage + type JSONLSessionV4ForkOptions struct + type JSONLSessionV4Metadata struct + CWD string + CreatedAt int64 + ID string + LegacyParentSessionPath *string + Metadata json.RawMessage + ModifiedAt float64 + ParentSessionID *string + Path string + SourceFormat int + func ListJSONLSessionV4Metadata(ctx context.Context, fs FileSystem, sessionsRoot string, cwd *string) ([]JSONLSessionV4Metadata, error) + type JSONLSessionV4Repo struct + Now func() int64 + func NewJSONLSessionV4Repo(fs FileSystem, sessionsRoot string) *JSONLSessionV4Repo + func (repo *JSONLSessionV4Repo) Create(ctx context.Context, options JSONLSessionV4CreateOptions) (*JSONLSessionV4Storage, error) + func (repo *JSONLSessionV4Repo) Delete(ctx context.Context, metadata JSONLSessionV4Metadata) error + func (repo *JSONLSessionV4Repo) Fork(ctx context.Context, source JSONLSessionV4Metadata, ...) (*JSONLSessionV4Storage, error) + func (repo *JSONLSessionV4Repo) List(ctx context.Context, cwd *string) ([]JSONLSessionV4Metadata, error) + func (repo *JSONLSessionV4Repo) Open(ctx context.Context, metadata JSONLSessionV4Metadata) (*JSONLSessionV4Storage, error) + type JSONLSessionV4Storage struct + Now func() int64 + func CreateJSONLSessionV4Storage(ctx context.Context, fs FileSystem, path string, header SessionV4Header) (*JSONLSessionV4Storage, error) + func LoadJSONLSessionV4Storage(ctx context.Context, fs FileSystem, path string) (*JSONLSessionV4Storage, error) + func OpenJSONLSessionV4Storage(ctx context.Context, fs FileSystem, sessionsRoot string, ...) (*JSONLSessionV4Storage, error) + func (storage *JSONLSessionV4Storage) AppendEntry(payload json.RawMessage, lane string) (SessionV4Entry, error) + func (storage *JSONLSessionV4Storage) AppendRecord(payload json.RawMessage) (SessionV4Record, error) + func (storage *JSONLSessionV4Storage) ClearName() error + func (storage *JSONLSessionV4Storage) CreateLane(lane string, at *string) error + func (storage *JSONLSessionV4Storage) Entry(id string) (SessionV4Entry, bool) + func (storage *JSONLSessionV4Storage) FindEntries(query SessionV4EntryQuery) ([]SessionV4Entry, error) + func (storage *JSONLSessionV4Storage) FindEntriesOnBranch(query SessionV4BranchQuery) ([]SessionV4Entry, error) + func (storage *JSONLSessionV4Storage) FindOpenOperations(lane string, limit *int) ([]SessionV4Record, error) + func (storage *JSONLSessionV4Storage) FindRecords(query SessionV4RecordQuery) ([]SessionV4Record, error) + func (storage *JSONLSessionV4Storage) Fork(ctx context.Context, path string, header SessionV4Header, ...) (*JSONLSessionV4Storage, error) + func (storage *JSONLSessionV4Storage) Label(id string) (string, bool) + func (storage *JSONLSessionV4Storage) Lanes() []SessionV4LanePointer + func (storage *JSONLSessionV4Storage) Log(options SessionV4LogOptions) ([]SessionV4LogItem, error) + func (storage *JSONLSessionV4Storage) Metadata() JSONLSessionV4Metadata + func (storage *JSONLSessionV4Storage) MoveLane(lane string, to *string) error + func (storage *JSONLSessionV4Storage) Name() (string, bool) + func (storage *JSONLSessionV4Storage) SetLabel(id string, label *string) error + func (storage *JSONLSessionV4Storage) SetName(name string) error + func (storage *JSONLSessionV4Storage) Stats() SessionStats + type LocalExecutionEnv = NodeExecutionEnv + type NodeExecutionEnv struct + CWD string + ShellEnv map[string]string + ShellPath string + func (env *NodeExecutionEnv) AbsolutePath(ctx context.Context, path string) (string, error) + func (env *NodeExecutionEnv) AppendFile(ctx context.Context, path string, content []byte) error + func (env *NodeExecutionEnv) CanonicalPath(ctx context.Context, path string) (string, error) + func (env *NodeExecutionEnv) Cleanup() error + func (env *NodeExecutionEnv) CreateDir(ctx context.Context, path string, recursive bool) error + func (env *NodeExecutionEnv) CreateTempDir(ctx context.Context, prefix string) (string, error) + func (env *NodeExecutionEnv) CreateTempFile(ctx context.Context, prefix, suffix string) (string, error) + func (env *NodeExecutionEnv) Exec(ctx context.Context, command string, options ExecOptions) (ExecResult, error) + func (env *NodeExecutionEnv) Exists(ctx context.Context, path string) (bool, error) + func (env *NodeExecutionEnv) FileInfo(ctx context.Context, path string) (FileInfo, error) + func (env *NodeExecutionEnv) JoinPath(ctx context.Context, parts ...string) (string, error) + func (env *NodeExecutionEnv) ListDir(ctx context.Context, path string) ([]FileInfo, error) + func (env *NodeExecutionEnv) ReadBinaryFile(ctx context.Context, path string) ([]byte, error) + func (env *NodeExecutionEnv) ReadTextFile(ctx context.Context, path string) (string, error) + func (env *NodeExecutionEnv) ReadTextLines(ctx context.Context, path string, maxLines int) ([]string, error) + func (env *NodeExecutionEnv) Remove(ctx context.Context, path string, recursive, force bool) error + func (env *NodeExecutionEnv) RenameFile(ctx context.Context, from, to string) error + func (env *NodeExecutionEnv) ResourceCanonicalPath(path string) (string, error) + func (env *NodeExecutionEnv) ResourceFileInfo(path string) (FileInfo, error) + func (env *NodeExecutionEnv) ResourceListDir(path string) ([]FileInfo, error) + func (env *NodeExecutionEnv) ResourceReadTextFile(path string) (string, error) + func (env *NodeExecutionEnv) WorkingDirectory() string + func (env *NodeExecutionEnv) WriteFile(ctx context.Context, path string, content []byte) error + func (env *NodeExecutionEnv) WriteFileExclusive(ctx context.Context, path string, content []byte) error + type PromptTemplate struct + Content string + Description string + Name string + type PromptTemplateDiagnostic struct + Code PromptTemplateDiagnosticCode + Message string + Path string + Type string + type PromptTemplateDiagnosticCode string + const PromptTemplateDiagnosticFileInfoFailed + const PromptTemplateDiagnosticListFailed + const PromptTemplateDiagnosticParseFailed + const PromptTemplateDiagnosticReadFailed + type ResourceFileSystem interface + ResourceCanonicalPath func(path string) (string, error) + ResourceFileInfo func(path string) (FileInfo, error) + ResourceListDir func(path string) ([]FileInfo, error) + ResourceReadTextFile func(path string) (string, error) + type RunOutcome string + const RunAborted + const RunCompleted + const RunFailed + type Session struct + func NewSession(storage SessionStorage, options ...SessionContextBuildOptions) *Session + func (session *Session) AppendActiveToolsChange(toolNames []string) (string, error) + func (session *Session) AppendCompaction(summary, firstKeptEntryID string, tokensBefore float64, details any, ...) (string, error) + func (session *Session) AppendCompactionWithTail(summary, firstKeptEntryID string, tokensBefore float64, details any, ...) (string, error) + func (session *Session) AppendCustom(customType string, data ...any) (string, error) + func (session *Session) AppendCustomMessage(customType string, content any, display bool, details ...any) (string, error) + func (session *Session) AppendLabel(targetID string, label *string) (string, error) + func (session *Session) AppendMessage(message any) (string, error) + func (session *Session) AppendModelChange(provider, modelID string) (string, error) + func (session *Session) AppendName(name string) (string, error) + func (session *Session) AppendThinkingLevelChange(level string) (string, error) + func (session *Session) Branch(fromID ...string) ([]SessionTreeEntry, error) + func (session *Session) Context(options ...SessionContextBuildOptions) (SessionContext, error) + func (session *Session) ContextEntries(options ...SessionContextBuildOptions) ([]SessionTreeEntry, error) + func (session *Session) Entries(options ...SessionEntryCursorOptions) []SessionTreeEntry + func (session *Session) Entry(id string) (*SessionTreeEntry, bool) + func (session *Session) Label(id string) (string, bool) + func (session *Session) LeafID() (*string, error) + func (session *Session) Metadata() SessionMetadata + func (session *Session) MoveTo(entryID *string, summary *BranchSummary) (string, error) + func (session *Session) Name() (string, bool, error) + func (session *Session) Stats() SessionStats + func (session *Session) Storage() SessionStorage + type SessionContext struct + ActiveToolNames []string + Messages []any + Model *SessionModel + ThinkingLevel string + func BuildSessionContext(entries []SessionTreeEntry, options ...SessionContextBuildOptions) SessionContext + func BuildSessionV4Context(pathEntries []SessionV4Entry, options ...SessionV4ContextOptions) SessionContext + type SessionContextBuildOptions struct + EntryProjectors map[string]CustomEntryContextMessageProjector + EntryTransforms []ContextEntryTransform + type SessionCreateOptions struct + CWD string + ID string + Metadata json.RawMessage + ParentSessionPath *string + type SessionEntry struct + Content any + CustomType string + Details any + Display bool + FirstKeptEntryID string + FromHook bool + FromID string + ID string + Message engine.AgentMessage + ParentID *string + RetainedTail engine.AgentMessages + Summary string + Timestamp string + TokensBefore float64 + Type string + Usage *ai.Usage + type SessionEntryCursorOptions struct + AfterEntrySeq int + Limit *int + type SessionError struct + Code SessionErrorCode + Err error + func (failure *SessionError) Error() string + func (failure *SessionError) Unwrap() error + type SessionErrorCode string + const SessionErrorAlreadyExists + const SessionErrorInvalidEntry + const SessionErrorInvalidFork + const SessionErrorInvalidLane + const SessionErrorInvalidPayload + const SessionErrorInvalidQuery + const SessionErrorInvalidSession + const SessionErrorNotFound + const SessionErrorStorage + const SessionErrorUnknown + type SessionForkOptions struct + EntryID string + Position ForkPosition + type SessionListOptions struct + CWD string + type SessionMetadata struct + CWD string + CreatedAt string + ID string + Metadata json.RawMessage + ParentSessionPath *string + Path string + type SessionModel struct + ModelID string + Provider string + type SessionRepo interface + Create func(context.Context, SessionCreateOptions) (*Session, error) + Delete func(context.Context, SessionMetadata) error + Fork func(context.Context, SessionMetadata, SessionForkOptions) (*Session, error) + List func(context.Context, SessionListOptions) ([]SessionMetadata, error) + Open func(context.Context, SessionMetadata) (*Session, error) + type SessionStats struct + CachedTokens float64 + CostTotal float64 + MessageCount int + TotalTokens float64 + UncachedTokens float64 + type SessionStorage interface + AppendEntry func(SessionTreeEntry) error + CreateEntryID func() (string, error) + Entries func(...SessionEntryCursorOptions) []SessionTreeEntry + EntriesByType func(string) []SessionTreeEntry + Entry func(string) (*SessionTreeEntry, bool) + Label func(string) (string, bool) + LeafID func() (*string, error) + Metadata func() SessionMetadata + PathToRootOrCompaction func(*string) ([]SessionTreeEntry, error) + SessionName func() (string, bool) + SessionStats func() SessionStats + SetLeafID func(*string) error + type SessionTreeEntry struct + ActiveToolNames []string + Content json.RawMessage + CustomType string + Data json.RawMessage + Details json.RawMessage + Display bool + FirstKeptEntryID string + FromHook *bool + FromID string + HasTargetID bool + ID string + Label *string + Message json.RawMessage + ModelID string + Name string + ParentID *string + Provider string + RetainedTail []json.RawMessage + Summary string + TargetID *string + ThinkingLevel string + Timestamp string + TokensBefore float64 + Type string + Usage *ai.Usage + func BuildContextEntries(entries []SessionTreeEntry, options ...SessionContextBuildOptions) []SessionTreeEntry + func DefaultContextEntryTransform(entries []SessionTreeEntry) []SessionTreeEntry + func EntriesToFork(storage SessionStorage, entryID string, position ForkPosition) ([]SessionTreeEntry, error) + func ParseSessionTreeEntry(data []byte) (SessionTreeEntry, error) + func (entry SessionTreeEntry) RawJSON() json.RawMessage + type SessionV4 struct + func NewSessionV4(storage SessionV4Storage, nextID ...func() string) *SessionV4 + func (session *SessionV4) AppendCustomEntry(customType string, data json.RawMessage, lane ...string) (string, error) + func (session *SessionV4) AppendMessage(message json.RawMessage) (string, error) + func (session *SessionV4) FindEntryOnBranch(query SessionV4BranchQuery, lane ...string) (*SessionV4Entry, error) + func (session *SessionV4) LeafID(lane ...string) (*string, error) + func (session *SessionV4) Stats() SessionStats + type SessionV4BranchQuery struct + Start string + StopAtID string + StopAtType string + type SessionV4ContextOptions struct + EntryProjectors map[string]SessionV4ContextProjector + EntryTransforms []SessionV4ContextTransform + type SessionV4ContextProjector func(SessionV4Entry, int, []SessionV4Entry) engine.AgentMessages + type SessionV4ContextTransform func([]SessionV4Entry) []SessionV4Entry + type SessionV4CreateOptions struct + ID *string + ParentSessionID *string + type SessionV4DecodeError struct + Kind SessionV4DecodeErrorKind + Message string + func (failure *SessionV4DecodeError) Error() string + type SessionV4DecodeErrorKind string + const SessionV4DecodeSchema + const SessionV4DecodeSyntax + type SessionV4Entry struct + ActiveToolNames []string + CustomType string + Data json.RawMessage + Details json.RawMessage + FromID string + ID string + Message json.RawMessage + ModelID string + ParentID *string + Provider string + RetainedTail []json.RawMessage + Seq int + Summary string + ThinkingLevel string + Timestamp int64 + TokensBefore float64 + Type string + func DefaultSessionV4ContextTransform(pathEntries []SessionV4Entry) []SessionV4Entry + func ParseSessionV4Entry(data []byte) (SessionV4Entry, error) + func (entry SessionV4Entry) MarshalJSON() ([]byte, error) + type SessionV4EntryQuery struct + AfterSeq *int + CustomType string + Limit *int + Order string + Type string + type SessionV4ForkOptions struct + EntryID *string + Position ForkPosition + Scope string + type SessionV4Header struct + CWD string + CreatedAt int64 + ID string + LegacyParentSessionPath *string + Metadata json.RawMessage + ParentSessionID *string + func ParseSessionV4Header(line []byte, path string) (SessionV4Header, error) + type SessionV4LanePointer struct + Lane string + LeafID *string + type SessionV4LogItem struct + Entry *SessionV4Entry + Fact string + Kind string + Label *string + Lane string + LeafID *string + Name string + NameCleared bool + Record *SessionV4Record + Seq int + TargetID string + func (item SessionV4LogItem) MarshalJSON() ([]byte, error) + type SessionV4LogOptions struct + AfterSeq *int + Limit *int + type SessionV4Metadata struct + CreatedAt int64 + ID string + ParentSessionID *string + type SessionV4Mutation struct + Entry *SessionV4Entry + EntryLane *string + Fact string + Kind string + Label *string + Lane string + LeafID *string + Name string + NameCleared bool + Record *SessionV4Record + Seq int + TargetID string + func ParseSessionV4Mutation(line []byte, path string, lineNumber int) (SessionV4Mutation, error) + type SessionV4NameClearer interface + ClearName func() error + type SessionV4Record struct + ID string + IntentKind string + Lane string + RunID string + Seq int + Timestamp int64 + Type string + Usage *SessionV4Usage + func (record SessionV4Record) MarshalJSON() ([]byte, error) + type SessionV4RecordQuery struct + AfterSeq *int + Lane string + Limit *int + OperationKind string + Order string + RunID string + Type string + type SessionV4RepoForkOptions struct + type SessionV4Storage interface + AppendEntry func(payload json.RawMessage, lane string) (SessionV4Entry, error) + AppendRecord func(payload json.RawMessage) (SessionV4Record, error) + CreateLane func(lane string, at *string) error + Entry func(id string) (SessionV4Entry, bool) + FindEntries func(query SessionV4EntryQuery) ([]SessionV4Entry, error) + FindEntriesOnBranch func(query SessionV4BranchQuery) ([]SessionV4Entry, error) + FindOpenOperations func(lane string, limit *int) ([]SessionV4Record, error) + FindRecords func(query SessionV4RecordQuery) ([]SessionV4Record, error) + Label func(id string) (string, bool) + Lanes func() []SessionV4LanePointer + Log func(options SessionV4LogOptions) ([]SessionV4LogItem, error) + MoveLane func(lane string, to *string) error + Name func() (string, bool) + SetLabel func(id string, label *string) error + SetName func(name string) error + Stats func() SessionStats + type SessionV4Usage struct + CacheRead float64 + CacheWrite float64 + CostTotal float64 + Input float64 + Output float64 + TotalTokens float64 + type Shell interface + Cleanup func() error + Exec func(context.Context, string, ExecOptions) (ExecResult, error) + type Skill struct + Content string + Description string + DisableModelInvocation bool + FilePath string + Name string + type SkillDiagnostic struct + Code SkillDiagnosticCode + Message string + Path string + Type string + type SkillDiagnosticCode string + const SkillDiagnosticFileInfoFailed + const SkillDiagnosticInvalidMeta + const SkillDiagnosticListFailed + const SkillDiagnosticParseFailed + const SkillDiagnosticReadFailed + type SourcedPromptTemplate struct + PromptTemplate PromptTemplate + Source T + type SourcedPromptTemplateDiagnostic struct + Source T + type SourcedPromptTemplateInput struct + Path string + Source T + type SourcedSkill struct + Skill Skill + Source T + type SourcedSkillDiagnostic struct + Source T + type SourcedSkillInput struct + Path string + Source T + type SummaryMessage struct + FromID string + Role string + Summary string + Timestamp int64 + TokensBefore float64 + type SummaryResult struct + Text string + Usage ai.Usage + func GenerateSummaryWithUsage(ctx context.Context, messages engine.AgentMessages, model *ai.Model, ...) (*SummaryResult, error)