UNPKG

@code-yeongyu/senpi

Version:

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

25 lines • 1.58 kB
import type { AgentMessage } from "@earendil-works/pi-agent-core"; import { type AssistantMessage } from "@earendil-works/pi-ai/compat"; export declare const REQUEST_SHAPE_RECOVERY_ENTRY_TYPE = "request-shape-recovery"; export declare const REQUEST_SHAPE_RECOVERY_NOTE = "Retried without web search replay data"; export declare const REQUEST_SHAPE_FAILURE_TEXT: string; /** A request-shape 400 is ours to fix, not the model's: it never walks the fallback chain (senpi#3727). */ export declare function isAnthropicRequestShapeRejection(message: AssistantMessage, contextWindow: number): boolean; export interface ProviderNativeStripResult { readonly messages: AgentMessage[]; readonly strippedBlocks: number; } /** Only assistant `providerNative` blocks at or before `cutoff` go; user text and client tool pairs never do. */ export declare function stripProviderNativeReplay(messages: readonly AgentMessage[], cutoff: number): ProviderNativeStripResult; export type RequestShapeDecision = "recover" | "give-up" | "not-request-shape"; /** One same-model recovery per failing streak; older history stays stripped because the bad block is still in it. */ export declare class RequestShapeRecovery { private cutoff; private attempted; decide(message: AssistantMessage, contextWindow: number): RequestShapeDecision; begin(failedAt: number): void; /** Any non-request-shape outcome (success, another error, a new prompt) ends the streak. */ endStreak(): void; apply(messages: AgentMessage[]): AgentMessage[]; } //# sourceMappingURL=request-shape.d.ts.map