UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

25 lines (24 loc) • 1.73 kB
/** True when the (provider-authored) diagnostic OPENS with the context-limit refusal family. */ export declare function startsWithInputTooLongAnchor(diagnostic: string): boolean; /** * Three-state classification verdict (adversarial-review r1: a binary answer conflated "the * provider said something ELSE" with "we could not read the provider", and the loop's prose * fallback then re-opened the reflected-text hole for exactly the errors this module HAD * examined): * - `"yes"` — provenance-checked input-too-long; the caller stamps the typed cause. * - `"no"` — the classification is AUTHORITATIVE-NEGATIVE: either the status can never carry * this refusal (5xx, auth, rate limit — reflected prose in those bodies must not * drive a context-shrinking recovery), or the provider's own diagnostic envelope * parsed and states a different error. The caller marks the terminal shell * ruled-out, which SUPPRESSES the loop's prose fallback for this message. * - `"unknown"` — a PTL-capable status whose body established no provenance (text/plain gateway, * truncated read): nothing is stamped either way, and the loop's historic prose * fallback keeps working for gateways that speak prose only. */ export type InputTooLongVerdict = "yes" | "no" | "unknown"; /** * Classify an HTTP refusal as input-too-long. `body` is the (bounded) error-body text as read; * a truncated read that no longer parses as JSON answers `"unknown"` (413 excepted — the status * alone is the provider's statement). */ export declare function classifyInputTooLong(status: number, body: string): InputTooLongVerdict;