2026-07-08 23:06:45 +02:00
|
|
|
from typing import Any
|
|
|
|
|
|
2026-07-08 22:29:21 +02:00
|
|
|
from fastapi import Request, Response
|
|
|
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
|
|
Add state-hub v0.1 — local-first state service for the Custodian
Implements the first live layer of the Custodian cognitive infrastructure:
PostgreSQL schema, FastAPI REST API, FastMCP stdio server, and Observable
Framework telemetry dashboard.
- state-hub/: full stack (docker-compose, FastAPI, Alembic, MCP server, dashboard)
- 5 DB tables: topics, workstreams, tasks, decisions, progress_events
- 11 MCP tools + 5 resources registered in .mcp.json
- Observable dashboard: Overview, Workstreams, Decisions, Progress pages
- CLAUDE.md: session protocol (get_state_summary / add_progress_event ritual)
- ~/.claude/CLAUDE.md: global cross-project reference to the hub
- scripts/pull_image.py: WSL2 TLS-resilient Docker image downloader
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 17:47:49 +01:00
|
|
|
from api.database import get_session
|
|
|
|
|
from api.models.progress_event import ProgressEvent
|
|
|
|
|
from api.schemas.progress_event import ProgressEventCreate, ProgressEventRead
|
2026-07-08 23:06:45 +02:00
|
|
|
from api.services.legacy_compat import meter_legacy_body_field, meter_legacy_query_param
|
2026-06-07 14:29:12 +02:00
|
|
|
from hub_core.routers.progress import create_progress_router
|
Add state-hub v0.1 — local-first state service for the Custodian
Implements the first live layer of the Custodian cognitive infrastructure:
PostgreSQL schema, FastAPI REST API, FastMCP stdio server, and Observable
Framework telemetry dashboard.
- state-hub/: full stack (docker-compose, FastAPI, Alembic, MCP server, dashboard)
- 5 DB tables: topics, workstreams, tasks, decisions, progress_events
- 11 MCP tools + 5 resources registered in .mcp.json
- Observable dashboard: Overview, Workstreams, Decisions, Progress pages
- CLAUDE.md: session protocol (get_state_summary / add_progress_event ritual)
- ~/.claude/CLAUDE.md: global cross-project reference to the hub
- scripts/pull_image.py: WSL2 TLS-resilient Docker image downloader
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 17:47:49 +01:00
|
|
|
|
2026-07-08 22:29:21 +02:00
|
|
|
|
2026-07-08 23:06:45 +02:00
|
|
|
async def _meter_progress_workstream_id_query(
|
2026-07-08 22:29:21 +02:00
|
|
|
session: AsyncSession,
|
|
|
|
|
request: Request,
|
|
|
|
|
response: Response,
|
|
|
|
|
) -> None:
|
|
|
|
|
await meter_legacy_query_param(
|
|
|
|
|
session=session,
|
|
|
|
|
request=request,
|
|
|
|
|
response=response,
|
|
|
|
|
method="GET",
|
|
|
|
|
route="/progress/",
|
|
|
|
|
replacement_ref="/progress/?workplan_id=<workplan_id>",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
2026-07-08 23:06:45 +02:00
|
|
|
async def _meter_progress_workstream_id_body(
|
|
|
|
|
session: AsyncSession,
|
|
|
|
|
request: Request,
|
|
|
|
|
response: Response,
|
|
|
|
|
) -> None:
|
|
|
|
|
await meter_legacy_body_field(
|
|
|
|
|
session=session,
|
|
|
|
|
request=request,
|
|
|
|
|
response=response,
|
|
|
|
|
method="POST",
|
|
|
|
|
route="/progress/",
|
|
|
|
|
field="workstream_id",
|
|
|
|
|
replacement_ref="POST /progress/ with workplan_id",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _progress_body_uses_legacy_workstream_id(body: Any) -> bool:
|
|
|
|
|
return bool(getattr(body, "used_legacy_workstream_id", False))
|
|
|
|
|
|
|
|
|
|
|
2026-06-07 14:29:12 +02:00
|
|
|
router = create_progress_router(
|
|
|
|
|
get_session,
|
|
|
|
|
progress_model=ProgressEvent,
|
|
|
|
|
progress_create_schema=ProgressEventCreate,
|
|
|
|
|
progress_read_schema=ProgressEventRead,
|
2026-07-08 23:06:45 +02:00
|
|
|
meter_legacy_workstream_id=_meter_progress_workstream_id_query,
|
|
|
|
|
progress_body_uses_legacy_workstream_id=_progress_body_uses_legacy_workstream_id,
|
|
|
|
|
meter_legacy_workstream_id_body=_meter_progress_workstream_id_body,
|
2026-06-07 14:29:12 +02:00
|
|
|
)
|
Add state-hub v0.1 — local-first state service for the Custodian
Implements the first live layer of the Custodian cognitive infrastructure:
PostgreSQL schema, FastAPI REST API, FastMCP stdio server, and Observable
Framework telemetry dashboard.
- state-hub/: full stack (docker-compose, FastAPI, Alembic, MCP server, dashboard)
- 5 DB tables: topics, workstreams, tasks, decisions, progress_events
- 11 MCP tools + 5 resources registered in .mcp.json
- Observable dashboard: Overview, Workstreams, Decisions, Progress pages
- CLAUDE.md: session protocol (get_state_summary / add_progress_event ritual)
- ~/.claude/CLAUDE.md: global cross-project reference to the hub
- scripts/pull_image.py: WSL2 TLS-resilient Docker image downloader
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 17:47:49 +01:00
|
|
|
|
2026-07-08 22:29:21 +02:00
|
|
|
__all__ = ["router"]
|