Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | /**
* What a web search did, and what a turn's searches came to.
*
* svc-ai's `web_search` keeps a report of every call
* (`app/util/web_search_report.py`, carried by svc-ai and svc-core byte for
* byte): it rides on the chat trace's `tool_call` frame and on the stored
* tool call the decision record reads. svc-core sums a turn's into a summary
* (`services/web_search_summary.py`), stored on the answer as
* `meta.web_search` and served on the chat's `response` frame.
*
* A report names no engine (`primary` / `fallback`) and no URL — only the
* hosts the workspace's Tools rules left out or put first, and none of those
* for a turn whose answer a rule may withhold.
*/
/** What a call to the tool came to. */
export type SearchOutcome =
| "found"
| "empty"
| "unavailable"
| "closed"
| "refused"
| "call_limit"
| "misconfigured";
/** What removed a result. */
export type SearchRemoval =
| "safety"
| "tool_config"
| "rules_blocked"
| "rules_not_allowed"
| "not_requested";
export interface SearchAttempt {
engine: "primary" | "fallback";
search_type: string;
outcome: "answered" | "empty" | "failed" | "skipped";
/** Why it failed (svc-ai's `FailureReason`), when it did. */
reason?: string | null;
returned: number;
}
export interface SearchReport {
version: number;
search_type: string;
/** The kind that gave the results, when not the one asked for. */
searched_as?: string | null;
freshness?: string | null;
outcome: SearchOutcome;
attempts: SearchAttempt[];
returned: number;
kept: number;
removed: Partial<Record<SearchRemoval, number>>;
not_shown: number;
left_out: { host: string; by: SearchRemoval }[];
put_first: string[];
scoped_to?: "call" | "rules" | "config" | null;
trusted_search: boolean;
date_removed?: string | null;
/** Whose sources were put first: the workspace's rules, or CHAIN-R's
* own for CHAINR Bot (svc-ai `platform_sources`). */
sources_set_by?: "rules" | "platform" | null;
cached: boolean;
}
/** What a turn's searches came to, the strongest first. */
export type WebSearchOutcome =
| "closed"
| "limited"
| "found"
| "unavailable"
| "empty";
/** One Tools rule, and what it did to the turn's searches. */
export interface WebSearchRuleEffect {
rule_id?: string | null;
rule?: string | null;
action: "trusted_sources" | "blocked_sources";
only: boolean;
/** The rule's own domains. */
domains: string[];
acted: boolean;
/** Searches it changed. */
narrowed: number;
closed: boolean;
left_out_count: number;
put_first_count: number;
/** Absent for a turn whose answer a rule may withhold. */
left_out?: string[];
put_first?: string[];
}
export interface WebSearchSummary {
version: number;
outcome: WebSearchOutcome;
searches: number;
found: number;
kept: number;
/** Engine failures, by reason. */
failures: Record<string, number>;
removed: Partial<Record<SearchRemoval, number>>;
rules: WebSearchRuleEffect[];
}
/** What a Tools rule's activity detail keeps of the turn's searches once
* settled (`detail[action].web`): counts, never a host. */
export interface SettledWeb {
searches: number;
narrowed: number;
left_out: number;
put_first: number;
closed?: boolean;
}
|