Documentation
¶
Overview ¶
Package state manages resume state for incremental agent execution. It tracks content hashes to detect when inputs change and regeneration is needed.
Index ¶
- Constants
- type AgentOutput
- type Manager
- func (m *Manager) Clear() error
- func (m *Manager) Load() error
- func (m *Manager) RecordAgentOutput(agentName, outputPath string, dependencyAgents []string) error
- func (m *Manager) Save() error
- func (m *Manager) ShouldRegenerate(agentName, outputPath string, dependencyAgents []string) (bool, string)
- func (m *Manager) UpdateConfigHash(persona string, stack, preferences interface{}) error
- func (m *Manager) UpdateInputHash(inputFiles []string) error
- type ResumeState
Constants ¶
const StateFile = ".pagent/.resume-state.json"
StateFile is the default location for resume state
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentOutput ¶
type AgentOutput struct {
// OutputPath is the path to the agent's output file
OutputPath string `json:"output_path"`
// OutputHash is the hash of the output content
OutputHash string `json:"output_hash"`
// InputHashAtGeneration is the input hash when this output was generated
InputHashAtGeneration string `json:"input_hash_at_generation"`
// ConfigHashAtGeneration is the config hash when this output was generated
ConfigHashAtGeneration string `json:"config_hash_at_generation"`
// DependencyHashes maps dependency agent names to their output hashes when this was generated
DependencyHashes map[string]string `json:"dependency_hashes"`
}
AgentOutput tracks the output state of a single agent.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles resume state operations.
func NewManager ¶
NewManager creates a new state manager for the given output directory.
func (*Manager) RecordAgentOutput ¶
RecordAgentOutput records the output of an agent for future resume checks.
func (*Manager) ShouldRegenerate ¶
func (m *Manager) ShouldRegenerate(agentName, outputPath string, dependencyAgents []string) (bool, string)
ShouldRegenerate determines if an agent needs to be regenerated. Returns true if the agent should run, false if it can be skipped.
func (*Manager) UpdateConfigHash ¶
UpdateConfigHash computes and stores a hash of the relevant config.
func (*Manager) UpdateInputHash ¶
UpdateInputHash computes and stores the hash of all input files.
type ResumeState ¶
type ResumeState struct {
// InputHash is the combined hash of all input files
InputHash string `json:"input_hash"`
// ConfigHash is the hash of relevant configuration (persona, preferences, stack)
ConfigHash string `json:"config_hash"`
// AgentOutputs maps agent names to their output state
AgentOutputs map[string]AgentOutput `json:"agent_outputs"`
}
ResumeState tracks the state of previous agent runs for resumability.