Migrate to Peer Paradigm (#131)
* Initial Model Changes
* fix migration
* update schemas
* handle router changes
* make name FK and corresponding crud changes
* fix routers
* comment metamessage references
* add bulk peer session operations
* update messages router
* fix require_auth to make app runnable
* remove peer from get messages
* add new routes
* implement new crud methods for session peers
* alter keys router
* add feature flags dict and token limit + fix SessionContext
* fix: paginate get_session_peers and make tokens/summary query params in get_session_context
* feat: add create_messages_for_peer, get_messages_for_peer
* fix: make session_peers a Table
* finalize upgrade
* fix: working migration
* fixes: schemas, crud, routes
* add token count
* fix migration errors discovered from db with data in it
* fixes: unify with sdk
* downgrade
* feat: swap jwts to new paradigm
* fix unit tests
* fix tests pt 2
* fix: handle foreign key errors in create_messages
* fix downgrade
* downgrade queue changes
* feat: add search to resources, make get_messages handle limits, add get_representation to peer
* chore: beef up tests
* fix: move chat and rep params to post body, add target to get_representation
* fix get_user_protected_collection and embedding store
* feat: add peer config to models, crud, schemas, routes
* fix: update tests and fix list(tuple()) to dict()
* add session peer left_at/joined_at and modify enqueue
* [wip]: feat: refactor history to match new paradigm and implement get_context
* fix messages enqueue and test it
* chore: align deriver and new honcho paradigm
* chore: update consumer
* chore: get rid of is_user
* feat: change queue tables to new key strat
* fix: convert queue session_id to str properly
* fix downgrade migration
* feat: re-integrate old deriver
* chore: coderabbit review, lots of small bug fixes
* fix: fix batch migration of messages and token count
* fix: mock ModelClient
* CodeRabbit comments
* CR comments 2
* fix: handle metadata and feature flags properly in get_or_creates
* cr comments 3
* feature flag to configuration
* feat: add real get crud
* fix: remove reverse param from places it does not belong
* add session.name constraint; narrow task type; disable deriver from configuration
* get_or_add_peers_to_session + session peers limit
* fix: add internal_metadata, fix agent
* fix: move working rep into crud get/set, unstub get_working_representation
* fix: don't payload metadata
* peer protected collection -> global / local rep collections
* fix: remove spurious mockery
* feat: add english language search index
* fix: remove spurious error
* chore: 2.0.0 -- update readme, changelog, claude.md
* chore: update readme for peer paradigm
---------
Co-authored-by: Vineeth Voruganti <13438633+VVoruganti@users.noreply.github.com>
Co-authored-by: Rajat Ahuja <rahuja445@gmail.com>