docs: simplify agent-browser usage (auto CDP connect)#104
Open
ninyawee wants to merge 6 commits intovercel-labs:mainfrom
Open
docs: simplify agent-browser usage (auto CDP connect)#104ninyawee wants to merge 6 commits intovercel-labs:mainfrom
ninyawee wants to merge 6 commits intovercel-labs:mainfrom
Conversation
added 6 commits
April 6, 2026 15:29
`getLogPath()` always returned the most recently started session's log file, ignoring which directory the user is in. In a monorepo with multiple d3k instances running simultaneously, this means `d3k logs` could show logs from the wrong project. Now uses `getProjectName()` to match the current directory's session first, falling back to the most recent session if no match is found.
`d3k agent-browser` currently requires `--cdp $(d3k cdp-port)` on every invocation because it just forwards args to the binary without session awareness. Since d3k already tracks the CDP URL in session.json, auto-inject `--cdp` when the user hasn't provided one. Also extracts `getSessionCdpPort()` to deduplicate the CDP port resolution logic between `runLocalBrowserTool` and `cdp-port` command.
Extract duplicated `findActiveSessions()` from 5 command files into a shared `utils/session.ts` with `findCurrentSession()` that uses `getProjectName()` to prefer the session matching the current working directory. Commands fixed: - `d3k errors` — was showing wrong project's errors - `d3k fix` — was analyzing wrong project's logs - `d3k crawl` — was crawling wrong project's app URL - `d3k find-component` — was using wrong project's CDP Also removes hardcoded `--cdp 9222` from crawl and find-component (now handled by the auto-inject in cli.ts from the previous PR). Net: -312 lines added, +107 lines removed (205 lines deleted).
agent-browser's `--cdp <port>` flag is broken (always falls back to 9222). The working approach is `agent-browser connect <port>` which establishes a persistent daemon connection. Change auto-inject from prepending `--cdp <port>` to running `connect <port>` before the user's command. Update AGENTS.md and both SKILL.md files to reflect the simplified usage.
Contributor
|
Someone is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
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
Updates AGENTS.md and both SKILL.md files to remove manual
--cdp $(d3k cdp-port)boilerplate from all examples.With #103,
d3k agent-browserauto-connects to the session's CDP port before running the user's command. The docs now reflect this:Files changed
AGENTS.md— remove CDP_PORT variable, simplify browser examplessrc/skills/d3k/SKILL.md— update Browser Interaction, Fix Workflow, Screenshots sectionsskills/d3k/SKILL.md— update CDP Browser Control and Examples sectionsDepends on #103.