2026-02-25 23:33:14 +01:00
|
|
|
import uuid
|
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 datetime import datetime
|
|
|
|
|
|
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
|
|
|
|
from api.schemas.decision import DecisionRead
|
|
|
|
|
from api.schemas.progress_event import ProgressEventRead
|
|
|
|
|
from api.schemas.task import TaskRead
|
|
|
|
|
from api.schemas.topic import TopicWithWorkstreams
|
2026-02-25 23:33:14 +01:00
|
|
|
from api.schemas.workstream import WorkstreamWithDeps
|
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 TopicTotals(BaseModel):
|
|
|
|
|
active: int = 0
|
|
|
|
|
paused: int = 0
|
|
|
|
|
archived: int = 0
|
|
|
|
|
total: int = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class WorkstreamTotals(BaseModel):
|
|
|
|
|
active: int = 0
|
|
|
|
|
blocked: int = 0
|
|
|
|
|
completed: int = 0
|
|
|
|
|
archived: int = 0
|
|
|
|
|
total: int = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TaskTotals(BaseModel):
|
|
|
|
|
todo: int = 0
|
|
|
|
|
in_progress: int = 0
|
|
|
|
|
blocked: int = 0
|
|
|
|
|
done: int = 0
|
|
|
|
|
cancelled: int = 0
|
|
|
|
|
total: int = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class DecisionTotals(BaseModel):
|
|
|
|
|
open: int = 0
|
|
|
|
|
resolved: int = 0
|
|
|
|
|
escalated: int = 0
|
|
|
|
|
superseded: int = 0
|
|
|
|
|
total: int = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Totals(BaseModel):
|
|
|
|
|
topics: TopicTotals
|
|
|
|
|
workstreams: WorkstreamTotals
|
|
|
|
|
tasks: TaskTotals
|
|
|
|
|
decisions: DecisionTotals
|
|
|
|
|
|
|
|
|
|
|
2026-02-25 23:33:14 +01:00
|
|
|
class NextStep(BaseModel):
|
|
|
|
|
"""A derived suggestion pointing to where work should happen next.
|
|
|
|
|
|
|
|
|
|
Suggestions are never persisted — they are computed on demand from
|
|
|
|
|
current hub state: recently resolved decisions, newly unblocked tasks,
|
|
|
|
|
cleared dependencies.
|
|
|
|
|
"""
|
|
|
|
|
type: str # unblocked_task | resolved_decision | dependency_cleared
|
|
|
|
|
domain: str | None = None
|
|
|
|
|
workstream_id: uuid.UUID | None = None
|
|
|
|
|
workstream_title: str | None = None
|
|
|
|
|
workstream_slug: str | None = None
|
|
|
|
|
task_id: uuid.UUID | None = None
|
|
|
|
|
task_title: str | None = None
|
|
|
|
|
message: str # plain-language explanation
|
|
|
|
|
|
|
|
|
|
|
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 StateSummary(BaseModel):
|
|
|
|
|
generated_at: datetime
|
|
|
|
|
totals: Totals
|
|
|
|
|
topics: list[TopicWithWorkstreams]
|
|
|
|
|
blocking_decisions: list[DecisionRead]
|
|
|
|
|
blocked_tasks: list[TaskRead]
|
|
|
|
|
recent_progress: list[ProgressEventRead]
|
2026-02-25 23:33:14 +01:00
|
|
|
open_workstreams: list[WorkstreamWithDeps]
|
|
|
|
|
next_steps: list[NextStep] = []
|