High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
fix: wire engine field in chrome handler responses
Boschededea6f7b49
diff --git a/internal/handlers/actions.go b/internal/handlers/actions.goindex 00810767..41b028a5 100644--- a/internal/handlers/actions.go+++ b/internal/handlers/actions.go@@ -333,10 +333,11 @@ func (h *Handlers) HandleAction(w http.ResponseWriter, r *http.Request) {return}- if engineName == "lite" {- w.Header().Set("X-Engine", "lite")- h.recordEngine(r, "lite")+ if engineName == "" {+ engineName = "chrome"}+ w.Header().Set("X-Engine", engineName)+ h.recordEngine(r, engineName)resp := map[string]any{"success": true, "result": result}if recoveryResult != nil {resp["recovery"] = recoveryResultdiff --git a/internal/handlers/navigation.go b/internal/handlers/navigation.goindex 973fd60f..892d13f1 100644--- a/internal/handlers/navigation.go+++ b/internal/handlers/navigation.go@@ -123,6 +123,9 @@ func (h *Handlers) HandleNavigate(w http.ResponseWriter, r *http.Request) {return}+ h.recordEngine(r, "chrome")+ w.Header().Set("X-Engine", "chrome")+// Ensure Chrome is initialized// Default to creating new tab (API design: /navigate always creates new tab)diff --git a/internal/handlers/snapshot.go b/internal/handlers/snapshot.goindex a517e40e..1917aa6c 100644--- a/internal/handlers/snapshot.go+++ b/internal/handlers/snapshot.go@@ -81,6 +81,9 @@ func (h *Handlers) HandleSnapshot(w http.ResponseWriter, r *http.Request) {return}+ h.recordEngine(r, "chrome")+ w.Header().Set("X-Engine", "chrome")+// Ensure Chrome is initializedif err := h.ensureChrome(); err != nil {if h.writeBridgeUnavailable(w, err) {@@ -333,6 +336,7 @@ func (h *Handlers) HandleSnapshot(w http.ResponseWriter, r *http.Request) {httpx.JSON(w, 200, map[string]any{"url": url,"title": title,+ "engine": "chrome","diff": true,"added": added,"changed": changed,@@ -387,10 +391,11 @@ func (h *Handlers) HandleSnapshot(w http.ResponseWriter, r *http.Request) {_, _ = w.Write(yamlContent)default:resp := map[string]any{- "url": url,- "title": title,- "nodes": flat,- "count": len(flat),+ "url": url,+ "title": title,+ "engine": "chrome",+ "nodes": flat,+ "count": len(flat),}if truncated {resp["truncated"] = truediff --git a/internal/handlers/text.go b/internal/handlers/text.goindex d089690d..4de2c9a7 100644--- a/internal/handlers/text.go+++ b/internal/handlers/text.go@@ -33,6 +33,9 @@ func (h *Handlers) HandleText(w http.ResponseWriter, r *http.Request) {return}+ h.recordEngine(r, "chrome")+ w.Header().Set("X-Engine", "chrome")+// Ensure Chrome is initializedif err := h.ensureChrome(); err != nil {if h.writeBridgeUnavailable(w, err) {diff --git a/tests/e2e/scenarios-api/engine-modes-full.sh b/tests/e2e/scenarios-api/engine-modes-full.shindex 0643d4ad..a2741c0b 100755--- a/tests/e2e/scenarios-api/engine-modes-full.sh+++ b/tests/e2e/scenarios-api/engine-modes-full.sh@@ -166,11 +166,12 @@ lite_get "/snapshot?tabId=${LITE_TAB}"assert_ok "lite snapshot"LITE_ENGINE=$(echo "$RESULT" | jq -r '.engine // empty')-if [ -n "$CHROME_ENGINE" ]; then+if [ "$CHROME_ENGINE" = "chrome" ]; thenecho -e " ${GREEN}✓${NC} chrome engine: $CHROME_ENGINE"((ASSERTIONS_PASSED++)) || trueelse- echo -e " ${YELLOW}⚠${NC} chrome engine field not present (may not be wired yet)"+ echo -e " ${RED}✗${NC} expected engine=chrome, got: $CHROME_ENGINE"+ ((ASSERTIONS_FAILED++)) || truefiif [ "$LITE_ENGINE" = "lite" ]; then