Files
claw/docs/plans/2026-03-27-sgclaw-overlay-and-basic-navigation-fixes.md

3.9 KiB

sgClaw Overlay And Basic Navigation Fixes Implementation Plan

For Claude: REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.

Goal: Make ordinary webpages render the new sgClaw floating chat design and support base navigation instructions like 打开知乎.

Architecture: Keep the ordinary-page injection entrypoint unchanged, but replace its in-shadow DOM layout with the same floating-window shell used by the new debug page. On the runtime side, extend the deterministic planner with explicit homepage navigation plans for supported sites so freeform open-site commands do not fail before the compat runtime can help.

Tech Stack: Chromium WebUI resource pipeline, injected Shadow DOM overlay JavaScript, Rust planner tests

Task 1: Lock the current regressions with failing tests

Files:

  • Modify: /home/zyl/projects/superRpa/src/chrome/browser/superrpa/sgclaw/sgclaw_chat_smoke.mjs
  • Modify: /home/zyl/projects/sgClaw/claw/tests/planner_test.rs

Step 1: Write the failing smoke expectations

Add assertions that the ordinary webpage overlay shows the new subtitle 面向当前网页的悬浮式对话与自动执行 and no longer exposes the old card titles like 聊天记录.

Step 2: Run the smoke to verify it fails

Run: node /home/zyl/projects/superRpa/src/chrome/browser/superrpa/sgclaw/sgclaw_chat_smoke.mjs Expected: FAIL because ordinary webpages still render the old overlay shell.

Step 3: Write the failing planner test

Add a test asserting plan_instruction("打开知乎") returns one Navigate step to https://www.zhihu.com.

Step 4: Run the planner test to verify it fails

Run: cargo test planner_supports_open_zhihu_homepage_instruction --test planner_test Expected: FAIL with unsupported instruction: 打开知乎.

Task 2: Migrate the ordinary webpage overlay to the new shell

Files:

  • Modify: /home/zyl/projects/superRpa/src/chrome/browser/resources/superrpa/sgclaw_overlay.js
  • Test: /home/zyl/projects/superRpa/src/chrome/browser/superrpa/sgclaw/sgclaw_chat_smoke.mjs

Step 1: Replace the old card layout with the new floating shell

Keep bridge calls, ids, and polling behavior intact, but render the new header, message pane, composer, settings panel, and debug drawer structure inside the existing injected Shadow DOM.

Step 2: Keep runtime visibility without reintroducing the old layout

Move logs and final result into secondary panels or inline cards so the ordinary webpage still exposes execution details without the old four-card layout.

Step 3: Run the smoke again

Run: node /home/zyl/projects/superRpa/src/chrome/browser/superrpa/sgclaw/sgclaw_chat_smoke.mjs Expected: PASS once rebuilt resources are being served by the browser binary.

Task 3: Extend planner support for basic open-site commands

Files:

  • Modify: /home/zyl/projects/sgClaw/claw/src/agent/planner.rs
  • Test: /home/zyl/projects/sgClaw/claw/tests/planner_test.rs

Step 1: Implement the minimal homepage plans

Support 打开知乎 and 打开百度 by returning single-step Navigate plans to their homepages.

Step 2: Run planner tests

Run: cargo test --test planner_test Expected: PASS.

Task 4: Build and verify the integrated behavior

Files:

  • Modify: /home/zyl/projects/superRpa/src/AGENTS.md
  • Modify: /home/zyl/projects/superRpa/src/docs/handoffs/2026-03-27-sgclaw-runtime-verification.md

Step 1: Rebuild impacted targets

Run: autoninja -C /home/zyl/projects/superRpa/src/out/KylinRelease chrome/browser/resources/superrpa:resources sgclaw

Step 2: Re-run targeted verification

Run the smoke and a focused sgclaw task submission check for 打开知乎.

Step 3: Document the final runtime path

Record that ordinary webpages and chrome://superrpa-functions/sgclaw-chat now share the same floating shell, and that homepage navigation commands are handled by the planner.