/** * Bounded auxiliary suggestion generation: transcript framing, secret * redaction, route resolution, deadline-fused LLM dispatch, and output * sanitization. Mirrors the session-title-llm call policy (byte bound, output * cap, deadline, pre-dispatch request event) so the model-visible⟺logged * invariant holds for every suggestion request. * @module @studyzy/dsh-suggest-prompt/generate */ import type { Context } from '@deepseek-ai/cordis'; import type { Session } from '@deepseek-ai/dsh-session'; import type { SuggestPromptSuggested } from './domain.ts'; import type { Config } from './index.ts'; /** Capability-owned timeout reason code for auxiliary suggestion requests. */ export declare const SUGGEST_PROMPT_TIMEOUT_CODE = "SUGGEST_PROMPT_TIMEOUT"; /** Validated immutable suggestion policy. */ export interface ResolvedSuggestPromptConfig extends Config { } /** * Validate and detach the required suggestion policy. * @param config - untrusted plugin configuration. * @returns immutable policy with optional route absence preserved. */ export declare function resolveSuggestPromptConfig(config: Config): ResolvedSuggestPromptConfig; /** * Stable instruction for the suggestion extraction call. The model is bound to * predicting the user's next prompt in the user's own voice, forbidden from * generating content or meta-text; `language` constrains the reply language to * match the conversation. * @param maxSuggestionChars - visible-character cap baked into the instruction. * @param language - reply language ("简体中文" for CJK conversations, else "English"). */ export declare function systemPrompt(maxSuggestionChars: number, language: string): string; /** Pick the reply language to match the user's last prompt (CJK → 简体中文). */ export declare function suggestionLanguage(pairs: readonly TranscriptPair[]): string; /** One redacted user/assistant exchange line ready for framing. */ export interface TranscriptPair { readonly role: 'user' | 'assistant'; readonly text: string; } /** The bounded transcript handed to the model, plus its log attribution. */ export interface Transcript { readonly pairs: readonly TranscriptPair[]; readonly sourceMessageSeqs: readonly number[]; readonly baseSeq: number; } /** * Build the model-visible transcript from the session log: user/assistant * messages of the last `maxRecentTurns` completed turns (default 1 — only the * last completed turn's user input and assistant final answer), redacted, * tail-trimmed to `maxTranscriptChars`. * @param session - session whose log is the transcript source. * @param maxRecentTurns - completed-turn tail to include (1 keeps only the last turn). * @param maxTranscriptChars - character budget for the kept tail. * @returns the bounded transcript, or `undefined` when no completed turn has messages. */ export declare function buildTranscript(session: Session, maxRecentTurns: number, maxTranscriptChars: number): Transcript | undefined; /** * Generate one suggestion for a completed turn through the shared auxiliary * LLM call. * @param ctx - context exposing the registered LLM service. * @param config - validated suggestion policy. * @param session - owning session log. * @param turn - completed turn whose completion this suggestion answers. * @param signal - cancellation forwarded to the auxiliary call. * @returns the durable whole-value suggestion event payload, or `undefined` * when the model produced no usable suggestion (an empty or semantically * rejectable reply — the system prompt tells it to reply with nothing when the * next step is not obvious). Genuine failures throw. */ export declare function generateSuggestion(ctx: Context, config: ResolvedSuggestPromptConfig, session: Session, turn: number, signal: AbortSignal): Promise; //# sourceMappingURL=generate.d.ts.map