harness

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ManagedMarker      = "aht managed integration"
	HookTimeoutSeconds = 5

	HookTypeCommand             = "command"
	HookEventSessionStart       = "SessionStart"
	HookEventSessionEnd         = "SessionEnd"
	HookEventUserPromptSubmit   = "UserPromptSubmit"
	HookEventPostToolUse        = "PostToolUse"
	HookEventPostToolUseFailure = "PostToolUseFailure"
	HookEventPreToolUse         = "PreToolUse"
	HookEventStop               = "Stop"
)
View Source
const (
	IntegrationVersion = 7
)

Variables

This section is empty.

Functions

func EnvNames

func EnvNames(field EnvField) []string

func FromCommand

func FromCommand(command string) (registry.Harness, bool)

func HookTimeoutSecondsFor

func HookTimeoutSecondsFor(harness registry.Harness, event string) int

HookTimeoutSecondsFor returns the native command-hook timeout for an event.

func IntegrationVersionFor

func IntegrationVersionFor(id registry.Harness) int

IntegrationVersionFor returns the managed artifact generation for a harness.

func Normalize

func Normalize(value string) (registry.Harness, error)

func PayloadCompatibleWithHarness

func PayloadCompatibleWithHarness(harness registry.Harness, rawPayload json.RawMessage) bool

func ProcessNames

func ProcessNames(harness registry.Harness) []string

ProcessNames returns executable names that identify a harness process.

func RawStdinDefaultsReportHookCommand

func RawStdinDefaultsReportHookCommand[T hookTransition](
	binary string,
	harness registry.Harness,
	transition T,
	event string,
	source string,
) string

func ReportHookCommand

func ReportHookCommand[T hookTransition](binary string, harness registry.Harness, transition T, event string, source string) string

func ResumeCommandFor

func ResumeCommandFor(harness registry.Harness, sessionID string, sessionPath string) []string

func ShellQuote

func ShellQuote(value string) string

func SupportedNames

func SupportedNames() []string

func WithResumeCommand

func WithResumeCommand(observation registry.Observation) registry.Observation

Types

type Adapter

type Adapter interface {
	Definition() Definition
}

func All

func All() []Adapter

func Find

func Find(harness registry.Harness) (Adapter, bool)

type Capabilities

type Capabilities struct {
	SessionStart      bool
	SessionEnd        bool
	RunningIdle       bool
	WaitingPermission bool
	ProcessIdentity   bool
	NativeCatalog     bool
	TTYTmuxContext    bool
}

type CommandHookInstallSpec

type CommandHookInstallSpec struct {
	Event   string
	Matcher string
	Command string
}

type CursorCommandHookInstallSpec

type CursorCommandHookInstallSpec struct {
	Event   string
	Command string
}

type CursorJSONHookInstallPlan

type CursorJSONHookInstallPlan struct {
	Path        string
	Source      string
	Label       string
	ConfigLabel string
	Hooks       []CursorCommandHookInstallSpec
}

type CursorJSONHooksAction

type CursorJSONHooksAction struct {
	Plan CursorJSONHookInstallPlan
}

type Definition

type Definition struct {
	ID           registry.Harness
	Aliases      []string
	ProcessNames []string
	Env          EnvKeys
	Capabilities Capabilities
}

type EnvField

type EnvField string
const (
	EnvSessionID   EnvField = "session_id"
	EnvSessionPath EnvField = "session_path"
	EnvProjectRoot EnvField = "project_root"
	EnvPID         EnvField = "pid"
	EnvEvent       EnvField = "event"
)

type EnvKeys

type EnvKeys struct {
	SessionID   []string
	SessionPath []string
	ProjectRoot []string
	PID         []string
	Event       []string
}

type HermesPluginRegistrationPlan

type HermesPluginRegistrationPlan struct {
	Command  string
	PluginID string
	Version  string
}

HermesPluginRegistrationPlan describes native Hermes plugin activation for a managed plugin installed in the documented user plugin directory.

type HookAdapter

type HookAdapter interface {
	HandleHook(invocation HookInvocation) HookResult
}

type HookInvocation

type HookInvocation struct {
	Event      string
	RawPayload json.RawMessage
	Payload    map[string]any
	ParentArgs []string
}

type HookPayloadValidator

type HookPayloadValidator func(json.RawMessage) bool

type HookResult

type HookResult struct {
	Report   registry.Observation
	ReportOK bool
	Response map[string]any
}

func HandleHook

