Make neo capture list/detail/stats/search, neo schema generate, neo exec, neo replay work for Electron apps that don't have the Chrome extension installed.
- Chrome extension's inject/interceptor.ts monkey-patches fetch/XHR in page context
- Intercepted calls →
window.postMessage({ type: 'neo:capture_request', payload }) - Extension's content script listens for postMessage → forwards to background/service worker
- Background stores in IndexedDB (
neo-capture-v01/capturedRequests) - CLI reads from IndexedDB via
Runtime.evaluatein the extension's service worker context
In Electron apps, steps 3-4 don't exist (no extension). Data posted via postMessage goes nowhere.
In the wrapper that buildInjectScript() creates, add a message event listener that catches neo:capture_request messages and pushes them to globalThis.__NEO_CAPTURES__[]. This is already partially there (__NEO_CAPTURES__ array exists) but it's not populated by the interceptor's postMessage flow.
Add after the inject script execution:
window.addEventListener('message', function(e) {
if (e.data && e.data.type === 'neo:capture_request' && e.data.payload) {
globalThis.__NEO_CAPTURES__.push(e.data.payload);
// Cap at 500 per the existing design
if (globalThis.__NEO_CAPTURES__.length > 500) {
globalThis.__NEO_CAPTURES__.shift();
}
}
});Currently all capture commands read from IndexedDB via the extension service worker. Add a fallback path:
- Add a helper function
isSessionMode(sessionName)— returns true if there's an active session with a pageWsUrl but no extension service worker available - Add
getSessionCaptures(sessionName, filters)— reads__NEO_CAPTURES__from the page viaRuntime.evaluate - In each capture command handler, check: if session mode → use
getSessionCaptures(), else → use existing extension IndexedDB path
Commands to update:
capture listcapture countcapture domainscapture detail <id>capture stats <domain>capture search <query>capture clearcapture export
schema generate: Already works with capture data arrays. Just feed it session captures instead of extension captures.exec: Already works via CDPRuntime.evaluatein page context — should work as-is with session mode.replay: Same as exec, needs the original capture data which can come from session captures.
- Build extension:
npm run build(needed for inject.js) - Find/create a simple Electron app on the system
- Test flow:
neo launch <app>orneo connect <port>→neo inject→ browse →neo capture list→neo schema generate
tools/neo.cjs:buildInjectScript()— add postMessage listener- Add
getSessionCaptures()helper - Update capture command handlers with session fallback
- Update
findExtensionWs()to not throw when in session mode
- Don't break existing Chrome extension flow
- Session mode is opt-in (only when user explicitly does
neo connect+neo inject) - Keep the 500 capture cap
- Captures in session mode are in-memory only (lost on page reload unless
--persistwas used)