generated from coulomb/repo-seed
Introduces a capability catalog (CUST-WP-0022) so domains can advertise what they provide and agents can request capabilities from other domains with auto-routing, lifecycle tracking, and task-unblocking on completion. - New models: CapabilityCatalog, CapabilityRequest with full lifecycle (requested → accepted → in_progress → ready_for_review → completed/rejected/withdrawn) - Migration i6d7e8f9a0b1: capability_catalog + capability_requests tables - Router /capability-catalog and /capability-requests with accept/status endpoints - 7 new MCP tools: register_capability, list_capabilities, request_capability, accept_capability_request, update_capability_request_status, list_capability_requests, get_capability_request - StateSummary gains open_capability_requests count - Dashboard: capability-requests.md page + docs/capabilities.md + docs/scope.md - SCOPE.md: three seed capabilities documented (MCP registration, state tracking, SBOM) - scope.template: Provided Capabilities section with example block - scripts/ingest_capabilities.py + make ingest-capabilities[/-all] targets Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
75 lines
3.6 KiB
Python
75 lines
3.6 KiB
Python
"""add capability_catalog and capability_requests tables
|
|
|
|
Revision ID: i6d7e8f9a0b1
|
|
Revises: h5c6d7e8f9a0
|
|
Create Date: 2026-03-19
|
|
"""
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
from sqlalchemy.dialects import postgresql
|
|
|
|
revision = "i6d7e8f9a0b1"
|
|
down_revision = "h5c6d7e8f9a0"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"capability_catalog",
|
|
sa.Column("id", postgresql.UUID(as_uuid=True), primary_key=True,
|
|
server_default=sa.text("gen_random_uuid()")),
|
|
sa.Column("domain_id", postgresql.UUID(as_uuid=True),
|
|
sa.ForeignKey("domains.id", ondelete="RESTRICT"),
|
|
nullable=False, index=True),
|
|
sa.Column("capability_type", sa.String(50), nullable=False),
|
|
sa.Column("title", sa.String(255), nullable=False),
|
|
sa.Column("description", sa.Text, nullable=True),
|
|
sa.Column("keywords", sa.ARRAY(sa.String), nullable=False, server_default="{}"),
|
|
sa.Column("status", sa.String(20), nullable=False, server_default="active"),
|
|
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False),
|
|
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False),
|
|
sa.UniqueConstraint("domain_id", "capability_type", "title", name="uq_catalog_domain_type_title"),
|
|
)
|
|
|
|
op.create_table(
|
|
"capability_requests",
|
|
sa.Column("id", postgresql.UUID(as_uuid=True), primary_key=True,
|
|
server_default=sa.text("gen_random_uuid()")),
|
|
sa.Column("title", sa.String(500), nullable=False),
|
|
sa.Column("description", sa.Text, nullable=True),
|
|
sa.Column("capability_type", sa.String(50), nullable=False),
|
|
sa.Column("priority", sa.String(20), nullable=False, server_default="medium"),
|
|
sa.Column("status", sa.String(20), nullable=False, server_default="requested"),
|
|
sa.Column("requesting_domain_id", postgresql.UUID(as_uuid=True),
|
|
sa.ForeignKey("domains.id", ondelete="RESTRICT"),
|
|
nullable=False, index=True),
|
|
sa.Column("requesting_workstream_id", postgresql.UUID(as_uuid=True),
|
|
sa.ForeignKey("workstreams.id", ondelete="SET NULL"),
|
|
nullable=True),
|
|
sa.Column("requesting_agent", sa.String(100), nullable=False),
|
|
sa.Column("fulfilling_domain_id", postgresql.UUID(as_uuid=True),
|
|
sa.ForeignKey("domains.id", ondelete="SET NULL"),
|
|
nullable=True, index=True),
|
|
sa.Column("fulfilling_workstream_id", postgresql.UUID(as_uuid=True),
|
|
sa.ForeignKey("workstreams.id", ondelete="SET NULL"),
|
|
nullable=True),
|
|
sa.Column("fulfilling_agent", sa.String(100), nullable=True),
|
|
sa.Column("blocking_task_id", postgresql.UUID(as_uuid=True),
|
|
sa.ForeignKey("tasks.id", ondelete="SET NULL"),
|
|
nullable=True),
|
|
sa.Column("catalog_entry_id", postgresql.UUID(as_uuid=True),
|
|
sa.ForeignKey("capability_catalog.id", ondelete="SET NULL"),
|
|
nullable=True),
|
|
sa.Column("resolution_note", sa.Text, nullable=True),
|
|
sa.Column("accepted_at", sa.DateTime(timezone=True), nullable=True),
|
|
sa.Column("completed_at", sa.DateTime(timezone=True), nullable=True),
|
|
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False),
|
|
sa.Column("updated_at", sa.DateTime(timezone=True), server_default=sa.func.now(), nullable=False),
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_table("capability_requests")
|
|
op.drop_table("capability_catalog")
|