func HandleHook(
	harness registry.Harness,
	explicitEvent string,
	rawPayload json.RawMessage,
	payload map[string]any,
	parentArgs []string,
) (HookResult, bool)

type HookTransition

type HookTransition string

HookTransition is the closed, dimension-aware state used by generated hook specifications that need to store a transition before rendering it.

const (
	HookActivityRunning     HookTransition = "activity:running"
	HookActivityWaiting     HookTransition = "activity:waiting"
	HookActivityIdle        HookTransition = "activity:idle"
	HookActivityFailed      HookTransition = "activity:failed"
	HookActivityInterrupted HookTransition = "activity:interrupted"
	HookPresenceGone        HookTransition = "presence:gone"
)

type ImportManifestInstallPlan

type ImportManifestInstallPlan struct {
	Path       string
	Name       string
	Source     string
	Components []string
}

type InstallAction

type InstallAction interface {
	// contains filtered or unexported methods
}

type InstallPlan

type InstallPlan struct {
	Actions []InstallAction
}

type Installable

type Installable interface {
	InstallPlan(binary string) InstallPlan
}

type JSONCommandHookInstallPlan

type JSONCommandHookInstallPlan struct {
	Path              string
	Source            string
	Label             string
	ConfigLabel       string
	StatusMessage     string
	OmitStatusMessage bool
	Hooks             []CommandHookInstallSpec
}

type JSONCommandHooksAction

type JSONCommandHooksAction struct {
	Plan JSONCommandHookInstallPlan
}

type ManagedTextBlockAction

type ManagedTextBlockAction struct {
	Plan ManagedTextBlockInstallPlan
}

type ManagedTextBlockInstallPlan

type ManagedTextBlockInstallPlan struct {
	Path        string
	Label       string
	ConfigLabel string
	StartMarker string
	EndMarker   string
	Block       string
}

type OpenClawPluginRegistrationPlan

type OpenClawPluginRegistrationPlan struct {
	Command                 string
	PluginID                string
	Version                 string
	AllowConversationAccess bool
}

OpenClawPluginRegistrationPlan describes native OpenClaw CLI registration for a managed plugin source directory.

type PayloadAdapter

type PayloadAdapter interface {
	PayloadCompatible(rawPayload json.RawMessage) bool
	PayloadDefaults(payload map[string]any) PayloadDefaults
}

type PayloadDefaults

type PayloadDefaults struct {
	SessionID   string
	SessionPath string
	CWD         string
	ProjectRoot string
	Event       string
	Attributes  map[string]string
}

func DefaultsFromPayload

func DefaultsFromPayload(harness registry.Harness, rawPayload json.RawMessage) PayloadDefaults

func DefaultsFromPayloadWithError

func DefaultsFromPayloadWithError(harness registry.Harness, rawPayload json.RawMessage) (PayloadDefaults, error)

DefaultsFromPayloadWithError derives known harness fields while preserving failures from adapters that consult auxiliary native session metadata.

type PluginDirectoryAction

type PluginDirectoryAction struct {
	Plan PluginDirectoryInstallPlan
}

type PluginDirectoryInstallPlan

type PluginDirectoryInstallPlan struct {
	Dir            string
	Label          string
	Files          []PluginFileInstallSpec
	SnippetOrder   []string
	MarkerFile     string
	ObsoleteFiles  []string
	ImportManifest *ImportManifestInstallPlan
	OpenClaw       *OpenClawPluginRegistrationPlan
	Hermes         *HermesPluginRegistrationPlan
}

type PluginFileInstallSpec

type PluginFileInstallSpec struct {
	Name        string
	Content     string
	JSONContent any
}

type RenderedFileAction

type RenderedFileAction struct {
	Plan RenderedFileInstallPlan
}

type RenderedFileInstallPlan

type RenderedFileInstallPlan struct {
	Path        string
	Label       string
	ConfigLabel string
	Content     string
	JSONContent any
}

type RenderedFileInstallSpec

type RenderedFileInstallSpec struct {
	Name        string
	Content     string
	JSONContent any
}

type RenderedFilesAction

type RenderedFilesAction struct {
	Plan RenderedFilesInstallPlan
}

type RenderedFilesInstallPlan

type RenderedFilesInstallPlan struct {
	Dir          string
	Label        string
	ConfigLabel  string
	Files        []RenderedFileInstallSpec
	SnippetOrder []string
}

type Resumable

type Resumable interface {
	ResumeCommand(sessionID string, sessionPath string) []string
}

type ShimAction

type ShimAction struct{}

Jump to

Keyboard shortcuts

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