feat(openclaw): add Env/Tools/Agents config panels

- Migrate OpenClaw commands from provider.rs to dedicated commands/openclaw.rs
- Add backend types and read/write for env, tools, agents.defaults sections
- Create EnvPanel (API key + custom vars KV editor)
- Create ToolsPanel (profile selector + allow/deny lists)
- Create AgentsDefaultsPanel (default model + runtime parameters)
- Extend App.tsx menu bar with Env/Tools/Agents buttons
- Remove Prompts button for OpenClaw (overlaps with Workspace AGENTS.md)
This commit is contained in:
Jason
2026-02-07 23:52:54 +08:00
parent 9035784aa4
commit 2b1f0f0f7e
15 changed files with 1017 additions and 81 deletions
+70 -3
View File
@@ -1,12 +1,25 @@
import { invoke } from "@tauri-apps/api/core";
import type { OpenClawDefaultModel, OpenClawModelCatalogEntry } from "@/types";
import type {
OpenClawDefaultModel,
OpenClawModelCatalogEntry,
OpenClawAgentsDefaults,
OpenClawEnvConfig,
OpenClawToolsConfig,
} from "@/types";
/**
* OpenClaw agents configuration API
* OpenClaw configuration API
*
* Manages agents.defaults configuration in ~/.openclaw/openclaw.json
* Manages ~/.openclaw/openclaw.json sections:
* - agents.defaults (model, catalog)
* - env (environment variables)
* - tools (permissions)
*/
export const openclawApi = {
// ============================================================
// Agents Configuration
// ============================================================
/**
* Get default model configuration (agents.defaults.model)
*/
@@ -40,6 +53,24 @@ export const openclawApi = {
return await invoke("set_openclaw_model_catalog", { catalog });
},
/**
* Get full agents.defaults config (all fields)
*/
async getAgentsDefaults(): Promise<OpenClawAgentsDefaults | null> {
return await invoke("get_openclaw_agents_defaults");
},
/**
* Set full agents.defaults config (all fields)
*/
async setAgentsDefaults(defaults: OpenClawAgentsDefaults): Promise<void> {
return await invoke("set_openclaw_agents_defaults", { defaults });
},
// ============================================================
// Provider Import
// ============================================================
/**
* Import providers from live config (openclaw.json) to database
*/
@@ -53,4 +84,40 @@ export const openclawApi = {
async getLiveProviderIds(): Promise<string[]> {
return await invoke("get_openclaw_live_provider_ids");
},
// ============================================================
// Env Configuration
// ============================================================
/**
* Get env config (env section of openclaw.json)
*/
async getEnv(): Promise<OpenClawEnvConfig> {
return await invoke("get_openclaw_env");
},
/**
* Set env config (env section of openclaw.json)
*/
async setEnv(env: OpenClawEnvConfig): Promise<void> {
return await invoke("set_openclaw_env", { env });
},
// ============================================================
// Tools Configuration
// ============================================================
/**
* Get tools config (tools section of openclaw.json)
*/
async getTools(): Promise<OpenClawToolsConfig> {
return await invoke("get_openclaw_tools");
},
/**
* Set tools config (tools section of openclaw.json)
*/
async setTools(tools: OpenClawToolsConfig): Promise<void> {
return await invoke("set_openclaw_tools", { tools });
},
};