UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

67 lines • 3.29 kB
import type { Api, Model } from "@earendil-works/pi-ai"; /** * The only providers a bare selector reaches: each model vendor's own lanes, * keyed by the vendor's model-id prefix. A bare id is a vendor policy, so a * reseller, gateway, cloud re-host or user-added provider that also publishes * the model is reached only through a selector that names it (`provider/id`). * Every provider id here exists in the builtin catalog or is registered by a * builtin extension (`anthropic-subscription`). */ export declare const FIRST_PARTY_PROVIDERS: readonly { readonly family: RegExp; readonly providers: readonly string[]; }[]; export interface BareSelectorParts { /** Model id without a provider prefix, e.g. `claude-opus-5`. */ family: string; thinkingLevel?: string; } /** Auth-tier probe. Providers holding an OAuth credential outrank API-key ones. */ export type FallbackAuthLookup = (model: Model<Api>) => boolean; /** * Auth tiers for bare expansion. OAuth first (a logged-in subscription is the * account the user actually wants used), then any configured credential, then * everything else. This ranks rather than filters: the runtime already skips * unauthenticated candidates, and dropping them here would erase the chain * whenever availability is not yet known. */ export interface FallbackAuthTiers { isUsingOAuth: FallbackAuthLookup; hasConfiguredAuth?: FallbackAuthLookup; /** * Deterministic usability gate, distinct from the auth tiers above. Auth * tiers rank; this filters, and only on a definitive `false`: a provider * whose own registration declares every unattended call refused (e.g. an * unacknowledged execution gate) must not consume a bare-expansion slot it * can never serve. Unknown eligibility stays included. */ isFallbackEligible?: FallbackAuthLookup; } /** * How many providers one bare selector may fan out to. A shipped default must * stay a short, readable chain: senpi's builtin catalog publishes popular models * under a dozen providers, and expanding to all of them turned `/fallback` into * an unreadable wall and the policy into "try every gateway that resells this". * Two keeps the useful property - a second account for the same model - without * the noise. */ declare const MAX_PROVIDERS_PER_FAMILY = 2; /** A selector is bare when it carries no provider prefix and no wildcard. */ export declare function parseBareSelector(raw: string): BareSelectorParts | undefined; /** * Conservative family match. A bare id matches its exact model and dash-suffixed * variants (`k3` -> `k3-256k`) but never an arbitrary substring, so `claude-fable-5` * cannot capture `not-claude-fable-5`. */ export declare function matchesFamily(model: Model<Api>, family: string): boolean; /** * Ranks one model per in-scope, eligible provider: OAuth-credential providers first (a * logged-in subscription is the account the user actually wants used), then the * fixed precedence table, then alphabetically. */ export declare function rankFamilyModels(models: readonly Model<Api>[], family: string, tiers: FallbackAuthTiers, options?: { limit?: number; sessionProvider?: string; }): Model<Api>[]; export { MAX_PROVIDERS_PER_FAMILY }; //# sourceMappingURL=expansion.d.ts.map