Files
OmniRoute/src/shared/schemas/searchTools.ts
Diego Rodrigues de Sa e Souza 78f09c8d9f Release v3.8.41 (#5327)
Release v3.8.41 — 52 commits since v3.8.40 (19 CHANGELOG bullets, 11 contributors).

All gating CI green: Unit×8, Coverage×8, Vitest, Package Artifact, Quality Ratchet, CodeQL, Lint, Docs Sync (Strict), Node 24/26 compat, E2E×9, Integration, Electron smoke.

Advisory checks overridden (main unprotected): PR Test Policy = test-masking heuristic on the cumulative 52-commit assert delta (legitimate dead-code-sweep removals + consolidations, reviewed per-PR); SonarCloud/SonarQube = new-code maintainability/coverage quality gate (CodeQL/Semgrep/Security/npm-audit/Dependabot all clean — not a security finding).
2026-06-29 16:51:03 -03:00

40 lines
1.5 KiB
TypeScript

// src/shared/schemas/searchTools.ts
import { z } from "zod";
/** Item exposto pelo /api/search/providers (estendido em F4). */
export const SearchProviderCatalogItemSchema = z.object({
id: z.string(),
name: z.string(),
/** "search" para os 12 search providers; "fetch" para firecrawl/jina/tavily-fetch. */
kind: z.enum(["search", "fetch"]),
costPerQuery: z.number().nonnegative(),
freeMonthlyQuota: z.number().int().nonnegative(),
searchTypes: z.array(z.string()).optional(), // só search
fetchFormats: z.array(z.string()).optional(), // só fetch
/** "configured" = creds presentes; "missing" = sem creds; "rate_limited" = todas as keys em cooldown. */
status: z.enum(["configured", "missing", "rate_limited"]),
/** Link para configurar provider. */
configureHref: z.string().default("/dashboard/providers"),
});
export type SearchProviderCatalogItem = z.infer<typeof SearchProviderCatalogItemSchema>;
export const SearchProviderCatalogResponseSchema = z.object({
providers: z.array(SearchProviderCatalogItemSchema),
});
/** ScrapeResult mostrado na aba Scrape (já é a resposta de /v1/web/fetch, mas tipado). */
export const ScrapeResultSchema = z.object({
provider: z.string(),
url: z.string(),
content: z.string(),
links: z.array(z.string()),
metadata: z
.object({
title: z.string().nullable(),
description: z.string().nullable(),
})
.nullable(),
screenshot_url: z.string().nullable(),
});
export type ScrapeResult = z.infer<typeof ScrapeResultSchema>;