KetraTerm
API · DevelopmentAll versions

HostEventSink

interface HostEventSink

Host-facing events emitted while parser commands are mapped to core state.

Hosts receive metadata and decide whether host-side actions can be honored. Grid mutation and terminal modes remain owned by core; session coordinates transport changes and terminal-to-host byte responses.

Parser metadata callbacks are synchronous and ordered on the mutation caller's thread. A TerminalSession holds its mutation lock during delivery. Return promptly; do not mutate the session or wait for a UI thread. Schedule UI work using the product's lifecycle. Direct sinks propagate exceptions to the caller; the PTY convenience bridge isolates and reports listener failures. Read-execution audits may arrive on session workers as documented below. No initial state replay or per-frame delivery is performed.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
abstract fun bell()

Called when the parser emits BEL.

Link copied to clipboard
open fun columnModeChanged(rows: Int, columns: Int)

Reports a completed logical column switch with synchronized core/transport dimensions. Hosts may schedule a physical window resize according to their own permission and layout policy. Called during parsing; do not wait for the EDT or mutate the grid.

Link copied to clipboard

Called after a valid OSC 7 current-working-directory URI is accepted.

Link copied to clipboard
open fun deminimizeWindow()

Called when the shell requests deminimizing (restoring) the window.

Link copied to clipboard
open fun hyperlinkRegistered(hyperlinkId: Int, uri: String, id: String?)

Called after a new OSC 8 registry entry is accepted. hyperlinkId is a positive session-local numeric identity; id is the optional application ID. Reusing an existing entry emits no registration. No browser action is implied.

Link copied to clipboard
open fun hyperlinkRemoved(hyperlinkId: Int)

Called after LRU eviction makes hyperlinkId unresolvable. Registration of a replacement follows all removals. Lowered limits can evict multiple entries, including when reusing an explicit key without registering a replacement. Numeric IDs are never reassigned. Closing OSC 8 or soft reset does not remove existing registry entries.

Link copied to clipboard

Called after hard reset clears a nonempty registry, instead of per-ID removals.

Link copied to clipboard
abstract fun iconTitleChanged(title: String)

Called after the OSC icon title metadata changes.

Link copied to clipboard
open fun lowerWindow()

Called when the shell requests lowering the window.

Link copied to clipboard
open fun minimizeWindow()

Called when the shell requests minimizing the window.

Link copied to clipboard
open fun moveWindow(x: Int, y: Int)

Called when the shell requests moving the window.

Link copied to clipboard

Called after the effective palette changes through OSC, host theme update, or hard reset. palette is the immutable core-owned value and may be retained. Queries, denied/invalid operations, and equal values do not emit an event.

Link copied to clipboard
open fun raiseWindow()

Called when the shell requests raising the window.

Link copied to clipboard
open fun resizeForColumnMode(rows: Int, columns: Int)

Prepares an 80/132-column switch before the destructive core reset.

Link copied to clipboard
abstract fun resizeWindow(rows: Int, columns: Int)

Called when the shell requests a window resize.

Link copied to clipboard
open fun setMaximized(maximize: Boolean)

Called when the shell requests maximizing or restoring the window.

Link copied to clipboard

Called when an OSC 133 shell integration marker is received.

Link copied to clipboard
open fun showNotification(title: String, body: String, level: NotificationLevel)

Called when the shell requests a desktop notification.

Link copied to clipboard

Called when an OSC 52 clipboard write request requires product-host user approval and has been decoded to text.

Link copied to clipboard

Content-free execution audit. Unlike parser metadata, this callback can arrive on a session worker; it must be thread-safe and return promptly. Do not reenter session mutation or wait for a UI thread from this callback. Never infer execution from the earlier admission decision alone.

Link copied to clipboard

Admits a validated read for session execution, including read denial when terminal replies are permitted. Direct adapter embedders own the response. This synchronous callback must not access the clipboard or wait for consent.

Link copied to clipboard

Called after an OSC 52 terminal clipboard request is evaluated by host policy.

Link copied to clipboard

Called when an OSC 52 clipboard write request has been allowed by host policy and decoded to text.

Link copied to clipboard
abstract fun windowTitleChanged(title: String)

Called after the OSC window title metadata changes.