Skip to content

EveSession

NexusLabs.Eve

EveSession Class

Tracks one eve conversation's immutable session identifier and stream cursor.

public sealed class EveSession

Inheritance System.Object → EveSession

Remarks

The handle is fixed. Once a turn assigns a session identifier, that identifier is retained for every later turn, control, and stream, including after a terminal session boundary. Start a separate conversation with CreateSession() instead of reusing a retired handle.

Properties

EveSession.State Property

Gets the current serializable session cursor. Consume a response stream before persisting a fully advanced cursor.

public NexusLabs.Eve.EveSessionState State { get; }

Property Value

EveSessionState

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

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

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 addressed by this handle.

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

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. The handle keeps its immutable session identifier, so it does not recycle into a new conversation; obtain a fresh handle from CreateSession() to start one. Resetting a session that never started is a successful local no-op that issues no HTTP request.

EveSession.RespondAsync(IReadOnlyList\<EveInputResponse>, EveTurnOptions, CancellationToken) Method

Resolves pending human-input requests with context, headers, or a reconnect policy.

public System.Threading.Tasks.Task<NexusLabs.Eve.EveMessageResponse> RespondAsync(System.Collections.Generic.IReadOnlyList<NexusLabs.Eve.EveInputResponse> inputResponses, NexusLabs.Eve.EveTurnOptions? options, System.Threading.CancellationToken cancellationToken);

Parameters

inputResponses System.Collections.Generic.IReadOnlyList<EveInputResponse>

Responses to pending approvals or questions.

options EveTurnOptions

Optional per-turn settings.

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.

Exceptions

System.ArgumentException
No input responses were supplied.

System.InvalidOperationException
The session has not started, so there is no pending input to resolve.

Remarks

eve 0.31.0 requires a turn to carry either a message or input responses, never both. Send a user message with SendAsync(EveMessageContent, EveTurnOptions, CancellationToken).

EveSession.RespondAsync(IReadOnlyList\<EveInputResponse>, CancellationToken) Method

Resolves pending human-input requests without sending a user message.

public System.Threading.Tasks.Task<NexusLabs.Eve.EveMessageResponse> RespondAsync(System.Collections.Generic.IReadOnlyList<NexusLabs.Eve.EveInputResponse> inputResponses, System.Threading.CancellationToken cancellationToken);

Parameters

inputResponses System.Collections.Generic.IReadOnlyList<EveInputResponse>

Responses to pending approvals or questions.

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(EveMessageContent, EveTurnOptions, CancellationToken) Method

Sends a user turn with context, headers, an output schema, or a reconnect policy.

public System.Threading.Tasks.Task<NexusLabs.Eve.EveMessageResponse> SendAsync(NexusLabs.Eve.EveMessageContent message, NexusLabs.Eve.EveTurnOptions? options, System.Threading.CancellationToken cancellationToken);

Parameters

message EveMessageContent

The user message.

options EveTurnOptions

Optional per-turn settings.

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.

Remarks

eve 0.31.0 requires a turn to carry either a message or input responses, never both. Resolve pending human input with RespondAsync(IReadOnlyList<EveInputResponse>, EveTurnOptions, CancellationToken).

EveSession.SendAsync(EveMessageContent, CancellationToken) Method

Sends a user turn carrying attachments or multi-part content.

public System.Threading.Tasks.Task<NexusLabs.Eve.EveMessageResponse> SendAsync(NexusLabs.Eve.EveMessageContent message, System.Threading.CancellationToken cancellationToken);

Parameters

message EveMessageContent

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.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.