Skip to main content

Module browser_start_page

Module browser_start_page 

Source
Expand description

Browser pane start page — a single URL, deliberately stored under shared_dir (~/.agentmux/shared/browser-start-page.json) for the same reason bookmarks are (bookmarks_store.rs): settings.json isolation is whole-file only (docs/specs/SPEC_SETTINGS_ISOLATED_BY_CHANNEL_2026_08_19.md §6), so a value that must stay global across channels can’t live inside it.

Unlike bookmarks, this value also rides inside FullConfigType — see docs/specs/SPEC_BROWSER_PANE_START_PAGE_2026_09_16.md §3.1 for why a second on-demand RPC (bookmarks’ .list pattern) was rejected in favor of piggybacking on GetFullConfig, which the frontend already awaits before its very first render. That means this module does two things bookmarks_store.rs doesn’t: it plugs into ConfigState (load_start_page_from_disk) and it watches its own file for changes (spawn_start_page_watcher), mirroring config_watcher_fs.rs’s settings watcher exactly so an edit from any window — or an external process — reaches every connected client via the same live broadcast settings.json changes already use, not just the window that made it.

Structs§

StartPageFile 🔒

Constants§

START_PAGE_FILE_NAME 🔒

Functions§

is_start_page_file_event 🔒
Whether a raw fs_watch event refers to browser-start-page.json specifically — mirrors config_watcher_fs::is_settings_file_event exactly, including excluding Removed (an external delete must not reset a configured start page back to “unset” and broadcast that).
load_start_page_from_disk
Load browser-start-page.json from disk into the ConfigState. Called once at startup, mirroring config_watcher_fs::load_settings_from_disk. An unresolvable shared_dir or a missing file both leave the config’s browser_start_page at its default (None) rather than failing boot — a start page is a convenience, never a startup precondition.
read_start_page
Read the configured start page. A missing file, or a present file with no url set yet, is Ok(None) — “nothing configured”, not an error, same as bookmarks’ missing-file case. A present-but-unparseable file IS an error: silently treating it as unset would look exactly like the user’s setting vanished (same reasoning bookmarks_store::read_bookmarks already documents).
spawn_start_page_watcher
Subscribe to browser-start-page.json via the shared FsWatchPool (the SAME pool instance the settings watcher uses — no new watcher subsystem) and broadcast the updated config to every connected client on change. Mirrors config_watcher_fs::spawn_settings_watcher exactly.
start_page_file_path
Resolves the shared, cross-channel start-page file path. Returns None when DataPaths can’t resolve (CI / unusual env) — same best-effort posture as bookmarks_store::bookmarks_file_path().
write_start_page
Write the start page, replacing whatever was there before. Same temp-file-then-rename crash safety as bookmarks_store::write_bookmarks. Two windows writing at the same instant still race at the whole-file level — last write wins — the same accepted limitation every other single-JSON-file store in this app has.