Riapplica la fase 5 di aKode (86e7c72e) sulla base ripulita:
- crate codex-* -> akode-*, codex-rs -> akode-rs, codex-cli -> akode-cli, binario e ausiliari akode;
- ~/.codex -> ~/.akode, CODEX_HOME -> AKODE_HOME, variabili CODEX_* -> AKODE_*, .codex/ -> .akode/ di progetto;
nessun fallback a ~/.codex o a CODEX_*;
- testi per l'utente "Codex" -> "aKode"; testi verso il modello e istruzioni di sistema invariati;
- snapshot insta rinominati (non ancora rigenerati).
I conflitti con la base ripulita sono stati risolti riapplicando la rinomina ai file senza le
funzioni di imeAI (script di mappa dei token per file).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
37 lines
1.1 KiB
Rust
37 lines
1.1 KiB
Rust
/// Incremental parser result for one pushed chunk (or final flush).
|
|
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
pub struct StreamTextChunk<T> {
|
|
/// Text safe to render immediately.
|
|
pub visible_text: String,
|
|
/// Hidden payloads extracted from the chunk.
|
|
pub extracted: Vec<T>,
|
|
}
|
|
|
|
impl<T> Default for StreamTextChunk<T> {
|
|
fn default() -> Self {
|
|
Self {
|
|
visible_text: String::new(),
|
|
extracted: Vec::new(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl<T> StreamTextChunk<T> {
|
|
/// Returns true when no visible text or extracted payloads were produced.
|
|
pub fn is_empty(&self) -> bool {
|
|
self.visible_text.is_empty() && self.extracted.is_empty()
|
|
}
|
|
}
|
|
|
|
/// Trait for parsers that consume streamed text and emit visible text plus extracted payloads.
|
|
pub trait StreamTextParser {
|
|
/// Payload extracted by this parser (for example a citation body).
|
|
type Extracted;
|
|
|
|
/// Feed a new text chunk.
|
|
fn push_str(&mut self, chunk: &str) -> StreamTextChunk<Self::Extracted>;
|
|
|
|
/// Flush any buffered state at end-of-stream (or end-of-item).
|
|
fn finish(&mut self) -> StreamTextChunk<Self::Extracted>;
|
|
}
|