Documentation
¶
Overview ¶
Package scenariofile parses graith scenario TOML files. It is shared by the CLI (gr scenario start) and the daemon (scenario trigger action) so both build a protocol.ScenarioStartMsg from the same code.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SessionInputs ¶
func SessionInputs(sf *File) ([]protocol.ScenarioSessionInput, error)
SessionInputs maps a parsed File's sessions to protocol.ScenarioSessionInput. agent_hooks defaults to true when unset.
func ValidateScenarioTriggers ¶
func ValidateScenarioTriggers(triggers []config.TriggerConfig, roles, members map[string]bool) error
ValidateScenarioTriggers validates the scenario-embedded [[trigger]] blocks. Each trigger must pass the shared structural validation (config.ValidateTriggerStructure) and the scenario-specific restrictions: it may only select sessions by a `role` the scenario defines (never a `repo`), it may not set an external execution repo, and its delivery inbox may only name a scenario member (or "orchestrator"/a template) — never a session outside the scenario. See issue #1027. Returns the first error found.
Types ¶
type File ¶
type File struct {
Version int `toml:"version"`
Scenario Meta `toml:"scenario"`
Sessions []Session `toml:"sessions"`
Triggers []config.TriggerConfig `toml:"trigger"`
}
File is the on-disk scenario definition.
func Parse ¶
Parse decodes and validates a scenario TOML document. Unknown fields are rejected so typos surface as errors.
func (*File) DefinedMembers ¶
DefinedMembers returns the set of session names in the scenario (including shared members). A scenario trigger's literal inbox delivery target must be one of these (or "orchestrator", or a template) — it may not name a session outside the scenario.
func (*File) DefinedRoles ¶
DefinedRoles returns the set of non-empty roles the scenario's own (non-shared) sessions declare. A scenario [[trigger]] watch may only select by one of these — a shared session keeps its original scenario identity, so a watch trigger could never bind to it, and allowing its role would validate a trigger that can never fire.
type Session ¶
type Session struct {
Name string `toml:"name"`
Repo string `toml:"repo"`
Agent string `toml:"agent"`
Model string `toml:"model"`
Base string `toml:"base"`
Role string `toml:"role"`
Task string `toml:"task"`
AgentHooks *bool `toml:"agent_hooks"`
// Includes attaches extra worktrees to the session, in addition to any
// inherited from the repo's [[repos]] config. See issue #1046.
Includes []string `toml:"includes"`
// Star creates the session starred so it is protected from an accidental
// manual `gr delete` (shared = true only shields from scenario stop/delete).
Star bool `toml:"star"`
}
Session is one [[sessions]] entry.