Device capability vocabulary: one tier ladder, one thermal ladder, and the projection from observed inputs onto them. More...
Namespaces | |
| namespace | detail |
| namespace | win |
Classes | |
| struct | ProcessResult |
| Result of a completed child process. More... | |
| struct | ProcessOptions |
| Options for child process execution. More... | |
| class | ChildProcessInputChannel |
| Move-only parent endpoint of the child's inherited standard-input channel. More... | |
| class | ChildProcess |
| Cross-platform child process with timeout, cancellation, and line-by-line output callbacks. More... | |
| class | Clipboard |
| class | DBus |
| struct | DeviceCapabilityInputs |
| What a shell observed about the device it is running on. More... | |
| struct | SafeAreaInsets |
| Safe-area insets in CSS-pixel space (already divided by content_scale). More... | |
| struct | KeyboardInset |
| Soft-keyboard inset (mobile only). More... | |
| struct | DisplayInfo |
| Logical display geometry. More... | |
| struct | EnvironmentChange |
| Bitmask of fields that changed in the snapshot delivered to a listener. More... | |
| struct | EnvironmentState |
| Snapshot of the full environment state. More... | |
| class | Environment |
| In-process notifier. More... | |
| struct | FileFilter |
| class | FileDialog |
| class | PermissionsOverride |
| Test helper: scope-guarded override. More... | |
| class | PopupMenu |
| struct | ProgressEvent |
| A structured progress event parsed from a PROGRESS:TYPE:PAYLOAD line. More... | |
| class | ProgressParser |
| Parses lines matching the PROGRESS:TYPE:PAYLOAD protocol and fires a callback for each match. More... | |
| struct | SpecialDirInputs |
| Everything the resolver may read, so every platform's layout can be computed (and tested) on any host. More... | |
Typedefs | |
| using | StandardInputByteProvider |
| Produces private standard-input bytes after the child has been spawned. | |
| using | StandardInputChannelSession |
| Owns a post-spawn exchange over the child's private inherited input channel. | |
| using | NativeWindowHandle = void* |
| using | NativeViewHandle = void* |
| using | NativeDisplayHandle = void* |
| using | RequestCallback = std::function<void(PermissionState)> |
Enumerations | |
| enum class | OS { macOS , iOS , Windows , Linux , Android , Unknown } |
| enum class | Arch { x86_64 , ARM64 , ARM32 , x86 , Unknown } |
| enum class | Compiler { Clang , GCC , MSVC , AppleClang , Unknown } |
| enum class | Endian { Little , Big } |
| enum class | DeviceCapabilityTier : std::uint8_t { Constrained = 0 , Standard = 1 , Full = 2 } |
| How much of the product a device can carry, on one ascending ladder. More... | |
| enum class | ThermalState : std::uint8_t { Nominal = 0 , Fair = 1 , Serious = 2 , Critical = 3 } |
| Live thermal pressure, ascending in heat. More... | |
| enum class | PointerPrecision : std::uint8_t { Coarse = 0 , Fine = 1 } |
| Precision of the device's primary pointing device. More... | |
| enum class | ColorScheme : uint8_t { light , dark , unknown } |
| Light/dark color scheme reported by the OS. More... | |
| enum class | LifecycleState : uint8_t { foreground , inactive , background , unknown } |
| Coarse foreground/background lifecycle state. More... | |
| enum class | Orientation : uint8_t { portrait , portrait_upside_down , landscape_left , landscape_right , flat , unknown } |
| Device orientation. More... | |
| enum class | MemoryPressure : uint8_t { normal , moderate , critical } |
| Memory pressure level. More... | |
| enum class | Permission { Microphone , Camera , BluetoothMidi , LocalNetwork , Notifications , BackgroundAudio , ForegroundService } |
| enum class | PermissionState { NotDetermined , Granted , Denied , Restricted } |
| enum class | RevealOutcome { revealed , opened_containing_folder , not_found , unsupported , failed } |
| What reveal_in_file_manager managed to do. More... | |
| enum class | SpecialDir { home , documents , desktop , music , app_data , app_data_shared , config , temp , cache , logs , current_executable , bundle_dir , user_presets } |
| enum class | SpecialDirOs { macos , ios , windows , linux_desktop , android , web } |
| Operating system a path is shaped for. More... | |
Functions | |
| ProcessResult | exec (const std::string &command, const std::vector< std::string > &args={}, int timeout_ms=30000) |
| Convenience: run a command and capture output (blocking). | |
| std::optional< std::filesystem::path > | find_on_path (const std::string &binary_name) |
| Check if a binary exists on PATH. Returns the full path if found. | |
| std::string | file_uri_to_path (const std::string &uri) |
| Convert a file:// URI to a local filesystem path (percent-decoded). | |
| constexpr DeviceCapabilityTier | project_device_capability_tier (DeviceCapabilityInputs inputs) |
| Projects observed capabilities onto the tier ladder. | |
| void | start_environment_observer_mac () |
| void | start_environment_observer () |
| PermissionState | query (Permission p) |
| Current state. Never blocks, never shows UI. | |
| void | request (Permission p, RequestCallback cb) |
| Async request. | |
| bool | has_platform_backend () |
| True when a real platform backend is wired (iOS / Android). | |
| const char * | to_string (RevealOutcome outcome) noexcept |
| Short stable name for an outcome ("revealed", "not_found", ...). | |
| RevealOutcome | reveal_in_file_manager (const std::filesystem::path &path) |
| Show path in the platform file manager: Finder (NSWorkspace activateFileViewerSelectingURLs), Windows Explorer (SHOpenFolderAndSelectItems), or on Linux the containing folder via xdg-open. | |
| std::string_view | special_dir_name (SpecialDir kind) noexcept |
| Stable lower_snake_case name, for diagnostics and tests. | |
| std::filesystem::path | special_dir (SpecialDir kind) |
| Resolve kind for the running process. Empty when unavailable. | |
| void | set_special_dir_override (SpecialDir kind, std::filesystem::path path) |
| Replace the resolved location for kind (a mobile host that learns its sandbox paths late, a test that must not touch the real home). | |
| void | clear_special_dir_overrides () |
| SpecialDirOs | host_special_dir_os () noexcept |
| The host OS this binary was built for. | |
| std::string | special_dir_for (SpecialDirOs os, SpecialDir kind, const SpecialDirInputs &inputs) |
| Resolve kind for os from inputs alone. Empty string when unavailable. | |
Device capability vocabulary: one tier ladder, one thermal ladder, and the projection from observed inputs onto them.
Everything here is an observation about the machine or a pure function of observations. What the product then grants at a given rung is policy, and policy is not here: pulp/format/device_quotas.hpp holds the quota table, at a rung the engine modules cannot reach. core/platform is named in every row of the engine's declared dependency floors, so anything placed here is reachable by every module and no floor row can object to it — which makes it the right address for a shared vocabulary and the wrong address for a budget.
This header is deliberately dependency-free. It includes no Pulp header, so it cannot name a document, a session, a transport, or a view, and every entry point is a constexpr free function over by-value trivially-copyable inputs. A projection that cannot reach mutable state by construction needs no runtime guard against mutating one.
| using pulp::platform::NativeDisplayHandle = void* |
| using pulp::platform::NativeViewHandle = void* |
| using pulp::platform::NativeWindowHandle = void* |
| using pulp::platform::RequestCallback = std::function<void(PermissionState)> |
Produces private standard-input bytes after the child has been spawned.
Returning std::nullopt rejects the launch. The callback runs synchronously outside ChildProcess's internal lock, may call non-mutating observers, and must not block indefinitely: it is caller code and cannot be preempted. Time spent in the callback consumes the standard-input delivery deadline.
Owns a post-spawn exchange over the child's private inherited input channel.
The callback runs synchronously outside ChildProcess's internal lock and must bound every blocking operation to the supplied deadline. Like the byte provider above, it is caller code and cannot safely be preempted.
|
strong |
|
strong |
Light/dark color scheme reported by the OS.
| Enumerator | |
|---|---|
| light | |
| dark | |
| unknown | Platform did not report; treat as dark per Pulp's default theme. |
|
strong |
|
strong |
How much of the product a device can carry, on one ascending ladder.
There is exactly one ladder. The browser lane's Tier A/B/C and the mobile lane's M-A/M-B/M-C are the same three rungs named twice, so they are the same three enumerators here:
| Rung | Browser | Mobile | Shape |
|---|---|---|---|
| Constrained | Tier A | M-A | Review and perform; no local realtime |
| Standard | Tier B | M-B | Authoring-complete |
| Full | Tier C | M-C | Precision authoring with headroom |
The rung is computed from observable inputs (see DeviceCapabilityInputs), never assumed from form factor: a tablet with a keyboard and a phone-sized browser tab land wherever their capabilities put them.
| Enumerator | |
|---|---|
| Constrained | |
| Standard | |
| Full | |
|
strong |
|
strong |
Coarse foreground/background lifecycle state.
Mobile platforms drive this from the activity/scene lifecycle; desktop drives from the active-window observer (NSApp resignActive on macOS, WM_ACTIVATEAPP on Windows, _NET_ACTIVE_WINDOW on X11).
| Enumerator | |
|---|---|
| foreground | |
| inactive | App is visible but not the focused window (split-screen, banner). |
| background | |
| unknown | |
|
strong |
Memory pressure level.
Mirrors Android's TRIM_MEMORY tiers + iOS's didReceiveMemoryWarning (which becomes critical). Desktop platforms emit normal only — they don't have a kernel-driven LMK.
| Enumerator | |
|---|---|
| normal | |
| moderate | Some background processes were killed; trim soft caches. |
| critical | Foreground app is the next likely target; release optional state. |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
|
strong |
What reveal_in_file_manager managed to do.
The outcome is reported honestly per platform rather than collapsed to a bool, because the platforms do not offer the same capability.
|
strong |
|
strong |
Operating system a path is shaped for.
Distinct from platform::OS because WebAssembly has its own layout.
| Enumerator | |
|---|---|
| macos | |
| ios | |
| windows | |
| linux_desktop | |
| android | |
| web | |
|
strong |
Live thermal pressure, ascending in heat.
Four rungs, chosen to be the coarsest ladder every reporting platform can be projected onto without inventing precision it does not have. Platforms with a finer ladder collapse into these; a platform with no thermal API at all can only ever report Nominal, which is why the absence of a thermal API lowers the capability tier rather than being ignored — see DeviceCapabilityInputs::thermal_reporting_available.
Consumers index a quota table by tier and thermal state together; the table belongs to the consumer, not to the platform layer.
| Enumerator | |
|---|---|
| Nominal | |
| Fair | |
| Serious | |
| Critical | |
| void pulp::platform::clear_special_dir_overrides | ( | ) |
| ProcessResult pulp::platform::exec | ( | const std::string & | command, |
| const std::vector< std::string > & | args = {}, | ||
| int | timeout_ms = 30000 ) |
Convenience: run a command and capture output (blocking).
| std::string pulp::platform::file_uri_to_path | ( | const std::string & | uri | ) |
| std::optional< std::filesystem::path > pulp::platform::find_on_path | ( | const std::string & | binary_name | ) |
Check if a binary exists on PATH. Returns the full path if found.
| bool pulp::platform::has_platform_backend | ( | ) |
True when a real platform backend is wired (iOS / Android).
False when the desktop / unsupported backend is active — useful for diagnostics and feature gating.
|
noexcept |
The host OS this binary was built for.
|
nodiscardconstexpr |
Projects observed capabilities onto the tier ladder.
Each axis independently states the highest rung it can support, and the result is the lowest of those: capability is a weakest-link property, so a device with sixteen cores and half a gigabyte is not a Full-tier device. Structuring it this way keeps each axis's contribution separately reviewable instead of hiding it in a cascade of conditions.
| PermissionState pulp::platform::query | ( | Permission | p | ) |
Current state. Never blocks, never shows UI.
| void pulp::platform::request | ( | Permission | p, |
| RequestCallback | cb ) |
| RevealOutcome pulp::platform::reveal_in_file_manager | ( | const std::filesystem::path & | path | ) |
Show path in the platform file manager: Finder (NSWorkspace activateFileViewerSelectingURLs), Windows Explorer (SHOpenFolderAndSelectItems), or on Linux the containing folder via xdg-open.
A directory is selected within its parent on macOS and Windows. Checks existence first, so a missing path yields not_found without touching the shell. Call from the main/UI thread.
| void pulp::platform::set_special_dir_override | ( | SpecialDir | kind, |
| std::filesystem::path | path ) |
Replace the resolved location for kind (a mobile host that learns its sandbox paths late, a test that must not touch the real home).
An empty path removes the override. Thread-safe.
| std::filesystem::path pulp::platform::special_dir | ( | SpecialDir | kind | ) |
Resolve kind for the running process. Empty when unavailable.
| std::string pulp::platform::special_dir_for | ( | SpecialDirOs | os, |
| SpecialDir | kind, | ||
| const SpecialDirInputs & | inputs ) |
Resolve kind for os from inputs alone. Empty string when unavailable.
|
noexcept |
Stable lower_snake_case name, for diagnostics and tests.
|
inline |
| void pulp::platform::start_environment_observer_mac | ( | ) |
|
noexcept |
Short stable name for an outcome ("revealed", "not_found", ...).
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
|
inlineconstexpr |
Core-count floor for DeviceCapabilityTier::Full.
|
inlineconstexpr |
Memory floor for DeviceCapabilityTier::Full.
|
inlineconstexpr |
Core-count floor for DeviceCapabilityTier::Standard.
|
inlineconstexpr |
Memory floor for DeviceCapabilityTier::Standard.
|
inlineconstexpr |