agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
28 lines (27 loc) • 1.28 kB
TypeScript
/**
* thinkingHandlerFor — the thinking handler a provider DECLARES.
*
* Pattern: capability declaration (the `promptCaching` / `cacheStrategyFor`
* twin). The adapter knows the shape its wire's thinking arrives in
* and declares the handler that normalizes it
* (`LLMProvider.thinkingHandler`); a wrapper forwards the field like
* `carriesInMessages`. Never chosen by `provider.name`.
* Role: the ONE place `Agent` and `LLMCall` resolve their handler when the
* builder did not set one.
*/
import type { LLMProvider } from '../provider-contract/types.js';
import type { ThinkingHandler } from './types.js';
/**
* The thinking handler `provider` declares, or `undefined` when it declares
* none (the agent then mounts no thinking stage).
*
* @throws TypeError when the declaration is not a handler (no string `id`, no
* `normalize` function) — refused at agent build, by provider name, rather
* than failing on the first response that carries thinking.
*
* @example
* ```ts
* thinkingHandlerFor(withRetry(anthropic()))?.id; // 'anthropic' — the wrapper forwards it
* ```
*/
export declare function thinkingHandlerFor(provider: Pick<LLMProvider, 'name' | 'thinkingHandler'>): ThinkingHandler | undefined;