Documentation
¶
Overview ¶
Package yamlutil holds small, dependency-free helpers shared between packages that decode agent/hook-authored YAML into Go values destined for json.Marshal. It has no internal boid imports so it can sit underneath both internal/orchestrator (business logic) and internal/sandbox (the in-sandbox CLI shim, which must not depend on orchestrator) without creating a layering cycle.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NormalizeKeys ¶
func NormalizeKeys(v interface{}) interface{}
NormalizeKeys recursively converts any map[interface{}]interface{} node (yaml.v3's decode shape for a YAML mapping with a non-string key — bool, int, or null) into map[string]interface{} so the result is always json.Marshal-able. Non-string keys are stringified with fmt.Sprint (true -> "true", 42 -> "42", nil -> "<nil>"). Already-string-keyed maps and slices are walked recursively so nested non-string keys anywhere in the tree are caught, not just at the top level. Scalars pass through unchanged.
This exists because a YAML document can silently acquire a non-string key through an external round-trip (the historical incident this guards against: an agent wrote `on: verifying`, and a PyYAML round-trip turned it into `true: verifying` — YAML's plain scalar resolution treats bareword `on`/`off`/`yes`/`no` as booleans). Every caller that turns agent-authored YAML into JSON for the payload_patch pipeline must apply this normalization identically, or the same input behaves differently depending on which path (file-based job_done vs the `boid task update --payload-patch` RPC) carried it — see wiring-seams.md #17.
Types ¶
This section is empty.