* Returns the tracking key for a querySource, or null if untracked. * Compact shares the same server-side cache as repl_main_thread * (same cacheSafeParams), so they share tracking state. * * For subagents with a tracked querySource, uses the unique agentId to * isolate tracking state. This pre
( querySource: QuerySource, agentId?: AgentId, )
| 147 | * logged via tengu_api_success for analytics. |
| 148 | */ |
| 149 | function getTrackingKey( |
| 150 | querySource: QuerySource, |
| 151 | agentId?: AgentId, |
| 152 | ): string | null { |
| 153 | if (querySource === 'compact') return 'repl_main_thread' |
| 154 | for (const prefix of TRACKED_SOURCE_PREFIXES) { |
| 155 | if (querySource.startsWith(prefix)) return agentId || querySource |
| 156 | } |
| 157 | return null |
| 158 | } |
| 159 | |
| 160 | function stripCacheControl( |
| 161 | items: ReadonlyArray<Record<string, unknown>>, |
no outgoing calls
no test coverage detected