UNPKG

@adonis-agora/agent

Version:

Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.

41 lines • 2.2 kB
import type { AuthServerMetadata, PoppyDocument } from './types.js'; import { type FetchLike, type SecurityOptions } from './util.js'; /** Major protocol versions this client implements (3.1). */ export declare const SUPPORTED_MAJOR_VERSIONS: string[]; export interface DiscoveryOptions extends SecurityOptions { fetch?: FetchLike | undefined; /** Shared cache honoring `Cache-Control: max-age` (3, 3.2: SHOULD cache). */ cache?: HttpJsonCache | undefined; } export interface Discovered { /** The host the agent asked for (no scheme), e.g. `example.com`. */ domain: string; wellKnownUrl: string; document: PoppyDocument; /** Absent only when the Company publishes no `auth` (web-only). */ metadata?: AuthServerMetadata | undefined; } /** In-memory cache of JSON documents by URL, by `Cache-Control: max-age`. */ export declare class HttpJsonCache { private readonly entries; get(url: string): unknown | undefined; set(url: string, value: unknown, cacheControl: string | null): void; } /** * Turns user input into the well-known URL. `example.com` → `https://example.com/...`. * With `insecureDev`, an explicit `http://host:port` is kept, and a bare loopback host * (`localhost:3333`) defaults to `http:`. */ export declare function wellKnownUrlFor(input: string, sec?: SecurityOptions): URL; /** Validates `poppy.json` against 3.1. Unknown fields are ignored, never rejected. */ export declare function validatePoppyDocument(json: unknown, requestedHost: string, sec?: SecurityOptions): PoppyDocument; /** RFC 8414 section 3: the well-known suffix goes between the host and the issuer's path. */ export declare function authServerMetadataUrl(issuer: string): URL; /** Validates the issuer metadata against 3.2. */ export declare function validateMetadata(json: unknown, doc: PoppyDocument, sec?: SecurityOptions): AuthServerMetadata; /** * Discovery (section 3): fetches `/.well-known/poppy.json` (HTTPS-only redirects), validates * it, then fetches and validates the issuer's RFC 8414 metadata (3.2). */ export declare function discover(input: string, opts?: DiscoveryOptions): Promise<Discovered>; //# sourceMappingURL=discovery.d.ts.map