Package-level declarations

Types

Link copied to clipboard
data class ApplicationMetadata(val productName: String = "2P-Kt", val version: String = "development", val homepage: String = "https://github.com/tuProlog/2p-kt")

Static, mostly cosmetic facts about the running application (e.g. shown in an "About" dialog).

Link copied to clipboard
data class ApplicationState(val started: Boolean = false, val exitRequested: Boolean = false, val metadata: ApplicationMetadata = ApplicationMetadata())

The part of GuiState describing the application's own lifecycle, independent of any page/workspace.

Link copied to clipboard
data class ConsoleState(val stdin: String = "", val stdout: TextStreamState = TextStreamState(), val stderr: TextStreamState = TextStreamState(), val warnings: WarningStreamState = WarningStreamState())

A page's standard input text plus everything it has produced on stdout/stderr and any warnings raised.

Link copied to clipboard
data class DiagnosticState(val values: List<Diagnostic> = emptyList(), val revision: Long = 0, val seenRevision: Long = 0)

A page's accumulated diagnostics from every source (syntax, solver, ...), each independently replaceable via replaceSource, plus an unread-changes counter for a lower-tab badge.

Link copied to clipboard
data class DocumentOrigin(val providerId: String, val opaqueReference: String, val displayName: String)

Where a document came from/should be saved to, in a way no toolkit-neutral code needs to interpret - only the frontend that registered providerId knows how to read/write opaqueReference.

Link copied to clipboard
data class DocumentState(val id: DocumentId, val displayName: String, val text: String = "", val origin: DocumentOrigin? = null, val revision: Long = 0, val persistedRevision: Long = 0)

One open document's content and save status, independent of which page(s) reference it.

Link copied to clipboard
data class EffectivePageConfiguration(val solverProfileId: SolverProfileId, val timeout: Duration, val options: Map<String, String>)

A page's actually-effective solver profile/timeout/options, after applying its own overrides on top of the workspace-wide defaults - see resolve.

Link copied to clipboard
sealed interface FeatureValue

A JSON-like value an extension's feature (e.g. PLP's BDD/probability) attaches to a page, keyed by name in PageFeatureState - toolkit-neutral so any frontend can render it without knowing the extension's own types.

Link copied to clipboard
data class GuiState(val application: ApplicationState, val workspace: WorkspaceState)

The entire observable state of a GuiController at one point in time - what GuiModel.state holds.

Link copied to clipboard
data class PageConfiguration(val solverProfileOverride: SolverProfileId? = null, val timeoutOverride: Duration? = null, val optionOverrides: Map<String, String> = emptyMap())

A page's own overrides on top of the workspace-wide WorkspaceConfiguration - null/absent fields fall back to the workspace default (see WorkspaceConfiguration.resolve).

Link copied to clipboard
sealed interface PageContent

What a page actually edits: either a shared, independently-persisted document, or throwaway scratch text local to the page itself.

Link copied to clipboard
data class PageFeatureState(val values: Map<String, FeatureValue> = emptyMap(), val revision: Long = 0)

One extension feature's current values for a page (e.g. PLP's BDD/probability), plus a revision counter for unread-changes tracking.

Link copied to clipboard
data class PageHistoryState(val resolutions: List<ResolutionHistoryEntry> = emptyList(), val capacity: Int = 100)

A page's bounded history of concluded resolutions - what its Solutions tree/panel renders.

Link copied to clipboard
data class PageState(val id: PageId, val title: String, val content: PageContent, val query: QueryState = QueryState(), val configuration: PageConfiguration = PageConfiguration(), val solverSession: SolverSessionState = SolverSessionState(), val resolution: ResolutionState = ResolutionState(), val history: PageHistoryState = PageHistoryState(), val console: ConsoleState = ConsoleState(), val diagnostics: DiagnosticState = DiagnosticState(), val semanticTokens: List<SemanticToken> = emptyList(), val features: Map<FeatureId, PageFeatureState> = emptyMap())

One page's entire state: what it edits/queries, its solver session, resolution/history, console, diagnostics, highlighting, and per-extension feature state.

Link copied to clipboard

One of a page's lower-tab panels, e.g. for tracking per-panel unread-changes badges.

Link copied to clipboard
data class QueryHistoryState(val entries: List<String> = emptyList(), val capacity: Int = 100)

A page's bounded, de-duplicated (consecutive-only) history of submitted queries - what its Up/Down query-history navigation steps through.

Link copied to clipboard
data class QueryState(val text: String = "", val history: QueryHistoryState = QueryHistoryState())

A page's current query text plus its submission history.

Link copied to clipboard
data class ResolutionHistoryEntry(val query: String, val solutions: List<SolutionPresentation>, val terminalStatus: ResolutionStatus, val error: String? = null)

One concluded resolution recorded in a page's history: the query it ran, every solution it yielded, and how it ended.

Link copied to clipboard
data class ResolutionState(val status: ResolutionStatus = ResolutionStatus.IDLE, val id: ResolutionSessionId? = null, val query: String? = null, val solutions: List<SolutionPresentation> = emptyList(), val error: String? = null, val revision: Long = 0, val seenRevision: Long = 0)

A page's current (in-progress or just-concluded) resolution: its status, solutions so far, and whether the Solutions panel has unread changes.

Link copied to clipboard

The lifecycle of one page's resolution.

Link copied to clipboard

How up-to-date a page's solver session is with respect to its source/configuration.

Link copied to clipboard
data class SolverSessionState(val lifecycle: SolverSessionLifecycle = SolverSessionLifecycle.ABSENT, val sessionId: SolverSessionId? = null, val profileId: SolverProfileId? = null, val loadedDocumentRevision: Long? = null, val capabilities: SolverCapabilities = SolverCapabilities.EMPTY, val inspection: SolverInspectionSnapshot = SolverInspectionSnapshot(), val error: String? = null)

A page's view of its own solver session: whether/how it's built, what it supports, and its latest inspectable snapshot.

Link copied to clipboard
data class TextStreamState(val text: String = "", val revision: Long = 0, val seenRevision: Long = 0)

An append-only text stream (stdout/stderr) with an unread-changes counter for a lower-tab badge.

Link copied to clipboard
data class WarningStreamState(val values: List<WarningPresentation> = emptyList(), val revision: Long = 0, val seenRevision: Long = 0)

An append-only list of solver warnings with an unread-changes counter for a lower-tab badge.

Link copied to clipboard
data class WorkspaceConfiguration(val defaultSolverProfileId: SolverProfileId, val defaultTimeout: Duration = 5.seconds, val defaultOptions: Map<String, String> = emptyMap(), val schedulingPolicy: ResolutionSchedulingPolicy = ResolutionSchedulingPolicy.PER_PAGE_CONCURRENT)

Workspace-wide defaults every page inherits unless it overrides them via its own PageConfiguration.

Link copied to clipboard
data class WorkspaceState(val documents: Map<DocumentId, DocumentState> = emptyMap(), val pages: List<PageState> = emptyList(), val selectedPageId: PageId? = null, val configuration: WorkspaceConfiguration)

Every open document and page, which one is selected, and the workspace-wide configuration - invariants (every page's document exists, the selected page exists) are enforced in the init block below.

Functions

Link copied to clipboard

Merges page's per-page overrides on top of this workspace-wide configuration.