host

package
v0.0.0-...-fc91168 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: Apache-2.0 Imports: 43 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

Package host implements the optional local Host. It has no dependency on the control plane, Tailcat, relay admission, or the client's SSH implementation.

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0 Copyright 2026 Nimote contributors

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const Address = "127.0.0.1:47831"
View Source
const Protocol = 1
View Source
const StructuredAgentSupported = structuredAgentSupported

Variables

View Source
var Edition = "community"

Edition is set by the downstream Connect release build.

View Source
var ErrRequestConflict = errRequestConflict
View Source
var ErrRequestUncertain = errRequestUncertain
View Source
var Version = "2.5.0-community"

Version is set by the release build; protocol compatibility is tracked separately.

Functions

func AtomicWrite

func AtomicWrite(path string, data []byte) error

func Call

func Call(ctx context.Context, dir string, req RPCRequest) ([]byte, error)

func CanonicalDirectory

func CanonicalDirectory(path string) string

func CheckStateName

func CheckStateName(dir string) error

CheckStateName prevents a status probe or a new GUI from creating a second identity before setup has migrated a legacy installation.

func ControlLock

func ControlLock(dir string) (*os.File, error)

ControlLock serializes management across GUI processes without owning Host lifetime.

func DecodeJSON

func DecodeJSON(data []byte, value any) error

func DefaultDir

func DefaultDir() (string, error)

func DeviceContext

func DeviceContext(ctx context.Context, id string) context.Context

func DeviceSSHCommand

func DeviceSSHCommand(binary, id string) (string, error)

DeviceSSHCommand generates the forced command only. Administrators bind it to a unique public key with OpenSSH restrict,command="..."; never a normal shell key.

func Fail

func Fail(w http.ResponseWriter, status int, message string)

func GitEvidence

func GitEvidence(ctx context.Context, dir string, args ...string) ([]byte, error)

func InitializeToolEnvironment

func InitializeToolEnvironment(ctx context.Context, dir string) error

InitializeToolEnvironment resolves the logged-in account's tools once. Shell failure is reported in diagnostics and falls back to platform directories. Invalid explicit configuration fails closed and never replaces a good snapshot.

func InspectAgents

func InspectAgents(ctx context.Context) map[string]AgentInstallation

InspectAgents is an explicit local diagnostic, never called by capabilities polling. A --version result is descriptive only; live handshakes decide safety. Uses the same owned process backend, bounded output and tree cancellation.

func MutationFailure

func MutationFailure(w http.ResponseWriter, err error)

func NewRequestID

func NewRequestID() (string, error)

NewRequestID creates an expiring, cryptographically random mutation key. Reuse it unchanged for retries. After seven days the Host rejects the key, allowing its receipt to be removed without permitting delayed execution. Clients must check mutation_expiry_v1 before using this format with old Hosts.

func PrivateDir

func PrivateDir(path string) error

func ReadJSON

func ReadJSON(w http.ResponseWriter, r *http.Request, value any) bool

func ReadPrivateLimit

func ReadPrivateLimit(path string, limit int64) ([]byte, error)

func ReadRunLog

func ReadRunLog(dir string) (string, error)

func Respond

func Respond(w http.ResponseWriter, status int, value any)

func RevokeDevice

func RevokeDevice(dir, id string) error

func RunEvidenceProcess

func RunEvidenceProcess(ctx context.Context, cmd *exec.Cmd, input io.Reader) ([]byte, error)

func RunOnce

func RunOnce[T any](m *WorkflowRuntime, id, operation string, payload any, run func() (T, error)) (T, error)

RunOnce uses the same receipt store and request fingerprint as core RPC.

func SameWorkspaceDirectory

func SameWorkspaceDirectory(a, b string) bool

func SaveConfig

func SaveConfig(dir string, c Config) error

SaveConfig only changes stopped Hosts. Callers serialize lifecycle operations.

func Serve

func Serve(ctx context.Context, dir string, ready io.Writer) error

Serve reserves the loopback listener before reading or recovering session state. A second daemon cannot mark the live daemon's processes interrupted.

func ServeMCP

