Documentation
¶
Index ¶
- Constants
- Variables
- func BashExecutionText(command string, options BashExecutionTextOptions) string
- func BranchSummaryText(summary string) string
- func CalculateContextTokens(usage llm.Usage) int
- func CompactionSummaryText(summary string) string
- func ConvertToLLM(messages []llm.Message) []llm.Message
- func EstimateTokens(message llm.Message) int
- func FindTurnStartIndex(entries []Entry, index, minIndex int) int
- func FormatPromptTemplateInvocation(template PromptTemplate, args []string) string
- func FormatSkillInvocation(skill Skill, additionalInstructions string) string
- func FormatSkillsForSystemPrompt(skills []Skill) string
- func GenerateSummary(ctx context.Context, messages []llm.Message, model llm.Model, maxTokens int, ...) (string, error)
- func GenerateTurnPrefixSummary(ctx context.Context, messages []llm.Message, model llm.Model, ...) (string, error)
- func GetLastAssistantUsage(entries []Entry) *llm.Usage
- func MessageExcludedFromContext(message llm.Message) bool
- func ParseCommandArgs(input string) []string
- func ResetUUIDv7ForTest()
- func SanitizeBinaryOutput(str string) string
- func SerializeConversation(messages []llm.Message) string
- func ShouldCompact(contextTokens, contextWindow int, settings CompactionSettings) bool
- func SubstituteArgs(content string, args []string) string
- func TruncateLine(line string, maxChars int) (string, bool)
- func UUIDv7() string
- func UUIDv7With(randomBytes RandomBytesFunc, nowMillis NowMillisFunc) string
- type AgentHarness
- func (h *AgentHarness) Abort(ctx context.Context) (clearedSteer, clearedFollowUp []llm.Message, err error)
- func (h *AgentHarness) AppendMessage(message llm.Message) error
- func (h *AgentHarness) Compact(ctx context.Context, customInstructions string) (CompactionResult, error)
- func (h *AgentHarness) FollowUp(ctx context.Context, text string, images ...llm.ContentPart) error
- func (h *AgentHarness) GetFollowUpMode() string
- func (h *AgentHarness) GetModel() llm.Model
- func (h *AgentHarness) GetResources() AgentHarnessResources
- func (h *AgentHarness) GetSteeringMode() string
- func (h *AgentHarness) GetStreamOptions() AgentHarnessStreamOptions
- func (h *AgentHarness) GetThinkingLevel() string
- func (h *AgentHarness) NavigateTree(ctx context.Context, targetID string, options NavigateTreeOptions) (NavigateTreeResult, error)
- func (h *AgentHarness) NextTurn(ctx context.Context, text string, images ...llm.ContentPart) error
- func (h *AgentHarness) On(eventType string, handler AgentHarnessHandler) func()
- func (h *AgentHarness) Phase() string
- func (h *AgentHarness) Prompt(ctx context.Context, text string, images ...llm.ContentPart) (llm.Message, error)
- func (h *AgentHarness) PromptFromTemplate(ctx context.Context, name string, args []string) (llm.Message, error)
- func (h *AgentHarness) Session() *Session
- func (h *AgentHarness) SetActiveTools(toolNames []string) error
- func (h *AgentHarness) SetFollowUpMode(mode string)
- func (h *AgentHarness) SetModel(ctx context.Context, model llm.Model) error
- func (h *AgentHarness) SetResources(ctx context.Context, resources AgentHarnessResources) error
- func (h *AgentHarness) SetSteeringMode(mode string)
- func (h *AgentHarness) SetStreamOptions(options AgentHarnessStreamOptions)
- func (h *AgentHarness) SetThinkingLevel(ctx context.Context, level string) error
- func (h *AgentHarness) SetTools(tools []core.AgentTool, activeToolNames ...string) error
- func (h *AgentHarness) Skill(ctx context.Context, name, additionalInstructions string) (llm.Message, error)
- func (h *AgentHarness) Steer(ctx context.Context, text string, images ...llm.ContentPart) error
- func (h *AgentHarness) Subscribe(listener AgentHarnessSubscriber) func()
- func (h *AgentHarness) WaitForIdle(ctx context.Context) error
- type AgentHarnessAuth
- type AgentHarnessError
- type AgentHarnessEvent
- type AgentHarnessHandler
- type AgentHarnessHookResult
- type AgentHarnessOptions
- type AgentHarnessResources
- type AgentHarnessStreamOptions
- type AgentHarnessStreamOptionsPatch
- type AgentHarnessSubscriber
- type BashExecutionTextOptions
- type BranchPreparation
- type BranchSummaryError
- type BranchSummaryOptions
- type BranchSummaryResult
- type CapturedShellResult
- type CollectEntriesResult
- type CompactOptions
- type CompactionError
- type CompactionPreparation
- type CompactionResult
- type CompactionSettings
- type ContextTokenEstimate
- type CreateDirOptions
- type CutPoint
- type Entry
- type ExecOptions
- type ExecResult
- type ExecutionEnv
- type ExecutionError
- type FileError
- type FileInfo
- type FileOps
- type FileSystem
- type InMemorySessionRepo
- func (r *InMemorySessionRepo) Create(id string) (*Session, error)
- func (r *InMemorySessionRepo) Delete(metadata SessionMetadata)
- func (r *InMemorySessionRepo) Fork(sourceMetadata SessionMetadata, id string, entryID *string, includeEntry bool) (*Session, error)
- func (r *InMemorySessionRepo) List() []SessionMetadata
- func (r *InMemorySessionRepo) Open(metadata SessionMetadata) (*Session, error)
- type InMemorySessionStorage
- func (s *InMemorySessionStorage) AppendEntry(entry Entry) error
- func (s *InMemorySessionStorage) CreateEntryID() string
- func (s *InMemorySessionStorage) Entries() []Entry
- func (s *InMemorySessionStorage) Entry(id string) (Entry, bool)
- func (s *InMemorySessionStorage) FindEntries(entryType string) []Entry
- func (s *InMemorySessionStorage) Label(id string) (string, bool)
- func (s *InMemorySessionStorage) LeafID() (string, bool, error)
- func (s *InMemorySessionStorage) Metadata() SessionMetadata
- func (s *InMemorySessionStorage) PathToRoot(leafID *string) ([]Entry, error)
- func (s *InMemorySessionStorage) SetLeafID(leafID *string) error
- type JsonlSessionRepo
- func (r *JsonlSessionRepo) Create(cwd, id string) (*Session, error)
- func (r *JsonlSessionRepo) Delete(metadata SessionMetadata) error
- func (r *JsonlSessionRepo) Fork(sourceMetadata SessionMetadata, cwd, id string, entryID *string, ...) (*Session, error)
- func (r *JsonlSessionRepo) List(cwd string) ([]SessionMetadata, error)
- func (r *JsonlSessionRepo) Open(metadata SessionMetadata) (*Session, error)
- type JsonlSessionStorage
- func (s *JsonlSessionStorage) AppendEntry(entry Entry) error
- func (s *JsonlSessionStorage) CreateEntryID() string
- func (s *JsonlSessionStorage) Entries() []Entry
- func (s *JsonlSessionStorage) Entry(id string) (Entry, bool)
- func (s *JsonlSessionStorage) FindEntries(entryType string) []Entry
- func (s *JsonlSessionStorage) Label(id string) (string, bool)
- func (s *JsonlSessionStorage) LeafID() (string, bool, error)
- func (s *JsonlSessionStorage) Metadata() SessionMetadata
- func (s *JsonlSessionStorage) PathToRoot(leafID *string) ([]Entry, error)
- func (s *JsonlSessionStorage) SetLeafID(leafID *string) error
- type LoadSkillsOptions
- type LocalExecutionEnv
- type LocalExecutionOption
- type NavigateTreeOptions
- type NavigateTreeResult
- type NowMillisFunc
- type Optional
- type PromptTemplate
- type PromptTemplateDiagnostic
- type PromptTemplateResult
- type RandomBytesFunc
- type RemoveOptions
- type Session
- func (s *Session) AppendCompaction(summary, firstKeptEntryID string, tokensBefore int, details ...any) (string, error)
- func (s *Session) AppendCompactionWithOptions(summary, firstKeptEntryID string, tokensBefore int, ...) (string, error)
- func (s *Session) AppendCustomMessageEntry(customType string, content any, display bool, details any) (string, error)
- func (s *Session) AppendLabel(targetID, label string) (string, error)
- func (s *Session) AppendMessage(message llm.Message) (string, error)
- func (s *Session) AppendModelChange(provider, modelID string) (string, error)
- func (s *Session) AppendSessionName(name string) (string, error)
- func (s *Session) AppendThinkingLevelChange(level string) (string, error)
- func (s *Session) Branch(fromID *string) ([]Entry, error)
- func (s *Session) BuildContext() (SessionContext, error)
- func (s *Session) Entries() []Entry
- func (s *Session) Entry(id string) (Entry, bool)
- func (s *Session) Label(id string) (string, bool)
- func (s *Session) LeafID() (*string, error)
- func (s *Session) Metadata() SessionMetadata
- func (s *Session) MoveTo(entryID *string, summary string, details ...any) (*string, error)
- func (s *Session) MoveToWithOptions(entryID *string, summary string, options SessionEntryOptions) (*string, error)
- func (s *Session) SessionName() (string, bool)
- func (s *Session) Storage() SessionStorage
- type SessionContext
- type SessionEntryOptions
- type SessionError
- type SessionMetadata
- type SessionStorage
- type Shell
- type Skill
- type SkillDiagnostic
- type SkillResult
- type SourcedPromptTemplate
- type SourcedPromptTemplateResult
- type SourcedSkill
- type SourcedSkillResult
- type SystemPromptContext
- type TempFileOptions
- type TruncationOptions
- type TruncationResult
Constants ¶
View Source
const ( AgentHarnessPhaseIdle = "idle" AgentHarnessPhaseTurn = "turn" AgentHarnessPhaseCompaction = "compaction" AgentHarnessPhaseBranchSummary = "branch_summary" )
View Source
const ( FileKindFile = harnessenv.FileKindFile FileKindDirectory = harnessenv.FileKindDirectory FileKindSymlink = harnessenv.FileKindSymlink FileErrorAborted = harnessenv.FileErrorAborted FileErrorNotFound = harnessenv.FileErrorNotFound FileErrorPermissionDenied = harnessenv.FileErrorPermissionDenied FileErrorNotDirectory = harnessenv.FileErrorNotDirectory FileErrorIsDirectory = harnessenv.FileErrorIsDirectory FileErrorInvalid = harnessenv.FileErrorInvalid FileErrorNotSupported = harnessenv.FileErrorNotSupported FileErrorUnknown = harnessenv.FileErrorUnknown ExecutionErrorAborted = harnessenv.ExecutionErrorAborted ExecutionErrorTimeout = harnessenv.ExecutionErrorTimeout ExecutionErrorSpawnError = harnessenv.ExecutionErrorSpawnError ExecutionErrorCallbackError = harnessenv.ExecutionErrorCallbackError ExecutionErrorUnknown = harnessenv.ExecutionErrorUnknown )
View Source
const ( DefaultMaxLines = utils.DefaultMaxLines DefaultMaxBytes = utils.DefaultMaxBytes GrepMaxLineLength = utils.GrepMaxLineLength TruncatedByLines = utils.TruncatedByLines TruncatedByBytes = utils.TruncatedByBytes TruncatedByNothing = utils.TruncatedByNothing )
View Source
const ( CompactionErrorAborted = "aborted" CompactionErrorSummarizationFailed = "summarization_failed" CompactionErrorInvalidSession = "invalid_session" CompactionErrorUnknown = "unknown" BranchSummaryErrorAborted = "aborted" BranchSummaryErrorSummarizationFailed = "summarization_failed" BranchSummaryErrorInvalidSession = "invalid_session" BranchSummaryErrorUnknown = "unknown" )
View Source
const BranchSummaryPrefix = `The following is a summary of a branch that this conversation came back from:
<summary>
`
View Source
const BranchSummarySuffix = `</summary>`
View Source
const CompactionSummaryPrefix = `The conversation history before this point was compacted into the following summary:
<summary>
`
View Source
const CompactionSummarySuffix = `
</summary>`
Variables ¶
View Source
var DefaultCompactionSettings = CompactionSettings{Enabled: true, ReserveTokens: 16_384, KeepRecentTokens: 20_000}
Functions ¶
func BashExecutionText ¶
func BashExecutionText(command string, options BashExecutionTextOptions) string
func BranchSummaryText ¶
func CalculateContextTokens ¶
func CompactionSummaryText ¶
func EstimateTokens ¶
func FindTurnStartIndex ¶
func FormatPromptTemplateInvocation ¶
func FormatPromptTemplateInvocation(template PromptTemplate, args []string) string
func FormatSkillInvocation ¶
func GenerateSummary ¶
func GetLastAssistantUsage ¶
func ParseCommandArgs ¶
func ResetUUIDv7ForTest ¶
func ResetUUIDv7ForTest()
func SanitizeBinaryOutput ¶
func SerializeConversation ¶
func ShouldCompact ¶
func ShouldCompact(contextTokens, contextWindow int, settings CompactionSettings) bool
func SubstituteArgs ¶
func UUIDv7With ¶
func UUIDv7With(randomBytes RandomBytesFunc, nowMillis NowMillisFunc) string
Types ¶
type AgentHarness ¶
type AgentHarness struct {
Env any
// contains filtered or unexported fields
}
func MustNewAgentHarness ¶
func MustNewAgentHarness(options AgentHarnessOptions) *AgentHarness
func NewAgentHarness ¶
func NewAgentHarness(options AgentHarnessOptions) (*AgentHarness, error)
func (*AgentHarness) AppendMessage ¶
func (h *AgentHarness) AppendMessage(message llm.Message) error
func (*AgentHarness) Compact ¶
func (h *AgentHarness) Compact(ctx context.Context, customInstructions string) (CompactionResult, error)
func (*AgentHarness) FollowUp ¶
func (h *AgentHarness) FollowUp(ctx context.Context, text string, images ...llm.ContentPart) error
func (*AgentHarness) GetFollowUpMode ¶
func (h *AgentHarness) GetFollowUpMode() string
func (*AgentHarness) GetModel ¶
func (h *AgentHarness) GetModel() llm.Model
func (*AgentHarness) GetResources ¶
func (h *AgentHarness) GetResources() AgentHarnessResources
func (*AgentHarness) GetSteeringMode ¶
func (h *AgentHarness) GetSteeringMode() string
func (*AgentHarness) GetStreamOptions ¶
func (h *AgentHarness) GetStreamOptions() AgentHarnessStreamOptions
func (*AgentHarness) GetThinkingLevel ¶
func (h *AgentHarness) GetThinkingLevel() string
func (*AgentHarness) NavigateTree ¶
func (h *AgentHarness) NavigateTree(ctx context.Context, targetID string, options NavigateTreeOptions) (NavigateTreeResult, error)
func (*AgentHarness) NextTurn ¶
func (h *AgentHarness) NextTurn(ctx context.Context, text string, images ...llm.ContentPart) error
func (*AgentHarness) On ¶
func (h *AgentHarness) On(eventType string, handler AgentHarnessHandler) func()
func (*AgentHarness) Phase ¶
func (h *AgentHarness) Phase() string
func (*AgentHarness) Prompt ¶
func (h *AgentHarness) Prompt(ctx context.Context, text string, images ...llm.ContentPart) (llm.Message, error)
func (*AgentHarness) PromptFromTemplate ¶
func (*AgentHarness) Session ¶
func (h *AgentHarness) Session() *Session
func (*AgentHarness) SetActiveTools ¶
func (h *AgentHarness) SetActiveTools(toolNames []string) error
func (*AgentHarness) SetFollowUpMode ¶
func (h *AgentHarness) SetFollowUpMode(mode string)
func (*AgentHarness) SetResources ¶
func (h *AgentHarness) SetResources(ctx context.Context, resources AgentHarnessResources) error
func (*AgentHarness) SetSteeringMode ¶
func (h *AgentHarness) SetSteeringMode(mode string)
func (*AgentHarness) SetStreamOptions ¶
func (h *AgentHarness) SetStreamOptions(options AgentHarnessStreamOptions)
func (*AgentHarness) SetThinkingLevel ¶
func (h *AgentHarness) SetThinkingLevel(ctx context.Context, level string) error
func (*AgentHarness) SetTools ¶
func (h *AgentHarness) SetTools(tools []core.AgentTool, activeToolNames ...string) error
func (*AgentHarness) Steer ¶
func (h *AgentHarness) Steer(ctx context.Context, text string, images ...llm.ContentPart) error
func (*AgentHarness) Subscribe ¶
func (h *AgentHarness) Subscribe(listener AgentHarnessSubscriber) func()
func (*AgentHarness) WaitForIdle ¶
func (h *AgentHarness) WaitForIdle(ctx context.Context) error
type AgentHarnessAuth ¶
type AgentHarnessError ¶
func (*AgentHarnessError) Error ¶
func (e *AgentHarnessError) Error() string
func (*AgentHarnessError) Unwrap ¶
func (e *AgentHarnessError) Unwrap() error
type AgentHarnessEvent ¶
type AgentHarnessEvent struct {
Type string
Message llm.Message
Messages []llm.Message
ToolResults []llm.Message
ToolCallID string
ToolName string
Input map[string]any
Content []llm.ContentPart
Details any
IsError bool
Steer []llm.Message
FollowUp []llm.Message
NextTurn []llm.Message
HadPendingMutations bool
NextTurnCount int
Model llm.Model
PreviousModel *llm.Model
Source string
Level string
PreviousLevel string
Resources AgentHarnessResources
PreviousResources AgentHarnessResources
Prompt string
Images []llm.ContentPart
SystemPrompt string
SessionID string
StreamOptions AgentHarnessStreamOptions
Payload any
Status int
Headers map[string]string
ClearedSteer []llm.Message
ClearedFollowUp []llm.Message
Preparation *CompactionPreparation
BranchEntries []Entry
CustomInstructions string
Compaction CompactionResult
CompactionEntry Entry
FromHook bool
TargetID string
OldLeafID *string
NewLeafID *string
CommonAncestorID *string
BranchSummary BranchSummaryResult
SummaryEntry *Entry
AgentEvent core.AgentEvent
}
type AgentHarnessHandler ¶
type AgentHarnessHandler func(context.Context, AgentHarnessEvent) (*AgentHarnessHookResult, error)
type AgentHarnessHookResult ¶
type AgentHarnessHookResult struct {
Messages []llm.Message
HasMessages bool
SystemPrompt string
HasSystemPrompt bool
StreamOptions *AgentHarnessStreamOptionsPatch
Payload any
HasPayload bool
Block bool
HasBlock bool
Reason string
Content []llm.ContentPart
HasContent bool
Details any
HasDetails bool
IsError bool
HasIsError bool
Terminate bool
HasTerminate bool
Cancel bool
Compaction CompactionResult
HasCompaction bool
BranchSummary BranchSummaryResult
HasBranchSummary bool
CustomInstructions string
HasCustomInstructions bool
ReplaceInstructions bool
HasReplaceInstructions bool
}
type AgentHarnessOptions ¶
type AgentHarnessOptions struct {
Env any
Session *Session
Model llm.Model
ThinkingLevel string
SystemPrompt string
BuildSystemPrompt func(context.Context, SystemPromptContext) (string, error)
GetAPIKeyAndHeaders func(context.Context, llm.Model) (AgentHarnessAuth, bool, error)
Resources AgentHarnessResources
Tools []core.AgentTool
ActiveToolNames []string
StreamOptions AgentHarnessStreamOptions
SteeringMode string
FollowUpMode string
ToolExecution string
}
type AgentHarnessResources ¶
type AgentHarnessResources struct {
Skills []Skill
PromptTemplates []PromptTemplate
}
func (AgentHarnessResources) Clone ¶
func (r AgentHarnessResources) Clone() AgentHarnessResources
type AgentHarnessStreamOptions ¶
type AgentHarnessStreamOptions struct {
Transport string
TimeoutMillis int
MaxRetries int
MaxRetryDelayMs int
Headers map[string]string
Metadata map[string]any
CacheRetention string
}
func ApplyStreamOptionsPatch ¶
func ApplyStreamOptionsPatch(base AgentHarnessStreamOptions, patch AgentHarnessStreamOptionsPatch) AgentHarnessStreamOptions
type AgentHarnessSubscriber ¶
type AgentHarnessSubscriber func(context.Context, AgentHarnessEvent) error
type BranchPreparation ¶
func PrepareBranchEntries ¶
func PrepareBranchEntries(entries []Entry, tokenBudget int) BranchPreparation
type BranchSummaryError ¶
func (*BranchSummaryError) Error ¶
func (e *BranchSummaryError) Error() string
func (*BranchSummaryError) Unwrap ¶
func (e *BranchSummaryError) Unwrap() error
type BranchSummaryOptions ¶
type BranchSummaryResult ¶
func GenerateBranchSummary ¶
func GenerateBranchSummary(ctx context.Context, entries []Entry, model llm.Model, options BranchSummaryOptions) (BranchSummaryResult, error)
type CapturedShellResult ¶
type CapturedShellResult = harnessenv.CapturedShellResult
func ExecuteShellWithCapture ¶
func ExecuteShellWithCapture(ctx context.Context, env *LocalExecutionEnv, command string, maxInlineBytes int) (CapturedShellResult, error)
type CollectEntriesResult ¶
func CollectEntriesForBranchSummary ¶
func CollectEntriesForBranchSummary(session *Session, oldLeafID *string, targetID string) (CollectEntriesResult, error)
type CompactOptions ¶
type CompactionError ¶
func (*CompactionError) Error ¶
func (e *CompactionError) Error() string
func (*CompactionError) Unwrap ¶
func (e *CompactionError) Unwrap() error
type CompactionPreparation ¶
type CompactionPreparation struct {
FirstKeptEntryID string `json:"firstKeptEntryId"`
MessagesToSummarize []llm.Message `json:"messagesToSummarize"`
TurnPrefixMessages []llm.Message `json:"turnPrefixMessages"`
IsSplitTurn bool `json:"isSplitTurn"`
TokensBefore int `json:"tokensBefore"`
PreviousSummary string `json:"previousSummary,omitempty"`
FileOps FileOps `json:"fileOps"`
Settings CompactionSettings `json:"settings"`
}
func PrepareCompaction ¶
func PrepareCompaction(pathEntries []Entry, settings CompactionSettings) (*CompactionPreparation, error)
type CompactionResult ¶
type CompactionResult struct {
Summary string `json:"summary"`
FirstKeptEntryID string `json:"firstKeptEntryId"`
TokensBefore int `json:"tokensBefore"`
Details map[string]any `json:"details,omitempty"`
}
func Compact ¶
func Compact(ctx context.Context, prep CompactionPreparation, model llm.Model, apiKey string, thinkingLevel string) (CompactionResult, error)
func CompactWithOptions ¶
func CompactWithOptions(ctx context.Context, prep CompactionPreparation, model llm.Model, options CompactOptions) (CompactionResult, error)
type CompactionSettings ¶
type ContextTokenEstimate ¶
type ContextTokenEstimate struct {
Tokens int `json:"tokens"`
UsageTokens int `json:"usageTokens"`
EstimateTokens int `json:"estimateTokens"`
LastUsageIndex *int `json:"lastUsageIndex"`
}
func EstimateContextTokens ¶
func EstimateContextTokens(messages []llm.Message) ContextTokenEstimate
type CreateDirOptions ¶
type CreateDirOptions = harnessenv.CreateDirOptions
type CutPoint ¶
type CutPoint struct {
FirstKeptEntryIndex int `json:"firstKeptEntryIndex"`
TurnStartIndex int `json:"turnStartIndex"`
IsSplitTurn bool `json:"isSplitTurn"`
}
func FindCutPoint ¶
type Entry ¶
type Entry struct {
Type string `json:"type"`
ID string `json:"id,omitempty"`
ParentID *string `json:"parentId,omitempty"`
Timestamp string `json:"timestamp,omitempty"`
Message llm.Message `json:"message,omitempty"`
TargetID *string `json:"targetId,omitempty"`
Label *string `json:"label,omitempty"`
ThinkingLevel string `json:"thinkingLevel,omitempty"`
Provider string `json:"provider,omitempty"`
ModelID string `json:"modelId,omitempty"`
Summary string `json:"summary,omitempty"`
FirstKeptEntryID string `json:"firstKeptEntryId,omitempty"`
TokensBefore int `json:"tokensBefore,omitempty"`
FromID string `json:"fromId,omitempty"`
CustomType string `json:"customType,omitempty"`
Content any `json:"content,omitempty"`
Display bool `json:"display,omitempty"`
Details any `json:"details,omitempty"`
FromHook bool `json:"fromHook,omitempty"`
Name string `json:"name,omitempty"`
}
type ExecOptions ¶
type ExecOptions = harnessenv.ExecOptions
type ExecResult ¶
type ExecResult = harnessenv.ExecResult
type ExecutionEnv ¶
type ExecutionEnv = harnessenv.ExecutionEnv
type ExecutionError ¶
type ExecutionError = harnessenv.ExecutionError
type FileError ¶
type FileError = harnessenv.FileError
type FileInfo ¶
type FileInfo = harnessenv.FileInfo
type FileSystem ¶
type FileSystem = harnessenv.FileSystem
type InMemorySessionRepo ¶
type InMemorySessionRepo struct {
// contains filtered or unexported fields
}
func NewInMemorySessionRepo ¶
func NewInMemorySessionRepo() *InMemorySessionRepo
func (*InMemorySessionRepo) Create ¶
func (r *InMemorySessionRepo) Create(id string) (*Session, error)
func (*InMemorySessionRepo) Delete ¶
func (r *InMemorySessionRepo) Delete(metadata SessionMetadata)
func (*InMemorySessionRepo) Fork ¶
func (r *InMemorySessionRepo) Fork(sourceMetadata SessionMetadata, id string, entryID *string, includeEntry bool) (*Session, error)
func (*InMemorySessionRepo) List ¶
func (r *InMemorySessionRepo) List() []SessionMetadata
func (*InMemorySessionRepo) Open ¶
func (r *InMemorySessionRepo) Open(metadata SessionMetadata) (*Session, error)
type InMemorySessionStorage ¶
type InMemorySessionStorage struct {
// contains filtered or unexported fields
}
func MustInMemorySessionStorage ¶
func MustInMemorySessionStorage() *InMemorySessionStorage
func NewInMemorySessionStorage ¶
func NewInMemorySessionStorage(metadata *SessionMetadata, entries []Entry) (*InMemorySessionStorage, error)
func (*InMemorySessionStorage) AppendEntry ¶
func (s *InMemorySessionStorage) AppendEntry(entry Entry) error
func (*InMemorySessionStorage) CreateEntryID ¶
func (s *InMemorySessionStorage) CreateEntryID() string
func (*InMemorySessionStorage) Entries ¶
func (s *InMemorySessionStorage) Entries() []Entry
func (*InMemorySessionStorage) Entry ¶
func (s *InMemorySessionStorage) Entry(id string) (Entry, bool)
func (*InMemorySessionStorage) FindEntries ¶
func (s *InMemorySessionStorage) FindEntries(entryType string) []Entry
func (*InMemorySessionStorage) Label ¶
func (s *InMemorySessionStorage) Label(id string) (string, bool)
func (*InMemorySessionStorage) LeafID ¶
func (s *InMemorySessionStorage) LeafID() (string, bool, error)
func (*InMemorySessionStorage) Metadata ¶
func (s *InMemorySessionStorage) Metadata() SessionMetadata
func (*InMemorySessionStorage) PathToRoot ¶
func (s *InMemorySessionStorage) PathToRoot(leafID *string) ([]Entry, error)
func (*InMemorySessionStorage) SetLeafID ¶
func (s *InMemorySessionStorage) SetLeafID(leafID *string) error
type JsonlSessionRepo ¶
type JsonlSessionRepo struct {
SessionsRoot string
}
func NewJsonlSessionRepo ¶
func NewJsonlSessionRepo(root string) *JsonlSessionRepo
func (*JsonlSessionRepo) Create ¶
func (r *JsonlSessionRepo) Create(cwd, id string) (*Session, error)
func (*JsonlSessionRepo) Delete ¶
func (r *JsonlSessionRepo) Delete(metadata SessionMetadata) error
func (*JsonlSessionRepo) Fork ¶
func (r *JsonlSessionRepo) Fork(sourceMetadata SessionMetadata, cwd, id string, entryID *string, includeEntry bool) (*Session, error)
func (*JsonlSessionRepo) List ¶
func (r *JsonlSessionRepo) List(cwd string) ([]SessionMetadata, error)
func (*JsonlSessionRepo) Open ¶
func (r *JsonlSessionRepo) Open(metadata SessionMetadata) (*Session, error)
type JsonlSessionStorage ¶
type JsonlSessionStorage struct {
// contains filtered or unexported fields
}
func CreateJsonlSessionStorage ¶
func CreateJsonlSessionStorage(filePath string, metadata SessionMetadata) (*JsonlSessionStorage, error)
func OpenJsonlSessionStorage ¶
func OpenJsonlSessionStorage(filePath string) (*JsonlSessionStorage, error)
func (*JsonlSessionStorage) AppendEntry ¶
func (s *JsonlSessionStorage) AppendEntry(entry Entry) error
func (*JsonlSessionStorage) CreateEntryID ¶
func (s *JsonlSessionStorage) CreateEntryID() string
func (*JsonlSessionStorage) Entries ¶
func (s *JsonlSessionStorage) Entries() []Entry
func (*JsonlSessionStorage) FindEntries ¶
func (s *JsonlSessionStorage) FindEntries(entryType string) []Entry
func (*JsonlSessionStorage) Metadata ¶
func (s *JsonlSessionStorage) Metadata() SessionMetadata
func (*JsonlSessionStorage) PathToRoot ¶
func (s *JsonlSessionStorage) PathToRoot(leafID *string) ([]Entry, error)
func (*JsonlSessionStorage) SetLeafID ¶
func (s *JsonlSessionStorage) SetLeafID(leafID *string) error
type LoadSkillsOptions ¶
type LocalExecutionEnv ¶
type LocalExecutionEnv = harnessenv.LocalExecutionEnv
func MustLocalExecutionEnv ¶
func MustLocalExecutionEnv(cwd string, options ...LocalExecutionOption) *LocalExecutionEnv
func NewLocalExecutionEnv ¶
func NewLocalExecutionEnv(cwd string, options ...LocalExecutionOption) (*LocalExecutionEnv, error)
type LocalExecutionOption ¶
type LocalExecutionOption = harnessenv.LocalExecutionOption
func WithShellPath ¶
func WithShellPath(path string) LocalExecutionOption
type NavigateTreeOptions ¶
type NavigateTreeOptions struct {
}
type NavigateTreeResult ¶
type NavigateTreeResult struct {
}
type NowMillisFunc ¶
type NowMillisFunc = sessionid.NowMillisFunc
type PromptTemplate ¶
type PromptTemplateResult ¶
type PromptTemplateResult struct {
PromptTemplates []PromptTemplate
Diagnostics []PromptTemplateDiagnostic
}
func LoadPromptTemplates ¶
func LoadPromptTemplates(paths ...string) PromptTemplateResult
type RandomBytesFunc ¶
type RandomBytesFunc = sessionid.RandomBytesFunc
type RemoveOptions ¶
type RemoveOptions = harnessenv.RemoveOptions
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func NewSession ¶
func NewSession(storage SessionStorage) *Session
func (*Session) AppendCompaction ¶
func (*Session) AppendCompactionWithOptions ¶
func (*Session) AppendCustomMessageEntry ¶
func (*Session) AppendMessage ¶
func (*Session) AppendModelChange ¶
func (*Session) AppendSessionName ¶
func (*Session) AppendThinkingLevelChange ¶
func (*Session) BuildContext ¶
func (s *Session) BuildContext() (SessionContext, error)
func (*Session) Metadata ¶
func (s *Session) Metadata() SessionMetadata
func (*Session) MoveToWithOptions ¶
func (*Session) SessionName ¶
func (*Session) Storage ¶
func (s *Session) Storage() SessionStorage
type SessionContext ¶
type SessionContext struct {
Messages []llm.Message
ThinkingLevel string
ModelProvider string
ModelID string
}
func BuildSessionContext ¶
func BuildSessionContext(pathEntries []Entry) SessionContext
type SessionEntryOptions ¶
type SessionError ¶
func (*SessionError) Error ¶
func (e *SessionError) Error() string
func (*SessionError) Unwrap ¶
func (e *SessionError) Unwrap() error
type SessionMetadata ¶
type SessionMetadata struct {
ID string `json:"id"`
CreatedAt string `json:"createdAt"`
CWD string `json:"cwd,omitempty"`
Path string `json:"path,omitempty"`
ParentSessionPath string `json:"parentSessionPath,omitempty"`
}
func LoadJsonlSessionMetadata ¶
func LoadJsonlSessionMetadata(filePath string) (SessionMetadata, error)
type SessionStorage ¶
type SessionStorage interface {
Metadata() SessionMetadata
LeafID() (string, bool, error)
SetLeafID(*string) error
CreateEntryID() string
AppendEntry(Entry) error
Entry(string) (Entry, bool)
FindEntries(string) []Entry
Label(string) (string, bool)
PathToRoot(*string) ([]Entry, error)
Entries() []Entry
}
type Shell ¶
type Shell = harnessenv.Shell
type SkillDiagnostic ¶
type SkillResult ¶
type SkillResult struct {
Skills []Skill
Diagnostics []SkillDiagnostic
}
func LoadSkills ¶
func LoadSkills(paths ...string) SkillResult
func LoadSkillsWithOptions ¶
func LoadSkillsWithOptions(options LoadSkillsOptions, paths ...string) SkillResult
type SourcedPromptTemplate ¶
type SourcedPromptTemplate struct {
PromptTemplate PromptTemplate
Source any
}
type SourcedPromptTemplateResult ¶
type SourcedPromptTemplateResult struct {
PromptTemplates []SourcedPromptTemplate
Diagnostics []PromptTemplateDiagnostic
}
func LoadSourcedPromptTemplates ¶
func LoadSourcedPromptTemplates(inputs map[string]any) SourcedPromptTemplateResult
type SourcedSkill ¶
type SourcedSkillResult ¶
type SourcedSkillResult struct {
Skills []SourcedSkill
Diagnostics []SkillDiagnostic
}
func LoadSourcedSkills ¶
func LoadSourcedSkills(inputs map[string]any) SourcedSkillResult
type SystemPromptContext ¶
type TempFileOptions ¶
type TempFileOptions = harnessenv.TempFileOptions
type TruncationOptions ¶
type TruncationOptions = utils.TruncationOptions
type TruncationResult ¶
type TruncationResult = utils.TruncationResult
func TruncateHead ¶
func TruncateHead(content string, options TruncationOptions) TruncationResult
func TruncateTail ¶
func TruncateTail(content string, options TruncationOptions) TruncationResult
Source Files
¶
Click to show internal directories.
Click to hide internal directories.