Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion src/services/auto-capture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ async function capturePrompt(

let summaryResult: { summary: string; type: string; tags: string[] } | null;
try {
summaryResult = await generateSummary(context, sessionID, prompt.content, prompt);
summaryResult = await generateSummary(ctx, context, sessionID, prompt.content, prompt);
} catch (error) {
const message = error instanceof Error ? error.message : String(error);
throw new Error(`Summary generation failed: ${message}`);
Expand Down Expand Up @@ -479,6 +479,7 @@ export function buildMarkdownContext(
}

async function generateSummary(
ctx: PluginInput,
context: string,
sessionID: string,
userPrompt: string,
Expand Down Expand Up @@ -589,6 +590,26 @@ CAPTURE if: code changed, bug fixed, feature added, decision made`;
throw new Error("External API not configured for auto-capture");
}

// Opencode provider failed but a manual fallback is configured — surface a
// non-blocking warning so the user knows their primary provider is broken.
if (opencodeProviderError && CONFIG.showErrorToasts) {
const errMsg =
opencodeProviderError instanceof Error
? opencodeProviderError.message
: String(opencodeProviderError);
const shortReason = errMsg.length > 100 ? errMsg.substring(0, 100) + "..." : errMsg;
ctx.client?.tui
.showToast({
body: {
title: "Using fallback provider",
message: `OpenCode provider failed (${shortReason}); using configured fallback.`,
variant: "warning",
duration: 5000,
},
})
.catch(() => {});
}

const { AIProviderFactory } = await import("./ai/ai-provider-factory.js");
const { buildMemoryProviderConfig } = await import("./ai/provider-config.js");
const { detectLanguage, getLanguageName } = await import("./language-detector.js");
Expand Down