NAME
sys.h - Bark platform utilities: clocks, KV storage, files, timers, clipboard, local AI.
SYNOPSIS
Classes
Main-thread callbacks dispatched during bark_sys_poll().
Configuration options for bark_sys_create().
Typedefs
Opaque system capability handle.
Key-value storage persistence scope.
Main-thread callbacks dispatched during bark_sys_poll().
Configuration options for bark_sys_create().
Optional callback invoked when bark_sys_file_pick_open() requests a file chooser.
Optional callback invoked when bark_sys_clipboard_write_text() writes clipboard text.
Completion callback for bark_sys_store_list(), delivering a JSON array string.
Completion callback for browser on-device Prompt API requests.
Enumerations
Key-value storage persistence scope.
Functions
Create a system capability handle.
Pump pending timers and OS/browser system events onto the main thread.
Destroy a system handle and release resources.
Current wall-clock UTC timestamp in milliseconds.
Monotonic steady clock timestamp in milliseconds.
Fill out with len cryptographically secure random bytes.
Generate a NUL-terminated RFC 4122 version 4 UUID string (36 chars + NUL).
Percent-decode src into out. Returns decoded byte length.
Infer an HTTP MIME content type from a filename extension.
Resolve the platform-standard per-user config directory for app_name (XDG/AppData/Application Support).
Schedule a one-shot or repeating timer with caller-defined id and delay ms.
Cancel a previously scheduled timer by id.
Read a string value from local or session KV storage. Returns length or negative on miss.
Write a string value into local or session KV storage.
Delete a key from local or session KV storage.
Install an in-window or platform file chooser hook (no-op on browser WASM).
Open an asynchronous file picker filtered by accept; delivers results via on_file_picked.
Register a local file path and return an opaque file handle.
Inject a dropped local file path, triggering on_file_picked with tag.
Read up to cap bytes at offset from a registered file handle.
Read an entire registered file (bounded by max_bytes) into a malloc()'d buffer.
Save an in-memory buffer as a downloaded file named name.
Open a streaming file download handle for incremental writes.
Append a chunk of bytes to an open streaming download handle.
Finalize (commit != 0) or abort (commit == 0) a streaming download handle.
Install a platform or window-system clipboard write hook.
Copy UTF-8 text to the system clipboard.
Request an image from the clipboard; delivers bytes via on_clipboard_image.
Open an external HTTP(S) URL in the user's default browser.
Read the current URL hash fragment into out.
Update the URL hash fragment without reloading (uses history.replaceState on WASM).
Show a synchronous confirmation dialog (returns 1 on OK / headless, 0 on cancel).
Store a JSON-encoded record under namespace ns and unique key (IndexedDB on WASM, JSONL on POSIX).
Asynchronously list all records in ns whose key starts with prefix as a JSON array.
Remove all records stored in namespace ns.
Return non-zero if a browser on-device LanguageModel Prompt API is present.
Run a one-shot prompt against the browser on-device LanguageModel API.
Detailed Description
Bark platform utilities: clocks, KV storage, files, timers, clipboard, local AI.
Headless OS and browser platform primitives.
Provides clocks, timer wheel, persistent/session key-value storage, file pickers and streaming saves, clipboard integration, external URL launching, URL hash/query helpers, and CSPRNG utilities. All callbacks in bark_sys_cbs_t fire exclusively on the main thread inside bark_sys_poll().
Enumeration Type Documentation
enum bark_kv_scope
Key-value storage persistence scope.
Enumerator
- BARK_KV_LOCAL
- Persistent per-machine storage under config_dir (localStorage in WASM).
- BARK_KV_SESSION
- Ephemeral in-memory session storage (sessionStorage in WASM).
Author
Generated automatically by Doxygen for Bark from the source code.