/** * Harness frame texts + coalescing for runaway-reasoning models. Ports * transponder's reasoning-continuity.mjs (continuity + interstitial) and * overthink-nudge.mjs, adapted to the proxy's outbound-Run injection rail: * instead of mid-conversation {"role":"system"} frames we append ONE coalesced * harness block to the outbound user text (append-only; never touches the * conversation prefix OpenCode manages). */ import { type ReasoningTailState } from "./reasoning-tail"; import { type ThinkingExhaustionState } from "./thinking-exhaustion"; export declare const HARNESS_FRAME_MODEL_RE: RegExp; export declare function reasoningContinuityText(): string; export declare function interstitialTextValue(): string; export declare function overthinkNudgeText(): string; /** Kill switch: continuity ON by default; `CURSOR_OPENCODE_REASONING_CONTINUITY=0` disables. */ export declare function reasoningContinuityEnabled(env?: Record): boolean; /** Cadence: fire on wave 1, then every Nth wave. Default 3, `CURSOR_OPENCODE_REASONING_CONTINUITY_EVERY` overrides. Floored at 1. */ export declare function reasoningContinuityCadence(env?: Record): number; /** Kill switch: interstitial ON by default; `CURSOR_OPENCODE_INTERSTITIAL_TEXT=0` disables. */ export declare function interstitialTextEnabled(env?: Record): boolean; /** Kill switch: overthink nudge ON by default; `CURSOR_OPENCODE_OVERTHINK_NUDGE=0` disables. */ export declare function overthinkNudgeEnabled(env?: Record): boolean; /** True when the model is in the runaway-reasoning family the frames target. */ export declare function harnessFramesEligible(modelId: string): boolean; /** * Per-conversation harness-frame state: continuity cadence counter rides next * to the reasoning-tail stash in the conversation map. */ export interface HarnessFrameState { /** Tool-result resume turns seen (continuity cadence counter). */ resolveContinuityCount: number; } export declare function newHarnessFrameState(): HarnessFrameState; /** * Throttled continuity note for tool-result resume turns: fires on resume 1, * then every Nth. Increments the cadence counter on every call. */ export declare function maybeContinuityNote(st: HarnessFrameState | null | undefined, modelId: string): string | null; /** Interstitial note for real user turns (not tool-result resumes). */ export declare function maybeInterstitialNote(modelId: string): string | null; /** Overthink reminder for real user turns. Applies even alongside plan-like instructions. */ export declare function maybeOverthinkNote(modelId: string): string | null; /** * Build the single coalesced harness appendix for one outbound Run. * - Real user turn (isUserTurn): interstitial + overthink. * - Tool-result resume: throttled continuity. * - Either: a pending [reasoning tail] note (single-shot consume). * - Either: a pending [thinking exhaustion] nudge (single-shot consume). * Returns "" when nothing applies. Callers append the result to the outbound * user text separated by "\n\n". */ export declare function buildHarnessAppendix(opts: { modelId: string; isUserTurn: boolean; frames: HarnessFrameState | null | undefined; tail: ReasoningTailState | null | undefined; /** Optional thinking-exhaustion arm (P2); single-shot consume into the appendix. */ exhaustion?: ThinkingExhaustionState | null | undefined; }): string;