diff --git a/docs/api.md b/docs/api.md index 0aeaa1a..751fc49 100644 --- a/docs/api.md +++ b/docs/api.md @@ -685,22 +685,36 @@ #### `GET /admin/sessions` -All sessions across all users. +All sessions across all users. Supports pagination, search, and sorting. + +**Query params** +| Param | Default | Description | +|---|---|---| +| `limit` | `50` | Page size | +| `offset` | `0` | Items to skip | +| `search` | — | Filter by session_id, name, user_id or profile_id (case-insensitive) | +| `sort_by` | `last_active` | `last_active`, `created_at`, `name`, `profile_id`, `user_id`, `pinned` | +| `sort_order` | `desc` | `asc` or `desc` | **Response `200`** ```json -[ - { - "session_id": "...", - "profile_id": "secretary", - "user_id": "user-uuid", - "name": "Research task", - "message_count": 12, - "pinned": false, - "created_at": "2026-05-04T10:00:00+00:00", - "last_active": "2026-05-04T10:30:00+00:00" - } -] +{ + "total": 128, + "limit": 50, + "offset": 0, + "items": [ + { + "session_id": "...", + "profile_id": "secretary", + "user_id": "user-uuid", + "name": "Research task", + "message_count": 12, + "pinned": false, + "created_at": "2026-05-04T10:00:00+00:00", + "last_active": "2026-05-04T10:30:00+00:00" + } + ] +} ``` --- @@ -728,11 +742,35 @@ #### `GET /admin/memory` -All memory facts (global view). Requires `navi.memory.read_all`. +All memory facts (global view). Requires `navi.memory.read_all`. Supports pagination, search, and sorting. + +**Query params** +| Param | Default | Description | +|---|---|---| +| `limit` | `50` | Page size | +| `offset` | `0` | Items to skip | +| `search` | — | Filter by key, value or category (case-insensitive) | +| `sort_by` | `updated_at` | `updated_at`, `category`, `key`, `confidence`, `source` | +| `sort_order` | `desc` | `asc` or `desc` | **Response `200`** ```json -{ "facts": [...], "count": 42 } +{ + "total": 128, + "limit": 50, + "offset": 0, + "items": [ + { + "id": "...", + "category": "profile", + "key": "name", + "value": "Eugene", + "source": "conversation", + "confidence": 90, + "updated_at": "2026-05-04T10:00:00+00:00" + } + ] +} ``` --- diff --git a/docs/memory.md b/docs/memory.md index b16f9db..265e581 100644 --- a/docs/memory.md +++ b/docs/memory.md @@ -92,7 +92,7 @@ | `upsert_fact(..., user_id=None)` | Insert or update a fact scoped to user | | `search_facts(query, limit=15, user_id=None)` | **Vector search first** (cosine distance, cutoff 0.3), then ILIKE fallback. `user_id=None` requires admin permission for global search. | | `delete_fact(key, category=None, user_id=None)` | Delete by key, optionally filtered by category and user | -| `get_all_facts(limit=None, user_id=None)` | All facts ordered by `(category, updated_at DESC)` | +| `get_all_facts(limit=None, offset=0, search=None, sort_by="category", sort_order="desc", user_id=None, all_users=False)` | All facts ordered by `sort_by`. Pass `all_users=True` for admin global view. | | `get_summary(user_id=None)` | Current narrative summary text for user | | `set_summary(content, user_id=None)` | Replace the summary for user | | `mark_session_extracted(session_id)` | Record extraction timestamp | diff --git a/docs/sessions.md b/docs/sessions.md index bfd460e..7ddfbc4 100644 --- a/docs/sessions.md +++ b/docs/sessions.md @@ -55,6 +55,8 @@ - `get(session_id)` → `Session | None` - `save(session)` — serializes with `model_dump(mode='json')` (required for datetime serialization) - `list_all(user_id=None, is_admin=False)` → if `is_admin`: all sessions; else: sessions for `user_id` or legacy (`user_id IS NULL`) sessions +- `count_all(user_id=None, is_admin=False, search=None)` → total matching sessions +- `search_list(limit, offset, user_id=None, is_admin=False, search=None, sort_by="last_active", sort_order="desc")` → paginated, filtered, sorted sessions - `delete(session_id)` → `bool` - `set_pinned(session_id, pinned)` → `bool` - `set_name(session_id, name)` → `bool`