@jataware/beaker-client
    Preparing search index...

    Class BeakerSession

    Main class for connecting to and working with a Beaker kernel.

    Index
    notebook: BeakerNotebook
    • get kernel(): IKernelConnection | null

      A reference to the Jupyter KernelConnection object for this session.

      Returns IKernelConnection | null

    • get prevClientId(): string | undefined

      Returns string | undefined

    • get services(): ServiceManager

      A reference to the Jupyter ServiceManager which contains all of the services for this session.

      Returns ServiceManager

    • get session(): SessionContext

      A reference to the underlying Jupyter SessionContext for this Beaker Session.

      Returns SessionContext

    • get sessionReady(): Promise<void>

      A promise that resolves once everything the session requires are also ready.

      Returns Promise<void>

    • Parameters

      • source: string

        The code contents of the cell.

      • metadata: {} = {}

        (Optional) Any metadata to be associated with the cell.

      • outputs: never[] = []

        (Optional) Any outputs that should be included/displayed.

      Returns BeakerCodeCell

      • A reference to the generated cell
    • Convenience method for adding a MarkdownCell to the notebook

      Parameters

      • source: string

        The raw markdown encoded text that should be rendered upon execute

      • metadata: {} = {}

        (Optional) Any metadata to be associated with the cell.

      Returns BeakerMarkdownCell

      • A reference to the generated cell
    • Convenience method for adding a QueryCell to the notebook

      Parameters

      • source: string

        The contents of the query for the LLM as a plain string

      • metadata: {} = {}

        (Optional) Any metadata to be associated with the cell.

      • sessionAttachments: ISessionAttachment[] = []

      Returns BeakerQueryCell

      • A reference to the generated cell
    • Convenience method for adding a RawCell to the notebook

      Parameters

      • source: string

        The raw contents to be included in the raw cell.

      • metadata: {} = {}

        (Optional) Any metadata to be associated with the cell.

      Returns BeakerRawCell

      • A reference to the generated cell
    • Executes a Beaker Action, handling all of the message

      The usual IBeakerFuture response handlers can be applied to the returned future to do act upon the responses.

      Parameters

      • actionName: string

        Name of the action to execute

      • payload: JSONObject

        Payload to pass along with the action

      • OptionalmessageId: string

        (Optional) Id for request message. If not provided, will be generated automatically.

      Returns IBeakerFuture

      • A future
    • Interrupt the kernel activity, stopping execution in both the beaker LLM ReAct loop and the subkernel as needed. See

      Returns Promise<any>

      • A future
    • Populates the sessions notebook with the provided notebook json

      Parameters

      • notebookJSONObject: BeakerNotebookContent

        The json representation of a notebook, as found inside an .ipynb file

      Returns Promise<void>

    • Low-level method for reconnecting to the kernel.

      Returns Promise<SessionContext>

    • Completely resets the session, clearing the notebook and history, and restarting the fresh kernel so it is in a fresh state.

      Returns void

    • Low-level method for sending a message to the Beaker kernel over the "shell" channel.

      Parameters

      • messageType: string

        The message type, as passed in msg.header.msg_type

      • content: JSONObject

        Any JSON-encodable payload to be included with the message

      • OptionalmessageId: string

        (Optional) Pre-defined id for the message. One will be generated if not provided.

      • Optionalmetadata: { [key: string]: any }

      Returns IBeakerFuture

    • Serializes the full session notebook document for persistence, embedding the current chat history under metadata.beaker.chat_history.

      This is the session-level counterpart to BeakerNotebook.toIPynb. The notebook itself is intentionally unaware of the chat history, so the session — which owns both the notebook and the history — is responsible for assembling the complete document. The returned object is a fresh copy so injecting the history does not mutate the live notebook metadata.

      Returns INotebookContent