@code-yeongyu/senpi
Version:
Coding agent CLI with read, bash, edit, write tools and session management
41 lines • 1.99 kB
TypeScript
import type { StreamFn } from "@earendil-works/pi-agent-core";
import type { Api, Model, SimpleStreamOptions } from "@earendil-works/pi-ai/compat";
import { type RetryPolicy } from "@earendil-works/pi-ai/compat";
interface SessionTitleAuth {
readonly apiKey?: string;
readonly headers?: Record<string, string>;
readonly extraBody?: Record<string, unknown>;
readonly env?: Record<string, string>;
}
interface GenerateSessionTitleOptions {
readonly firstPrompt: string;
readonly model: Model<Api>;
readonly auth: SessionTitleAuth;
readonly sessionId: string;
readonly baseOptions?: SimpleStreamOptions;
readonly signal?: AbortSignal;
readonly streamFn?: StreamFn;
readonly retry?: RetryPolicy;
}
/**
* Narrow the user's retry budget for cosmetic background title generation.
*
* A title is not worth the full agent-turn budget: the default policy would
* keep hitting an already-overloaded provider for ~14s while the user's real
* turn competes for the same capacity, and a custom `baseDelayMs` could stall
* it far longer. One retry recovers the common single-blip case; a title that
* still fails is regenerated at the next turn end anyway. `enabled` stays the
* user's call, and a smaller configured budget is never inflated.
*/
export declare function sessionTitleRetryPolicy(settings: RetryPolicy): RetryPolicy;
export declare function shouldSkipSessionTitle(text: string): boolean;
export declare function generateSessionTitle(options: GenerateSessionTitleOptions): Promise<string | undefined>;
/**
* Reduce a raw provider error payload (e.g. an Anthropic `{"type":"error",...}`
* body, optionally prefixed with an HTTP status code) to a short human-readable
* line while keeping the error type and request id for follow-up. Non-JSON and
* unrecognized payloads pass through unchanged.
*/
export declare function humanizeProviderError(raw: string): string;
export {};
//# sourceMappingURL=session-title-generator.d.ts.map