feat: overhaul OpenClaw config panels with JSON5 round-trip write engine

- Add json-five crate for JSON5 serialization preserving comments and formatting
- Rewrite openclaw_config.rs with comment-preserving JSON5 read/write engine
- Add Tauri commands: get_openclaw_live_provider, write_openclaw_config_section
- Redesign EnvPanel as full JSON editor with structured error handling
- Add tools.profile selection (minimal/coding/messaging/full) to ToolsPanel
- Add legacy timeout migration support to AgentsDefaultsPanel
- Add OpenClawHealthBanner component for config validation warnings
- Add supporting hooks, mutations, utility functions, and unit tests
This commit is contained in:
Jason
2026-03-06 18:35:23 +08:00
parent b4fdd5fc0d
commit 7e6f803035
18 changed files with 1242 additions and 385 deletions
+19 -5
View File
@@ -5,6 +5,8 @@ import type {
OpenClawAgentsDefaults,
OpenClawEnvConfig,
OpenClawToolsConfig,
OpenClawHealthWarning,
OpenClawWriteOutcome,
} from "@/types";
/**
@@ -30,7 +32,7 @@ export const openclawApi = {
/**
* Set default model configuration (agents.defaults.model)
*/
async setDefaultModel(model: OpenClawDefaultModel): Promise<void> {
async setDefaultModel(model: OpenClawDefaultModel): Promise<OpenClawWriteOutcome> {
return await invoke("set_openclaw_default_model", { model });
},
@@ -49,7 +51,7 @@ export const openclawApi = {
*/
async setModelCatalog(
catalog: Record<string, OpenClawModelCatalogEntry>,
): Promise<void> {
): Promise<OpenClawWriteOutcome> {
return await invoke("set_openclaw_model_catalog", { catalog });
},
@@ -63,7 +65,9 @@ export const openclawApi = {
/**
* Set full agents.defaults config (all fields)
*/
async setAgentsDefaults(defaults: OpenClawAgentsDefaults): Promise<void> {
async setAgentsDefaults(
defaults: OpenClawAgentsDefaults,
): Promise<OpenClawWriteOutcome> {
return await invoke("set_openclaw_agents_defaults", { defaults });
},
@@ -81,7 +85,7 @@ export const openclawApi = {
/**
* Set env config (env section of openclaw.json)
*/
async setEnv(env: OpenClawEnvConfig): Promise<void> {
async setEnv(env: OpenClawEnvConfig): Promise<OpenClawWriteOutcome> {
return await invoke("set_openclaw_env", { env });
},
@@ -99,7 +103,17 @@ export const openclawApi = {
/**
* Set tools config (tools section of openclaw.json)
*/
async setTools(tools: OpenClawToolsConfig): Promise<void> {
async setTools(tools: OpenClawToolsConfig): Promise<OpenClawWriteOutcome> {
return await invoke("set_openclaw_tools", { tools });
},
async scanHealth(): Promise<OpenClawHealthWarning[]> {
return await invoke("scan_openclaw_config_health");
},
async getLiveProvider(
providerId: string,
): Promise<Record<string, unknown> | null> {
return await invoke("get_openclaw_live_provider", { providerId });
},
};