EveSession
NexusLabs.Eve¶
EveSession Class¶
Tracks one eve conversation's continuation token, session identifier, and stream cursor.
Inheritance System.Object → EveSession
Properties¶
EveSession.State Property¶
Gets the current serializable session cursor. Consume a response stream before persisting a fully advanced cursor.
Property Value¶
Methods¶
EveSession.CancelAsync(string, CancellationToken) Method¶
Requests cooperative cancellation of the active turn with an optional turn guard. Continue consuming the turn stream to observe its terminal boundary.
public System.Threading.Tasks.Task<NexusLabs.Eve.EveCancellationOutcome> CancelAsync(string? turnId, System.Threading.CancellationToken cancellationToken);
Parameters¶
turnId System.String
An optional guard that limits cancellation to the observed turn identifier.
cancellationToken System.Threading.CancellationToken
Cancels the cancellation request.
Returns¶
System.Threading.Tasks.Task<EveCancellationOutcome>
The successful cancellation disposition.
EveSession.CancelAsync(CancellationToken) Method¶
Requests cooperative cancellation of the active turn. Continue consuming the turn stream to observe its terminal boundary.
public System.Threading.Tasks.Task<NexusLabs.Eve.EveCancellationOutcome> CancelAsync(System.Threading.CancellationToken cancellationToken);
Parameters¶
cancellationToken System.Threading.CancellationToken
Cancels the cancellation request.
Returns¶
System.Threading.Tasks.Task<EveCancellationOutcome>
The successful cancellation disposition.
EveSession.ClearAsync(CancellationToken) Method¶
Queues clearing of this session's durable model-message history while preserving the session identity, configuration, non-message state, limits, continuation token, and sandbox.
public System.Threading.Tasks.Task<NexusLabs.Eve.EveClearOutcome> ClearAsync(System.Threading.CancellationToken cancellationToken);
Parameters¶
cancellationToken System.Threading.CancellationToken
Cancels the clear request.
Returns¶
System.Threading.Tasks.Task<EveClearOutcome>
The successful clear disposition.
Exceptions¶
System.InvalidOperationException
The session has an identifier but no continuation token, so its outstanding event stream
must be consumed before clearing.
EveClientException
The server returned a non-successful status.
EveProtocolException
The body was not a recognized clear payload.
Remarks¶
The clear is asynchronous on the durable stream. Consume events through ContextCleared and the following SessionWaiting boundary before sending another turn. Clearing a session that never started is a successful local no-op that issues no HTTP request. Unlike ResetAsync(CancellationToken), a successful clear leaves the local cursor unchanged.
EveSession.CompactAsync(CancellationToken) Method¶
Queues context compaction for the durable session that owns this handle's continuation token without sending model input.
public System.Threading.Tasks.Task<NexusLabs.Eve.EveCompactOutcome> CompactAsync(System.Threading.CancellationToken cancellationToken);
Parameters¶
cancellationToken System.Threading.CancellationToken
Cancels the compaction request.
Returns¶
System.Threading.Tasks.Task<EveCompactOutcome>
The successful compaction disposition.
Exceptions¶
System.InvalidOperationException
The session has an identifier but no continuation token, so its outstanding event stream
must be consumed before compacting.
EveClientException
The server returned a non-successful status.
EveProtocolException
The body was not a recognized compaction payload.
Remarks¶
Compaction is asynchronous. Consume the durable event stream through its next session
boundary before sending another turn; compaction.completed confirms that
summarization succeeded. Compacting a session that never started is a successful local
no-op that issues no HTTP request. Unlike ResetAsync(CancellationToken),
compaction preserves the local session cursor.
EveSession.ResetAsync(CancellationToken) Method¶
Terminally retires the durable session that owns this handle's continuation token.
public System.Threading.Tasks.Task<NexusLabs.Eve.EveResetOutcome> ResetAsync(System.Threading.CancellationToken cancellationToken);
Parameters¶
cancellationToken System.Threading.CancellationToken
Cancels the reset request.
Returns¶
System.Threading.Tasks.Task<EveResetOutcome>
The successful reset disposition.
Exceptions¶
System.InvalidOperationException
The session has an identifier but no continuation token, so its outstanding event stream
must be consumed before resetting.
EveClientException
The server returned a non-successful status.
EveProtocolException
The body was not a recognized reset payload.
Remarks¶
Unlike CancelAsync(CancellationToken), which only requests cancellation of the active turn, reset releases the durable session so the next send starts a fresh conversation. Resetting a session that never started is a successful local no-op that issues no HTTP request. After a successful reset the local state is empty.
EveSession.SendAsync(EveSendTurnRequest, CancellationToken) Method¶
Sends a full user turn, including attachments, input responses, context, or output schema.
public System.Threading.Tasks.Task<NexusLabs.Eve.EveMessageResponse> SendAsync(NexusLabs.Eve.EveSendTurnRequest request, System.Threading.CancellationToken cancellationToken);
Parameters¶
request EveSendTurnRequest
The turn payload.
cancellationToken System.Threading.CancellationToken
Cancels the POST and subsequent response stream.
Returns¶
System.Threading.Tasks.Task<EveMessageResponse>
Accepted turn metadata and its single-use event stream.
EveSession.SendAsync(string, CancellationToken) Method¶
Sends a plain-text user turn.
public System.Threading.Tasks.Task<NexusLabs.Eve.EveMessageResponse> SendAsync(string message, System.Threading.CancellationToken cancellationToken);
Parameters¶
message System.String
The user message.
cancellationToken System.Threading.CancellationToken
Cancels the POST and subsequent response stream.
Returns¶
System.Threading.Tasks.Task<EveMessageResponse>
Accepted turn metadata and its single-use event stream.
EveSession.StreamAsync(EveStreamOptions, CancellationToken) Method¶
Attaches to the existing session stream from the stored or overridden cursor. Unlike a sent-turn response, this stream remains boundary-blind.
public System.Collections.Generic.IAsyncEnumerable<NexusLabs.Eve.EveStreamEvent> StreamAsync(NexusLabs.Eve.EveStreamOptions? options, System.Threading.CancellationToken cancellationToken);
Parameters¶
options EveStreamOptions
Optional cursor, bound, and reconnect overrides.
cancellationToken System.Threading.CancellationToken
Stops local stream consumption.
Returns¶
System.Collections.Generic.IAsyncEnumerable<EveStreamEvent>
The durable session event stream.
Exceptions¶
System.InvalidOperationException
The session has no identifier because no message has been sent yet.
System.ArgumentOutOfRangeException
A bounded read was requested with a negative effective start cursor, which cannot be
bounded because its absolute position is unknown.
EveProtocolException
A bounded read did not receive a valid durable tail index from the server.
Remarks¶
The stream follows live events by default. Set Follow to false for a bounded catch-up read that completes once the cursor passes the durable tail observed when the stream opened. The stored cursor advances past every consumed event in both modes.
EveSession.StreamAsync(CancellationToken) Method¶
Attaches to the existing session stream from the stored or overridden cursor. Unlike a sent-turn response, this stream remains boundary-blind.
public System.Collections.Generic.IAsyncEnumerable<NexusLabs.Eve.EveStreamEvent> StreamAsync(System.Threading.CancellationToken cancellationToken);
Parameters¶
cancellationToken System.Threading.CancellationToken
Stops local stream consumption.
Returns¶
System.Collections.Generic.IAsyncEnumerable<EveStreamEvent>
The durable session event stream.