Documentation
¶
Index ¶
- Constants
- Variables
- func CheckHomePin(pin HomePin, stateDir string, env map[string]string) error
- func CheckSessionDrift(existing, next SessionRecord) error
- func ClearActiveTurnIfSafe(root Root, adapterRef, sessionKey string) error
- func FinalizeCommittedTurn(root Root, adapterRef, sessionKey string, turn CommittedTurn) error
- func FormatVersion(providerVersion, protocolDigest string) string
- func LeaseID(runID string, epoch int, nodePath, sessionKey string) string
- func RecordTurnIntent(root Root, adapterRef, sessionKey string, turn ActiveTurn) error
- func RedactKnownSecretShapes(s string) string
- func ReleaseLease(root Root, adapterRef, sessionKey, leaseID string) error
- func SessionRecordPath(root Root, adapterRef, sessionKey string) string
- func ValidateSessionKey(key string) error
- func WriteSessionRecord(root Root, rec SessionRecord) error
- type ActiveTurn
- type CommittedTurn
- type HomePin
- type LeaseRecord
- type LeaseRequest
- type Root
- type SessionRecord
- type TurnPhase
Constants ¶
View Source
const ( SessionSchema = "awf-live-session-v1" PhaseIntentRecorded = TurnPhase("intent_recorded") PhaseProviderTurnStarted = TurnPhase("provider_turn_started") )
View Source
const LeaseSchema = "awf-live-lease-v1"
Variables ¶
View Source
var ( ErrLiveHomeDrift = errors.New("agent/live: live home drift") ErrUnsafeRoot = errors.New("agent/live: unsafe root") ErrInvalidSessionKey = errors.New("agent/live: invalid session key") ErrSessionDrift = errors.New("agent/live: session drift") ErrActiveTurnNotClearable = errors.New("agent/live: active turn not clearable") ErrActiveTurnMismatch = errors.New("agent/live: active turn mismatch") ErrLiveLeaseConflict = agent.ErrLiveLeaseConflict ErrLiveLeaseStaleOwned = agent.ErrLiveLeaseStaleOwned )
Functions ¶
func CheckSessionDrift ¶
func CheckSessionDrift(existing, next SessionRecord) error
func ClearActiveTurnIfSafe ¶
func FinalizeCommittedTurn ¶
func FinalizeCommittedTurn(root Root, adapterRef, sessionKey string, turn CommittedTurn) error
func FormatVersion ¶
func RecordTurnIntent ¶
func RecordTurnIntent(root Root, adapterRef, sessionKey string, turn ActiveTurn) error
func RedactKnownSecretShapes ¶
func ReleaseLease ¶
func SessionRecordPath ¶
func ValidateSessionKey ¶
func WriteSessionRecord ¶
func WriteSessionRecord(root Root, rec SessionRecord) error
Types ¶
type ActiveTurn ¶
type ActiveTurn struct {
Phase TurnPhase `json:"phase"`
RunID string `json:"run_id"`
NodePath string `json:"node_path"`
CurrentEpoch int `json:"current_epoch"`
NextEpoch int `json:"next_epoch"`
PromptDigest string `json:"prompt_digest"`
LeaseID string `json:"lease_id"`
ProviderTurnID string `json:"provider_turn_id,omitempty"`
}
type CommittedTurn ¶
type LeaseRecord ¶
type LeaseRecord struct {
Schema string `json:"schema"`
AdapterRef string `json:"adapter_ref"`
SessionKey string `json:"session_key"`
OwnerRunID string `json:"owner_run_id"`
OwnerPID int `json:"owner_pid"`
OwnerNodePath string `json:"owner_node_path"`
OwnerEpoch int `json:"owner_epoch"`
LeaseID string `json:"lease_id"`
TTLSeconds int64 `json:"ttl_seconds"`
AcquiredUnix int64 `json:"acquired_unix"`
HeartbeatUnix int64 `json:"heartbeat_unix"`
}
func AcquireLease ¶
func AcquireLease(root Root, req LeaseRequest, now time.Time, runHeld func(string) bool) (LeaseRecord, error)
type LeaseRequest ¶
type LeaseRequest struct {
AdapterRef string `json:"adapter_ref"`
SessionKey string `json:"session_key"`
OwnerRunID string `json:"owner_run_id"`
OwnerPID int `json:"owner_pid"`
OwnerNodePath string `json:"owner_node_path"`
OwnerEpoch int `json:"owner_epoch"`
LeaseID string `json:"lease_id"`
TTLSeconds int64 `json:"ttl_seconds"`
}
type SessionRecord ¶
type SessionRecord struct {
Schema string `json:"schema"`
AdapterRef string `json:"adapter_ref"`
SessionKey string `json:"session_key"`
CWD string `json:"cwd,omitempty"`
CanonicalCWD string `json:"canonical_cwd"`
ProviderSessionID string `json:"provider_session_id,omitempty"`
TmuxSession string `json:"tmux_session,omitempty"`
TranscriptPath string `json:"transcript_path,omitempty"`
OwnerRunID string `json:"owner_run_id,omitempty"`
LastSeenUnix int64 `json:"last_seen_unix,omitempty"`
AdapterVersion string `json:"adapter_version,omitempty"`
ProviderBinary string `json:"provider_binary,omitempty"`
ProviderProtocolSchema string `json:"provider_protocol_schema,omitempty"`
ActiveTurn *ActiveTurn `json:"active_turn,omitempty"`
LastCommittedTurn *CommittedTurn `json:"last_committed_turn,omitempty"`
}
func ReadSessionRecord ¶
func ReadSessionRecord(root Root, adapterRef, sessionKey string) (SessionRecord, error)
Click to show internal directories.
Click to hide internal directories.