2026-08-22 18:39:21 +02:00
|
|
|
from typing import Literal
|
|
|
|
|
|
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_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
|
|
|
model_config = SettingsConfigDict(
|
|
|
|
|
env_file=".env",
|
|
|
|
|
env_file_encoding="utf-8",
|
|
|
|
|
extra="ignore",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
database_url: str = "postgresql+asyncpg://custodian:changeme@127.0.0.1:5432/custodian"
|
|
|
|
|
api_base: str = "http://127.0.0.1:8000"
|
2026-08-25 10:36:37 +02:00
|
|
|
# What this instance claims to be. Deliberately defaults to "unknown":
|
|
|
|
|
# an instance that has not declared itself is not the primary, and callers
|
|
|
|
|
# that need the authoritative hub must be able to tell the difference.
|
|
|
|
|
# Answering on a port is not evidence of authority — that assumption cost
|
|
|
|
|
# seven weeks of onboarding (CUST-WP-0067-T03, ADR-010).
|
2026-08-25 12:55:11 +02:00
|
|
|
state_hub_instance_role: Literal["primary", "cache", "unknown"] = "unknown"
|
|
|
|
|
# Env vars are STATE_HUB_INSTANCE_ROLE / STATE_HUB_INSTANCE_LABEL — the
|
|
|
|
|
# field name *is* the binding, so renaming either breaks the deployment
|
|
|
|
|
# silently. Covered by tests/test_instance_identity.py.
|
2026-08-25 10:36:37 +02:00
|
|
|
# Free-form label to name *which* instance answered, e.g. "railiance01".
|
2026-08-25 12:55:11 +02:00
|
|
|
state_hub_instance_label: 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
|
|
|
debug: bool = False
|
2026-05-22 13:45:53 +02:00
|
|
|
state_hub_report_dir: str = "reports/recently-on-scope"
|
|
|
|
|
state_hub_markitect_cli_path: str | None = None
|
2026-08-09 16:19:53 +02:00
|
|
|
activity_core_url: str | None = None
|
|
|
|
|
activity_core_worker_token: str | None = None
|
|
|
|
|
ops_run_projection_ttl_seconds: float = 15.0
|
|
|
|
|
ops_run_sla_hours: float = 1.0
|
2026-08-22 18:39:21 +02:00
|
|
|
sbom_nexus_url: str | None = None
|
|
|
|
|
sbom_nexus_read_mode: Literal["legacy", "nexus"] = "legacy"
|
2026-08-22 19:55:08 +02:00
|
|
|
sbom_nexus_write_mode: Literal["legacy", "nexus"] = "legacy"
|
2026-08-22 18:39:21 +02:00
|
|
|
sbom_nexus_timeout_seconds: float = 5.0
|
2026-08-29 03:17:37 +02:00
|
|
|
# Repository renames are central-only, compare-and-set operations. The
|
|
|
|
|
# secret signs short-lived, non-persistent preflight evidence; it must be
|
|
|
|
|
# supplied by the deployment (normally through OpenBao), never recorded in
|
|
|
|
|
# State Hub. With no secret the read-only report remains available but no
|
|
|
|
|
# mutation token can be issued.
|
|
|
|
|
repository_rename_preflight_secret: str | None = None
|
|
|
|
|
repository_rename_preflight_ttl_seconds: int = 900
|
|
|
|
|
repository_rename_forge_timeout_seconds: float = 10.0
|
STATE-WP-0101-T02/T03: decision classes, evidence refusals, write-back route
T02: additive migration d5e6f7a8b9c0 (decision_class, memo_id,
approval_id, resolution_source, resolution_evidence, evidence_refs,
CHECKs, partial unique memo_id); typed evidence_refs; 409
evidence_required for text resolve, resolving PATCH fields and resolved
create on C1/C2; raise-only class; C3 refused as reserved.
T03: POST /decisions/{id}/resolve-evidence (link/resolve), projected
token verified by TokenReview with audience
state-hub-decision-writeback and an exact subject allowlist; outcome
record v1 validation, 8 KiB bound, secret scan; idempotent on
(decision_id, memo_id). Off by default (DECISION_WRITEBACK_ENABLED).
Tests use a fake reviewer; full suite 1286 passed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 5502@bnt-lap001
Assistant-Session: 68b3b02f-5d0f-4e71-8421-796f62e50196
2026-11-01 04:01:48 +01:00
|
|
|
# STATE-WP-0101-T03: authenticated decision write-back route
|
|
|
|
|
# (POST /decisions/{id}/resolve-evidence). Off by default; enabling it needs
|
|
|
|
|
# the API ServiceAccount bound to system:auth-delegator (founder-run, cluster
|
|
|
|
|
# RBAC) so TokenReview works. Subjects: comma-separated exact allowlist.
|
|
|
|
|
decision_writeback_enabled: bool = False
|
|
|
|
|
decision_writeback_audience: str = "state-hub-decision-writeback"
|
|
|
|
|
decision_writeback_subjects: str = "system:serviceaccount:state-hub:state-hub"
|
|
|
|
|
kubernetes_api_url: str = "https://kubernetes.default.svc"
|
|
|
|
|
kubernetes_serviceaccount_dir: str = "/var/run/secrets/kubernetes.io/serviceaccount"
|
|
|
|
|
token_review_timeout_seconds: float = 5.0
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
settings = Settings()
|