Skip to main content

Crate ftui_runtime

Crate ftui_runtime 

Source
Expand description

FrankenTUI Runtime

This crate provides the runtime components that tie together the core, render, and layout crates into a complete terminal application framework.

§Key Components

  • TerminalWriter - Unified terminal output coordinator with inline mode support
  • LogSink - Line-buffered writer for sanitized log output
  • Program - Bubbletea/Elm-style runtime for terminal applications
  • Model - Trait for application state and behavior
  • Cmd - Commands for side effects
  • Subscription - Trait for continuous event sources
  • Every - Built-in tick subscription

§Role in FrankenTUI

ftui-runtime is the orchestrator. It consumes input events from ftui-core, drives your Model::update, calls Model::view to render frames, and delegates rendering to ftui-render via TerminalWriter.

§How it fits in the system

The runtime is the center of the architecture: it is the bridge between input (ftui-core) and output (ftui-render). Widgets and layout are optional layers used by your view() to construct UI output.

Re-exports§

pub use asciicast::AsciicastRecorder;
pub use asciicast::AsciicastWriter;
pub use cancellation::CancellationSource;
pub use cancellation::CancellationToken;
pub use diff_evidence::DiffEvidenceLedger;
pub use diff_evidence::DiffRegime;
pub use diff_evidence::DiffStrategyRecord;
pub use diff_evidence::Observation;
pub use diff_evidence::RegimeTransition;
pub use evidence_sink::EvidenceSink;
pub use evidence_sink::EvidenceSinkConfig;
pub use evidence_sink::EvidenceSinkDestination;
pub use evidence_telemetry::BudgetDecisionSnapshot;
pub use evidence_telemetry::ConformalSnapshot;
pub use evidence_telemetry::DiffDecisionSnapshot;
pub use evidence_telemetry::ResizeDecisionSnapshot;
pub use evidence_telemetry::budget_snapshot;
pub use evidence_telemetry::clear_budget_snapshot;
pub use evidence_telemetry::clear_diff_snapshot;
pub use evidence_telemetry::clear_resize_snapshot;
pub use evidence_telemetry::diff_snapshot;
pub use evidence_telemetry::resize_snapshot;
pub use evidence_telemetry::set_budget_snapshot;
pub use evidence_telemetry::set_diff_snapshot;
pub use evidence_telemetry::set_resize_snapshot;
pub use input_macro::EventRecorder;
pub use input_macro::FilteredEventRecorder;
pub use input_macro::InputMacro;
pub use input_macro::MacroPlayback;
pub use input_macro::MacroPlayer;
pub use input_macro::MacroRecorder;
pub use input_macro::RecordingFilter;
pub use input_macro::RecordingState;
pub use input_macro::TimedEvent;
pub use locale::LocaleContext;
pub use locale::LocaleOverride;
pub use locale::current_locale;
pub use locale::detect_system_locale;
pub use locale::set_locale;
pub use log_sink::LogSink;
pub use process_subscription::ProcessEvent;
pub use process_subscription::ProcessSubscription;
pub use program::App;
pub use program::AppBuilder;
pub use program::BatchController;
pub use program::Cmd;
pub use program::EffectQueueConfig;
pub use program::FrameTiming;
pub use program::FrameTimingConfig;
pub use program::FrameTimingSink;
pub use program::HeadlessEventSource;
pub use program::InlineAutoRemeasureConfig;
pub use program::LoadGovernorConfig;
pub use program::Model;
pub use program::MouseCapturePolicy;
pub use program::PaneTerminalAdapter;
pub use program::PaneTerminalAdapterConfig;
pub use program::PaneTerminalDispatch;
pub use program::PaneTerminalIgnoredReason;
pub use program::PaneTerminalLifecyclePhase;
pub use program::PaneTerminalLogEntry;
pub use program::PaneTerminalLogOutcome;
pub use program::PaneTerminalSplitterHandle;
pub use program::PersistenceConfig;
pub use program::Program;
pub use program::ProgramConfig;
pub use program::ResizeBehavior;
pub use program::RolloutPolicy;
pub use program::RuntimeLane;
pub use program::TaskExecutorBackend;
pub use program::TaskSpec;
pub use program::WidgetRefreshConfig;
pub use program::pane_terminal_resolve_splitter_target;
pub use program::pane_terminal_splitter_handles;
pub use program::pane_terminal_target_from_hit;
pub use program::register_pane_terminal_splitter_hits;
pub use render_trace::RenderTraceConfig;
pub use render_trace::RenderTraceContext;
pub use render_trace::RenderTraceFrame;
pub use render_trace::RenderTraceRecorder;
pub use retry::BackoffStrategy;
pub use retry::RetryPolicy;
pub use retry::task_with_retry;
pub use retry::task_with_timeout;
pub use simulator::ProgramSimulator;
pub use string_model::StringModel;
pub use string_model::StringModelAdapter;
pub use subscription::Every;
pub use subscription::StopSignal;
pub use subscription::SubId;
pub use subscription::Subscription;
pub use terminal_writer::ScreenMode;
pub use terminal_writer::TerminalWriter;
pub use terminal_writer::UiAnchor;
pub use terminal_writer::inline_active_widgets;
pub use tick_strategy::ActiveOnly;
pub use tick_strategy::ActivePlusAdjacent;
pub use tick_strategy::AllocationCurve;
pub use tick_strategy::Custom;
pub use tick_strategy::DecayConfig;
pub use tick_strategy::MarkovPredictor;
pub use tick_strategy::Predictive;
pub use tick_strategy::PredictiveConfig;
pub use tick_strategy::PredictiveStrategyConfig;
pub use tick_strategy::ScreenPrediction;
pub use tick_strategy::ScreenTickDispatch;
pub use tick_strategy::TickAllocation;
pub use tick_strategy::TickDecision;
pub use tick_strategy::TickStrategy;
pub use tick_strategy::TickStrategyKind;
pub use tick_strategy::TransitionCounter;
pub use tick_strategy::TransitionEntry;
pub use tick_strategy::TransitionHistory;
pub use tick_strategy::Uniform;
pub use voi_telemetry::clear_inline_auto_voi_snapshot;
pub use voi_telemetry::inline_auto_voi_snapshot;
pub use voi_telemetry::set_inline_auto_voi_snapshot;
pub use allocation_budget::AllocationBudget;
pub use allocation_budget::BudgetAlert;
pub use allocation_budget::BudgetConfig;
pub use allocation_budget::BudgetEvidence;
pub use allocation_budget::BudgetSummary;
pub use conformal_alert::AlertConfig;
pub use conformal_alert::AlertDecision;
pub use conformal_alert::AlertEvidence;
pub use conformal_alert::AlertReason;
pub use conformal_alert::AlertStats;
pub use conformal_alert::ConformalAlert;
pub use conformal_frame_guard::ConformalFrameGuard;
pub use conformal_frame_guard::ConformalFrameGuardConfig;
pub use conformal_frame_guard::ConformalFrameGuardTelemetry;
pub use conformal_frame_guard::GuardState;
pub use conformal_frame_guard::NonconformitySummary;
pub use conformal_frame_guard::P99Prediction;
pub use conformal_predictor::BucketKey;
pub use conformal_predictor::ConformalConfig;
pub use conformal_predictor::ConformalPrediction;
pub use conformal_predictor::ConformalPredictor;
pub use conformal_predictor::ConformalUpdate;
pub use conformal_predictor::DiffBucket;
pub use conformal_predictor::ModeBucket;
pub use cost_model::BatchCostParams;
pub use cost_model::BatchCostResult;
pub use cost_model::CacheCostParams;
pub use cost_model::CacheCostResult;
pub use cost_model::PipelineCostParams;
pub use cost_model::PipelineCostResult;
pub use cost_model::StageStats;
pub use decision_core::Action as DecisionAction;
pub use decision_core::Decision;
pub use decision_core::DecisionCore;
pub use decision_core::Outcome as DecisionOutcome;
pub use decision_core::Posterior;
pub use decision_core::State as DecisionState;
pub use decision_core::argmin_expected_loss;
pub use decision_core::second_best_loss;
pub use degradation_cascade::CascadeConfig;
pub use degradation_cascade::CascadeDecision;
pub use degradation_cascade::CascadeEvidence;
pub use degradation_cascade::CascadeTelemetry;
pub use degradation_cascade::DegradationCascade;
pub use degradation_cascade::PreRenderResult;
pub use demo::DemoDefinition;
pub use demo::DemoParseError;
pub use demo::DemoStep;
pub use demo::parse_demo_yaml;
pub use demo::validate_demos;
pub use effect_system::QueueTelemetry;
pub use effect_system::effects_command_total;
pub use effect_system::effects_executed_total;
pub use effect_system::effects_queue_dropped;
pub use effect_system::effects_queue_enqueued;
pub use effect_system::effects_queue_high_water;
pub use effect_system::effects_queue_processed;
pub use effect_system::effects_subscription_total;
pub use effect_system::queue_telemetry;
pub use effect_system::record_command_effect;
pub use effect_system::record_subscription_start;
pub use effect_system::record_subscription_stop;
pub use effect_system::trace_command_effect;
pub use eprocess_throttle::EProcessThrottle;
pub use eprocess_throttle::ThrottleConfig;
pub use eprocess_throttle::ThrottleDecision;
pub use eprocess_throttle::ThrottleLog;
pub use eprocess_throttle::ThrottleStats;
pub use eprocess_throttle::eprocess_rejections_total;
pub use flake_detector::EvidenceLog;
pub use flake_detector::FlakeConfig;
pub use flake_detector::FlakeDecision;
pub use flake_detector::FlakeDetector;
pub use flake_detector::FlakeSummary;
pub use flat_combine::CombinerStats;
pub use flat_combine::FlatCombiner;
pub use lens::AtIndex;
pub use lens::Composed;
pub use lens::Fst;
pub use lens::Identity;
pub use lens::Lens;
pub use lens::Prism;
pub use lens::Snd;
pub use lens::SomePrism;
pub use lens::at_index;
pub use lens::compose;
pub use metrics_registry::BuiltinCounter;
pub use metrics_registry::BuiltinGauge;
pub use metrics_registry::BuiltinHistogram;
pub use metrics_registry::Counter as MetricsCounter;
pub use metrics_registry::Gauge as MetricsGauge;
pub use metrics_registry::Histogram as MetricsHistogram;
pub use metrics_registry::METRICS;
pub use metrics_registry::MetricsRegistry;
pub use policy_config::BocpdPolicyConfig;
pub use policy_config::CascadePolicyConfig;
pub use policy_config::ConformalPolicyConfig;
pub use policy_config::EProcessBudgetPolicyConfig;
pub use policy_config::EProcessThrottlePolicyConfig;
pub use policy_config::EvidencePolicyConfig;
pub use policy_config::FrameGuardPolicyConfig;
pub use policy_config::PidPolicyConfig;
pub use policy_config::PolicyConfig;
pub use policy_config::PolicyConfigError;
pub use policy_config::VoiPolicyConfig;
pub use policy_registry::PolicyRegistry;
pub use policy_registry::PolicyRegistryError;
pub use policy_registry::PolicySwitchEvent;
pub use reactive::BatchScope;
pub use reactive::Binding;
pub use reactive::BindingScope;
pub use reactive::Computed;
pub use reactive::Observable;
pub use reactive::TwoWayBinding;
pub use resize_coalescer::CoalesceAction;
pub use resize_coalescer::CoalescerConfig;
pub use resize_coalescer::CoalescerStats;
pub use resize_coalescer::CycleTimePercentiles;
pub use resize_coalescer::DecisionLog;
pub use resize_coalescer::DecisionSummary;
pub use resize_coalescer::Regime;
pub use resize_coalescer::ResizeCoalescer;
pub use resize_sla::ResizeEvidence;
pub use resize_sla::ResizeSlaMonitor;
pub use resize_sla::SlaConfig;
pub use resize_sla::SlaLogEntry;
pub use resize_sla::SlaSummary;
pub use resize_sla::make_sla_hooks;
pub use reversible::AddOp;
pub use reversible::InsertOp;
pub use reversible::Journal;
pub use reversible::MulOp;
pub use reversible::PushOp;
pub use reversible::RemoveOp;
pub use reversible::Reversible;
pub use reversible::Sequence;
pub use reversible::SetOp;
pub use reversible::SwapOp;
pub use reversible::XorOp;
pub use schema_compat::CompatCheckResult;
pub use schema_compat::Compatibility;
pub use schema_compat::MatrixEntry;
pub use schema_compat::SchemaKind;
pub use schema_compat::check_event_trace_compat;
pub use schema_compat::check_evidence_compat;
pub use schema_compat::check_golden_trace_compat;
pub use schema_compat::check_render_trace_compat;
pub use schema_compat::check_schema_compat;
pub use schema_compat::default_compatibility_matrix;
pub use schema_compat::run_compatibility_matrix;
pub use slo::BreachResult;
pub use slo::BreachSeverity;
pub use slo::MetricSlo;
pub use slo::MetricType;
pub use slo::SafeModeDecision;
pub use slo::SloSchema;
pub use slo::SloSchemaError;
pub use slo::check_breach;
pub use slo::check_safe_mode;
pub use slo::emit_slo_check;
pub use slo::parse_slo_yaml;
pub use slo::run_slo_check;
pub use undo::CommandBatch;
pub use undo::CommandError;
pub use undo::CommandMetadata;
pub use undo::CommandResult;
pub use undo::CommandSource;
pub use undo::HistoryConfig;
pub use undo::HistoryManager;
pub use undo::MergeConfig;
pub use undo::TextDeleteCmd;
pub use undo::TextInsertCmd;
pub use undo::TextReplaceCmd;
pub use undo::Transaction;
pub use undo::TransactionScope;
pub use undo::UndoableCmd;
pub use undo::WidgetId;
pub use unified_evidence::DecisionDomain;
pub use unified_evidence::DomainSummary;
pub use unified_evidence::EmitsEvidence;
pub use unified_evidence::EvidenceEntry;
pub use unified_evidence::EvidenceEntryBuilder;
pub use unified_evidence::EvidenceTerm;
pub use unified_evidence::LedgerSummary;
pub use unified_evidence::UnifiedEvidenceLedger;
pub use validation_pipeline::LedgerEntry;
pub use validation_pipeline::PipelineConfig;
pub use validation_pipeline::PipelineResult;
pub use validation_pipeline::PipelineSummary;
pub use validation_pipeline::ValidationOutcome;
pub use validation_pipeline::ValidationPipeline;
pub use validation_pipeline::ValidatorStats;
pub use voi_sampling::DeferredRefinementConfig;
pub use voi_sampling::DeferredRefinementPlan;
pub use voi_sampling::DeferredRefinementScheduler;
pub use voi_sampling::RefinementCandidate;
pub use voi_sampling::RefinementSelection;
pub use voi_sampling::VoiConfig;
pub use voi_sampling::VoiDecision;
pub use voi_sampling::VoiLogEntry;
pub use voi_sampling::VoiObservation;
pub use voi_sampling::VoiSampler;
pub use voi_sampling::VoiSamplerSnapshot;
pub use voi_sampling::VoiSummary;
pub use voi_sampling::voi_samples_skipped_total;
pub use voi_sampling::voi_samples_taken_total;
pub use state_persistence::MemoryStorage;
pub use state_persistence::RegistryStats;
pub use state_persistence::StateRegistry;
pub use state_persistence::StorageBackend;
pub use state_persistence::StorageError;
pub use state_persistence::StorageResult;
pub use state_persistence::StoredEntry;
pub use schedule_trace::CancelReason;
pub use schedule_trace::GoldenCompareResult;
pub use schedule_trace::IsomorphismProof;
pub use schedule_trace::ScheduleTrace;
pub use schedule_trace::SchedulerPolicy;
pub use schedule_trace::TaskEvent;
pub use schedule_trace::TraceConfig;
pub use schedule_trace::TraceEntry;
pub use schedule_trace::TraceSummary;
pub use schedule_trace::WakeupReason;
pub use schedule_trace::compare_golden;
pub use terminal_writer::RuntimeDiffConfig;
pub use wasm_runner::RenderedFrame;
pub use wasm_runner::StepResult;
pub use wasm_runner::WasmRunner;

