Documentation
¶
Index ¶
Constants ¶
const ( ManagedBegin = "# BEGIN AMQ MANAGED" ManagedEnd = "# END AMQ MANAGED" )
Managed fragment markers for AMQ hook injection into WORKFLOW.md.
Variables ¶
var ( ErrNoFrontmatter = errors.New("WORKFLOW.md has no YAML frontmatter") ErrInvalidYAML = errors.New("WORKFLOW.md frontmatter is not valid YAML") ErrNotAMap = errors.New("WORKFLOW.md frontmatter must be a YAML map") ErrWorkflowNotFound = errors.New("WORKFLOW.md not found") )
var HookEvents = []string{"after_create", "before_run", "after_run", "before_remove"}
HookEvent names matching the symphony spec.
var ValidEvents = []string{"after_create", "before_run", "after_run", "before_remove"}
Valid symphony lifecycle events, matching the spec.
Functions ¶
This section is empty.
Types ¶
type EmitOptions ¶
type EmitOptions struct {
Event string // Lifecycle event name (required)
Me string // Agent handle (required)
Root string // AMQ root directory (required, resolved)
Workspace string // Workspace path (default: cwd)
Identifier string // Workspace key (default: basename of workspace)
}
EmitOptions configures the Emit operation.
type EmitResult ¶
type EmitResult struct {
Event string `json:"event"`
Me string `json:"me"`
Workspace string `json:"workspace"`
Identifier string `json:"identifier"`
Thread string `json:"thread"`
MessagePath string `json:"message_path"`
}
EmitResult describes the outcome of an Emit operation.
func Emit ¶
func Emit(opts EmitOptions) (*EmitResult, error)
Emit builds and delivers an AMQ message for a symphony lifecycle event.
The message is self-delivered: from=me, to=me. This allows an agent monitoring its own inbox to react to orchestrator events.
type HooksConfig ¶
type HooksConfig struct {
AfterCreate string `yaml:"after_create"`
BeforeRun string `yaml:"before_run"`
AfterRun string `yaml:"after_run"`
BeforeRemove string `yaml:"before_remove"`
}
HooksConfig represents the hooks section of the WORKFLOW.md frontmatter.
type InitOptions ¶
type InitOptions struct {
WorkflowPath string // Path to WORKFLOW.md (default: "WORKFLOW.md")
Me string // Agent handle for --me in generated hooks
Root string // AMQ root to pin in generated hooks (may be empty)
Check bool // Inspect only, do not write
Force bool // Rewrite even if fragment already present
}
InitOptions configures the Init operation.
type InitResult ¶
type InitResult struct {
WorkflowPath string `json:"workflow_path"`
Created bool `json:"created"` // true if hooks section was newly created
Updated bool `json:"updated"` // true if managed fragment was written/rewritten
AlreadyOK bool `json:"already_ok"` // true if managed fragment was already present and unchanged
CheckOnly bool `json:"check_only"` // true if --check was used
HooksFound bool `json:"hooks_found"` // true if AMQ managed hooks are present in the file
}
InitResult describes the outcome of an Init operation.
func Init ¶
func Init(opts InitOptions) (*InitResult, error)
Init patches a WORKFLOW.md file with AMQ-managed hook fragments.
The function is idempotent: running it twice produces the same result. Existing user hook content is preserved; the AMQ managed fragment is appended or replaced within each hook.
type Workflow ¶
type Workflow struct {
Config map[string]interface{} // YAML frontmatter as a generic map
Prompt string // Markdown body after frontmatter
Raw string // Original file content
}
Workflow represents a parsed WORKFLOW.md file with YAML frontmatter and Markdown prompt body.
func ParseWorkflow ¶
ParseWorkflow parses a WORKFLOW.md file from its raw content. The format is:
--- <YAML frontmatter> --- <Markdown prompt body>
If there is no frontmatter delimiter, the entire content is treated as the prompt body with an empty config.
func ReadWorkflow ¶
ReadWorkflow reads and parses a WORKFLOW.md file from disk.
func (*Workflow) GetHooks ¶
func (w *Workflow) GetHooks() HooksConfig
GetHooks extracts the hooks configuration from the workflow config map. Returns a zero-value HooksConfig if no hooks are configured.
func (*Workflow) MarshalWorkflow ¶
MarshalWorkflow serializes the workflow back to WORKFLOW.md format.
func (*Workflow) SetHooks ¶
func (w *Workflow) SetHooks(hooks HooksConfig)
SetHooks writes the hooks section back into the workflow config map.