refactor: extract shared AgentStateManager pattern (gt-gaw8e)
- Create internal/agent package with shared State type and StateManager - StateManager uses Go generics for type-safe load/save operations - Update witness and refinery to use shared State type alias - Replace loadState/saveState implementations with StateManager delegation - Maintains backwards compatibility through re-exported constants 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,20 +3,18 @@ package witness
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/steveyegge/gastown/internal/agent"
|
||||
)
|
||||
|
||||
// State represents the witness's running state.
|
||||
type State string
|
||||
// State is an alias for agent.State for backwards compatibility.
|
||||
type State = agent.State
|
||||
|
||||
// State constants - re-exported from agent package for backwards compatibility.
|
||||
const (
|
||||
// StateStopped means the witness is not running.
|
||||
StateStopped State = "stopped"
|
||||
|
||||
// StateRunning means the witness is actively monitoring.
|
||||
StateRunning State = "running"
|
||||
|
||||
// StatePaused means the witness is paused (not monitoring).
|
||||
StatePaused State = "paused"
|
||||
StateStopped = agent.StateStopped
|
||||
StateRunning = agent.StateRunning
|
||||
StatePaused = agent.StatePaused
|
||||
)
|
||||
|
||||
// Witness represents a rig's polecat monitoring agent.
|
||||
|
||||
Reference in New Issue
Block a user