Modules§

allocation_budget
Sequential allocation leak detection using CUSUM and e-process.
alpha_investing
Alpha-Investing: sequential FDR control for multiple simultaneous alerts.
asciicast
Asciicast v2 recorder for capturing terminal sessions.
bocpd
Bayesian Online Change-Point Detection (BOCPD) for Resize Regime Detection.
cancellation
Cooperative cancellation tokens for commands and tasks.
conformal_alert
Conformal alert threshold calibration with anytime-valid e-process control.
conformal_frame_guard
Conformal frame guard: coverage-guaranteed prediction intervals for frame timing.
conformal_predictor
Conformal predictor for frame-time risk (bd-3e1t.3.2).
conformal_stages
Multi-stage conformal prediction for render pipeline timing.
cost_model
Formal cost models for caches, scheduling, and batching (bd-lff4p.5.6).
debug_trace
Zero-cost debug tracing controlled by environment variable.
decision_core
Generic expected-loss decision framework (bd-2uv9c, bd-3rss7).
degradation_cascade
Degradation cascade: conformal guard → budget controller → widget priority.
demo
Demo definition parser and runner (bd-2xj.3).
diff_evidence
Diff strategy evidence ledger (bd-3jlw5.3).
effect_system
Effect system observability and Cx-aware execution helpers.
eprocess_throttle
Anytime-valid throttle using e-process (test martingale) control.
evidence_bridges
Evidence bridges: convert domain-specific decision types into unified EvidenceEntry records (bd-xox.4).
evidence_sink
JSONL evidence sink for deterministic diagnostics.
evidence_telemetry
Evidence telemetry snapshots for runtime explainability overlays.
flake_detector
Anytime-Valid Flake Detector (bd-1plj).
flat_combine
Flat combining for batched operation dispatch under contention.
input_fairness
Input Fairness Guard (bd-1rz0.17)
input_macro
Input macro recording and playback.
ivm
Incremental View Maintenance (IVM) — delta-propagation DAG for derived render state (bd-3akdb.1).
lens
Bidirectional lenses for state-widget binding.
locale
Locale context provider for runtime-wide internationalization.
log_sink
Log sink for in-process output routing.
metrics_registry
Prometheus-compatible metrics registry (bd-xox.3).
policy_config
Policy-as-data configuration for FrankenTUI decision controllers.
policy_registry
Thread-safe registry of named PolicyConfig instances with lock-free reads and atomic hot-swap via arc_swap::ArcSwap.
process_subscription
Process subscription for spawning and monitoring external processes.
program
Bubbletea/Elm-style runtime for terminal applications.
queueing_scheduler
Queueing Theory Scheduler with SRPT/Smith-Rule Style Scheduling (bd-13pq.7).
reactive
Reactive data bindings for FrankenTUI.
render_trace
Render-trace recorder for deterministic replay (bd-3e1t.4.13).
resize_coalescer
Adaptive resize stream coalescer.
resize_sla
Resize SLA monitoring with conformal alerting (bd-1rz0.21).
retry
Retry policies and timeout-enforced task helpers.
reversible
Reversible computing primitives for undo.
rough_path
Rough-path signatures for sequential trace feature extraction.
schedule_trace
Schedule Trace Module (bd-gyi5).
schema_compat
Suite-wide trace and evidence schema compatibility (bd-ehk.3).
simulator
Deterministic program simulator for testing.
slo
SLO schema, breach detection, and safe-mode enforcement (bd-2xj.2).
sos_barrier
SOS barrier certificate evaluator for frame-budget admissibility.
state_persistence
Widget state persistence for save/restore across sessions.
string_model
Easy-mode adapter for string-based views.
subscription
Subscription system for continuous event sources.
telemetry_schema
Canonical telemetry schema for the FrankenTUI runtime (bd-17ar5).
terminal_writer
Terminal output coordinator with inline mode support.
tick_strategy
Tick strategy primitives for selective background ticking.
transparency
Galaxy-brain transparency layer with progressive disclosure (bd-xox.5).
undo
Undo/Redo command history framework.
unified_evidence
Unified Evidence Ledger for all Bayesian decision points (bd-fp38v).
validation_pipeline
Expected-cost validation ordering with Bayesian online learning.
voi_sampling
Value-of-Information (VOI) Sampling Policy for expensive measurements.
voi_telemetry
VOI debug telemetry snapshots for runtime introspection.
wasm_runner
Step-based program runner for WASM targets.

Macros§

bind
Create a direct Binding to an observable.
bind_map
Create a mapped Binding from an observable with a transform function.
bind_map2
Create a mapped Binding from two observables.
debug_trace
Conditionally print debug trace output to stderr.

Structs§

BackendFeatures
Terminal feature toggles that backends must support.
DiffStrategyConfig
Configuration for the diff strategy selector.
DiffStrategySelector
Bayesian diff strategy selector.
StrategyEvidence
Evidence supporting a strategy decision.

Enums§

DiffStrategy
The diff strategy to use for the current frame.

Traits§

BackendEventSource
Event source abstraction: terminal size queries, feature toggles, and event I/O.

Type Aliases§

Locale
Locale identifier (e.g., "en", "en-US", "ru").