From 680668ffdb38fc908f7e4a359b2e4f49d56ca1bf Mon Sep 17 00:00:00 2001 From: yushen Date: Tue, 24 Mar 2026 15:59:11 +0800 Subject: [PATCH] feat(workspace): add context field for AI agent background info Add a `context` text field to workspaces, allowing users to provide background information and context for AI agents working in the workspace. Full stack: migration, sqlc queries, Go handler, TS types, SDK, and settings page UI. Co-Authored-By: Claude Opus 4.6 (1M context) --- apps/web/app/(dashboard)/settings/page.tsx | 16 ++++++++++ apps/web/lib/auth-context.test.tsx | 4 +++ apps/web/test/helpers.tsx | 1 + packages/sdk/src/api-client.ts | 4 +-- packages/types/src/workspace.ts | 1 + server/internal/handler/workspace.go | 20 ++++++++---- .../migrations/006_workspace_context.down.sql | 1 + .../migrations/006_workspace_context.up.sql | 1 + server/pkg/db/generated/models.go | 19 +++++++++++ server/pkg/db/generated/workspace.sql.go | 32 +++++++++++++------ server/pkg/db/queries/workspace.sql | 5 +-- 11 files changed, 85 insertions(+), 19 deletions(-) create mode 100644 server/migrations/006_workspace_context.down.sql create mode 100644 server/migrations/006_workspace_context.up.sql diff --git a/apps/web/app/(dashboard)/settings/page.tsx b/apps/web/app/(dashboard)/settings/page.tsx index af2a7ea1..ca31a753 100644 --- a/apps/web/app/(dashboard)/settings/page.tsx +++ b/apps/web/app/(dashboard)/settings/page.tsx @@ -95,6 +95,7 @@ export default function SettingsPage() { const [description, setDescription] = useState( workspace?.description ?? "", ); + const [context, setContext] = useState(workspace?.context ?? ""); const [profileName, setProfileName] = useState(user?.name ?? ""); const [avatarUrl, setAvatarUrl] = useState(user?.avatar_url ?? ""); const [saving, setSaving] = useState(false); @@ -115,6 +116,7 @@ export default function SettingsPage() { useEffect(() => { setName(workspace?.name ?? ""); setDescription(workspace?.description ?? ""); + setContext(workspace?.context ?? ""); }, [workspace]); useEffect(() => { @@ -130,6 +132,7 @@ export default function SettingsPage() { const updated = await api.updateWorkspace(workspace.id, { name, description: description || undefined, + context: context || undefined, }); updateWorkspace(updated); setSaved(true); @@ -330,6 +333,19 @@ export default function SettingsPage() { placeholder="What does this workspace focus on?" /> +
+ +