feat(playwright): adopt per-thread sessions for shared Chrome automation
This commit is contained in:
@@ -15,10 +15,18 @@ description: "Browse XiaoHongShu (小红书) with Playwright and execute account
|
||||
|
||||
## Shared Session Policy
|
||||
|
||||
- Reuse a single Playwright CLI session across all web-automation skills:
|
||||
- `export PLAYWRIGHT_SHARED_SESSION=codex-shared`
|
||||
- Use per-thread Playwright CLI sessions across all web-automation skills:
|
||||
- Auto session policy: `tools/pw` derives one Playwright session per `CODEX_THREAD_ID` (fallback: `PLAYWRIGHT_SESSION_OWNER` or explicit `--session`).
|
||||
- Use `/Users/xd/java/xhs/tools/pw` as the only Playwright CLI entrypoint.
|
||||
- Do not pass `--session` directly in skill-specific commands.
|
||||
- Prefer the default auto session; pass `--session <name>` only when explicit isolation is required.
|
||||
|
||||
## Network Preflight Gate (Required)
|
||||
|
||||
- Before first browser step, run:
|
||||
- `tools/pw --help`
|
||||
- If it fails with network sandbox signatures (`ENOTFOUND`, `EAI_AGAIN`, `ETIMEDOUT`, `ECONNREFUSED`, or `registry.npmjs.org` fetch failure):
|
||||
- rerun the same command with escalation (`sandbox_permissions=require_escalated`).
|
||||
- Do not continue browsing/点赞/收藏/评论 until this preflight succeeds.
|
||||
|
||||
## 1) Confirm Login State
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
interface:
|
||||
display_name: "XHS Engage"
|
||||
short_description: "Browse feed and engage via likes, favorites, and comments."
|
||||
default_prompt: "Use $xiaohongshu-engage with PLAYWRIGHT_SHARED_SESSION=codex-shared and execute browser steps only through /Users/xd/java/xhs/tools/pw while browsing XiaoHongShu and interacting with relevant posts through likes, favorites, and concise comments."
|
||||
default_prompt: "Use $xiaohongshu-engage with auto per-thread Playwright session via /Users/xd/java/xhs/tools/pw and execute browser steps only through /Users/xd/java/xhs/tools/pw while browsing XiaoHongShu and interacting with relevant posts through likes, favorites, and concise comments."
|
||||
|
||||
policy:
|
||||
allow_implicit_invocation: true
|
||||
|
||||
Reference in New Issue
Block a user