The agent owns a single instance of the xi-core process. Each session that the agent is managing is backed by a separate view/buffer pair in xi-core. The xi-core process is not exposed to the embedded module directly; the embedded module communicates with the agent, which forwards messages to xi-core:
A ‘session’ can be thought of as an ephemeral document managed by xi_session_agent
. Sessions are created by parent mods, and edited by the embeddable_xi
child mod. A parent can have multiple active sessions, and can change which session is currently associated with a given child by setting the child’s link. (not implemented)
When a parent module wants the user to enter some text, it first calls the NewSession
fidl method. This returns a session identifier; it passes this identifier to the xi_embeddable
module (via its link), and embeds that module as a child. At any point (for instance in response to a button press) it can fetch the contents of the buffer by passing the session identifier to the GetContents
fidl method. When it is finished with the session it can call the CloseSession
fidl method to clean up session state.