GCWing / GCWing/OpenBitFun

feat(session): add compact action to session control tool

Ouverte
#2,469 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Rust
Étoiles
2.3k
Forks
231
Merge moyen
2 h 46 min
PR mergées (30 j)
577

Description

## 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)**.

Guide de contribution

Ouvrir le guide de contribution

Piste de recherche

Locate the manual compaction task and ContextCompactionOutcome flow first, then trace SessionControlAction, its string mapping, authorization checks, dispatch, and the tool input schema. Extend the compact path so the applied tokens, ratio, and summary are returned, and run the compact validation tests to confirm self-compaction and owner/creator/ancestor authorization behavior.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
rust
Domaine
backend-api-design, tooling
Type d'issue
Fonctionnalité
Difficulté
4/5
Temps estimé
3-5 jours
Activité
Active
Clarté
Plutôt claire
Accessibilité débutants
68/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.