UNPKG

agentfootprint

Version:

The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.

37 lines (36 loc) • 1.69 kB
/** * Built-in credential kinds — small strategies implementing the {@link Credential} * protocol. Each is a factory returning `{ kind, ...rawFields, toHeaders() }`. * * The framework + tools only ever call `cred.toHeaders()` (generic — no `kind` * switching); the raw fields are there for the rare non-HTTP case. A custom kind * is any object implementing `Credential` — no library change needed. */ import type { Credential } from './types.js'; export interface BearerCredential extends Credential { readonly kind: 'bearer'; readonly token: string; } /** OAuth / bearer token → `Authorization: Bearer <token>`. */ export declare function bearer(token: string): BearerCredential; export interface ApiKeyCredential extends Credential { readonly kind: 'apiKey'; readonly key: string; readonly headerName: string; } /** API key → a single header (default `x-api-key`). */ export declare function apiKey(key: string, headerName?: string): ApiKeyCredential; export interface BasicCredential extends Credential { readonly kind: 'basic'; readonly username: string; readonly password: string; } /** HTTP Basic auth → `Authorization: Basic base64(user:pass)`. */ export declare function basic(username: string, password: string): BasicCredential; export interface HeadersCredential extends Credential { readonly kind: 'headers'; readonly headers: Readonly<Record<string, string>>; } /** The universal escape: arbitrary auth headers. Any scheme reduces to this, so * a provider with no matching typed kind can always return `headers(...)`. */ export declare function headers(map: Readonly<Record<string, string>>): HeadersCredential;