MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / open

Method open

cli/src/engine.rs:55–68  ·  view source on GitHub ↗

Boot the harness page and wait until the worker is ready to receive eval calls.

(manifest: &Manifest)

Source from the content-addressed store, hash-verified

53impl Session {
54 /// Boot the harness page and wait until the worker is ready to receive eval calls.
55 pub fn open(manifest: &Manifest) -> Result<Self> {
56 let packages = serde_json::to_string(manifest)?;
57 let port = serve(packages)?;
58 let url = format!("http://127.0.0.1:{port}/");
59
60 // One spinner covers the whole bring-up: Chromium spawn + page load + worker boot.
61 let _sp = crate::ui::spinner("starting chromium");
62 let browser = launch().context("launching headless Chromium")?;
63 let tab = browser.new_tab().map_err(|e| anyhow!("opening a tab: {e}"))?;
64 tab.navigate_to(&url).map_err(|e| anyhow!("navigating to the harness: {e}"))?;
65 tab.wait_until_navigated().map_err(|e| anyhow!("waiting for page load: {e}"))?;
66 wait_ready(&tab)?;
67 Ok(Self { _browser: browser, tab, history: String::new(), history_lines: 0 })
68 }
69
70 /// Recompile prior history with `src` so imports and defs persist; only new lines reach `on_line`.
71 pub fn eval<F: FnMut(&str)>(&mut self, src: &str, mut on_line: F) -> Result<Outcome> {

Callers 1

idb.jsFile · 0.45

Calls 4

serveFunction · 0.85
spinnerFunction · 0.85
launchFunction · 0.85
wait_readyFunction · 0.85

Tested by

no test coverage detected