agentleFS
xun404xun404/dsh-pihuo-plugins/.agents/skills/development-cdp/SKILL.md

development-cdp

Skill2 starsChanged 3 months agoMITView on GitHub

Inspect and automate the DeepSeek Harness Web UI through Chrome DevTools Protocol (CDP). Use when verifying dsh-pihuo plugins in the browser, checking startup, composer, or tool cards, taking screenshots, or running scripts/cdp-check.mjs. Triggers: CDP, Chrome remote debugging, pageinfo, "网页调试", /development-cdp.

  • Installs packages

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Do not --patch packages/bundle/cordis.patch.yml against a stock web profile: those names are not in the profile, and empty args refuse …

    line 55
  2. Distinctive:

    Wait for both before automating:

    line 68
  3. Very specific:

    React inputs ignore .value =: Use the native setter + input.

    line 130
  4. Distinctive:

    Never bind CDP off loopback: No application auth on the debug port.

    line 135

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Development CDP (dsh Web)

This repo's UI is the dsh browser app, not PiHuo's Electron shell. Drive a Chrome/Chromium tab whose origin is the dsh host. Do not attach to a random tab, and do not treat router-agents :8315 as this project.

Authoritative checker: scripts/cdp-check.mjs (no extra npm deps; Node 22+).

Process map

Two processes, restarted separately:

ProcessDefaultRole
dsh hosthttp://127.0.0.1:3080Cordis tree, /api, /plugins/<id>/client.js
Chrome with CDP127.0.0.1:9222The actual Web UI

Web profile disables shared HMR. A plugin source change needs a dsh restart (and a hard reload). A stale host serves an old __DSH_BOOT__.

Packaged Chrome without --remote-debugging-port cannot be attached after the fact.

Start

From this repo, after pnpm build:

node scripts/write-dev-patch.mjs /tmp/dsh-pihuo-web.patch.yml

# npm-published launcher (no harness build)
npx --yes @deepseek-ai/dsh web --patch /tmp/dsh-pihuo-web.patch.yml

# or a source checkout after `pnpm install && pnpm run build`
pnpm --dir ../deepseek-harness dsh web --patch /tmp/dsh-pihuo-web.patch.yml

write-dev-patch.mjs writes package-name rows and symlinks this checkout into $DSH_HOME/profiles/web/node_modules. NODE_PATH is not enough: Node ESM import() ignores it. Do not use absolute src/index.ts paths for a dsh.client package: client-modules keys the graph by Loader name, and a path id will not match lib/client.js.

Do not --patch packages/bundle/cordis.patch.yml against a stock web profile: those names are not in the profile, and empty args refuse start().

Chrome (loopback only — CDP has no auth):

"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
  --remote-debugging-port=9222 \
  --user-data-dir=/tmp/dsh-pihuo-cdp \
  http://127.0.0.1:3080

Wait for both before automating:

curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:3080/
node scripts/cdp-check.mjs wait

Override ports:

CDP_PORT=9333 DSH_WEB_ORIGIN=127.0.0.1:8080 node scripts/cdp-check.mjs pageinfo

Commands

node scripts/cdp-check.mjs list               # CDP targets
node scripts/cdp-check.mjs wait               # CDP + origin ready
node scripts/cdp-check.mjs pageinfo           # first call every session
node scripts/cdp-check.mjs console
node scripts/cdp-check.mjs dom '[data-composer-card]'
node scripts/cdp-check.mjs text '[data-acp-worker]'
node scripts/cdp-check.mjs eval "<js>"        # awaitPromise: true
node scripts/cdp-check.mjs shot /tmp/dsh.png

pageinfo reports URL, composer presence, [data-acp-worker] count, chat anchors, and __DSH_BOOT__.entries ids (the wire is { rev, entries }, not .plugins). The UI plugin is composed when hasUiAcpWorker is true.

Client bundle format: dsh-plugin-client.

Driving chat

Stateful inspection: eval in the page. Gestures you must see: DOM clicks. Prefer visible text over :nth-child.

React controlled composer — native setter + input:

node scripts/cdp-check.mjs eval "(() => {
  const ta = document.querySelector('[data-composer-card] textarea');
  if (!ta) return 'no textarea';
  const set = Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, 'value').set;
  set.call(ta, 'Call acp_worker to list the workspace root.');
  ta.dispatchEvent(new Event('input', { bubbles: true }));
  return { value: ta.value, phase: ta.getAttribute('data-phase') };
})()"

Scope reads to the visible conversation. Prefer [data-composer-card] in the visible column and [data-chat-anchor-key] for tool rows. Our Worker row is [data-acp-worker]. Missing after a completed acp_worker call means the generic card ran — the client factory is not in the boot graph, or lib/client.js is not a __ModuleLoader__ bundle.

Pitfalls

  1. Wait for the host, not just CDP. A Chrome tab on a down :3080 is an error page. pageinfo.url must contain the dsh origin.
  2. This is not Electron. PiHuo's :8315 and window.routerAgents do not exist here. Do not curl :4111.
  3. React inputs ignore .value =. Use the native setter + input.
  4. HMR is off on the web profile. Restart dsh after plugin edits.
  5. __DSH_BOOT__ is { rev, entries }. entries[].id is the loader name (the package name for a dsh.client row).
  6. eval accepts await. Wrap fetches in an async IIFE.
  7. Never bind CDP off loopback. No application auth on the debug port.
  8. Do not session.append new event types to “make CDP see a node.” Chat state comes from first-party tool/call / tool/result (see HANDOVER).
  9. Pick the dsh tab. list then confirm DSH_WEB_ORIGIN; DevTools windows are skipped, other localhost tabs are not.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.