1.9 KiB
Backend Workbench Alignment Design
Goal
Align the Go backend with the latest Svelte workbench prototype. The frontend currently models a Discord-like project workbench with dynamic projects, project-scoped channels, and channel-specific first-screen data.
API Contract
Add GET /api/projects/:id/workspace.
The response intentionally matches apps/web/src/features/workbench/types.ts and uses camelCase field names:
projectchannelstagsrecentSessionsinboxtasksaiSessionsnotesSourcescronPlans
Project
The project payload contains:
idnamedescriptioninitialsunreadCount
unreadCount is the count of open inbox items in the requested project.
Channels
System channels are derived by the backend for every project:
overviewinboxtasksai_sessionsnotes_sourcescron
Custom channels are stored in the database as project-scoped URL shortcuts:
titleiconurlsortOrder
System channel counts are derived from project data. Custom channels do not have counts.
Channel Data
The workspace response includes first-screen channel data:
- Inbox items map to mail-like message rows.
- Tasks map to todo-style cards with a
completedboolean. - AI sessions map to session list rows.
- Notes and sources are merged into one attachment/file-management list.
- Cron plans are metadata-only scheduled plans.
Cron plans do not execute autonomous agent work in this MVP.
Access Control
The endpoint only returns a workspace when the authenticated user owns the project. This follows the existing protected router and project dashboard behavior.
Tests
Backend tests should verify:
- The workspace rejects projects owned by another user.
- The workspace returns camelCase fields aligned with the frontend type.
- System channel counts are scoped to the requested project.
- Custom channels and Cron plans are project-scoped.