Documentation
¶
Index ¶
- func BuildFallbackQuery(rc RecoveryContext) string
- func ComputeFingerprint(ctx RecoveryContext) string
- func HydratePlanForEvent(eventID string, rc RecoveryContext, replay Replay, plan *RecoveryPlan)
- func ResetRuntimeState()
- func SummarizeArgs(args map[string]any) map[string]any
- type AgentRoute
- type AgentRoutePayload
- type AgentTask
- type CaptureInput
- type DecisionHints
- type DecisionOwner
- type DocAction
- type DocSearch
- type DocSearchItem
- type Executor
- type FinalizeHint
- type KBHit
- type KnowledgeRetrieval
- type KnowledgeRetriever
- type LastError
- type OperationKind
- type PlanOptions
- type Planner
- type Probe
- type ProbeResult
- type RecoveryAttempt
- type RecoveryBundle
- type RecoveryContext
- type RecoveryEvent
- type RecoveryExecution
- type RecoveryPlan
- type Replay
- type RuleHints
- type Store
- func (s *Store) Capture(ctx RecoveryContext, replay ...Replay) (*LastError, error)
- func (s *Store) Enabled() bool
- func (s *Store) Finalize(eventID, outcome string, exec *RecoveryExecution) error
- func (s *Store) LoadErrorByEvent(eventID string) (*LastError, error)
- func (s *Store) LoadLastError() (*LastError, error)
- func (s *Store) SaveAnalysis(eventID string, plan RecoveryPlan, bundle RecoveryBundle) error
- func (s *Store) SavePlan(eventID string, plan RecoveryPlan) error
- type ToolCallRecord
- type ToolInvoker
- type ToolResponse
- type ToolResponseBlock
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildFallbackQuery ¶
func BuildFallbackQuery(rc RecoveryContext) string
func ComputeFingerprint ¶
func ComputeFingerprint(ctx RecoveryContext) string
func HydratePlanForEvent ¶
func HydratePlanForEvent(eventID string, rc RecoveryContext, replay Replay, plan *RecoveryPlan)
func ResetRuntimeState ¶
func ResetRuntimeState()
Types ¶
type AgentRoute ¶
type AgentRoute struct {
Required bool `json:"required"`
Target string `json:"target,omitempty"`
Executor string `json:"executor,omitempty"`
Reasons []string `json:"reasons"`
Payload *AgentRoutePayload `json:"payload,omitempty"`
}
type AgentRoutePayload ¶
type AgentRoutePayload struct {
EventID string `json:"event_id"`
Context RecoveryContext `json:"context"`
Replay Replay `json:"replay"`
RawError string `json:"raw_error"`
Category string `json:"category"`
DecisionOwner DecisionOwner `json:"decision_owner,omitempty"`
Confidence float64 `json:"confidence"`
ShouldRetry bool `json:"should_retry"`
ShouldStop bool `json:"should_stop"`
SafeActions []string `json:"safe_actions"`
DocActions []DocAction `json:"doc_actions,omitempty"`
KBHits []KBHit `json:"kb_hits"`
DocSearch DocSearch `json:"doc_search"`
HumanActions []string `json:"human_actions"`
DecisionHints DecisionHints `json:"decision_hints"`
Evidence []string `json:"evidence"`
RuleHints RuleHints `json:"rule_hints"`
ProbeResults []ProbeResult `json:"probe_results,omitempty"`
}
type AgentTask ¶
type AgentTask struct {
Goal string `json:"goal"`
Why string `json:"why"`
MustReadRefs []string `json:"must_read_refs,omitempty"`
AllowedActions []string `json:"allowed_actions,omitempty"`
ForbiddenActions []string `json:"forbidden_actions,omitempty"`
StopConditions []string `json:"stop_conditions,omitempty"`
FinalizeRequirement string `json:"finalize_requirement,omitempty"`
}
type CaptureInput ¶
type DecisionHints ¶
type DecisionOwner ¶
type DecisionOwner string
const ( DecisionOwnerBuiltinRule DecisionOwner = "builtin_rule" DecisionOwnerAgent DecisionOwner = "agent" )
type DocSearch ¶
type DocSearch struct {
Provider string `json:"provider,omitempty"`
Query string `json:"query,omitempty"`
Page int `json:"page,omitempty"`
Size int `json:"size,omitempty"`
CurrentPage int `json:"current_page,omitempty"`
TotalCount int `json:"total_count,omitempty"`
HasMore bool `json:"has_more"`
Status string `json:"status,omitempty"`
Error string `json:"error,omitempty"`
Request *ToolCallRecord `json:"request,omitempty"`
Response *ToolResponse `json:"response,omitempty"`
Items []DocSearchItem `json:"items,omitempty"`
}
type DocSearchItem ¶
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
func NewExecutor ¶
func NewExecutor(planner *Planner, invoker ToolInvoker) *Executor
type FinalizeHint ¶
type KnowledgeRetrieval ¶
type KnowledgeRetriever ¶
type KnowledgeRetriever interface {
Search(ctx context.Context, query string, rc RecoveryContext) (KnowledgeRetrieval, error)
}
type LastError ¶
type LastError struct {
EventID string `json:"event_id"`
RecordedAt string `json:"recorded_at"`
Context RecoveryContext `json:"context"`
Replay Replay `json:"replay,omitempty"`
}
func LatestCapture ¶
func LatestCapture() *LastError
type OperationKind ¶
type OperationKind string
const ( OperationRead OperationKind = "read" OperationWrite OperationKind = "write" OperationUnknown OperationKind = "unknown" )
func InferOperationKind ¶
func InferOperationKind(toolName string) OperationKind
type PlanOptions ¶
type Planner ¶
type Planner struct {
// contains filtered or unexported fields
}
func NewPlanner ¶
func NewPlanner(retriever KnowledgeRetriever) *Planner
func (*Planner) Plan ¶
func (p *Planner) Plan(ctx context.Context, rc RecoveryContext) RecoveryPlan
func (*Planner) PlanWithOptions ¶
func (p *Planner) PlanWithOptions(ctx context.Context, rc RecoveryContext, opts PlanOptions) RecoveryPlan
type Probe ¶
type Probe func(ctx context.Context, invoker ToolInvoker, rc RecoveryContext, replay Replay, plan RecoveryPlan) *ProbeResult
type ProbeResult ¶
type ProbeResult struct {
Name string `json:"name"`
Status string `json:"status"`
ServerID string `json:"server_id,omitempty"`
ToolName string `json:"tool_name,omitempty"`
ArgsSummary map[string]any `json:"args_summary,omitempty"`
Summary string `json:"summary,omitempty"`
Output any `json:"output,omitempty"`
Error string `json:"error,omitempty"`
}
type RecoveryAttempt ¶
type RecoveryBundle ¶
type RecoveryBundle struct {
Status string `json:"status"`
EventID string `json:"event_id"`
Context RecoveryContext `json:"context"`
Replay Replay `json:"replay"`
Plan RecoveryPlan `json:"plan"`
DocSearch DocSearch `json:"doc_search"`
KBHits []KBHit `json:"kb_hits,omitempty"`
DocActions []DocAction `json:"doc_actions,omitempty"`
HumanActions []string `json:"human_actions,omitempty"`
ProbeResults []ProbeResult `json:"probe_results,omitempty"`
AgentTask AgentTask `json:"agent_task"`
FinalizeHint FinalizeHint `json:"finalize_hint"`
AnalysisError string `json:"analysis_error,omitempty"`
}
type RecoveryContext ¶
type RecoveryContext struct {
CommandPath []string `json:"command_path"`
ServerID string `json:"server_id,omitempty"`
ToolName string `json:"tool_name,omitempty"`
OperationKind OperationKind `json:"operation_kind"`
CLIErrorCode string `json:"cli_error_code,omitempty"`
RawError string `json:"raw_error"`
CallStage string `json:"call_stage,omitempty"`
HTTPStatus int `json:"http_status,omitempty"`
RetryAfter string `json:"retry_after,omitempty"`
TraceID string `json:"trace_id,omitempty"`
RequestID string `json:"request_id,omitempty"`
ArgsSummary map[string]any `json:"args_summary,omitempty"`
Fingerprint string `json:"fingerprint"`
}
func BuildContext ¶
func BuildContext(input CaptureInput) RecoveryContext
type RecoveryEvent ¶
type RecoveryEvent struct {
EventID string `json:"event_id"`
Phase string `json:"phase"`
RecordedAt string `json:"recorded_at"`
Context *RecoveryContext `json:"context,omitempty"`
Replay *Replay `json:"replay,omitempty"`
Plan *RecoveryPlan `json:"plan,omitempty"`
Bundle *RecoveryBundle `json:"bundle,omitempty"`
Execution *RecoveryExecution `json:"execution,omitempty"`
Outcome string `json:"outcome,omitempty"`
}
type RecoveryExecution ¶
type RecoveryExecution struct {
Actions []string `json:"actions,omitempty"`
Attempts []RecoveryAttempt `json:"attempts,omitempty"`
Result string `json:"result,omitempty"`
ErrorSummary string `json:"error_summary,omitempty"`
}
type RecoveryPlan ¶
type RecoveryPlan struct {
Category string `json:"category"`
DecisionOwner DecisionOwner `json:"decision_owner,omitempty"`
Confidence float64 `json:"confidence"`
AutoActions []string `json:"auto_actions"`
SafeActions []string `json:"safe_actions"`
DocActions []DocAction `json:"doc_actions,omitempty"`
DocSearch DocSearch `json:"doc_search"`
DecisionHints DecisionHints `json:"decision_hints"`
HumanActions []string `json:"human_actions"`
Evidence []string `json:"evidence"`
KBHits []KBHit `json:"kb_hits"`
ShouldRetry bool `json:"should_retry"`
ShouldStop bool `json:"should_stop"`
RuleHints RuleHints `json:"rule_hints"`
AgentRoute AgentRoute `json:"agent_route"`
}
type Replay ¶
type Replay struct {
ServerID string `json:"server_id,omitempty"`
ToolName string `json:"tool_name,omitempty"`
OperationKind OperationKind `json:"operation_kind"`
ToolArgs map[string]any `json:"tool_args,omitempty"`
RedactedArgv []string `json:"redacted_argv,omitempty"`
RedactedCommand string `json:"redacted_command,omitempty"`
}
func BuildReplay ¶
func BuildReplay(input CaptureInput) Replay
type RuleHints ¶
type RuleHints struct {
Category string `json:"category"`
DecisionOwner DecisionOwner `json:"decision_owner,omitempty"`
Confidence float64 `json:"confidence"`
SafeActions []string `json:"safe_actions"`
HumanActions []string `json:"human_actions"`
Evidence []string `json:"evidence"`
ShouldRetry bool `json:"should_retry"`
ShouldStop bool `json:"should_stop"`
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) Capture ¶
func (s *Store) Capture(ctx RecoveryContext, replay ...Replay) (*LastError, error)
func (*Store) Finalize ¶
func (s *Store) Finalize(eventID, outcome string, exec *RecoveryExecution) error
func (*Store) LoadErrorByEvent ¶
func (*Store) LoadLastError ¶
func (*Store) SaveAnalysis ¶
func (s *Store) SaveAnalysis(eventID string, plan RecoveryPlan, bundle RecoveryBundle) error
type ToolCallRecord ¶
type ToolInvoker ¶
type ToolResponse ¶
type ToolResponse struct {
IsError bool `json:"is_error,omitempty"`
Content []ToolResponseBlock `json:"content,omitempty"`
}
type ToolResponseBlock ¶
Click to show internal directories.
Click to hide internal directories.