// DOCUMENTATION

LP CDP domain

Koko's custom CDP namespace for AI extraction and stable backend-node actions.

Protocols

LP.* is Koko's custom CDP domain for agent-oriented automation — token-efficient extraction, semantic DOM, and stable backendNodeId handles that survive better than fragile CSS selectors.

Extraction APIs

CDP methodSDK equivalentDescription
LP.getMarkdownpage.markdown()Token-efficient page text
LP.getSemanticTreepage.semanticTree()Pruned a11y DOM for LLMs
LP.getStructuredDatapage.getStructuredData()JSON-LD, OpenGraph, meta
LP.detectFormspage.detectForms()Form schema + field IDs
LP.getInteractiveElementspage.getInteractiveElements()Clickable/focusable inventory

Node actions

CDP methodSDK equivalent
LP.fillNodepage.node(id).fill()
LP.clickNodepage.node(id).click()
LP.hoverNodepage.node(id).hover()
LP.pressKeypage.node(id).press()
LP.selectOptionNodepage.node(id).selectOption()
LP.setCheckedNodepage.node(id).check() / uncheck()
LP.getNodeDetailspage.waitForSelectorHandle()
LP.handleJavaScriptDialogpage.armDialog()

Agent workflow example

const [search] = await page.findElement({ role: "combobox", name: "search" });
const input = page.node(search.backendNodeId!);
await input.fill("Koko browser");

const submit = await page.waitForSelectorHandle('input[name="btnK"]');
await submit.click();

Navigation wait

waitUntil: "done" is the MCP default and LP-aware navigation wait — stricter than Playwright networkidle.

Known limitations

  • LP.clickNode can hang on some submit buttons that trigger full navigation
  • Do not infer click health from fill health — different synchronization paths

Handlers implemented in src/protocols/cdp/domains/lp.zig.