agentfootprint
Version:
The explainable agent framework — backtrack a wrong answer to the exact context that caused it (evidence, not guesses). Built on footprintjs.
47 lines • 2.23 kB
JavaScript
;
/**
* classify/types — the PORT for a calibrated classifier.
*
* Pattern: port + adapters (the `LLMProvider` precedent). A classifier is
* not a model that generates text: handed a STATE and a set of
* typed QUESTIONS it scores the declared candidates from one
* reading and answers each question with a distribution, a
* confidence, or a probability — the "scored choice" of
* docs/design/2026-09-scored-choice.md, opened 2026-09-17.
* Role: zero-import leaf. `src/injection-engine/classifierScorer.ts`
* (a pure-core file behind `agentfootprint/skill-graph`) types its
* port against this file, so nothing here may import anything.
*
* LAWS.
* - A score is data only when the provider produced it. Nothing in this
* folder infers a probability, defaults a choice or renormalises a
* distribution — `probabilities` is the wire's own object, whatever it sums
* to (the real probe summed to 1.0; a provider that rounds may not).
* - Cost is data: every result carries `latencyMs` measured around the
* call, and `usage` when the provider reported it, so a bench or a lens
* reads the cost of a judgment off the record instead of estimating it.
* - A failure is a `ClassifierError` with the provider's status when there
* was one — never a guessed answer.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ClassifierError = void 0;
/**
* A classifier call that produced no answer. `status` is the provider's HTTP
* status when there was one; `retryable` says whether the adapter judged it
* a transient (rate limit, overload) — an adapter has already retried those
* up to its `maxRetries` before this reaches a caller. The message carries
* the provider's error text, never a key.
*/
class ClassifierError extends Error {
status;
retryable;
constructor(message, options = {}) {
super(message);
this.name = 'ClassifierError';
if (options.status !== undefined)
this.status = options.status;
this.retryable = options.retryable ?? false;
}
}
exports.ClassifierError = ClassifierError;
//# sourceMappingURL=types.js.map