feat(session): add compact action to session control tool
- Ngôn ngữ chính
- Rust
- Star
- 2.3k
- Fork
- 231
- Merge trung bình
- 2 giờ 49 phút
- Pull request đã merge (30 ngày)
- 589
Mô tả
## Summary
Add the `compact` action to the session control tool family so a caller can compact a session context to reduce its token footprint and surface the applied compaction statistics (tokens/ratio/summary).
## Plan
- Thread `ContextCompactionOutcome` through the manual compaction task so the finished outcome is returned instead of being discarded.
- Add `compact_session_with_outcome` returning `BitFunResult`; `compact_session_manually` delegates to it for the Desktop compatibility API.
- Extend `SessionControlAction` with a `Compact` variant and its `as_str` mapping.
- Allow compacting the caller's own session (the sole self-mutation exception) while keeping owner/creator/ancestor authorization inline.
- Wire the `Compact` dispatch to the compact engine and return the applied stats.
- Extend the tool input schema/description and add compact validation tests.
AI-assisted output. Test extent: **已测 (tested)**.
Hướng dẫn đóng góp
Hướng nghiên cứu
Trước tiên, hãy xác định tác vụ compact thủ công và luồng ContextCompactionOutcome, sau đó lần theo SessionControlAction, ánh xạ chuỗi của nó, các bước kiểm tra ủy quyền, việc dispatch và schema đầu vào của tool. Mở rộng đường compact để trả về số token đã áp dụng, tỷ lệ và bản tóm tắt, rồi chạy các bài kiểm tra xác thực compact để xác nhận hành vi ủy quyền đối với self-compaction và owner/creator/ancestor.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- rust
- Lĩnh vực
- backend-api-design, tooling
- Loại issue
- Tính năng
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Sôi nổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 68/100