termhost

package
v0.9.49 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package termhost publishes the visible chat lifecycle to terminal hosts. Host adapters are deliberately thin; Manager owns ordering, fanout, coalescing, timeouts, and shutdown.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	Name() string
	Send(context.Context, Event) error
}

Adapter is the small integration boundary implemented by first-party hosts and generic command sinks.

type Control

type Control struct {
	Sequence     string
	RefreshAfter time.Duration
}

Control is terminal output that must be returned to Bubble Tea's renderer. RefreshAfter is non-zero while the active OSC protocol needs a keepalive.

type Event

type Event = lifecycle.Event

Event aliases the dependency-free public lifecycle event contract.

type Manager

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

Manager fans each lifecycle event out to independently scheduled adapters. Report never waits for an adapter. Each adapter retains only its latest pending state while its current command is running.

func New

func New(cfg config.LifecycleConfig, legacyProgress bool) (*Manager, error)

New discovers all selected terminal hosts and starts one independent worker per enabled adapter. Multiple detected hosts are active simultaneously.

func (*Manager) Close

func (m *Manager) Close()

Close relinquishes all claimed adapters in parallel. The total wait is one aggregate budget, regardless of adapter count. Close is idempotent.

func (*Manager) Report

func (m *Manager) Report(snapshot lifecycle.Snapshot) Control

Report publishes a normalized snapshot once and returns any renderer-owned OSC output. Calling Report with an unchanged active snapshot is useful for an OSC keepalive; adapters still deduplicate it independently.

func (*Manager) RestoreOSC

func (m *Manager) RestoreOSC() string

RestoreOSC returns a clear sequence when this manager currently owns an OSC indicator. The caller must write it only after Bubble Tea releases renderer ownership (or while performing bounded forced-exit cleanup).

type Status

type Status struct {
	Name     string `json:"name"`
	Type     string `json:"type"`
	Detected bool   `json:"detected"`
	Enabled  bool   `json:"enabled"`
	Reason   string `json:"reason"`
}

Status describes why an adapter is or is not active. It is safe to expose to users: command arguments and environment values are never included.

type StatusReport

type StatusReport struct {
	Enabled  bool     `json:"enabled"`
	Reason   string   `json:"reason"`
	Adapters []Status `json:"adapters"`
	OSC      Status   `json:"osc"`
}

StatusReport is returned by lifecycle status and uses deterministic ordering.

func Inspect

func Inspect(cfg config.LifecycleConfig, legacyProgress bool) (StatusReport, error)

Inspect reports discovery and policy without publishing state or executing a custom command.

Jump to

Keyboard shortcuts

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