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>
58 lines
1.8 KiB
Python
58 lines
1.8 KiB
Python
import os
|
|
from contextlib import asynccontextmanager
|
|
|
|
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from api.database import engine
|
|
from api.routers import decisions, extension_points, progress, state, tasks, technical_debt, topics, workstreams, workstream_dependencies
|
|
from api.routers import domains, repos, contributions, sbom, policy, domain_goals, repo_goals, messages, capability_requests
|
|
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
yield
|
|
await engine.dispose()
|
|
|
|
|
|
app = FastAPI(
|
|
title="Custodian State Hub",
|
|
description="Local-first state API for the Custodian agent system.",
|
|
version="0.6.0",
|
|
lifespan=lifespan,
|
|
)
|
|
|
|
_cors_env = os.getenv("CORS_ORIGINS", "http://localhost:3000,http://127.0.0.1:3000")
|
|
_cors_origins = [o.strip() for o in _cors_env.split(",") if o.strip()]
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=_cors_origins,
|
|
allow_methods=["GET", "POST", "PATCH", "DELETE", "PUT"],
|
|
allow_headers=["Content-Type"],
|
|
)
|
|
|
|
app.include_router(domains.router)
|
|
app.include_router(repos.router)
|
|
app.include_router(topics.router)
|
|
app.include_router(workstreams.router)
|
|
app.include_router(workstream_dependencies.router)
|
|
app.include_router(tasks.router)
|
|
app.include_router(decisions.router)
|
|
app.include_router(extension_points.router)
|
|
app.include_router(technical_debt.router)
|
|
app.include_router(progress.router)
|
|
app.include_router(domain_goals.router)
|
|
app.include_router(repo_goals.router)
|
|
app.include_router(contributions.router)
|
|
app.include_router(sbom.router)
|
|
app.include_router(messages.router)
|
|
app.include_router(capability_requests.router)
|
|
app.include_router(state.router)
|
|
app.include_router(policy.router)
|
|
|
|
|
|
@app.get("/", include_in_schema=False)
|
|
async def root():
|
|
return {"service": "state-hub", "docs": "/docs"}
|