* Strip encryptedContent from web search results to reduce token usage. * The encrypted page content can be massive (4000+ chars per result) and isn't * needed for model context. Keep URL, title, and pageAge for reference.
(output: unknown[])
| 288 | * needed for model context. Keep URL, title, and pageAge for reference. |
| 289 | */ |
| 290 | function stripEncryptedContentFromArray(output: unknown[]): unknown[] { |
| 291 | return output.map((item: unknown) => { |
| 292 | if (item && typeof item === "object" && "encryptedContent" in item) { |
| 293 | // Remove encryptedContent but keep other fields |
| 294 | const { encryptedContent, ...rest } = item as Record<string, unknown>; |
| 295 | return rest; |
| 296 | } |
| 297 | |
| 298 | return item; |
| 299 | }); |
| 300 | } |
| 301 | |
| 302 | export function stripEncryptedContent(output: unknown): unknown { |
| 303 | if (Array.isArray(output)) { |
no outgoing calls
no test coverage detected