func ServeMCP(ctx context.Context, dir string, in io.Reader, out io.Writer, write bool) error

ServeMCP delegates JSON-RPC, lifecycle and protocol negotiation to the official SDK. Host retains tool authorization and authenticated loopback RPC only.

func ServeRPCStream

func ServeRPCStream(ctx context.Context, dir string, input io.Reader, output io.Writer) error

ServeRPCStream carries bounded, multiplexed requests over one SSH exec channel. The credential stays on the host. EOF only detaches the client; processes belong to the daemon, never to this bridge.

func ServeWithExtension

func ServeWithExtension(ctx context.Context, dir string, ready io.Writer, extension Extension) error

func StateIdle

func StateIdle(dir string) (bool, error)

StateIdle distinguishes a closed RPC listener from completion of process and session cleanup. A new detached daemon must wait until the previous owner releases this lock, even after the shutdown response has been delivered.

func SupportsStructuredAgent

func SupportsStructuredAgent(agent string) bool

func ValidExecutionPolicy

func ValidExecutionPolicy(policy string) bool

func ValidID

func ValidID(id string) bool

Types

type Activity

type Activity struct {
	Sequence     uint64    `json:"sequence"`
	Type         string    `json:"type"`
	State        string    `json:"state,omitempty"`
	ReferenceID  string    `json:"reference_id,omitempty"`
	OutputOffset int64     `json:"output_offset"`
	Time         time.Time `json:"time"`
}

Activity is a small history reference, never a second copy of terminal/tool content. OutputOffset points into the existing rolling byte log.

type ActivityPage

type ActivityPage struct {
	Events         []Activity `json:"events"`
	Cursor         uint64     `json:"cursor"`
	ResyncRequired bool       `json:"resync_required"`
}

type AgentInstallation

type AgentInstallation struct {
	PathSource          string                       `json:"path_source,omitempty"`
	DiscoveryError      string                       `json:"discovery_error,omitempty"`
	SessionCapabilities *ExternalSessionCapabilities `json:"session_capabilities,omitempty"`
	CLIPath             string                       `json:"cli_path,omitempty"`
	CLIDiscovered       bool                         `json:"cli_discovered"`
	History             string                       `json:"history"`
	Resume              string                       `json:"resume"`
	LiveAttach          bool                         `json:"live_attach"`
	LiveAttachReason    string                       `json:"live_attach_reason"`
	Path                string                       `json:"path,omitempty"`
	Protocol            string                       `json:"protocol"`
	ProtocolVersion     int                          `json:"protocol_version,omitempty"`
	Installed           bool                         `json:"installed"`
	Version             string                       `json:"version,omitempty"`
	ProbeStatus         string                       `json:"probe_status"`
}

type AgentMessage

type AgentMessage struct {
	Action     string `json:"action"`
	RequestID  string `json:"request_id,omitempty"`
	Text       string `json:"text,omitempty"`
	TurnID     string `json:"turn_id,omitempty"`
	ApprovalID string `json:"approval_id,omitempty"`
	Decision   string `json:"decision,omitempty"`
	OptionID   string `json:"option_id,omitempty"`
	Value      string `json:"value,omitempty"`
}

AgentMessage is a semantic operation, never terminal input or arbitrary RPC.

type AgentResume

type AgentResume struct {
	ConversationID string `json:"conversation_id"`
}

type AgentStatement

type AgentStatement struct {
	Text   string `json:"text"`
	Source string `json:"source"`
}

type Capabilities

type Capabilities struct {
	Enforcement *ResourceEnforcement         `json:"enforcement,omitempty"`
	Version     string                       `json:"version"`
	Protocol    int                          `json:"protocol"`
	MinProtocol int                          `json:"min_protocol"`
	Platform    string                       `json:"platform"`
	Arch        string                       `json:"arch"`
	HostID      string                       `json:"host_id"`
	Features    map[string]bool              `json:"features"`
	Tools       map[string]string            `json:"tools"`
	Agents      map[string]AgentInstallation `json:"agents,omitempty"`
}

type CodeVersion

