Docs · API reference · Verso.Abstractions

IExecutionContext Interface#

Context provided to language kernels during cell code execution. Extends IVersoContext with execution-specific state.

public interface IExecutionContext : Verso.Abstractions.IVersoContext

Implements IVersoContext

Properties#

CellId Property#

Gets the unique identifier of the cell being executed.

System.Guid CellId { get; }

Property Value#

System.Guid

ExecutionCount Property#

Gets the monotonically increasing execution counter for the current cell.

int ExecutionCount { get; }

Property Value#

System.Int32

Methods#

DisplayAsync(CellOutput) Method#

Sends a display output that can be updated in place during execution.

System.Threading.Tasks.Task DisplayAsync(Verso.Abstractions.CellOutput output);

Parameters#

output CellOutput

The cell output to display.

Returns#

System.Threading.Tasks.Task
A task that completes when the output has been displayed.

RequestInputAsync(string, bool, CancellationToken) Method#

Requests a single line of user input from the current front-end.

System.Threading.Tasks.Task<string?> RequestInputAsync(string prompt, bool isPassword=false, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

Parameters#

prompt System.String

Prompt text shown to the user.

isPassword System.Boolean

Whether the input should be masked.

cancellationToken System.Threading.CancellationToken

Cancellation token for the pending input request.

Returns#

System.Threading.Tasks.Task<System.String>
The entered value, or null when the user cancels the prompt.

TryFormatAsync(object, IReadOnlyList<string>) Method#

Attempts to format a runtime value with a registered specialized data formatter. Returns null when no formatter claims the value so the language kernel can preserve its native formatting behavior.

System.Threading.Tasks.Task<Verso.Abstractions.CellOutput?> TryFormatAsync(object value, System.Collections.Generic.IReadOnlyList<string>? acceptableMimeTypes=null);

Parameters#

value System.Object

The runtime value to format.

acceptableMimeTypes System.Collections.Generic.IReadOnlyList<System.String>

Optional MIME types the host can render, in descending order of preference.

Returns#

System.Threading.Tasks.Task<CellOutput>