keepalive

package
v0.1.0 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 keepalive provides agent activity signaling via file touch.

This package uses a best-effort design: all write operations silently ignore errors. This is intentional because:

  1. Keepalive signals are non-critical - the system works without them
  2. Failures (disk full, permissions, etc.) should not interrupt gt commands
  3. The daemon tolerates missing signals by using timeouts

Functions in this package write JSON files to .runtime/ or daemon/ directories. These files are used by the daemon to detect agent activity and implement features like exponential backoff during idle periods.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Touch

func Touch(command string)

Touch updates the keepalive file in the workspace's .runtime directory. It silently ignores errors (best-effort signaling).

func TouchInWorkspace

func TouchInWorkspace(workspaceRoot, command string)

TouchInWorkspace updates the keepalive file in a specific workspace. It silently ignores errors (best-effort signaling).

func TouchWithArgs

func TouchWithArgs(command string, args []string)

TouchWithArgs updates the keepalive file with the full command including args. It silently ignores errors (best-effort signaling).

Types

type State

type State struct {
	LastCommand string    `json:"last_command"`
	Timestamp   time.Time `json:"timestamp"`
}

State represents the keepalive file contents.

func Read

func Read(workspaceRoot string) *State

Read returns the current keepalive state for the workspace. Returns nil if the file doesn't exist or can't be read.

func (*State) Age

func (s *State) Age() time.Duration

Age returns how old the keepalive signal is. Returns a very large duration if the state is nil.

Jump to

Keyboard shortcuts

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