google.adk.apps.compaction._run_compaction_for_sliding_window()
Here is an example with compaction_invocation_threshold = 2 and overlap_size = 1:
compaction_invocation_threshold: The number of *new* user-initiated invocations that, once fully represented in the session's events, will trigger a compaction.
overlap_size: The number of preceding invocations to include from the end of the last compacted range. This creates an overlap between consecutive compacted summaries, maintaining context.
Let's assume events are added for invocation_ids 1, 2, 3, and 4 in order.
invocation_id: 1
invocation_id: 2 (compaction_invocation_thresholdに達した)
The session now contains: [E(inv=1, role=user), E(inv=1, role=model), E(inv=2, role=user), E(inv=2, role=model), E(inv=2, role=user), CompactedEvent(inv=[1, 2])].
invocation_id: 3
invocation_id: 4 (再びcompaction_invocation_thresholdに達した)
The session now contains: [E(inv=1, role=user), E(inv=1, role=model), E(inv=2, role=user), E(inv=2, role=model), E(inv=2, role=user), CompactedEvent(inv=[1, 2]), E(inv=3, role=user), E(inv=3, role=model), E(inv=4, role=user), E(inv=4, role=model), CompactedEvent(inv=[2, 4])].
overlap_size=1なので、invocation_id=2も含む
IMO:EventとCompactedEventが入り混じったsessionはどう使われる?