smriti/backend
Himanshu Dongre 7eabdc820e Add multi-branch space state endpoint
GET /api/v4/chat/spaces/{id}/state is the richer sibling of /head. It
returns main HEAD plus up to 5 active non-main branches plus a
lightweight divergence signal when any active branch disagrees with
main on decisions. Hard caps (5 branches, 2 divergent pairs, 3
decisions per side per pair) keep the aggregate response digestible.

Divergence detection reuses lineage._diff_lists so matching stays
consistent with smriti compare — decisions differing only in case or
punctuation normalize equal and do not trigger a false divergence
signal.

The query helper uses a Python-side per-branch dedupe rather than
Postgres DISTINCT ON so integration tests can run on sqlite without
dialect-specific workarounds. The non-main commit space for any real
project is small, so the cost is negligible.

No schema changes. No migrations. No behavior change for existing
callers of /head.
2026-04-12 01:58:03 +05:30
..
alembic Record project_root and author_agent on checkpoints 2026-04-11 18:08:13 +05:30
app Add multi-branch space state endpoint 2026-04-12 01:58:03 +05:30
config Initial public release 2026-03-22 13:48:50 +05:30
tests Add multi-branch space state endpoint 2026-04-12 01:58:03 +05:30
alembic.ini Initial public release 2026-03-22 13:48:50 +05:30
Dockerfile Initial public release 2026-03-22 13:48:50 +05:30
pyproject.toml Initial public release 2026-03-22 13:48:50 +05:30