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
|
2026-03-04 19:44:14 +01:00
|
|
|
from typing import Self
|
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 pydantic import BaseModel, ConfigDict, model_validator
|
|
|
|
|
|
|
|
|
|
from api.models.task import TaskPriority, TaskStatus
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TaskCreate(BaseModel):
|
|
|
|
|
workstream_id: uuid.UUID
|
|
|
|
|
title: str
|
|
|
|
|
description: str | None = None
|
|
|
|
|
status: TaskStatus = TaskStatus.todo
|
|
|
|
|
priority: TaskPriority = TaskPriority.medium
|
|
|
|
|
assignee: str | None = None
|
|
|
|
|
due_date: date | None = None
|
|
|
|
|
blocking_reason: str | None = None
|
2026-03-04 19:44:14 +01:00
|
|
|
needs_human: bool = False
|
|
|
|
|
intervention_note: str | None = None
|
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
|
|
|
parent_task_id: uuid.UUID | None = None
|
|
|
|
|
|
2026-03-04 19:44:14 +01:00
|
|
|
@model_validator(mode="after")
|
|
|
|
|
def intervention_note_required_when_flagged(self) -> Self:
|
|
|
|
|
if self.needs_human and not self.intervention_note:
|
|
|
|
|
raise ValueError("intervention_note is required when needs_human is True")
|
|
|
|
|
return self
|
|
|
|
|
|
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 TaskUpdate(BaseModel):
|
|
|
|
|
title: str | None = None
|
|
|
|
|
description: str | None = None
|
|
|
|
|
status: TaskStatus | None = None
|
|
|
|
|
priority: TaskPriority | None = None
|
|
|
|
|
assignee: str | None = None
|
|
|
|
|
due_date: date | None = None
|
|
|
|
|
blocking_reason: str | None = None
|
2026-03-04 19:44:14 +01:00
|
|
|
needs_human: bool | None = None
|
|
|
|
|
intervention_note: str | None = None
|
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
|
|
|
parent_task_id: uuid.UUID | None = None
|
|
|
|
|
|
|
|
|
|
@model_validator(mode="after")
|
2026-03-04 19:44:14 +01:00
|
|
|
def blocking_reason_required_when_blocked(self) -> Self:
|
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
|
|
|
if self.status == TaskStatus.blocked and not self.blocking_reason:
|
|
|
|
|
raise ValueError("blocking_reason is required when status is blocked")
|
|
|
|
|
return self
|
|
|
|
|
|
2026-03-04 19:44:14 +01:00
|
|
|
@model_validator(mode="after")
|
|
|
|
|
def intervention_note_required_when_flagged(self) -> Self:
|
|
|
|
|
if self.needs_human and not self.intervention_note:
|
|
|
|
|
raise ValueError("intervention_note is required when needs_human is True")
|
|
|
|
|
return self
|
|
|
|
|
|
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 TaskRead(BaseModel):
|
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
|
id: uuid.UUID
|
|
|
|
|
workstream_id: uuid.UUID
|
|
|
|
|
title: str
|
|
|
|
|
description: str | None = None
|
|
|
|
|
status: TaskStatus
|
|
|
|
|
priority: TaskPriority
|
|
|
|
|
assignee: str | None = None
|
|
|
|
|
due_date: date | None = None
|
|
|
|
|
blocking_reason: str | None = None
|
2026-03-04 19:44:14 +01:00
|
|
|
needs_human: bool
|
|
|
|
|
intervention_note: str | None = None
|
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
|
|
|
parent_task_id: uuid.UUID | None = None
|
|
|
|
|
created_at: datetime
|
|
|
|
|
updated_at: datetime
|