agent: collapse capability As* helpers onto two generic gates · Entire
agent: collapse capability As* helpers onto two generic gates
1b1e8b5→main·
Soph·2w ago·1 file·+44 added/-125 removed
Every As* helper repeated the same nil-check / type-assert / CapabilityDeclarer-gate dance. Fold the logic into declaredCapability[T] (assert + DeclaredCaps gate) and builtinCapability[T] (assert only, for built-in-only capabilities), leaving each As* a one-line wrapper with its existing doc contract. Behavior is unchanged and covered by the existing per-capability gate tests in capabilities_test.go.
Co-Authored-By: Claude Fable 5 noreply@anthropic.com
Sessions
7b73bd925300View transcript
Changes
1
cmd/entire/cli/agent
Mcapabilities.go+44/-125
30 unmodified lines
... (code snippet continues) ...
// SubagentAwareExtractor bool json:"subagent_aware_extractor"
// ... (remaining function definitions) ...
// AsSkillEventExtractor returns the agent as SkillEventExtractor if it implements // the interface. Skill-event extraction is currently built-in only; external // agents do not expose this optional interface through declared capabilities. func AsSkillEventExtractor(ag Agent) (SkillEventExtractor, bool) { if ag == nil { return nil, false } see, ok := ag.(SkillEventExtractor) return see, ok return builtinCapabilitySkillEventExtractor }