Add config sync mode to prevent config file overwrites on startup (#63)

Fixes #62

- Config file in workspace volume is now the source of truth
* Preserve raw config content with comments instead of re-stringifying parsed JSON
* Sync provider credentials to OpenCode server when adding or removing API keys
* Add error handling for session errors with toast notifications and inline message display
* Refactor provider settings to manage API keys directly with edit/delete support
This commit is contained in:
Chris Scott authored and GitHub committed 2026-01-15 10:39:38 -05:00
1 parent f3505de0e1
commit 078fbd1a05
13 files changed
+605 -240

No files matched your search

+9 -1
View File
@@ -8,6 +8,8 @@ import type {
ContentPart,
} from "../api/types";
import type { paths, components } from "../api/opencode-types";
import { parseNetworkError } from "../lib/opencode-errors";
import { showToast } from "../lib/toast";
const titleGeneratingSessionsState = new Set<string>();
const titleGeneratingListeners = new Set<() => void>();
@@ -322,12 +324,18 @@ export const useSendPrompt = (opcodeUrl: string | null | undefined, directory?:
return { optimisticUserID, response, userPromptText };
},
onError: (_, variables) => {
onError: (error, variables) => {
const { sessionID } = variables;
queryClient.setQueryData<MessageListResponse>(
["opencode", "messages", opcodeUrl, sessionID, directory],
(old) => old?.filter((msg) => !msg.info.id.startsWith("optimistic_")),
);
const parsed = parseNetworkError(error);
showToast.error(parsed.title, {
description: parsed.message,
duration: 5000,
});
},
onSuccess: async (data, variables) => {
const { sessionID } = variables;