mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-28 08:44:41 +08:00
feat(openclaw): extend workspace files with HEARTBEAT/BOOTSTRAP/BOOT
Add 3 new markdown files to the workspace whitelist and frontend grid: - HEARTBEAT.md: activity runlist - BOOTSTRAP.md: first-run ritual - BOOT.md: gateway restart checklist Update i18n for all 3 locales (zh, en, ja).
This commit is contained in:
@@ -9,6 +9,9 @@ const ALLOWED_FILES: &[&str] = &[
|
||||
"IDENTITY.md",
|
||||
"TOOLS.md",
|
||||
"MEMORY.md",
|
||||
"HEARTBEAT.md",
|
||||
"BOOTSTRAP.md",
|
||||
"BOOT.md",
|
||||
];
|
||||
|
||||
fn validate_filename(filename: &str) -> Result<(), String> {
|
||||
@@ -33,9 +36,9 @@ pub async fn read_workspace_file(filename: String) -> Result<Option<String>, Str
|
||||
return Ok(None);
|
||||
}
|
||||
|
||||
std::fs::read_to_string(&path).map(Some).map_err(|e| {
|
||||
format!("Failed to read workspace file {filename}: {e}")
|
||||
})
|
||||
std::fs::read_to_string(&path)
|
||||
.map(Some)
|
||||
.map_err(|e| format!("Failed to read workspace file {filename}: {e}"))
|
||||
}
|
||||
|
||||
/// Write content to an OpenClaw workspace file (atomic write).
|
||||
@@ -47,13 +50,11 @@ pub async fn write_workspace_file(filename: String, content: String) -> Result<(
|
||||
let workspace_dir = get_openclaw_dir().join("workspace");
|
||||
|
||||
// Ensure workspace directory exists
|
||||
std::fs::create_dir_all(&workspace_dir).map_err(|e| {
|
||||
format!("Failed to create workspace directory: {e}")
|
||||
})?;
|
||||
std::fs::create_dir_all(&workspace_dir)
|
||||
.map_err(|e| format!("Failed to create workspace directory: {e}"))?;
|
||||
|
||||
let path = workspace_dir.join(&filename);
|
||||
|
||||
write_text_file(&path, &content).map_err(|e| {
|
||||
format!("Failed to write workspace file {filename}: {e}")
|
||||
})
|
||||
write_text_file(&path, &content)
|
||||
.map_err(|e| format!("Failed to write workspace file {filename}: {e}"))
|
||||
}
|
||||
|
||||
@@ -7,6 +7,9 @@ import {
|
||||
IdCard,
|
||||
Wrench,
|
||||
Brain,
|
||||
Activity,
|
||||
Rocket,
|
||||
Power,
|
||||
CheckCircle2,
|
||||
Circle,
|
||||
} from "lucide-react";
|
||||
@@ -31,6 +34,17 @@ const WORKSPACE_FILES: WorkspaceFile[] = [
|
||||
},
|
||||
{ filename: "TOOLS.md", icon: Wrench, descKey: "workspace.files.tools" },
|
||||
{ filename: "MEMORY.md", icon: Brain, descKey: "workspace.files.memory" },
|
||||
{
|
||||
filename: "HEARTBEAT.md",
|
||||
icon: Activity,
|
||||
descKey: "workspace.files.heartbeat",
|
||||
},
|
||||
{
|
||||
filename: "BOOTSTRAP.md",
|
||||
icon: Rocket,
|
||||
descKey: "workspace.files.bootstrap",
|
||||
},
|
||||
{ filename: "BOOT.md", icon: Power, descKey: "workspace.files.boot" },
|
||||
];
|
||||
|
||||
const WorkspaceFilesPanel: React.FC = () => {
|
||||
|
||||
@@ -1124,13 +1124,64 @@
|
||||
"user": "User profile and preferences",
|
||||
"identity": "Agent name and avatar",
|
||||
"tools": "Local tool documentation",
|
||||
"memory": "Long-term memory and decisions"
|
||||
"memory": "Long-term memory and decisions",
|
||||
"heartbeat": "Heartbeat run checklist",
|
||||
"bootstrap": "First-run bootstrap ritual",
|
||||
"boot": "Gateway reboot checklist"
|
||||
},
|
||||
"editing": "Edit {{filename}}",
|
||||
"saveSuccess": "Saved successfully",
|
||||
"saveFailed": "Failed to save",
|
||||
"loadFailed": "Failed to load"
|
||||
},
|
||||
"openclaw": {
|
||||
"env": {
|
||||
"title": "Environment Variables",
|
||||
"description": "Manage environment variables in openclaw.json (API keys, custom variables, etc.)",
|
||||
"keyPlaceholder": "Variable name",
|
||||
"valuePlaceholder": "Value",
|
||||
"add": "Add Variable",
|
||||
"saveSuccess": "Environment variables saved",
|
||||
"saveFailed": "Failed to save environment variables",
|
||||
"loadFailed": "Failed to load environment variables"
|
||||
},
|
||||
"tools": {
|
||||
"title": "Tool Permissions",
|
||||
"description": "Manage tool permissions in openclaw.json (allow/deny lists)",
|
||||
"profile": "Permission Profile",
|
||||
"profiles": {
|
||||
"default": "Default",
|
||||
"strict": "Strict",
|
||||
"permissive": "Permissive",
|
||||
"custom": "Custom"
|
||||
},
|
||||
"allowList": "Allow List",
|
||||
"denyList": "Deny List",
|
||||
"patternPlaceholder": "Tool name or pattern",
|
||||
"addAllow": "Add Allow",
|
||||
"addDeny": "Add Deny",
|
||||
"saveSuccess": "Tool permissions saved",
|
||||
"saveFailed": "Failed to save tool permissions",
|
||||
"loadFailed": "Failed to load tool permissions"
|
||||
},
|
||||
"agents": {
|
||||
"title": "Agents Config",
|
||||
"description": "Manage agents.defaults in openclaw.json (default model, runtime parameters, etc.)",
|
||||
"modelSection": "Model Configuration",
|
||||
"primaryModel": "Primary Model",
|
||||
"primaryModelHint": "Format: provider/model-id",
|
||||
"fallbackModels": "Fallback Models",
|
||||
"fallbackModelsHint": "Comma-separated, ordered by priority",
|
||||
"runtimeSection": "Runtime Parameters",
|
||||
"workspace": "Workspace Path",
|
||||
"timeout": "Timeout (seconds)",
|
||||
"contextTokens": "Context Tokens",
|
||||
"maxConcurrent": "Max Concurrent",
|
||||
"saveSuccess": "Agents config saved",
|
||||
"saveFailed": "Failed to save agents config",
|
||||
"loadFailed": "Failed to load agents config"
|
||||
}
|
||||
},
|
||||
"env": {
|
||||
"warning": {
|
||||
"title": "Environment Variable Conflicts Detected",
|
||||
|
||||
@@ -1124,13 +1124,64 @@
|
||||
"user": "ユーザープロファイルと設定",
|
||||
"identity": "エージェントの名前とアバター",
|
||||
"tools": "ローカルツールドキュメント",
|
||||
"memory": "長期記憶と意思決定記録"
|
||||
"memory": "長期記憶と意思決定記録",
|
||||
"heartbeat": "ハートビート実行チェックリスト",
|
||||
"bootstrap": "初回実行ブートストラップ",
|
||||
"boot": "ゲートウェイ再起動チェックリスト"
|
||||
},
|
||||
"editing": "{{filename}} を編集",
|
||||
"saveSuccess": "保存しました",
|
||||
"saveFailed": "保存に失敗しました",
|
||||
"loadFailed": "読み込みに失敗しました"
|
||||
},
|
||||
"openclaw": {
|
||||
"env": {
|
||||
"title": "環境変数",
|
||||
"description": "openclaw.json の環境変数設定を管理(APIキー、カスタム変数など)",
|
||||
"keyPlaceholder": "変数名",
|
||||
"valuePlaceholder": "値",
|
||||
"add": "変数を追加",
|
||||
"saveSuccess": "環境変数を保存しました",
|
||||
"saveFailed": "環境変数の保存に失敗しました",
|
||||
"loadFailed": "環境変数の読み込みに失敗しました"
|
||||
},
|
||||
"tools": {
|
||||
"title": "ツール権限",
|
||||
"description": "openclaw.json のツール権限設定を管理(許可/拒否リスト)",
|
||||
"profile": "権限プロファイル",
|
||||
"profiles": {
|
||||
"default": "デフォルト",
|
||||
"strict": "厳格",
|
||||
"permissive": "寛容",
|
||||
"custom": "カスタム"
|
||||
},
|
||||
"allowList": "許可リスト",
|
||||
"denyList": "拒否リスト",
|
||||
"patternPlaceholder": "ツール名またはパターン",
|
||||
"addAllow": "許可を追加",
|
||||
"addDeny": "拒否を追加",
|
||||
"saveSuccess": "ツール権限を保存しました",
|
||||
"saveFailed": "ツール権限の保存に失敗しました",
|
||||
"loadFailed": "ツール権限の読み込みに失敗しました"
|
||||
},
|
||||
"agents": {
|
||||
"title": "Agents 設定",
|
||||
"description": "openclaw.json の agents.defaults 設定を管理(デフォルトモデル、ランタイムパラメータなど)",
|
||||
"modelSection": "モデル設定",
|
||||
"primaryModel": "プライマリモデル",
|
||||
"primaryModelHint": "形式: provider/model-id",
|
||||
"fallbackModels": "フォールバックモデル",
|
||||
"fallbackModelsHint": "カンマ区切り、優先度順",
|
||||
"runtimeSection": "ランタイムパラメータ",
|
||||
"workspace": "ワークスペースパス",
|
||||
"timeout": "タイムアウト(秒)",
|
||||
"contextTokens": "コンテキストトークン数",
|
||||
"maxConcurrent": "最大同時実行数",
|
||||
"saveSuccess": "Agents 設定を保存しました",
|
||||
"saveFailed": "Agents 設定の保存に失敗しました",
|
||||
"loadFailed": "Agents 設定の読み込みに失敗しました"
|
||||
}
|
||||
},
|
||||
"env": {
|
||||
"warning": {
|
||||
"title": "競合する環境変数を検出しました",
|
||||
|
||||
@@ -1124,13 +1124,64 @@
|
||||
"user": "用户档案和偏好",
|
||||
"identity": "Agent 名称和头像",
|
||||
"tools": "本地工具文档",
|
||||
"memory": "长期记忆和决策记录"
|
||||
"memory": "长期记忆和决策记录",
|
||||
"heartbeat": "心跳运行清单",
|
||||
"bootstrap": "首次运行仪式",
|
||||
"boot": "网关重启清单"
|
||||
},
|
||||
"editing": "编辑 {{filename}}",
|
||||
"saveSuccess": "保存成功",
|
||||
"saveFailed": "保存失败",
|
||||
"loadFailed": "读取失败"
|
||||
},
|
||||
"openclaw": {
|
||||
"env": {
|
||||
"title": "环境变量",
|
||||
"description": "管理 openclaw.json 中的环境变量配置(API Key、自定义变量等)",
|
||||
"keyPlaceholder": "变量名",
|
||||
"valuePlaceholder": "值",
|
||||
"add": "添加变量",
|
||||
"saveSuccess": "环境变量已保存",
|
||||
"saveFailed": "保存环境变量失败",
|
||||
"loadFailed": "读取环境变量失败"
|
||||
},
|
||||
"tools": {
|
||||
"title": "工具权限",
|
||||
"description": "管理 openclaw.json 中的工具权限配置(允许/拒绝列表)",
|
||||
"profile": "权限模式",
|
||||
"profiles": {
|
||||
"default": "默认",
|
||||
"strict": "严格",
|
||||
"permissive": "宽松",
|
||||
"custom": "自定义"
|
||||
},
|
||||
"allowList": "允许列表",
|
||||
"denyList": "拒绝列表",
|
||||
"patternPlaceholder": "工具名称或模式",
|
||||
"addAllow": "添加允许",
|
||||
"addDeny": "添加拒绝",
|
||||
"saveSuccess": "工具权限已保存",
|
||||
"saveFailed": "保存工具权限失败",
|
||||
"loadFailed": "读取工具权限失败"
|
||||
},
|
||||
"agents": {
|
||||
"title": "Agents 配置",
|
||||
"description": "管理 openclaw.json 中的 agents.defaults 配置(默认模型、运行参数等)",
|
||||
"modelSection": "模型配置",
|
||||
"primaryModel": "主模型",
|
||||
"primaryModelHint": "格式:provider/model-id",
|
||||
"fallbackModels": "回退模型",
|
||||
"fallbackModelsHint": "逗号分隔,按优先级排列",
|
||||
"runtimeSection": "运行参数",
|
||||
"workspace": "工作区路径",
|
||||
"timeout": "超时时间(秒)",
|
||||
"contextTokens": "上下文 Token 数",
|
||||
"maxConcurrent": "最大并发数",
|
||||
"saveSuccess": "Agents 配置已保存",
|
||||
"saveFailed": "保存 Agents 配置失败",
|
||||
"loadFailed": "读取 Agents 配置失败"
|
||||
}
|
||||
},
|
||||
"env": {
|
||||
"warning": {
|
||||
"title": "检测到系统环境变量冲突",
|
||||
|
||||
Reference in New Issue
Block a user