feat(index): add provider cache missing warning toast

Show warning toast when hasConnectedProvidersCache() returns false,
indicating model filtering is disabled. Prompts user to restart
OpenCode for full functionality.
This commit is contained in:
justsisyphus
2026-01-28 13:31:11 +09:00
parent e0ab9f42c4
commit 399e550a80
+12 -1
View File
@@ -78,7 +78,7 @@ import { SkillMcpManager } from "./features/skill-mcp-manager";
import { initTaskToastManager } from "./features/task-toast-manager";
import { TmuxSessionManager } from "./features/tmux-subagent";
import { type HookName } from "./config";
import { log, detectExternalNotificationPlugin, getNotificationConflictWarning, resetMessageCursor, includesCaseInsensitive } from "./shared";
import { log, detectExternalNotificationPlugin, getNotificationConflictWarning, resetMessageCursor, includesCaseInsensitive, hasConnectedProvidersCache } from "./shared";
import { loadPluginConfig } from "./plugin-config";
import { createModelCacheState, getModelLimit } from "./plugin-state";
import { createConfigHandler } from "./plugin-handlers";
@@ -398,6 +398,17 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
await autoSlashCommand?.["chat.message"]?.(input, output);
await startWork?.["chat.message"]?.(input, output);
if (!hasConnectedProvidersCache()) {
ctx.client.tui.showToast({
body: {
title: "⚠️ Provider Cache Missing",
message: "Model filtering disabled. RESTART OpenCode to enable full functionality.",
variant: "warning" as const,
duration: 6000,
},
}).catch(() => {});
}
if (ralphLoop) {
const parts = (
output as { parts?: Array<{ type: string; text?: string }> }