diff --git a/web/src/app/api/local-agent/cron-tool-execute/route.ts b/web/src/app/api/local-agent/cron-tool-execute/route.ts index 0b89c0ebf..b64be58c2 100644 --- a/web/src/app/api/local-agent/cron-tool-execute/route.ts +++ b/web/src/app/api/local-agent/cron-tool-execute/route.ts @@ -11,7 +11,7 @@ import { resolveWorkspacePath, createLocalToolRegistry, executeLocalToolCall, - syncWorkspaceFileToBackend, + syncAgentContextFileToBackend, } from "@/lib/agent/tools/local-execution"; import { INTERNAL_URL } from "@/lib/constants"; @@ -66,7 +66,7 @@ export async function POST(request: NextRequest): Promise { // Execute the tool const result = await executeLocalToolCall(registry, toolName, toolInput || {}); - // Sync workspace file to backend DB after write/edit operations + // Sync agent context file to backend DB after write/edit operations if ( (toolName === "write_file" || toolName === "edit_file") && result.output && @@ -74,7 +74,7 @@ export async function POST(request: NextRequest): Promise { ) { const cookieStr = await getCookieString(); const base = INTERNAL_URL || "http://localhost:8080"; - syncWorkspaceFileToBackend( + syncAgentContextFileToBackend( resolvedPath, toolInput.path as string, base, diff --git a/web/src/components/desktop/AgentConfigView.tsx b/web/src/components/desktop/AgentConfigView.tsx index f72bad6a8..62bcc7b3d 100644 --- a/web/src/components/desktop/AgentConfigView.tsx +++ b/web/src/components/desktop/AgentConfigView.tsx @@ -3,7 +3,7 @@ import { useState, useEffect, useCallback } from "react"; import { AgentConfigSkeleton } from "./AgentConfigSkeleton"; -interface WorkspaceFile { +interface AgentContextFile { path: string; content: string; created_at: string; @@ -11,7 +11,7 @@ interface WorkspaceFile { } export function AgentConfigView() { - const [files, setFiles] = useState([]); + const [files, setFiles] = useState([]); const [selectedPath, setSelectedPath] = useState(null); const [editorContent, setEditorContent] = useState(""); const [savedContent, setSavedContent] = useState(""); @@ -24,9 +24,9 @@ export function AgentConfigView() { const fetchFiles = useCallback(async () => { try { setLoading(true); - const resp = await fetch("/api/agent/workspace-files"); - if (!resp.ok) throw new Error("Failed to fetch workspace files"); - const data = (await resp.json()) as { files: WorkspaceFile[] }; + const resp = await fetch("/api/agent/context"); + if (!resp.ok) throw new Error("Failed to fetch context files"); + const data = (await resp.json()) as { files: AgentContextFile[] }; setFiles(data.files); const firstFile = data.files[0]; if (firstFile && !selectedPath) { @@ -57,10 +57,10 @@ export function AgentConfigView() { .map(encodeURIComponent) .join("/"); const resp = await fetch( - `/api/agent/workspace-files/${encodedPath}` + `/api/agent/context/${encodedPath}` ); if (!resp.ok) throw new Error("Failed to read file"); - const data = (await resp.json()) as WorkspaceFile; + const data = (await resp.json()) as AgentContextFile; setSelectedPath(path); setEditorContent(data.content); setSavedContent(data.content); @@ -78,7 +78,7 @@ export function AgentConfigView() { if (!selectedPath) return; try { setSaving(true); - const resp = await fetch("/api/agent/workspace-files", { + const resp = await fetch("/api/agent/context", { method: "PUT", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ path: selectedPath, content: editorContent }), @@ -86,9 +86,9 @@ export function AgentConfigView() { if (!resp.ok) throw new Error("Failed to save file"); setSavedContent(editorContent); // Refresh file list to update timestamps - const listResp = await fetch("/api/agent/workspace-files"); + const listResp = await fetch("/api/agent/context"); if (listResp.ok) { - const data = (await listResp.json()) as { files: WorkspaceFile[] }; + const data = (await listResp.json()) as { files: AgentContextFile[] }; setFiles(data.files); } } catch (err) { @@ -118,13 +118,13 @@ export function AgentConfigView() { Configuration

- View and edit workspace files that persist across agent sessions. + View and edit context files that persist across agent sessions.

{files.length === 0 ? (
- No workspace files found. Start a conversation with the Bud Agent + No context files found. Start a conversation with the Bud Agent to create them.
) : ( diff --git a/web/src/lib/agent/tools/local-execution.ts b/web/src/lib/agent/tools/local-execution.ts index 3416e4976..550214da7 100644 --- a/web/src/lib/agent/tools/local-execution.ts +++ b/web/src/lib/agent/tools/local-execution.ts @@ -136,11 +136,11 @@ export async function executeLocalToolCall( } /** - * Sync a workspace file to the backend database after a local write/edit. + * Sync an agent context file to the backend database after a local write/edit. * This ensures the backend sees file updates * made through the agent's file tools. */ -export async function syncWorkspaceFileToBackend( +export async function syncAgentContextFileToBackend( workspacePath: string, filePath: string, apiBaseUrl: string, @@ -154,7 +154,7 @@ export async function syncWorkspaceFileToBackend( const content = fs.readFileSync(resolvedPath, "utf-8"); - const resp = await fetch(`${apiBaseUrl}/api/agent/workspace-files`, { + const resp = await fetch(`${apiBaseUrl}/api/agent/context`, { method: "PUT", headers: { "Content-Type": "application/json", @@ -164,7 +164,7 @@ export async function syncWorkspaceFileToBackend( }); if (!resp.ok) { - console.warn(`Failed to sync workspace file ${filePath}: ${resp.status}`); + console.warn(`Failed to sync context file ${filePath}: ${resp.status}`); } } catch { // Non-critical: don't let sync failures affect tool execution diff --git a/web/src/lib/agent/tools/tool-catalog.ts b/web/src/lib/agent/tools/tool-catalog.ts index 3731515f8..965a6ff36 100644 --- a/web/src/lib/agent/tools/tool-catalog.ts +++ b/web/src/lib/agent/tools/tool-catalog.ts @@ -501,9 +501,9 @@ export const TOOL_CATALOG: ToolCatalogEntry[] = [ ], }, { - name: "workspace_read", + name: "context_read", description: - "Read a workspace file by path. Workspace files are persistent documents like SOUL.md, USER.md, IDENTITY.md, AGENTS.md, and MEMORY.md.", + "Read a context file by path. Context files are persistent documents like SOUL.md, USER.md, IDENTITY.md, AGENTS.md, and MEMORY.md.", category: "remote", requiresApproval: false, parameters: [ @@ -511,15 +511,15 @@ export const TOOL_CATALOG: ToolCatalogEntry[] = [ name: "path", type: "string", description: - "The workspace file path to read. Example: 'SOUL.md', 'USER.md'.", + "The context file path to read. Example: 'SOUL.md', 'USER.md'.", required: true, }, ], }, { - name: "workspace_write", + name: "context_write", description: - "Create or update a workspace file. Use this to persist documents like SOUL.md, USER.md, IDENTITY.md, AGENTS.md, and MEMORY.md.", + "Create or update a context file. Use this to persist documents like SOUL.md, USER.md, IDENTITY.md, AGENTS.md, and MEMORY.md.", category: "remote", requiresApproval: false, parameters: [ @@ -527,7 +527,7 @@ export const TOOL_CATALOG: ToolCatalogEntry[] = [ name: "path", type: "string", description: - "The workspace file path to write. Example: 'SOUL.md', 'USER.md'.", + "The context file path to write. Example: 'SOUL.md', 'USER.md'.", required: true, }, { @@ -539,9 +539,9 @@ export const TOOL_CATALOG: ToolCatalogEntry[] = [ ], }, { - name: "workspace_list", + name: "context_list", description: - "List workspace files, optionally filtered by a path prefix. Use this to discover available workspace files.", + "List context files, optionally filtered by a path prefix. Use this to discover available context files.", category: "remote", requiresApproval: false, parameters: [