harnessdispatch

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAuthorized

func IsAuthorized(event *normevent.Event) bool

IsAuthorized is the shared dispatch authorization gate before CEL evaluation. It is intentionally agent-generic: stage-specific constraints (review state, bot identity, fork/label guards, etc.) belong in harness trigger CEL expressions, not here. This layer only encodes cross-cutting GitHub rules that bash routing applied before CEL existed and that are awkward to express purely from normalized events alone.

Most transitions require write-level actor.role from the collaborator permission API. Label-added events are authorized without a write role because GitHub label application needs triage/write access and bots often lack a collaborator role in that API (mirroring bash label routing). Bot-submitted pull_request_review events are also authorized without a write role so downstream CEL can filter review state, bot identity, and other review-stage guards.

func KillSwitchActive

func KillSwitchActive(configDir string) (bool, error)

KillSwitchActive reads kill_switch from config in configDir.

func MergedConfigAgents

func MergedConfigAgents(configDir string) ([]config.AgentEntry, error)

MergedConfigAgents loads agent entries from per-repo config directory.

Types

type ExecutionRef

type ExecutionRef struct {
	Agent         string `json:"agent"`
	Role          string `json:"role"`
	SourceRepo    string `json:"source_repo"`
	EventType     string `json:"event_type"`
	EventPayload  string `json:"event_payload"`
	TriggerSource string `json:"trigger_source,omitempty"`
	StatusRepo    string `json:"status_repo"`
	StatusNumber  string `json:"status_number"`
}

ExecutionRef is the matrix payload consumed by harness-run and fullsend run.

func Dispatch

func Dispatch(ctx context.Context, opts Options) ([]ExecutionRef, error)

Dispatch evaluates authorization, kill switch, harness triggers, and returns execution refs. Returns empty slice (not error) when denied or no matches.

func ProjectExecutionRef

func ProjectExecutionRef(agentName string, role string, event *normevent.Event) (ExecutionRef, error)

ProjectExecutionRef maps a matched harness and event to an execution ref. Harness role values must be registered in the mint service ALLOWED_ROLES policy; custom role names pass harness validation but fail token minting with HTTP 403 until mint enrollment is extended for the org.

type Options

type Options struct {
	ConfigDir string
	Event     *normevent.Event
}

Options configures a dispatch run.

type TriggeredHarness

type TriggeredHarness struct {
	Name    string
	Harness *harness.Harness
	Path    string
}

TriggeredHarness pairs a registered agent with its loaded harness.

func ListTriggeredHarnesses

func ListTriggeredHarnesses(ctx context.Context, configDir string, cfg *config.DirConfig) ([]TriggeredHarness, error)

ListTriggeredHarnesses returns config-registered agents whose harness has a non-empty trigger.

func MatchHarnesses

func MatchHarnesses(candidates []TriggeredHarness, event *normevent.Event) ([]TriggeredHarness, error)

MatchHarnesses evaluates CEL triggers and returns matching harnesses.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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