pub enum ParseEvent {
Show 13 variants
StreamStart {
output_schema_hash: String,
},
FieldStart {
path: String,
field_type: FieldType,
},
ValueAppend {
path: String,
delta: String,
},
ValueSet {
path: String,
value: FieldValue,
},
ListOpen {
path: String,
},
ElementAdded {
path: String,
index: usize,
value: FieldValue,
},
ListClose {
path: String,
value: FieldValue,
},
ObjectOpen {
path: String,
},
EntryAdded {
path: String,
key: String,
value: FieldValue,
},
ObjectClose {
path: String,
value: FieldValue,
},
FieldComplete {
path: String,
value: FieldValue,
},
StreamComplete {
output: FieldValue,
},
StreamError {
path: Option<String>,
message: String,
},
}Expand description
One event produced by the streaming parser.
Variants are emitted in the order content arrives from the LM.
Consumers can rebuild the full structured output from the sequence,
OR react to specific events (FieldComplete for “field X is done”,
StreamComplete for “everything is done”, ValueAppend for chat-UI
typing).
Variants§
StreamStart
First event, always. Carries an opaque hash of the output signature so clients can sanity-check they were rendering against the right schema. The full schema is fetched separately via the existing application endpoints (kept out of the stream-start payload to bound the on-open size).
FieldStart
A declared output field’s [[ ## name ## ]] marker arrived.
Path is /<field_name>; field_type is the declared type for
the field so clients know what value-event variants to expect.
ValueAppend
Incremental text content for a FieldType::String field.
delta is the new content since the previous event for this
path; clients concatenate to render progressively (chat-UI
typing). Only emitted for String fields; structured fields
use ElementAdded / EntryAdded instead.
ValueSet
Atomic value emitted when a non-string scalar finishes
parsing (Int, Float, Bool, Enum, Nullable<scalar>).
Reserved for future per-FieldType-variant expansion — not
emitted by the initial-step parser (which supports String
and List<String> only).
ListOpen
A FieldType::List field’s content opened — the LM emitted
[. Path identifies the field; clients can render an empty
list shell before elements arrive.
ElementAdded
One element of a FieldType::List finished parsing.
index is the element’s position in the list; value is its
typed value.
ListClose
A FieldType::List field’s content closed — the LM emitted
]. value is the complete parsed list for clients that
didn’t accumulate from ElementAdded events.
ObjectOpen
A FieldType::Map or FieldType::Object field’s content
opened — the LM emitted {. Reserved for future expansion.
EntryAdded
One key-value pair of a FieldType::Map / FieldType::Object
finished parsing. Reserved for future expansion.
ObjectClose
A FieldType::Map / FieldType::Object field’s content
closed — the LM emitted }. Reserved for future expansion.
FieldComplete
A field’s marker boundary arrived; the prior field is fully
done. Carries the full parsed value for clients that didn’t
accumulate from per-value events. Always emitted at field-
completion, after any ListClose / ObjectClose /
ValueAppend events for the field.
StreamComplete
The [[ ## completed ## ]] sentinel arrived. output is the
full structured output as a FieldValue::Object map of
field-name → field-value, mirroring Adapter::parse.
Fields
output: FieldValueStreamError
Mid-stream parse or deserialization failure. path is the
node where the error occurred (may be None for errors
between fields). Streaming halts after this event; the
consumer returns a non-retryable error.
Implementations§
Source§impl ParseEvent
impl ParseEvent
Sourcepub const fn event_type(&self) -> &'static str
pub const fn event_type(&self) -> &'static str
Stable event-type identifier for wire serialization. Mirrors
the snake-case identifier the streaming consumer uses
when declaring schemas via StreamingEventDef.
Sourcepub const fn is_durable(&self) -> bool
pub const fn is_durable(&self) -> bool
Whether this event variant should be durable (WAL-persisted)
for late-subscriber replay. Boundary events (start / open /
close / complete / error) are durable because they reconstruct
the schema’s structure; per-value events (value_append,
value_set, element_added, entry_added) are volatile —
late subscribers fetch the final structured output via the
existing execution endpoint and only need structural events
for skeleton rendering.