Repository navigation
Add: 利用者の Chrome を開発コンテナから CDP で操作する Skill chrome-cdp を足す - #2153
Open
takemi-ohama wants to merge 5 commits into
Open
takemi-ohama wants to merge 5 commits into
takemi-ohama wants to merge 5 commits into
Conversation
ログインと目視は利用者の Chrome で行い、大量の操作は Cookie を取り出して コンテナの headless で回す。リモートのホスト(EC2 など)の上のコンテナからは、 SSH の RemoteForward とホストの中継(socat)で届かせる。9222 をネットワークへ 開かないこと、対象の origin の Cookie だけを取ることを決まりにする。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KYHP7zFtYgAYtprVz6q6a2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KYHP7zFtYgAYtprVz6q6a2
… を読む形に置き換える Claude Code が Skill 本文の $2 $3 を起動時の引数に置き換えるため、skill-frontmatter-check が落ちていた。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KYHP82g1gdLBLQ9WcKeiJo
- browser-connection.md から Chrome の起動フラグ・WSL2 / macOS の経路・ネットワーク別の到達手段を外し、/ndf:chrome-cdp を案内する。pytest の cdp-remote 設定と conftest の統合は残す - 既定のプロファイルで CDP を開く手順は Chrome 136 以降で動かず、--remote-allow-origins=* は検査ごと外すため、どちらも使わない - 同じ前提に立つ scripts/start-host-chrome.sh を削除する - cdp_endpoint は IP で書く(名前だと Chrome が Host ヘッダを理由に拒む。IP なら Host を書き換えずに connect_over_cdp が通ることを Chrome 155 で確認)。テンプレートの例も IP に揃える - chrome-cdp に、Host の書き換えが要るのは名前で接続するときだけであることを書き足す Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KYHP82g1gdLBLQ9WcKeiJo
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KYHP82g1gdLBLQ9WcKeiJo
Contributor
Author
|
範囲外と判断し、#2154 として残した(CI の pytest が 1 回 10〜13 分かかる件。目標 3 分)。 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
開発コンテナの中のエージェントが、利用者の PC で動いている Chrome を CDP で操作する手順を Skill にした。認証のある画面は、利用者がいつもの Chrome でログインして目視し、E2E のような大量の操作は、その Chrome から取り出した Cookie でコンテナの headless の Chromium が回す。
開発環境がリモートのホスト(AWS EC2)の上のコンテナへ移り、以前の
host.docker.internal:9222が使えなくなったことがきっかけ。エディタのポート転送は向きが逆で代わりにならないため、SSH のRemoteForwardと、ホストのネットワークで動く中継(socat)で届かせる。carmo-system-console の画面モックの E2E で、この経路を実際に使って alpha の検証を通した。plugins/ndf/skills/chrome-cdp/SKILL.md: 経路の判定(同じ PC の Docker / リモートのホスト)、PC 側の設定、中継の立て方、Host ヘッダの上書き、Playwright での接続、Cookie の取り出し、安全のための決まりreferences/local-side-setup.md: 利用者の PC で動くエージェント(WSL の Claude など)へそのまま渡す指示書EXPECTED_COUNTS)references/browser-connection.mdから Chrome の起動フラグ・WSL2 / macOS の経路・ネットワーク別の到達手段を外し、/ndf:chrome-cdpを案内する。pytest のcdp-remote設定と conftest の統合は残す。既定のプロファイルで CDP を開く手順は Chrome 136 以降で動かず、--remote-allow-origins=*は検査ごと外すため使わない。同じ前提のscripts/start-host-chrome.shは削除するcdp_endpointは IP で書く。名前だと Chrome が Host ヘッダを理由に拒むが、IP なら Host を書き換えずにconnectOverCDPが通る(Chrome 155 で確認)。テンプレートの例も IP に揃え、chrome-cdp にもこの点を書き足す安全のための決まり: 9222 をネットワークへ開かない(CDP には認証が無い)、
context.cookies()は対象の origin を渡して呼ぶ(引数なしだと全サイトの Cookie が取れる)、利用者のタブを閉じない。関連する issue: なし(利用者の依頼で直接起こした)
Test plan
bash scripts/build-runtime-plugins.sh --check— 生成物は最新python3 scripts/check-skill-frontmatter.py— 通過(codex の初期一覧 10753 / 15177 文字)python3 scripts/check-skill-repo-assumptions.py— 通過python3 scripts/check-doc-staleness.py --root .— 通過python3 scripts/check-markdown-links.py --root .— 通過uv run --frozen --project . --all-extras pytest . -q -n 4— 10412 passed, 1 failed(下の既存の失敗)bash scripts/validate-runtime-plugins.sh— 8 errors(下の既存の失敗)未検証の項目: Codex・Kiro・agy での実際の発動(Claude Code では手順どおりに使って alpha の E2E を通した)
既存の失敗:
validate-runtime-plugins.shの 8 errors はエージェント定義のmodel(Invalid model tier sonnet)に対するもので、変更前のdevelopでも同じ 8 件が出るtest_external_ai_run.py::test_success_returns_file[agy]は、手元の環境で agy の CLI が起動できない(launch_failed)ため。今回の変更は agy の起動に触れていない範囲外と判断したもの: 中継コンテナを立てる処理のスクリプト化(いまは本文のコマンド 1 つで足りる)
影響範囲
start-host-chrome.shを削除。CDP 接続の説明は/ndf:chrome-cdpへ)🤖 Generated with Claude Code
https://claude.ai/code/session_01KYHP7zFtYgAYtprVz6q6a2