(source: unknown)
| 78 | } |
| 79 | |
| 80 | export function isSubagentThreadSource(source: unknown): boolean { |
| 81 | if (typeof source === "string") { |
| 82 | const normalized = source.trim().toLowerCase(); |
| 83 | return normalized.startsWith("subagent") || normalized.startsWith("sub_agent"); |
| 84 | } |
| 85 | |
| 86 | const sourceRecord = asRecord(source); |
| 87 | if (!sourceRecord) { |
| 88 | return false; |
| 89 | } |
| 90 | |
| 91 | const subAgent = |
| 92 | sourceRecord.subAgent ?? sourceRecord.sub_agent ?? sourceRecord.subagent; |
| 93 | if (subAgent === null || subAgent === undefined) { |
| 94 | return false; |
| 95 | } |
| 96 | if (typeof subAgent === "string") { |
| 97 | return subAgent.trim().length > 0; |
| 98 | } |
| 99 | return typeof subAgent === "object"; |
| 100 | } |
| 101 | |
| 102 | export function shouldHideSubagentThreadFromSidebar(source: unknown): boolean { |
| 103 | const subagentKind = getSubagentKind(source); |
no test coverage detected