type CodeVersion struct {
	Root        string   `json:"root"`
	CommonDir   string   `json:"common_dir"`
	Branch      string   `json:"branch"`
	Head        string   `json:"head"`
	Fingerprint string   `json:"fingerprint"`
	Dirty       bool     `json:"dirty"`
	Files       []string `json:"files"`
	DiffStat    string   `json:"diff_stat"`
	Unknown     string   `json:"unknown,omitempty"`
}

func CaptureCode

func CaptureCode(ctx context.Context, dir string) (CodeVersion, string)

type Config

type Config struct {
	Port     int    `json:"port"`
	LogLevel string `json:"log_level"`
}

Config is shared by every local client. The SSH RPC wire protocol is unchanged.

func ReadConfig

func ReadConfig(dir string) (Config, error)

func (Config) Address

func (c Config) Address() string

func (Config) Validate

func (c Config) Validate() error

type ConflictWarning

type ConflictWarning struct {
	Sessions    []string `json:"sessions"`
	Agents      []string `json:"agents"`
	Directories []string `json:"directories"`
	Kind        string   `json:"kind"`
	Severity    string   `json:"severity"`
	Files       []string `json:"files"`
	Evidence    string   `json:"evidence"`
	Attribution string   `json:"attribution"`
}

type Device

type Device struct {
	ID             string            `json:"id"`
	Name           string            `json:"name"`
	Role           string            `json:"role"`
	Created        time.Time         `json:"created"`
	Revoked        *time.Time        `json:"revoked,omitempty"`
	Sessions       []string          `json:"sessions,omitempty"`
	IdentityScopes map[string]uint32 `json:"identity_scopes,omitempty"`
}

Devices are deliberately read-only. Giving a same-user client command execution would let it read the owner's credential and bypass device revocation.

func CreateControllerDevice

func CreateControllerDevice(dir, name string, sessions []string) (Device, error)

func CreateDevice

func CreateDevice(dir, name string) (Device, error)

func CreateScopedDevice

func CreateScopedDevice(dir, name, role string, sessions []string) (Device, error)

CreateScopedDevice grants observation, or cancellation/decline only, to an explicit set of existing session IDs. It never grants OS-user execution.

func ListDevices

func ListDevices(dir string) ([]Device, error)

type Event

type Event struct {
	Revision  uint64    `json:"revision"`
	SessionID string    `json:"session_id"`
	State     string    `json:"state"`
	Time      time.Time `json:"time"`
}

Event is a durable state-change notification, independent of client lifetime. Output remains in the per-session byte log and is retrieved with its cursor.

type EventPage

type EventPage struct {
	Events         []Event `json:"events"`
	Cursor         uint64  `json:"cursor"`
	ResyncRequired bool    `json:"resync_required"`
}

type ExecutionIdentity

type ExecutionIdentity struct {
	UID uint32 `json:"uid"`
	GID uint32 `json:"gid"`
}

Advanced Linux-only execution boundary. A fresh dedicated numeric UID is reserved for one session forever; it is not the Host's account or another session's identity. Unsupported/nonprivileged backends fail before execution.

type Extension

type Extension struct {
	Path       string
	NewHandler func(*WorkflowRuntime) ScopedHandler
	Features   func(map[string]string) map[string]bool
}

Extension registers a workflow handler and its negotiated feature flags.

type ExternalAttachment

