/** * Cache-busting fix for prompt prefix cache eviction. * * PROBLEM: Every PromptInput we send to OpenCode (notifications, idle * wakeups, ignored messages) creates a new user message. OpenCode's * `createUserMessage` resolves variant relative to the chosen agent. If * we don't pass model/variant, defaults take over and bust the provider * prefix cache that the previous assistant turn warmed. * * APPROACH: Mirror what `opencode-xtra` does in production. Read recent * messages from `client.session.messages()`, walk newest→oldest across * roles, and MERGE field-by-field so the newest context-bearing message * wins while older messages only fill fields it did not provide. Read BOTH * the flat shape (`info.providerID`) used by AssistantMessage and the * nested shape (`info.model.providerID`) used by UserMessage. * * IMPORTANT: This context is only meaningful for callers that DO trigger * LLM inference (e.g. background-bash idle wakes with `noReply: false`). * Callers using `noReply: true` (one-off ignored messages, warnings, * announcements) never trigger inference, so they don't need model or * variant — the model/variant pass-through there is unnecessary AND has * been observed to crash OpenCode under some configurations. Limit * model/variant pass-through to wake-style calls. */ export interface ResolvedPromptContext { agent?: string; model?: { providerID: string; modelID: string; }; variant?: string; } export declare function resolvePromptContext(client: unknown, sessionId: string): Promise; export interface LastAssistantModel { providerID: string; modelID: string; variant?: string; } /** @deprecated Use {@link resolvePromptContext} which also returns agent. */ export declare function getLastAssistantModel(client: unknown, sessionId: string): Promise; //# sourceMappingURL=last-assistant-model.d.ts.map