claude-flow
Version:
Ruflo - Enterprise AI agent orchestration for Claude Code. Deploy 60+ specialized agents in coordinated swarms with self-learning, fault-tolerant consensus, vector memory, and MCP integration
52 lines • 2.24 kB
TypeScript
/**
* GAIA Tool: visit_webpage — iter-57 (upgraded from iter-54 base)
*
* Fetches the FULL readable text content of a webpage URL — not just snippets.
* This closes the HAL parity gap identified in iter-51 surrender analysis
* (~25-35% of L1 questions need full page reading that snippet-only tools miss).
*
* Upgrade over iter-54 base (iter-57 changes):
* - max_chars input parameter (default 50k, was hardcoded 8k)
* - Test hooks interface (visitWebpageTestHooks) for unit tests without live HTTP
* - URL validation with helpful error messages
* - Link extraction (up to 30 links) — enables follow-up navigation
* - Better HTML extraction: content-block heuristics (main/article selection)
* - AIDefence PII gate (optional dep, graceful skip if not installed)
* - Structured VisitWebpageResult type + diagnostic stderr logging
* - Python bs4 primary path preserved (already in benchmark env)
*
* Extraction pipeline:
* 1. fetch() + Python bs4.get_text() (primary — better quality, handles encoding)
* 2. Regex-based fallback (no external dep) if bs4 unavailable or output too short
* 3. Content passed through AIDefence PII gate before returning to agent
*
* Refs: ADR-138, ADR-133, iter-54, iter-57, #2156
*/
import { GaiaTool, ToolDefinition } from './types.js';
export interface VisitWebpageResult {
title: string;
content: string;
links: Array<{
href: string;
text: string;
}>;
sources_consulted: string[];
chars_returned: number;
truncated: boolean;
}
export interface VisitWebpageTestHooks {
/** Override the HTTP fetch so tests never make live calls. */
fetchHtml?: (url: string) => Promise<{
html: string;
finalUrl: string;
}>;
}
export declare const visitWebpageTestHooks: VisitWebpageTestHooks;
export declare function visitWebpage(url: string, maxChars?: number): Promise<VisitWebpageResult>;
export declare class VisitWebpageTool implements GaiaTool {
readonly name = "visit_webpage";
readonly definition: ToolDefinition;
execute(input: Record<string, unknown>): Promise<string>;
}
export declare function createVisitWebpageTool(): VisitWebpageTool;
//# sourceMappingURL=visit_webpage.d.ts.map