Commit Graph
3 Commits
Author SHA1 Message Date
huangruitengandhuangruiteng a571010fb3 test: update stats API fixtures for auth plugins (#3208)
Co-authored-by: huangruiteng <huangruiteng@bytedance.com>
2026-07-13 13:52:25 +08:00
MaojiaShengandopenviking ce998873f9 lisence: change the main lisence to AGPL-3.0 (#1085)
* lisence: change the main lisence from Apache-2.0 to AGPL-v3

* lisence: change the main lisence from Apache-2.0 to AGPL-v3

* lisence: change the main lisence from Apache-2.0 to AGPL-v3

---------

Co-authored-by: openviking <openviking@example.com>
2026-03-30 14:37:42 +08:00
a6bc5ea0eb feat(server): add memory health statistics API endpoints (#706)
* feat(server): add memory health statistics API endpoints

Add two new API endpoints for querying aggregate memory health:
- GET /stats/memories - global memory stats (counts by category,
  hotness distribution, staleness metrics)
- GET /stats/sessions/{id} - per-session extraction statistics

The StatsAggregator reads from existing VikingDB indexes and the
hotness_score function without introducing new storage.

Includes unit tests with mocked VikingDB backend.

* feat(parse): implement audio resource parser with Whisper transcription

Replace the audio parser stub with a working implementation that:
- Extracts metadata (duration, sample rate, channels, bitrate) via mutagen
- Transcribes speech via Whisper API with timestamped segments
- Builds structured ResourceNode tree with L0/L1/L2 content tiers
- Falls back to metadata-only output when Whisper is unavailable
- Adds mutagen as optional dependency under [audio] extra
- Adds audio_summary prompt template for semantic indexing
- Includes unit tests with mocked Whisper API and mutagen

* style: format with ruff

* Revert audio parser changes from this branch

The audio parser feature is unrelated to memory health stats and
belongs in its own PR (#707). Reverts audio.py to pre-rewrite state,
removes the unused audio_summary.yaml template and audio parser tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Address review feedback: fix N+1 query, remove total_vectors, fix error handling

- Replace per-category _query_memories_by_category with single
  _query_all_memories call, grouping by category in Python (1 DB
  round-trip instead of 8)
- Remove misleading total_vectors field (was identical to
  total_memories). Will add real vector count from VikingDB index
  stats in a follow-up
- Distinguish KeyError (session not found) from other failures in
  stats.py endpoint, returning INTERNAL_ERROR for unexpected exceptions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(stats): align tests with review feedback changes

- Remove total_vectors assertions (field was removed per review)
- Use KeyError instead of Exception for session-not-found test
- Add test_session_internal_error to verify INTERNAL_ERROR for
  unexpected exceptions (was previously swallowed as NOT_FOUND)

* fix(deps): remove leftover audio optional dependency

The `audio` optional dependency group (`mutagen>=1.47.0`) was left
over from the reverted audio parser commit (898cc8e). It belongs in
#707 with the audio parser feature, not in this stats API PR.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 15:01:15 +08:00