| 1 | package event |
| 2 | |
| 3 | import "strings" |
| 4 | |
| 5 | // Reserved ToolProgress channel names for local sub-agent progress previews. |
| 6 | // |
| 7 | // These names are an internal wire contract between the agent progress |
| 8 | // tracker and local frontends (desktop and CLI). They must never be presented |
| 9 | // as provider-visible tool names: ACP and bot consumers ignore ToolProgress |
| 10 | // bodies entirely, and the names are filtered out of any transcript or |
| 11 | // provider context by construction (they only ever ride ToolProgress events). |
| 12 | // |
| 13 | // The status channel carries exactly one of the phase values produced by the |
| 14 | // tracker (queued/running/reasoning/responding/tool/retrying/completed/ |
| 15 | // failed/cancelled) in Tool.Output; the other channels carry bounded UTF-8 |
| 16 | // text deltas. Tool.Truncated marks a merged or truncated preview round, |
| 17 | // Tool.DurationMs rides terminal status events, and progress lookup is keyed |
| 18 | // by Tool.ID (the child task card ID). |
| 19 | const ( |
| 20 | SubagentProgressPrefix = "reasonix.subagent." |
| 21 | SubagentProgressStatusName = SubagentProgressPrefix + "status" |
| 22 | SubagentProgressReasoningName = SubagentProgressPrefix + "reasoning" |
| 23 | SubagentProgressTextName = SubagentProgressPrefix + "text" |
| 24 | SubagentProgressNoticeName = SubagentProgressPrefix + "notice" |
| 25 | ) |
| 26 | |
| 27 | // IsReservedSubagentProgressName reports whether name belongs to the reserved |
| 28 | // sub-agent progress namespace. Consumers must suppress unknown names in this |
| 29 | // namespace so an older frontend never renders a channel introduced by a newer |
| 30 | // agent as ordinary tool output. |
| 31 | func IsReservedSubagentProgressName(name string) bool { |
| 32 | return strings.HasPrefix(name, SubagentProgressPrefix) |
| 33 | } |
| 34 | |
| 35 | // IsSubagentProgressName reports whether the ToolProgress Name carries a |
| 36 | // currently supported sub-agent progress channel. Use |
| 37 | // IsReservedSubagentProgressName when routing unknown future channels away from |
| 38 | // ordinary tool output. |
| 39 | func IsSubagentProgressName(name string) bool { |
| 40 | switch name { |
| 41 | case SubagentProgressStatusName, SubagentProgressReasoningName, |
| 42 | SubagentProgressTextName, SubagentProgressNoticeName: |
| 43 | return true |
| 44 | } |
| 45 | return false |
| 46 | } |
| 47 |