Transcript Compaction Renderer (src/lib.rs)

grok-build · crates/codegen/xai-compaction-transcript/src/lib.rs · rust · Apache-2.0
files, ai, voice, ui, lang:rust, tag:markdown, tag:compaction

Pure Rust rendering of compacted conversation segments into markdown, including stats blocks, keyword extraction, and incremental index rows. Reuse for transcript compaction output without I/O.

// Source: https://github.com/xai-org/grok-build | License: Apache-2.0 | Copyright 2023-2026 SpaceXAI
// Provided via justclaw.it.com; keep this notice with the code.
//! Pure rendering of a compacted segment into self-contained markdown, aligned
//! with the Python compaction implementation (`render_segment_to_markdown` /
//! `compute_turn_stats`; INDEX built incrementally via [`INDEX_HEADER`] +
//! [`render_index_row`]). No I/O.
//! Not byte-identical — the data models differ (Python `Turn`/channels vs our
//! [`ConversationItem`]) — but headers, sections, detail levels, and INDEX
//! columns match.

#![deny(clippy::indexing_slicing)]

use std::sync::OnceLock;

use regex::Regex;
use xai_grok_sampling_types::ConversationItem;

/// Layout of the per-session segment store — single source of

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key