@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
55 lines • 3.15 kB
TypeScript
import type { ThinkingLevel } from "@earendil-works/pi-agent-core";
import type { Api, Model, ModelThinkingLevel, ThinkingSelection } from "@earendil-works/pi-ai";
/**
* Tier detection is owned by `packages/ai`, which already treats an explicit `thinkingLevelMap` as
* authoritative and infers tiers from the model id only when no map is present. These wrappers keep
* the coding-agent's `ThinkingLevel` vocabulary without duplicating the capability rules.
*/
export declare function supportsXhigh(model: Model<Api>): boolean;
export declare function supportsMax(model: Model<Api>): boolean;
export declare function getSupportedThinkingLevels(model: Model<Api>): ThinkingLevel[];
/** Why an explicit thinking selection runs at a lower level than the one requested (senpi#2395). */
export type ThinkingClampReason = "model-not-reasoning" | "level-unsupported";
/** An explicit selection that also records the requested level when a clamp changed it. */
export interface ClampedThinkingSelection extends ThinkingSelection {
readonly requested?: ModelThinkingLevel;
readonly clampReason?: ThinkingClampReason;
}
/** One clamp of an explicit request, as shown to the user. */
export interface ThinkingClampNotice {
provider: string;
modelId: string;
requestedLevel: ModelThinkingLevel;
appliedLevel: ModelThinkingLevel;
reason: ThinkingClampReason;
}
/**
* Apply the effective `level` to an explicit selection. When it differs from `requested`, the selection keeps
* the requested level and the clamp reason instead of reading as if `level` had been chosen.
*/
export declare function clampThinkingSelection(selection: ThinkingSelection | undefined, requested: ModelThinkingLevel, level: ModelThinkingLevel, model: Model<Api> | undefined): ThinkingSelection | undefined;
export declare function getThinkingClampNotice(selection: ThinkingSelection | undefined, model: Model<Api> | undefined): ThinkingClampNotice | undefined;
export declare function formatThinkingClampWarning(notice: ThinkingClampNotice): string;
/** Capability classes used by capability-aware reasoning commands. */
export type ReasoningCapabilityKind = "none" | "always-on" | "on-off" | "graded";
export interface ReasoningCapability {
kind: ReasoningCapabilityKind;
/** Supported levels, always non-empty; includes "off" when the model can disable reasoning. */
levels: ThinkingLevel[];
/** Supported levels excluding "off" (empty for kind "none"). */
nonOffLevels: ThinkingLevel[];
}
/**
* Classify a model's reasoning capability purely from `model.reasoning` and its supported thinking
* levels — never from the model id or thinkingFormat/compat config.
*
* - reasoning=false -> "none"
* - "off" is not supported -> "always-on"
* - exactly one non-off level -> "on-off"
* - otherwise -> "graded"
*
* Malformed input (e.g. a thinkingLevelMap that vetoes every level) cannot throw: the wrapper's
* ["off"] fallback means the model degrades to kind "none" with levels ["off"].
*/
export declare function classifyReasoningCapability(model: Model<Api>): ReasoningCapability;
//# sourceMappingURL=thinking-levels.d.ts.map