type ExternalAttachment struct {
	ExternalConnection
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

type ExternalConnection

type ExternalConnection struct {
	Transport string `json:"transport"`
	Endpoint  string `json:"endpoint"`
}

Only non-secret connection identity is persisted with Session. Credentials travel in authenticated POST bodies, never query strings, args or Session.

type ExternalSessionCapabilities

type ExternalSessionCapabilities struct {
	DiscoveryTransports []string `json:"discovery_transports,omitempty"`
	LiveTransports      []string `json:"live_transports,omitempty"`
	Discovery           string   `json:"discovery"`
	History             string   `json:"history"`
	Resume              string   `json:"resume"`
	LiveControl         string   `json:"live_control"`
	HistoryMode         string   `json:"history_mode"`
	Reason              string   `json:"reason"`
}

Values are supported, conditional, or unsupported. Conditional requires a successful native request; installation or a saved ID is not sufficient.

type HistoryAggregate

type HistoryAggregate struct {
	Partial          bool              `json:"partial"`
	Items            []map[string]any  `json:"items"`
	NextCursor       *string           `json:"next_cursor"`
	Providers        map[string]string `json:"providers"`
	LiveAttach       bool              `json:"live_attach"`
	LiveAttachReason string            `json:"live_attach_reason"`
}

type InboxItem

type InboxItem struct {
	SummarySource string    `json:"summary_source"`
	Session       Session   `json:"session"`
	View          string    `json:"view"`
	Updated       time.Time `json:"updated"`
	Summary       string    `json:"summary"`
	Revision      string    `json:"revision"`
	Archived      bool      `json:"archived"`
}

type InboxPage

type InboxPage struct {
	Items  []InboxItem    `json:"items"`
	Counts map[string]int `json:"counts"`
}

type InboxReview

type InboxReview struct {
	CompletedTurnSequence uint64    `json:"completed_turn_sequence,omitempty"`
	Status                string    `json:"status"`
	Revision              uint64    `json:"revision"`
	Sequence              uint64    `json:"sequence"`
	Updated               time.Time `json:"updated"`
}

Review markers acknowledge one observed revision, never future turns.

type Manager

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

func NewManager

func NewManager(dir string) (*Manager, error)

func NewManagerWithLimits

func NewManagerWithLimits(dir string, limits ResourceLimits) (*Manager, error)

func (*Manager) Activity

func (m *Manager) Activity(id string, after uint64) (ActivityPage, error)

func (*Manager) AgentMessage

func (m *Manager) AgentMessage(id string, req AgentMessage) error

func (*Manager) AgentSnapshot

func (m *Manager) AgentSnapshot(id string) (map[string]any, error)

func (*Manager) Cancel

func (m *Manager) Cancel(id string) error

func (*Manager) CaptureVerification

func (m *Manager) CaptureVerification(ctx context.Context, id string) (VerificationReport, error)

func (*Manager) Close

func (m *Manager) Close()

func (*Manager) Conflicts

func (m *Manager) Conflicts(ctx context.Context, allowed func(string) bool) []ConflictWarning

func (*Manager) Delete

func (m *Manager) Delete(id string) error

func (*Manager) Events

func (m *Manager) Events(after uint64) EventPage

func (*Manager) Get

func (m *Manager) Get(id string) (Session, error)

func (*Manager) Inbox

func (m *Manager) Inbox(allowed func(string) bool) (InboxPage, error)

allowed is applied before reading auxiliary metadata or computing counts.

func (*Manager) Input

func (m *Manager) Input(id string, data []byte) error

func (*Manager) List

func (m *Manager) List(after uint64) []Session

func (*Manager) OpenInputStream

func (m *Manager) OpenInputStream(id, principal string) (string, error)

Streams are allocated by the daemon, never reconstructed from client input. Losing a stream (restart or bounded eviction) makes every old frame invalid. This is safe because terminal processes do not survive a daemon restart.

func (*Manager) Output

func (m *Manager) Output(id string, offset int64) ([]byte, int64, error)

Output keeps the protocol-1 byte cursor contract. OutputPage also reports where retained output starts when an old cursor has fallen behind.

func (*Manager) OutputPage

func (m *Manager) OutputPage(id string, offset int64) ([]byte, int64, int64, error)

func (*Manager) PrepareIdleShutdown

func (m *Manager) PrepareIdleShutdown() error

PrepareIdleShutdown atomically rejects shutdown if any process is still owned and prevents new sessions from starting once an idle shutdown is accepted.

func (*Manager) RequestStorage

func (m *Manager) RequestStorage() *RequestStorageStatus

RequestStorage is local operational metadata; it contains no mutation payloads. Legacy receipts cannot be safely discarded without changing the old protocol.

func (*Manager) Resize

func (m *Manager) Resize(id string, rows, cols uint16) error

func (*Manager) Resources

func (m *Manager) Resources() ResourceStatus

func (*Manager) ReviewInbox

func (m *Manager) ReviewInbox(id, revision, status string) error

func (*Manager) Start

func (m *Manager) Start(req StartRequest) (Session, error)

Auto mode probes a live stable-protocol handshake before a prompt is accepted. This wrapper never holds the manager lock while waiting for the agent, so an upgrade-incompatible CLI cannot freeze other terminals. No user turn is sent during probing, and running turns are never retried through another adapter.

func (*Manager) StartVerification

func (m *Manager) StartVerification(ctx context.Context, id string, commands []TestCommand) (VerificationReport, error)

func (*Manager) StreamInput

func (m *Manager) StreamInput(id, principal, streamID string, sequence uint64, data []byte) (inputStreamReceipt, error)

Only the next sequence can write. The latest receipt can be queried again with the same bytes; older frames and changed duplicates are never replayed. A failed/partial write poisons the stream, including all subsequent frames. inputMu also serializes writes from legacy clients and other devices.

func (*Manager) Verification

func (m *Manager) Verification(ctx context.Context, id string) (VerificationReport, error)

type MutationReceipt

type MutationReceipt = mutationReceipt

type RPCRequest

type RPCRequest = hostclient.Request

RPCRequest is one authenticated request transported over an existing SSH exec channel. No credential is returned to the phone or placed in argv.

type RecoveryFile

type RecoveryFile struct {
	Name   string `json:"name"`
	SHA256 string `json:"sha256"`
	Size   int64  `json:"size"`
	Issue  string `json:"issue,omitempty"`
	Action string `json:"action,omitempty"`
}

Recovery is explicit local maintenance on a stopped Host. Unknown/unsafe files block repair; request receipts, credentials, outputs and activity are never reset.

type RecoveryPlan

type RecoveryPlan struct {
	ID            string         `json:"id"`
	Files         []RecoveryFile `json:"files"`
	Blocked       bool           `json:"blocked"`
	ResetRevision uint64         `json:"reset_revision"`
}

func InspectRecovery

func InspectRecovery(dir string) (RecoveryPlan, error)

type RecoveryResult

type RecoveryResult struct {
	Changed bool   `json:"changed"`
	Backup  string `json:"backup,omitempty"`
}

func ApplyRecovery

func ApplyRecovery(dir, planID string) (RecoveryResult, error)

type RequestStorageStatus

type RequestStorageStatus struct {
	Receipts         int   `json:"receipts"`
	LegacyReceipts   int   `json:"legacy_receipts"`
	Bytes            int64 `json:"bytes"`
	ReservedBytes    int64 `json:"reserved_bytes"`
	Active           int   `json:"active"`
	ReceiptLimit     int   `json:"receipt_limit"`
	ByteLimit        int64 `json:"byte_limit"`
	RetentionSeconds int64 `json:"retention_seconds"`
	CapacityWarning  bool  `json:"capacity_warning"`
}

type ResourceEnforcement

type ResourceEnforcement struct {
	Backend             string `json:"backend"`
	HardCPU             bool   `json:"hard_cpu"`
	HardMemory          bool   `json:"hard_memory"`
	HardTasks           bool   `json:"hard_tasks"`
	CrashCleanup        string `json:"crash_cleanup"`
	IndependentIdentity bool   `json:"independent_identity"`
}

type ResourceLimits

type ResourceLimits struct {
	MaxActiveSessions   int    `json:"max_active_sessions"`
	MaxRetainedSessions int    `json:"max_retained_sessions"`
	MaxRuntimeSeconds   int64  `json:"max_runtime_seconds"`
	MinFreeDiskBytes    uint64 `json:"min_free_disk_bytes"`
	CPUPercent          int    `json:"cpu_percent,omitempty"`
	MemoryBytes         uint64 `json:"memory_bytes,omitempty"`
	MaxProcesses        int    `json:"max_processes,omitempty"`
	CgroupRoot          string `json:"cgroup_root,omitempty"`
	// contains filtered or unexported fields
}

ResourceLimits governs Host admission and supervised process lifetimes. It is separate from GUI-owned config.json, so old clients cannot silently erase it. Zero runtime means unlimited. Native quotas require a supported kernel containment backend.

func DefaultResourceLimits

func DefaultResourceLimits() ResourceLimits

func ReadResourceLimits

func ReadResourceLimits(dir string) (ResourceLimits, error)

func (ResourceLimits) Validate

func (l ResourceLimits) Validate() error

type ResourceStatus

type ResourceStatus struct {
	Limits        ResourceLimits `json:"limits"`
	Active        int            `json:"active"`
	Retained      int            `json:"retained"`
	FreeDiskBytes uint64         `json:"free_disk_bytes"`
	DiskAvailable bool           `json:"disk_available"`
}

type RunLog

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

RunLog retains a bounded native-service log, never terminal or Agent output.

func OpenRunLog

func OpenRunLog(dir string) (*RunLog, error)

func (*RunLog) Close

func (l *RunLog) Close() error

func (*RunLog) Write

func (l *RunLog) Write(b []byte) (int, error)

type ScopedHandler

type ScopedHandler func(http.ResponseWriter, *http.Request, func(string) bool)

ScopedHandler runs after Host authentication, protocol and request limits. A non-nil session predicate limits reads to the caller's authorized sessions. Only the owner can call mutation methods.

type Server

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

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Session

type Session struct {
	External *ExternalConnection `json:"external,omitempty"`

	SourceDirectory       string         `json:"source_directory,omitempty"`
	BaseCommit            string         `json:"base_commit,omitempty"`
	ExecutionPolicy       string         `json:"execution_policy,omitempty"`
	ActivitySequence      uint64         `json:"activity_sequence,omitempty"`
	Task                  *TaskReference `json:"task,omitempty"`
	AgentStatus           string         `json:"agent_status,omitempty"`
	StartRequestID        string         `json:"start_request_id,omitempty"`
	CompatibilityFallback string         `json:"compatibility_fallback,omitempty"`
	Interaction           string         `json:"interaction,omitempty"`
	OutputBytes           int64          `json:"output_bytes"`
	OutputTruncated       bool           `json:"output_truncated"`
	ID                    string         `json:"id"`
	ConversationID        string         `json:"conversation_id,omitempty"`
	Kind                  string         `json:"kind"`
	Agent                 string         `json:"agent,omitempty"`
	Command               string         `json:"command"`
	Args                  []string       `json:"args,omitempty"`
	Directory             string         `json:"directory"`
	State                 string         `json:"state"`
	Started               time.Time      `json:"started"`
	Finished              *time.Time     `json:"finished,omitempty"`
	ExitCode              *int           `json:"exit_code,omitempty"`
	Error                 string         `json:"error,omitempty"`
	Revision              uint64         `json:"revision"`
}

type StartRequest

type StartRequest struct {
	Attach *ExternalAttachment `json:"attach,omitempty"`

	Worktree        *WorktreeRequest   `json:"worktree,omitempty"`
	Identity        *ExecutionIdentity `json:"execution_identity,omitempty"`
	ExecutionPolicy string             `json:"execution_policy,omitempty"`
	Task            *TaskReference     `json:"task,omitempty"`
	RequestID       string             `json:"request_id,omitempty"`

	Interaction string       `json:"interaction,omitempty"` // terminal (default), structured, or auto
	Kind        string       `json:"kind"`                  // task, terminal, agent
	Command     string       `json:"command"`
	Args        []string     `json:"args"`
	Directory   string       `json:"directory"`
	Agent       string       `json:"agent"` // codex, claude, opencode
	Resume      *AgentResume `json:"resume,omitempty"`
	// contains filtered or unexported fields
}

type TaskReference

type TaskReference struct {
	ID    string `json:"id"`
	Label string `json:"label,omitempty"`
}

A client Task reference scoped by the session's Host and workspace. It never authorizes executing that Task or bypassing approvals.

type TestCommand

type TestCommand struct {
	Command string   `json:"command"`
	Args    []string `json:"args,omitempty"`
}

type TestEvidence

type TestEvidence struct {
	TestCommand
	SessionID  string     `json:"session_id,omitempty"`
	Started    *time.Time `json:"started,omitempty"`
	Finished   *time.Time `json:"finished,omitempty"`
	ExitCode   *int       `json:"exit_code"`
	Status     string     `json:"status"`
	Version    string     `json:"version"`
	Source     string     `json:"source"`
	OutputPath string     `json:"output_path,omitempty"`
}

type ToolEnvironmentConfig

type ToolEnvironmentConfig struct {
	Executables  map[string]string `json:"executables,omitempty"`
	SearchPaths  []string          `json:"search_paths,omitempty"`
	DisableShell bool              `json:"disable_shell,omitempty"`
}

ToolEnvironmentConfig is intentionally separate from config.json: GUI settings writers and older clients must not erase executable overrides when saving ports.

type ToolEnvironmentStatus

type ToolEnvironmentStatus struct {
	RefreshedAt time.Time             `json:"refreshed_at"`
	ShellStatus string                `json:"shell_status"`
	SearchPaths []toolSearchDirectory `json:"search_paths"`
	Executables map[string]string     `json:"executables,omitempty"`
}

type VerificationReport

type VerificationReport struct {
	AgentStatement   *AgentStatement `json:"agent_statement,omitempty"`
	BaseCommit       string          `json:"base_commit,omitempty"`
	TestedTree       string          `json:"tested_tree,omitempty"`
	RemoteStale      bool            `json:"remote_stale,omitempty"`
	PublishedCommit  string          `json:"published_commit,omitempty"`
	SessionID        string          `json:"session_id"`
	Task             *TaskReference  `json:"task"`
	Workspace        string          `json:"workspace"`
	Goal             string          `json:"goal"`
	Result           string          `json:"result"`
	ResultSource     string          `json:"result_source"`
	Captured         time.Time       `json:"captured"`
	Version          CodeVersion     `json:"version"`
	Source           string          `json:"source"`
	Status           string          `json:"status"`
	Tests            []TestEvidence  `json:"tests"`
	Stale            bool            `json:"stale"`
	PRURL            *string         `json:"pr_url"`
	Unknown          []string        `json:"unknown"`
	DiffSHA          string          `json:"diff_sha"`
	DiffPath         string          `json:"diff_path"`
	OutputPath       string          `json:"output_path"`
	ActivitySequence uint64          `json:"activity_sequence"`
	Diff             string          `json:"-"`
}

type WorkflowRuntime

type WorkflowRuntime struct {
	*Manager
}

WorkflowRuntime lets linked orchestration use the live Host manager and its durable ledger while keeping the session and process internals private.

func NewWorkflowRuntime

func NewWorkflowRuntime(manager *Manager) *WorkflowRuntime

func (*WorkflowRuntime) BeginMutation

func (m *WorkflowRuntime) BeginMutation() (func(), bool)

BeginMutation keeps idle shutdown from interrupting a synchronous workflow mutation before its asynchronous worker has been registered.

func (*WorkflowRuntime) Context

func (m *WorkflowRuntime) Context() context.Context

func (*WorkflowRuntime) Launch

func (m *WorkflowRuntime) Launch(id string, run func()) bool

func (*WorkflowRuntime) MarkVerificationRemoteStale

func (m *WorkflowRuntime) MarkVerificationRemoteStale(id, reason string) error

func (*WorkflowRuntime) ReadReceipt

func (m *WorkflowRuntime) ReadReceipt(id string) (requestRecord, error)

func (*WorkflowRuntime) Running

func (m *WorkflowRuntime) Running(id string) bool

func (*WorkflowRuntime) SaveVerification

func (m *WorkflowRuntime) SaveVerification(id string, report VerificationReport) error

func (*WorkflowRuntime) SessionDir

func (m *WorkflowRuntime) SessionDir() string

func (*WorkflowRuntime) Start

func (m *WorkflowRuntime) Start(req StartRequest, baseCommit string) (Session, error)

func (*WorkflowRuntime) Stopped

func (m *WorkflowRuntime) Stopped() bool

func (*WorkflowRuntime) WaitAgentReady

func (m *WorkflowRuntime) WaitAgentReady(id string) error

type WorktreeRequest

type WorktreeRequest struct {
	Branch string `json:"branch,omitempty"`
	Base   string `json:"base,omitempty"`
}

Jump to

Keyboard shortcuts

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