mirror of
https://github.com/tiennm99/goclaw.git
synced 2026-08-08 08:21:55 +00:00
* feat(teams): refactor attachments, remove team_message, add task comments UI Major team system refactoring: - Drop team_workspace_files, team_workspace_file_versions, team_workspace_comments, team_messages tables; replace team_task_attachments with path-based schema - Add denormalized comment_count/attachment_count on team_tasks for dashboard perf - Auto-track file writes as task attachments via WorkspaceInterceptor - Remove team_message tool entirely (tool, store, i18n, builtin_tools, MCP bridge) - Members communicate via task comments; approve/reject use comments for audit trail - Add commented/new_task notification types to TeamNotifyConfig - Enrich task completion announce with member comments - User-created tasks stay pending (backlog) — no auto-assign to leader - Configurable member request tasks (member_requests.enabled in team settings) - Structured task description template in TEAM.md for v2 leads - HTTP attachment download endpoint with IDOR + path traversal protection - Web UI: count badges on task list, comments section with input, download button - Team settings UI: completed/commented/new_task toggles, member requests section * feat(teams): priority dispatch, compact prompting, realtime comments - Priority dispatch: DispatchUnblockedTasks dispatches only 1 task per owner per round (highest priority first). Fixes cancel bug where CancelSession killed innocent queued tasks. - Prompt rework: Replace verbose Task Decomposition (25 lines) with compact Task Planning (8 lines). Add explicit UUID warning and sequencing guidance for weak models (Qwen, MiniMax). - Recent comments in dispatch: buildRecentCommentsSummary appends 3 most recent comments to re-dispatched tasks (reject, retry, stale). - Enrich comment event payload with TaskNumber, Subject, CommentText (truncated 500 runes, UTF-8 safe). - UI: Board subscribes to TEAM_TASK_COMMENTED for realtime comment_count badge updates. Task detail dialog auto-refreshes comments on event. - Tool description hint: guide models to write self-contained task descriptions with clear objectives and context. * perf(teams): add ListRecentTaskComments with SQL LIMIT Dispatch only needs 3 most recent comments — avoid fetching all. New ListRecentTaskComments(ctx, taskID, limit) uses ORDER BY DESC LIMIT N then reverses to chronological order. * feat(teams): add subject embedding for semantic task search + improve prompting - Add vector(1536) embedding column to team_tasks with HNSW index - Implement hybrid search: FTS (0.3) + cosine similarity (0.7) with graceful fallback - Auto-generate embeddings on task create/update, backfill existing tasks on startup - Wire embedding provider into PGTeamStore via gateway_setup - Change FTS from OR to AND with prefix matching for precise keyword search - Reduce search page size from 30 to 5 to save tokens - Rename migration 000023 → 000024, bump RequiredSchemaVersion to 24 - Update TEAM.md hints: prefer search over list, batch task creation with blocked_by - Add anti-pattern examples to prevent sequential task creation
42 lines
1.9 KiB
SQL
42 lines
1.9 KiB
SQL
-- Phase 1: Team attachments refactor — drop workspace_files, messages; path-based attachments
|
|
-- Also adds denormalized count columns on team_tasks for dashboard performance.
|
|
|
|
-- 1. Drop old attachments (FK → team_workspace_files)
|
|
DROP TABLE IF EXISTS team_task_attachments;
|
|
|
|
-- 2. Drop workspace sub-tables (FK → team_workspace_files)
|
|
DROP TABLE IF EXISTS team_workspace_comments;
|
|
DROP TABLE IF EXISTS team_workspace_file_versions;
|
|
|
|
-- 3. Drop workspace files table
|
|
DROP TABLE IF EXISTS team_workspace_files;
|
|
|
|
-- 4. Drop team messages table (tool removed)
|
|
DROP TABLE IF EXISTS team_messages;
|
|
|
|
-- 5. Create new path-based attachments table
|
|
CREATE TABLE team_task_attachments (
|
|
id UUID PRIMARY KEY DEFAULT uuid_generate_v7(),
|
|
task_id UUID NOT NULL REFERENCES team_tasks(id) ON DELETE CASCADE,
|
|
team_id UUID NOT NULL REFERENCES agent_teams(id) ON DELETE CASCADE,
|
|
chat_id VARCHAR(255) NOT NULL DEFAULT '',
|
|
path TEXT NOT NULL,
|
|
file_size BIGINT NOT NULL DEFAULT 0,
|
|
mime_type VARCHAR(100) DEFAULT '',
|
|
created_by_agent_id UUID REFERENCES agents(id),
|
|
created_by_sender_id VARCHAR(255) DEFAULT '',
|
|
metadata JSONB NOT NULL DEFAULT '{}',
|
|
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
|
UNIQUE(task_id, path)
|
|
);
|
|
CREATE INDEX idx_tta_task ON team_task_attachments(task_id);
|
|
CREATE INDEX idx_tta_team ON team_task_attachments(team_id);
|
|
|
|
-- 6. Denormalized count columns for dashboard performance
|
|
ALTER TABLE team_tasks ADD COLUMN IF NOT EXISTS comment_count INT NOT NULL DEFAULT 0;
|
|
ALTER TABLE team_tasks ADD COLUMN IF NOT EXISTS attachment_count INT NOT NULL DEFAULT 0;
|
|
|
|
-- 7. Vector embedding for semantic task search (subject only)
|
|
ALTER TABLE team_tasks ADD COLUMN IF NOT EXISTS embedding vector(1536);
|
|
CREATE INDEX IF NOT EXISTS idx_tt_embedding ON team_tasks USING hnsw (embedding vector_cosine_ops);
|