Documentation
¶
Index ¶
- type Decision
- type ExecutionPlan
- type ExecutionState
- type LLMPlanner
- type PlanAdjustment
- type Planner
- func (p *Planner) AdjustPlan(plan *ExecutionPlan, state *ExecutionState, reason string) *PlanAdjustment
- func (p *Planner) CreatePlan(input string, result *perception.PerceptionResult) *Decision
- func (p *Planner) GetNextStep(plan *ExecutionPlan, state *ExecutionState) *Step
- func (p *Planner) MarkStepComplete(state *ExecutionState, stepID int)
- func (p *Planner) MarkStepFailed(state *ExecutionState, stepID int)
- type RetrievalHint
- type Step
- type StepStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decision ¶
type Decision struct {
Plan *ExecutionPlan `json:"plan"`
RetrievalHints []RetrievalHint `json:"retrieval_hints"`
ContextHints []string `json:"context_hints"`
MaxTurns int `json:"max_turns"`
EnableSubAgents bool `json:"enable_sub_agents"`
ToolFilter []string `json:"tool_filter,omitempty"` // If set, only these tools allowed
ClarificationNeeded bool `json:"clarification_needed"`
ClarificationQuestion string `json:"clarification_question,omitempty"`
}
Decision represents a decision made by the cognition layer
type ExecutionPlan ¶
type ExecutionPlan struct {
TaskID string `json:"task_id"`
Description string `json:"description"`
OriginalInput string `json:"original_input"`
Complexity perception.TaskComplexity `json:"complexity"`
Steps []Step `json:"steps"`
TotalEstimatedTurns int `json:"total_estimated_turns"`
CreatedAt int64 `json:"created_at"`
ModifiedAt int64 `json:"modified_at"`
IsDynamic bool `json:"is_dynamic"` // Whether plan can change
}
ExecutionPlan represents the complete plan for a task
type ExecutionState ¶
type ExecutionState struct {
CurrentStepID int `json:"current_step_id"`
StepsCompleted []int `json:"steps_completed"`
StepsFailed []int `json:"steps_failed"`
TurnsUsed int `json:"turns_used"`
Adjustments []PlanAdjustment `json:"adjustments"`
}
ExecutionState tracks the current state of plan execution
type LLMPlanner ¶ added in v0.4.10
type LLMPlanner struct {
// contains filtered or unexported fields
}
LLMPlanner uses LLM for intelligent task planning
func NewLLMPlanner ¶ added in v0.4.10
func NewLLMPlanner(prov provider.Provider) *LLMPlanner
NewLLMPlanner creates a new LLM-based planner
func (*LLMPlanner) AdjustPlanWithFeedback ¶ added in v0.4.10
func (p *LLMPlanner) AdjustPlanWithFeedback(ctx context.Context, plan *ExecutionPlan, feedback string) (*PlanAdjustment, error)
AdjustPlanWithFeedback adjusts plan based on execution feedback
func (*LLMPlanner) CreatePlan ¶ added in v0.4.10
CreatePlan uses LLM to create an execution plan
type PlanAdjustment ¶
type PlanAdjustment struct {
Reason string `json:"reason"`
StepAdded []Step `json:"steps_added,omitempty"`
StepRemoved []int `json:"steps_removed,omitempty"`
StepModified []int `json:"steps_modified,omitempty"`
AdjustedAt int64 `json:"adjusted_at"`
}
PlanAdjustment represents a change to the execution plan
type Planner ¶
type Planner struct {
}
Planner handles task decomposition and execution planning
func (*Planner) AdjustPlan ¶
func (p *Planner) AdjustPlan(plan *ExecutionPlan, state *ExecutionState, reason string) *PlanAdjustment
AdjustPlan adjusts the execution plan based on execution feedback
func (*Planner) CreatePlan ¶
func (p *Planner) CreatePlan(input string, result *perception.PerceptionResult) *Decision
CreatePlan creates an execution plan based on perception result
func (*Planner) GetNextStep ¶
func (p *Planner) GetNextStep(plan *ExecutionPlan, state *ExecutionState) *Step
GetNextStep returns the next step that should be executed
func (*Planner) MarkStepComplete ¶
func (p *Planner) MarkStepComplete(state *ExecutionState, stepID int)
MarkStepComplete marks a step as completed
func (*Planner) MarkStepFailed ¶
func (p *Planner) MarkStepFailed(state *ExecutionState, stepID int)
MarkStepFailed marks a step as failed
type RetrievalHint ¶
type RetrievalHint struct {
Type string `json:"type"` // "memory", "file", "history"
Query string `json:"query"`
Relevance float64 `json:"relevance"` // 0.0 - 1.0
}
RetrievalHint represents a hint for memory retrieval
type Step ¶
type Step struct {
ID int `json:"id"`
Description string `json:"description"`
Tools []string `json:"tools,omitempty"` // Tools likely needed for this step
Priority int `json:"priority"` // 1 = highest
EstimatedTurns int `json:"estimated_turns"`
Dependencies []int `json:"dependencies,omitempty"` // Step IDs that must complete first
Status StepStatus `json:"status"`
}
Step represents a single step in the execution plan
type StepStatus ¶
type StepStatus string
StepStatus represents the status of a plan step
const ( StepPending StepStatus = "pending" StepRunning StepStatus = "running" StepComplete StepStatus = "complete" StepFailed StepStatus = "failed" StepSkipped StepStatus = "skipped" )