:class:WindowedSummary with sender labels on non-self lines.
The default view for the discussion and workflow adapters. Same bounded-tail-plus-compaction behaviour as :class:WindowedSummary; non-self projections are prefixed [<sender name>]: so the manager / next speaker can tell who just spoke. The head :class:CompactionSummary for elided envelopes also lists speakers by name rather than by raw id.
Source code in autogen/beta/network/views/builtin.py
| def __init__(self, recent_n: int) -> None:
if recent_n < 1:
raise ValueError(f"recent_n must be >= 1, got {recent_n}")
self._recent_n = recent_n
|
name class-attribute instance-attribute
name = 'named_windowed_summary'
project async
Source code in autogen/beta/network/views/builtin.py
| async def project(
self,
wal: list[Envelope],
*,
participant_id: str,
channel: ChannelMetadata,
render_envelope: EnvelopeRenderer,
name_for: NameResolver = default_name_resolver,
) -> list[BaseEvent]:
visible: list[tuple[Envelope, str]] = []
for envelope in wal:
if not visible_to(envelope, participant_id):
continue
text = render_envelope(envelope)
if text is None:
continue
visible.append((envelope, text))
if len(visible) <= self._recent_n:
return [_to_named_event(env, txt, participant_id, name_for) for env, txt in visible]
cutoff = len(visible) - self._recent_n
older = visible[:cutoff]
recent = visible[cutoff:]
summary = _summarize_older([env for env, _ in older], name_for=name_for)
compaction = CompactionSummary(summary=summary, event_count=len(older))
return [
compaction,
*(_to_named_event(env, txt, participant_id, name_for) for env, txt in recent),
]
|