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<ContextCompactionOutcome>; 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).
Summary
Add the
compactaction 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
ContextCompactionOutcomethrough the manual compaction task so the finished outcome is returned instead of being discarded.compact_session_with_outcomereturningBitFunResult<ContextCompactionOutcome>;compact_session_manuallydelegates to it for the Desktop compatibility API.SessionControlActionwith aCompactvariant and itsas_strmapping.Compactdispatch to the compact engine and return the applied stats.AI-assisted output. Test extent: 已测 (tested).