improved validity verification, ui responsiveness
This commit is contained in:
47
src/types.ts
47
src/types.ts
@@ -2,6 +2,16 @@
|
||||
* Deep Research — type definitions
|
||||
*/
|
||||
|
||||
/** Content type classification for a source */
|
||||
export type ContentType =
|
||||
| "documentation"
|
||||
| "paper"
|
||||
| "news"
|
||||
| "blog"
|
||||
| "forum"
|
||||
| "official"
|
||||
| "other";
|
||||
|
||||
/** A single search result from Firecrawl */
|
||||
export interface SearchResult {
|
||||
title: string;
|
||||
@@ -10,6 +20,14 @@ export interface SearchResult {
|
||||
markdown: string;
|
||||
}
|
||||
|
||||
/** Enriched search result with source authority metadata */
|
||||
export interface EnrichedSearchResult extends SearchResult {
|
||||
domain: string;
|
||||
authorityScore: number; // 0.0 – 1.0
|
||||
publishedDate: Date | null;
|
||||
contentType: ContentType;
|
||||
}
|
||||
|
||||
/** A finding extracted from search results by an analysis agent */
|
||||
export interface Finding {
|
||||
title: string;
|
||||
@@ -17,6 +35,22 @@ export interface Finding {
|
||||
sources: string[];
|
||||
keyQuotes: string[];
|
||||
confidence: "high" | "medium" | "low";
|
||||
/** 0.0 – 1.0: how many independent sources support this finding */
|
||||
corroborationScore?: number;
|
||||
/** Authority score of the best source supporting this finding */
|
||||
bestSourceAuthority?: number;
|
||||
/** Average authority score across all sources */
|
||||
avgSourceAuthority?: number;
|
||||
}
|
||||
|
||||
/** A numbered reference with full metadata */
|
||||
export interface Reference {
|
||||
id: number;
|
||||
url: string;
|
||||
title: string;
|
||||
domain: string;
|
||||
authorityScore: number;
|
||||
accessedAt: string; // ISO date string
|
||||
}
|
||||
|
||||
/** A generated search query with its intent/rationale */
|
||||
@@ -30,18 +64,28 @@ export interface SearchQuery {
|
||||
export interface ResearchRound {
|
||||
round: number;
|
||||
queries: SearchQuery[];
|
||||
results: SearchResult[];
|
||||
results: EnrichedSearchResult[];
|
||||
findings: Finding[];
|
||||
/** Any follow-up questions/angles the analysis suggests */
|
||||
followUpTopics: string[];
|
||||
/** Number of sources that actually returned data (non-empty) */
|
||||
successfulSearches: number;
|
||||
}
|
||||
|
||||
/** Target audience expertise level */
|
||||
export type Audience = "expert" | "general" | "executive";
|
||||
|
||||
/** Configuration for a research session */
|
||||
export interface ResearchConfig {
|
||||
question: string;
|
||||
depth: number; // 1-3 rounds
|
||||
breadth: number; // queries per round (1-5)
|
||||
format: "markdown" | "structured";
|
||||
audience?: Audience;
|
||||
/** Focus on specific research angles only (empty = all angles) */
|
||||
focus?: string[];
|
||||
/** Show the research methodology section in the report */
|
||||
showMethodology?: boolean;
|
||||
}
|
||||
|
||||
/** Final research report */
|
||||
@@ -52,4 +96,5 @@ export interface ResearchReport {
|
||||
totalSearches: number;
|
||||
totalPagesScraped: number;
|
||||
durationMs: number;
|
||||
references: Reference[];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user