Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAuthorized ¶
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 ¶
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, kill-switched, or no triggers match. Returns an error when every registered harness fails to resolve or load.
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 is the fullsend config directory (e.g. ".fullsend").
// Must be a direct child of the repo root; filepath.Dir is used
// to locate OWNERS and OWNERS_ALIASES for authorization.
ConfigDir string
Event *normevent.Event
// FetchPolicy controls SSRF protection for URL-sourced agent harnesses.
// When nil, fetch.DefaultPolicy is used (allows github.com and
// raw.githubusercontent.com). Set this in tests to allow httptest domains.
FetchPolicy *fetch.FetchPolicy
}
Options configures a dispatch run.
type TriggeredHarness ¶
TriggeredHarness pairs a registered agent with its loaded harness.
func ListTriggeredHarnesses ¶
func ListTriggeredHarnesses(ctx context.Context, configDir string, cfg config.ConfigReader, fetchPolicy *fetch.FetchPolicy) ([]TriggeredHarness, error)
ListTriggeredHarnesses returns config-registered agents whose harness has a non-empty trigger. fetchPolicy controls SSRF protection for URL-sourced agents. When nil, fetch.DefaultPolicy is used. Callers that need custom domain lists (e.g. tests using httptest) can pass a policy with the test server's domain.
Per-agent resolve/load failures are logged as GitHub Actions error annotations and skipped so a single broken harness does not block the rest. If every registered agent fails to resolve or load, an error is returned so a fully-unreadable harness set is not indistinguishable from "no trigger matched".
func MatchHarnesses ¶
func MatchHarnesses(candidates []TriggeredHarness, event *normevent.Event) ([]TriggeredHarness, error)
MatchHarnesses evaluates CEL triggers and returns matching harnesses.