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
|
|
|
import uuid
|
|
|
|
|
from datetime import date, datetime
|
|
|
|
|
|
|
|
|
|
from pydantic import BaseModel, ConfigDict
|
|
|
|
|
|
|
|
|
|
from api.models.workstream import WorkstreamStatus
|
2026-02-25 23:33:14 +01:00
|
|
|
from api.schemas.workstream_dependency import WorkstreamDepStub
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
class WorkstreamCreate(BaseModel):
|
|
|
|
|
topic_id: uuid.UUID
|
|
|
|
|
slug: str
|
|
|
|
|
title: str
|
|
|
|
|
description: str | None = None
|
|
|
|
|
status: WorkstreamStatus = WorkstreamStatus.active
|
|
|
|
|
owner: str | None = None
|
|
|
|
|
due_date: date | None = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class WorkstreamUpdate(BaseModel):
|
|
|
|
|
title: str | None = None
|
|
|
|
|
description: str | None = None
|
|
|
|
|
status: WorkstreamStatus | None = None
|
|
|
|
|
owner: str | None = None
|
|
|
|
|
due_date: date | None = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class WorkstreamRead(BaseModel):
|
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
id: uuid.UUID
|
|
|
|
|
topic_id: uuid.UUID
|
|
|
|
|
slug: str
|
|
|
|
|
title: str
|
|
|
|
|
description: str | None = None
|
|
|
|
|
status: WorkstreamStatus
|
|
|
|
|
owner: str | None = None
|
|
|
|
|
due_date: date | None = None
|
|
|
|
|
created_at: datetime
|
|
|
|
|
updated_at: datetime
|
2026-02-25 00:50:43 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class WorkstreamWithTaskCounts(WorkstreamRead):
|
|
|
|
|
tasks_total: int = 0
|
|
|
|
|
tasks_todo: int = 0
|
|
|
|
|
tasks_in_progress: int = 0
|
|
|
|
|
tasks_blocked: int = 0
|
|
|
|
|
tasks_done: int = 0
|
2026-02-25 23:33:14 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class WorkstreamWithDeps(WorkstreamWithTaskCounts):
|
|
|
|
|
"""WorkstreamWithTaskCounts enriched with dependency graph edges."""
|
|
|
|
|
depends_on: list[WorkstreamDepStub] = []
|
|
|
|
|
blocks: list[WorkstreamDepStub] = []
|