picoclaw/pkg/orch/reporter.go
dj-oyu 4cc6690fc2 feat(orch): define AgentState typed enum and report plan mode transitions
- Add pkg/orch/state.go with AgentState string type and constants:
  idle, waiting, toolcall, plan_interviewing, plan_review, plan_executing, plan_completed
- Update AgentReporter interface and all implementations to use AgentState instead of raw strings
- Add ReportStateChange calls in loop.go at plan review/executing/completed transitions
- Update index.html statusText/glow for all 4 plan states (📋🔍▶️)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-01 01:59:03 +09:00

21 lines
883 B
Go

package orch
// AgentReporter is the interface for reporting agent lifecycle events.
// Both Broadcaster (real events) and noopReporter (disabled) implement this.
type AgentReporter interface {
ReportSpawn(id, label, task string)
ReportStateChange(id string, state AgentState, tool string)
ReportConversation(from, to, text string)
ReportGC(id, reason string)
}
type noopReporter struct{}
func (n *noopReporter) ReportSpawn(id, label, task string) {}
func (n *noopReporter) ReportStateChange(id string, state AgentState, tool string) {}
func (n *noopReporter) ReportConversation(from, to, text string) {}
func (n *noopReporter) ReportGC(id, reason string) {}
// Noop is the AgentReporter to use when orchestration is disabled.
// Allows nil-free code in callers.
var Noop AgentReporter = &noopReporter{}