Documentation
¶
Index ¶
- type Budget
- type Config
- type Event
- func (e *Event) IsApproval() bool
- func (e *Event) IsDone() bool
- func (e *Event) IsError() bool
- func (e *Event) IsMessage() bool
- func (e *Event) IsPlan() bool
- func (e *Event) IsThinking() bool
- func (e *Event) IsTokenUsage() bool
- func (e *Event) IsToolCall() bool
- func (e *Event) IsToolResult() bool
- func (e *Event) String() string
- type EventType
- type ExecuteResponse
- type Info
- type Observer
- type ObserverFunc
- type Option
- type Plan
- type PlanApproval
- type PlanMode
- type PlanStep
- type PlannerHelper
- func (p *PlannerHelper) ApprovalChan() chan<- PlanApproval
- func (p *PlannerHelper) Approve(approved bool)
- func (p *PlannerHelper) CreatePlan(ctx context.Context, input string) (*Plan, error)
- func (p *PlannerHelper) GetMode() PlanMode
- func (p *PlannerHelper) IsEnabled() bool
- func (p *PlannerHelper) RequestApproval(ctx context.Context, plan *Plan) bool
- func (p *PlannerHelper) SetMode(mode PlanMode)
- func (p *PlannerHelper) ShouldEnterPlanMode(input string) bool
- type Session
- func (s *Session) ApprovePlan(approved bool)
- func (s *Session) Close()
- func (s *Session) Context() context.Context
- func (s *Session) Enqueue(content string, priority dinoQueue.Priority) (<-chan *dinoQueue.Result, error)
- func (s *Session) EnqueueBatch(contents []string, priority dinoQueue.Priority) ([]<-chan *dinoQueue.Result, error)
- func (s *Session) GetAgent() *engine.AgentEngine
- func (s *Session) GetMemory() types.MemoryProvider
- func (s *Session) ID() string
- func (s *Session) Input() chan<- interface{}
- func (s *Session) IsRunning() bool
- func (s *Session) Output() <-chan *Event
- func (s *Session) QueuePending() int
- func (s *Session) QueueSize() int
- func (s *Session) QueueStats() dinoQueue.Stats
- func (s *Session) Start()
- func (s *Session) Stop()
- func (s *Session) Subscribe(obs Observer) string
- func (s *Session) Unsubscribe(id string)
- type SessionFactory
- type Summary
- type Time
- type ToolCallInfo
- type Usage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
InputBufferSize int
OutputBufferSize int
EnableQueue bool
QueueSize int
MaxPending int
PlannerEnabled bool
PlannerPrompt string
PlannerAutoApprove bool
}
func DefaultConfig ¶
func DefaultConfig() *Config
type Event ¶
type Event struct {
Type EventType `json:"type"`
SessionID string `json:"session_id"`
Content string `json:"content,omitempty"`
Thinking string `json:"thinking,omitempty"`
ToolCallID string `json:"tool_call_id,omitempty"`
ToolName string `json:"tool_name,omitempty"`
ToolInput map[string]any `json:"tool_input,omitempty"`
ToolOutput any `json:"tool_output,omitempty"`
Error string `json:"error,omitempty"`
Approved bool `json:"approved,omitempty"`
Usage *Usage `json:"usage,omitempty"`
Plan *Plan `json:"plan,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
func (*Event) IsApproval ¶
func (*Event) IsThinking ¶
func (*Event) IsTokenUsage ¶
func (*Event) IsToolCall ¶
func (*Event) IsToolResult ¶
type EventType ¶
type EventType string
const ( EventTypeMessage EventType = "message" EventTypeThinking EventType = "thinking" EventTypeToolCall EventType = "tool_call" EventTypeToolResult EventType = "tool_result" EventTypeToolStart EventType = "tool_start" EventTypeTokenUsage EventType = "token_usage" EventTypeError EventType = "error" EventTypeDone EventType = "done" EventTypeApproved EventType = "approved" EventTypeApproval EventType = "approval" EventTypePlan EventType = "plan" EventTypePlanStep EventType = "plan_step" )
type ExecuteResponse ¶
type ExecuteResponse struct {
SessionID string
Content string
ToolCalls []ToolCallInfo
Usage Usage
Error error
}
type Info ¶
type Info struct {
ID string `json:"id"`
Title string `json:"title"`
Summary *Summary `json:"summary,omitempty"`
Time Time `json:"time"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
func (*Info) SetSummary ¶
type ObserverFunc ¶
type ObserverFunc func(event *Event)
func (ObserverFunc) OnEvent ¶
func (f ObserverFunc) OnEvent(event *Event)
type Option ¶
type Option func(*Config)
func WithInputBufferSize ¶
func WithOutputBufferSize ¶
func WithPlannerEnabled ¶
func WithQueueEnabled ¶
type PlanApproval ¶
type PlannerHelper ¶
type PlannerHelper struct {
// contains filtered or unexported fields
}
func NewPlannerHelper ¶
func NewPlannerHelper(enabled bool, prompt string, autoApprove bool, llmProvider types.LLMProvider, toolSchemas []map[string]interface{}) *PlannerHelper
func (*PlannerHelper) ApprovalChan ¶
func (p *PlannerHelper) ApprovalChan() chan<- PlanApproval
func (*PlannerHelper) Approve ¶
func (p *PlannerHelper) Approve(approved bool)
func (*PlannerHelper) CreatePlan ¶
func (*PlannerHelper) GetMode ¶
func (p *PlannerHelper) GetMode() PlanMode
func (*PlannerHelper) IsEnabled ¶
func (p *PlannerHelper) IsEnabled() bool
func (*PlannerHelper) RequestApproval ¶
func (p *PlannerHelper) RequestApproval(ctx context.Context, plan *Plan) bool
func (*PlannerHelper) SetMode ¶
func (p *PlannerHelper) SetMode(mode PlanMode)
func (*PlannerHelper) ShouldEnterPlanMode ¶
func (p *PlannerHelper) ShouldEnterPlanMode(input string) bool
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
func NewSession ¶
func NewSession(id string, agent *engine.AgentEngine, factory SessionFactory, ctx context.Context, cfg *Config, planner *PlannerHelper, budget interface{ CanExecute(sessionID string) bool }) *Session
func (*Session) ApprovePlan ¶
func (*Session) EnqueueBatch ¶
func (*Session) GetAgent ¶ added in v1.8.1
func (s *Session) GetAgent() *engine.AgentEngine
func (*Session) GetMemory ¶ added in v1.8.1
func (s *Session) GetMemory() types.MemoryProvider
func (*Session) QueuePending ¶
func (*Session) QueueStats ¶
func (*Session) Unsubscribe ¶
type SessionFactory ¶
type SessionFactory interface {
RecordLoop(sessionID string, action agentutils.LoopDetectAction)
RecordTokens(ctx context.Context, sessionID string, tokens int)
Detect(ctx context.Context, sessionID string, action agentutils.LoopDetectAction) *agentutils.LoopDetectResult
}
type ToolCallInfo ¶
type Usage ¶
type Usage = agenttypes.Usage
Click to show internal directories.
Click to hide internal directories.