From c380528a27f5482c8eb74c8fc1e0afd23a0d6329 Mon Sep 17 00:00:00 2001 From: Jason Date: Tue, 24 Feb 2026 09:45:10 +0800 Subject: [PATCH] feat(workspace): make directory paths clickable and rename "Today's Note" to "Add Memory" Add open_workspace_directory Tauri command to open workspace/memory dirs in the system file manager. Rename dailyMemory.createToday across all locales. --- src-tauri/src/commands/workspace.rs | 24 +++++++++++++++++++ src-tauri/src/lib.rs | 1 + src/components/workspace/DailyMemoryPanel.tsx | 9 +++++-- .../workspace/WorkspaceFilesPanel.tsx | 8 ++++++- src/i18n/locales/en.json | 3 ++- src/i18n/locales/ja.json | 3 ++- src/i18n/locales/zh.json | 3 ++- src/lib/api/workspace.ts | 4 ++++ 8 files changed, 49 insertions(+), 6 deletions(-) diff --git a/src-tauri/src/commands/workspace.rs b/src-tauri/src/commands/workspace.rs index c8405419..172deceb 100644 --- a/src-tauri/src/commands/workspace.rs +++ b/src-tauri/src/commands/workspace.rs @@ -1,5 +1,7 @@ use regex::Regex; use std::sync::LazyLock; +use tauri::AppHandle; +use tauri_plugin_opener::OpenerExt; use crate::config::write_text_file; use crate::openclaw_config::get_openclaw_dir; @@ -336,3 +338,25 @@ pub async fn write_workspace_file(filename: String, content: String) -> Result<( write_text_file(&path, &content) .map_err(|e| format!("Failed to write workspace file {filename}: {e}")) } + +/// Open the workspace or memory directory in the system file manager. +/// `subdir`: "workspace" opens `~/.openclaw/workspace/`, +/// "memory" opens `~/.openclaw/workspace/memory/`. +#[tauri::command] +pub async fn open_workspace_directory(handle: AppHandle, subdir: String) -> Result { + let dir = match subdir.as_str() { + "memory" => get_openclaw_dir().join("workspace").join("memory"), + _ => get_openclaw_dir().join("workspace"), + }; + + if !dir.exists() { + std::fs::create_dir_all(&dir).map_err(|e| format!("Failed to create directory: {e}"))?; + } + + handle + .opener() + .open_path(dir.to_string_lossy().to_string(), None::) + .map_err(|e| format!("Failed to open directory: {e}"))?; + + Ok(true) +} diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 0fbb1bb9..e2cefc38 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -1052,6 +1052,7 @@ pub fn run() { commands::write_daily_memory_file, commands::delete_daily_memory_file, commands::search_daily_memory_files, + commands::open_workspace_directory, ]); let app = builder diff --git a/src/components/workspace/DailyMemoryPanel.tsx b/src/components/workspace/DailyMemoryPanel.tsx index f81295b7..8b2008c6 100644 --- a/src/components/workspace/DailyMemoryPanel.tsx +++ b/src/components/workspace/DailyMemoryPanel.tsx @@ -7,7 +7,7 @@ import React, { } from "react"; import { useTranslation } from "react-i18next"; import { toast } from "sonner"; -import { Calendar, Trash2, Plus, Search, X } from "lucide-react"; +import { Calendar, Trash2, Plus, Search, X, FolderOpen } from "lucide-react"; import { AnimatePresence, motion } from "framer-motion"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; @@ -352,8 +352,13 @@ const DailyMemoryPanel: React.FC = ({
{/* Header with path, search, and create button */}
-

+

workspaceApi.openDirectory("memory")} + title={t("workspace.openDirectory")} + > ~/.openclaw/workspace/memory/ +