molecule-core/workspace-server/migrations/009_activity_logs.sql
Hongming Wang d8026347e5 chore: open-source restructure — rename dirs, remove internal files, scrub secrets
Renames:
- platform/ → workspace-server/ (Go module path stays as "platform" for
  external dep compat — will update after plugin module republish)
- workspace-template/ → workspace/

Removed (moved to separate repos or deleted):
- PLAN.md — internal roadmap (move to private project board)
- HANDOFF.md, AGENTS.md — one-time internal session docs
- .claude/ — gitignored entirely (local agent config)
- infra/cloudflare-worker/ → Molecule-AI/molecule-tenant-proxy
- org-templates/molecule-dev/ → standalone template repo
- .mcp-eval/ → molecule-mcp-server repo
- test-results/ — ephemeral, gitignored

Security scrubbing:
- Cloudflare account/zone/KV IDs → placeholders
- Real EC2 IPs → <EC2_IP> in all docs
- CF token prefix, Neon project ID, Fly app names → redacted
- Langfuse dev credentials → parameterized
- Personal runner username/machine name → generic

Community files:
- CONTRIBUTING.md — build, test, branch conventions
- CODE_OF_CONDUCT.md — Contributor Covenant 2.1

All Dockerfiles, CI workflows, docker-compose, railway.toml, render.yaml,
README, CLAUDE.md updated for new directory names.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-18 00:24:44 -07:00

25 lines
1.6 KiB
SQL

-- Activity logs: comprehensive logging for A2A communication, task updates, agent actions, and errors.
CREATE TABLE IF NOT EXISTS activity_logs (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
workspace_id UUID NOT NULL REFERENCES workspaces(id) ON DELETE CASCADE,
activity_type TEXT NOT NULL, -- 'a2a_send', 'a2a_receive', 'task_update', 'agent_log', 'error'
source_id UUID, -- workspace that initiated the action
target_id UUID, -- workspace that received the action (for A2A)
method TEXT, -- A2A method name (e.g. 'message/send') or task action
summary TEXT, -- Human-readable summary
request_body JSONB, -- Request payload (for A2A)
response_body JSONB, -- Response payload (for A2A)
duration_ms INTEGER, -- How long the operation took
status TEXT DEFAULT 'ok', -- 'ok', 'error', 'timeout'
error_detail TEXT, -- Error message if status != 'ok'
created_at TIMESTAMPTZ DEFAULT now()
);
-- Composite index covers (workspace_id) prefix and (workspace_id, activity_type) lookups.
-- Separate idx_activity_created_at kept for global retention cleanup queries.
CREATE INDEX IF NOT EXISTS idx_activity_ws_type_time ON activity_logs(workspace_id, activity_type, created_at DESC);
CREATE INDEX IF NOT EXISTS idx_activity_created_at ON activity_logs(created_at);
-- Add current_task to workspaces for showing what the agent is currently working on.
ALTER TABLE workspaces ADD COLUMN IF NOT EXISTS current_task TEXT;