computerhost

package
v2.25.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package computerhost keeps the state of computer steps that the server, CLI and executor share.

Index

Constants

View Source
const (
	// AgentProvider identifies computer steps in agent sessions.
	AgentProvider = "computer"
	// DataDirName is the directory under the Dagu data directory that holds
	// computer step state.
	DataDirName = "computer"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Record

type Record struct {
	DAGName  string `json:"dagName"`
	DAGRunID string `json:"dagRunId"`
	StepName string `json:"stepName"`
	// Generation is the agent-session generation that paused.
	Generation int `json:"generation"`
	// Deadline bounds how long the step waits to be resumed.
	Deadline time.Time `json:"deadline"`
	// Cursor is the index of the next operation a resumed step runs.
	Cursor int `json:"cursor"`
	// Outputs holds values extracted before the step paused.
	Outputs map[string]any `json:"outputs,omitempty"`
	// ReplayPending and ReplayUsed carry the step's replay cache changes
	// across the pause: the act operations it recorded or dropped, applied
	// only if the step succeeds, and the recordings it replayed, as they
	// were read.
	ReplayPending map[string]json.RawMessage `json:"replayPending,omitempty"`
	ReplayUsed    map[string]json.RawMessage `json:"replayUsed,omitempty"`
}

Record describes a computer step that paused for input. It exists only while the step waits. A DAG run holds one record per step.

func (Record) Waiting

func (r Record) Waiting(now time.Time) bool

Waiting reports whether the record still accepts a resume at now.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store persists records as private files.

func NewStore

func NewStore(computerDataDir string) *Store

NewStore returns a store rooted under the computer data directory.

func (*Store) Delete

func (s *Store) Delete(dagRunID, stepName string) error

Delete removes the record of a step of a DAG run. A missing record is not an error.

func (*Store) Load

func (s *Store) Load(dagRunID, stepName string) (Record, error)

Load returns the record of a step of a DAG run. A missing record reports os.ErrNotExist.

func (*Store) Save

func (s *Store) Save(record Record) error

Save writes the record of its step, replacing any previous version, and removes records whose deadline passed.

Jump to

Keyboard shortcuts

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