import type { ToolDefinition, ToolInputSchema } from "../../tools/ToolTypes.js"; /** * Hand-declared HTTP tools. * * Deliberately *not* a generic OpenAPI compiler. Importing an arbitrary spec * drags in hundreds of irrelevant operations, several authentication styles, * inconsistent pagination, enormous nested schemas, and write operations that * have no business being reachable — and then the orchestrator has to choose * among them. A Jira, CRM, or Graph lookup is three lines of declaration; an * offline importer is worth building only once maintaining those declarations * across several real connectors proves burdensome. * * Everything here is read-only by construction: the method allowlist rejects * anything that mutates. */ export type HttpToolMethod = "GET" | "HEAD"; export interface HttpConnectorAuth { type: "bearer" | "basic" | "header" | "none" | "oauth2_refresh"; /** Resolved value. Never a reference — resolution happens before this point. */ token?: string; username?: string; password?: string; headerName?: string; /** oauth2_refresh only: exchanges a stored refresh token for an access token. */ tokenUrl?: string; clientId?: string; refreshToken?: string; scope?: string; } export declare const resetAccessTokenCache: () => void; export interface HttpToolDeclaration { id: string; description: string; method: HttpToolMethod; /** e.g. `/rest/api/3/issue/{issueKey}` — `{name}` is substituted from args. */ urlTemplate: string; inputSchema?: ToolInputSchema; /** * Dotted path into the response, e.g. `issues[].fields.summary`. Applied * before the result reaches a model, because a raw API payload routinely * exceeds an entire evidence budget. */ responseSelector?: string; /** Cap on serialized response characters. */ maxResponseChars?: number; } export interface HttpConnectorDefinition { name: string; baseUrl: string; auth?: HttpConnectorAuth; headers?: Record; timeoutMs?: number; tools: HttpToolDeclaration[]; enabled?: boolean; } /** * Substitutes `{name}` placeholders and appends anything left over as query * parameters. Placeholder values are URL-encoded, so a model cannot inject a * path segment or escape the connector's base URL. */ export declare const buildHttpUrl: (baseUrl: string, template: string, args: Record) => string; /** * Projects a response down to what was asked for. `items[].name` maps over an * array; a plain dotted path drills in. */ export declare const applyResponseSelector: (payload: unknown, selector?: string) => unknown; export interface HttpToolFactoryOptions { connector: HttpConnectorDefinition; fetchImpl?: typeof fetch; } export declare const httpToolName: (connector: string, tool: string) => string; export declare const httpToolToDefinition: (declaration: HttpToolDeclaration, options: HttpToolFactoryOptions) => ToolDefinition; export declare const httpConnectorToDefinitions: (options: HttpToolFactoryOptions) => ToolDefinition[]; //# sourceMappingURL=HttpToolDefinition.d.ts.map