agent

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package agent provides unified agent settings management.

Package agent provides shared types and utilities for Gas Town agents (witness, refinery, deacon, etc.).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureSettingsForAllAgents

func EnsureSettingsForAllAgents(workDir, role string) error

EnsureSettingsForAllAgents ensures settings exist for all supported agents. This is useful during installation to prepare the workspace for any agent.

func EnsureSettingsForRole

func EnsureSettingsForRole(workDir, role string, agentName string) error

EnsureSettingsForRole ensures agent settings exist for the given agent preset and role. This is a unified function that delegates to the appropriate agent-specific implementation.

For Cursor: Creates .cursor/rules/gastown.mdc with rules and .cursor/hooks.json For other agents: Currently no-op (may be extended in future)

Types

type State

type State string

State represents an agent's running state.

const (
	// StateStopped means the agent is not running.
	StateStopped State = "stopped"

	// StateRunning means the agent is actively operating.
	StateRunning State = "running"

	// StatePaused means the agent is paused (not operating but not stopped).
	StatePaused State = "paused"
)

type StateManager

type StateManager[T any] struct {
	// contains filtered or unexported fields
}

StateManager handles loading and saving agent state to disk. It uses generics to work with any state type.

func NewStateManager

func NewStateManager[T any](rigPath, stateFileName string, defaultFactory func() *T) *StateManager[T]

NewStateManager creates a new StateManager for the given state file path. The defaultFactory function is called when the state file doesn't exist to create a new state with default values.

func (*StateManager[T]) Load

func (m *StateManager[T]) Load() (*T, error)

Load loads agent state from disk. If the file doesn't exist, returns a new state created by the default factory.

func (*StateManager[T]) Save

func (m *StateManager[T]) Save(state *T) error

Save persists agent state to disk using atomic write.

func (*StateManager[T]) StateFile

func (m *StateManager[T]) StateFile() string

StateFile returns the path to the state file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL