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:
mediocre
2026-01-05 00:19:41 -08:00
committed by Steve Yegge
parent 18578b3030
commit f49197243d
5 changed files with 119 additions and 76 deletions

View File

@@ -5,20 +5,18 @@ import (
"errors"
"fmt"
"time"
"github.com/steveyegge/gastown/internal/agent"
)
// State represents the refinery'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 refinery is not running.
StateStopped State = "stopped"
// StateRunning means the refinery is actively processing.
StateRunning State = "running"
// StatePaused means the refinery is paused (not processing new items).
StatePaused State = "paused"
StateStopped = agent.StateStopped
StateRunning = agent.StateRunning
StatePaused = agent.StatePaused
)
// Refinery represents a rig's merge queue processor.