UNPKG

@code-yeongyu/senpi

Version:

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

51 lines • 2.86 kB
import type { Api, Model } from "@earendil-works/pi-ai"; import type { ModelRegistry } from "../../model-registry.ts"; import { SettingsManager } from "../../settings-manager.ts"; import type { ExtensionAPI, ServiceTier } from "../types.ts"; export type { ServiceTier }; export declare const CODEX_RESPONSES_API = "openai-codex-responses"; /** Whether requests for this API accept the OpenAI `service_tier` field. */ export declare function supportsServiceTier(api: Api | undefined): boolean; export declare function addServiceTierToPayload(api: Api | undefined, payload: unknown, serviceTier?: ServiceTier): unknown; /** * The model that owns this model's persisted service-tier preference. * * A `-fast` catalog variant and its base model are one model to the user (`/fast` just swaps * between them), so both must read and write ONE key. Anything else can hold contradictory * preferences for the same choice. */ export declare function resolveServiceTierMemoryModel(modelRegistry: ModelRegistry, model: Model<Api>): Model<Api>; /** Remembered service tier for this model, normalized onto its base-model key. */ export declare function getRememberedServiceTier(settingsManager: SettingsManager, modelRegistry: ModelRegistry, model: Model<Api>): ServiceTier | undefined; /** Host capabilities `applyFastMode` needs; satisfied by an extension context plus `pi`. */ export interface FastModeContext { cwd: string; agentDir: string; model: Model<Api> | undefined; modelRegistry: ModelRegistry; /** Tier the host resolved for the active model (scoped/favorite pin or catalog). */ serviceTier: ServiceTier | undefined; isProjectTrusted(): boolean; notify(message: string, level: "info" | "warning" | "error"): void; setSessionModel(model: Model<Api>): Promise<boolean>; setSessionFastMode(enabled: boolean): void; } export interface FastModeResult { /** Fast mode state after the call; unchanged when the request was refused. */ enabled: boolean; /** False when the request was refused (non-Codex model, active pin, failed model switch). */ applied: boolean; /** The just-persisted tier (or the unchanged one when refused); `"priority"` on, `"auto"` off. */ recordedTier: ServiceTier; message: string; } /** * Single entry point for turning fast mode on/off: the `/fast` command and any other surface * (RPC) must go through this so persistence and `-fast` key normalization exist exactly once. * * `off` persists an explicit `"auto"` rather than deleting the key: deletion re-inherits the * catalog/global tier, which is what the user just asked to turn off. */ export declare function applyFastMode(ctx: FastModeContext, enabled: boolean): Promise<FastModeResult>; export default function serviceTierExtension(pi: ExtensionAPI): void; //# sourceMappingURL=service-tier.d.ts.map