Problem
Installing pi-agent-browser-native as a normal Pi/OMP extension eagerly imports its large runtime graph during every session startup, even when no browser work is requested.
Controlled OMP 18.0.3 RPC benchmark (--no-session --no-skills --no-rules, isolated profile/cwd, 5 warmups, 30 samples):
| Configuration |
Median |
| No extensions |
1.28 s |
pi-agent-browser-native@0.5.0 loaded directly |
1.69 s |
| Same 0.5.0 entrypoint behind a dynamic-import façade |
1.23 s |
The eager entrypoint adds about 410 ms. This is import/initialization cost, not browser launch; the package already avoids spawning browser subprocesses during registration.
Proposal
Split the extension into:
- A lightweight entrypoint that registers the public tool schema and essential lifecycle hooks.
- A heavy runtime module loaded once, via a shared dynamic-import promise, when
agent_browser is first executed or browser-specific prompt handling is required.
The façade should preserve current lifecycle behavior by retaining/replaying the active session context when the runtime initializes. Please account for session_start, session_tree, session_shutdown, prompt guidance, conditional agent_browser_web_search registration, and cleanup behavior.
Problem
Installing
pi-agent-browser-nativeas a normal Pi/OMP extension eagerly imports its large runtime graph during every session startup, even when no browser work is requested.Controlled OMP 18.0.3 RPC benchmark (
--no-session --no-skills --no-rules, isolated profile/cwd, 5 warmups, 30 samples):pi-agent-browser-native@0.5.0loaded directlyThe eager entrypoint adds about 410 ms. This is import/initialization cost, not browser launch; the package already avoids spawning browser subprocesses during registration.
Proposal
Split the extension into:
agent_browseris first executed or browser-specific prompt handling is required.The façade should preserve current lifecycle behavior by retaining/replaying the active session context when the runtime initializes. Please account for
session_start,session_tree,session_shutdown, prompt guidance, conditionalagent_browser_web_searchregistration, and cleanup behavior.