KetraTerm
API · v0.3.0All versions

TerminalCompletionLearningStore

class TerminalCompletionLearningStore @JvmOverloads constructor(capacity: Int = DEFAULT_CAPACITY)

Mutable, bounded in-memory store for exact command completion learning.

Hosts record command lifecycle outcomes and explicit popup feedback. Optional persistence may hydrate the store once through mergeSnapshot and persist snapshot values. The store performs no I/O and does not emit candidates. Mutations are serialized around one mutable exact index. Ranking rows retain only opaque identities; plaintext replay is attached only to successful commands that TerminalCompletionReplayPolicy approves. Published snapshots are immutable and retain identity until their contents change.

Parameters

capacity

maximum distinct exact-command rows retained.

Throws

if capacity is not positive.

Constructors

Link copied to clipboard
constructor(capacity: Int = DEFAULT_CAPACITY)

Functions

Link copied to clipboard
fun clear()

Removes all retained ranking evidence and replay commands.

Link copied to clipboard

Adds distinct aggregate events from snapshot to retained learning.

Link copied to clipboard
fun recordCommandResult(commandLine: String, successful: Boolean, profileId: String?, workingDirectoryUri: String?, usedAtEpochMillis: Long): Boolean

Records a completed command execution.

Link copied to clipboard
fun recordSuggestionFeedback(commandLine: String, feedback: TerminalCompletionFeedbackKind, profileId: String?, workingDirectoryUri: String?, feedbackAtEpochMillis: Long): Boolean

Records explicit user feedback for the exact suggested command.

Link copied to clipboard

Returns the current immutable exact-command statistics snapshot.