[{"data":1,"prerenderedAt":329},["ShallowReactive",2],{"navigation_docs":3,"-providers-attach":100,"-providers-attach-surround":326},[4,52],{"title":5,"path":6,"stem":7,"children":8,"icon":51},"Guide","\u002Fguide","1.guide\u002F01.index",[9,11,15,19,23,27,31,35,39,43,47],{"title":10,"path":6,"stem":7},"Getting Started",{"title":12,"path":13,"stem":14},"Scrape","\u002Fguide\u002Fscrape","1.guide\u002F02.scrape",{"title":16,"path":17,"stem":18},"Screenshots and PDFs","\u002Fguide\u002Fcaptures","1.guide\u002F03.captures",{"title":20,"path":21,"stem":22},"Links and accessibility and extract","\u002Fguide\u002Freading","1.guide\u002F04.reading",{"title":24,"path":25,"stem":26},"WebMCP","\u002Fguide\u002Fwebmcp","1.guide\u002F05.webmcp",{"title":28,"path":29,"stem":30},"Crawl and search","\u002Fguide\u002Fcrawl","1.guide\u002F06.crawl",{"title":32,"path":33,"stem":34},"Sessions","\u002Fguide\u002Fsessions","1.guide\u002F07.sessions",{"title":36,"path":37,"stem":38},"CLI","\u002Fguide\u002Fcli","1.guide\u002F08.cli",{"title":40,"path":41,"stem":42},"MCP, Pi, OMP and AI SDK","\u002Fguide\u002Fagents","1.guide\u002F09.agents",{"title":44,"path":45,"stem":46},"Errors","\u002Fguide\u002Ferrors","1.guide\u002F10.errors",{"title":48,"path":49,"stem":50},"Custom providers","\u002Fguide\u002Fcustom","1.guide\u002F11.custom","i-lucide-book-open",{"title":53,"path":54,"stem":55,"children":56,"icon":99},"Providers","\u002Fproviders","2.providers\u002F00.index",[57,59,63,67,71,75,79,83,87,91,95],{"title":58,"path":54,"stem":55},"Every provider",{"title":60,"path":61,"stem":62},"Steel","\u002Fproviders\u002Fsteel","2.providers\u002F01.steel",{"title":64,"path":65,"stem":66},"Browserbase","\u002Fproviders\u002Fbrowserbase","2.providers\u002F02.browserbase",{"title":68,"path":69,"stem":70},"Kernel","\u002Fproviders\u002Fkernel","2.providers\u002F03.kernel",{"title":72,"path":73,"stem":74},"Browserless","\u002Fproviders\u002Fbrowserless","2.providers\u002F04.browserless",{"title":76,"path":77,"stem":78},"Hyperbrowser","\u002Fproviders\u002Fhyperbrowser","2.providers\u002F05.hyperbrowser",{"title":80,"path":81,"stem":82},"Anchor","\u002Fproviders\u002Fanchor","2.providers\u002F06.anchor",{"title":84,"path":85,"stem":86},"Cloudflare","\u002Fproviders\u002Fcloudflare","2.providers\u002F07.cloudflare",{"title":88,"path":89,"stem":90},"Playwright","\u002Fproviders\u002Fplaywright","2.providers\u002F08.playwright",{"title":92,"path":93,"stem":94},"Lightpanda","\u002Fproviders\u002Flightpanda","2.providers\u002F09.lightpanda",{"title":96,"path":97,"stem":98},"Attach","\u002Fproviders\u002Fattach","2.providers\u002F10.attach","i-lucide-server",{"id":101,"title":96,"body":102,"description":319,"extension":320,"links":321,"meta":322,"navigation":323,"path":97,"seo":324,"stem":98,"__hash__":325},"docs\u002F2.providers\u002F10.attach.md",{"type":103,"value":104,"toc":312},"minimark",[105,109,117,128,133,148,155,184,188,203,222,239,245,255,259,270,280,283,293,296,306,309],[106,107],"provider-facts",{"name":108},"attach",[110,111,112,113,116],"p",{},"Want your agent to read a borrowed archive.org book? Or an SSO dashboard? ",[114,115,108],"code",{}," reads the tabs in your own browser. Your logins stay where they are. No new browser and no key.",[110,118,119,120,123,124,127],{},"Choose it with ",[114,121,122],{},"-p attach"," or ",[114,125,126],{},"provider: \"attach\"",". A call without a provider never lands here. That's a good boundary. This browser belongs to you.",[129,130,132],"h2",{"id":131},"start-the-browser","Start the browser",[110,134,135,136,139,140,143,144,147],{},"Chrome and Chromium use CDP through ",[114,137,138],{},"playwright-core",". Start the browser with ",[114,141,142],{},"--remote-debugging-port=9222",". Since Chrome 136, that switch is ignored on the default profile. Chrome wants a separate ",[114,145,146],{},"--user-data-dir",". Log in once inside that profile.",[110,149,150,151,154],{},"Firefox and its forks use WebDriver BiDi. Start Firefox with ",[114,152,153],{},"--remote-debugging-port 9222",". Firefox has no such profile restriction. Neither protocol needs a separate client installed. BiDi uses Node's own WebSocket.",[110,156,157,158,161,162,165,166,168,169,172,173,176,177,180,181,183],{},"Which one does it pick? On an ",[114,159,160],{},"http:\u002F\u002F"," address, Chromium advertises its socket at ",[114,163,164],{},"\u002Fjson\u002Fversion",". Firefox returns 404, so ",[114,167,108],{}," uses ",[114,170,171],{},"ws:\u002F\u002Fhost:port\u002Fsession",". A ",[114,174,175],{},"ws:\u002F\u002F"," path of ",[114,178,179],{},"\u002Fsession"," selects BiDi. Other ",[114,182,175],{}," paths select CDP.",[129,185,187],{"id":186},"connect-and-pick-a-tab","Connect and pick a tab",[110,189,190,191,194,195,198,199,202],{},"The default address is ",[114,192,193],{},"http:\u002F\u002F127.0.0.1:9222",". Set ",[114,196,197],{},"ATTACH_URL"," to override it. In the library, use ",[114,200,201],{},"create(\"attach\", { baseURL })",".",[110,204,205,206,209,210,213,214,217,218,221],{},"Only loopback hosts are allowed: ",[114,207,208],{},"localhost",", any ",[114,211,212],{},"127.x.x.x"," address, or ",[114,215,216],{},"[::1]",". Other hosts raise ",[114,219,220],{},"InvalidInputError"," before connecting. Your debugging port doesn't get a free trip elsewhere.",[110,223,224,225,227,228,231,232,235,236,202],{},"Which tab? The URL names one. It doesn't load a page. First, ",[114,226,108],{}," looks for an exact address, ignoring the fragment. Otherwise, it picks the first tab under that address. ",[114,229,230],{},"\u002Fbook"," matches ",[114,233,234],{},"\u002Fbook\u002Fpage\u002F3",", not ",[114,237,238],{},"\u002Fbookshelf",[110,240,241,242,244],{},"No match? ",[114,243,220],{}," lists open tabs, up to twenty. If there are more, it adds \"and N more\". The agent can pick from what's actually open.",[246,247,253],"pre",{"className":248,"code":250,"language":251,"meta":252},[249],"language-text","$ browsers scrape https:\u002F\u002Fexample.com\u002Fborrowed -p attach\nNo open tab at https:\u002F\u002Fexample.com\u002Fborrowed. attach reads tabs you opened and never loads a page itself. Open tabs: https:\u002F\u002Fexample.com\u002F.\n","text","",[114,254,250],{"__ignoreMap":252},[129,256,258],{"id":257},"read-without-taking-over","Read without taking over",[110,260,261,262,265,266,269],{},"Scrape returns the current title, HTML, text and links. Its result URL includes the tab's fragment. There's no status code. Nothing was loaded. ",[114,263,264],{},"waitFor"," works, and ",[114,267,268],{},"links"," works without a session.",[110,271,272,273,276,277,279],{},"Screenshots support PNG and JPEG, not WebP. ",[114,274,275],{},"selector"," captures an element cut from the viewport. Full page and ",[114,278,264],{}," work too.",[110,281,282],{},"A screenshot brings its tab to the front. Chrome only paints the visible tab. A background tab that had just scrolled took up to 20 seconds to give a frame. That's the visible interruption. No mouse grabbing.",[110,284,285,288,289,292],{},[114,286,287],{},"navigate()"," throws ",[114,290,291],{},"UnsupportedOperationError",". Attach never navigates or closes a tab or browser. Releasing a session only disconnects.",[129,294,32],{"id":295},"sessions",[110,297,298,301,302,305],{},[114,299,300],{},"createSession()"," connects to the browser. The first scrape or screenshot with a URL picks a tab. The session keeps it for ",[114,303,304],{},"evaluate(script, session)",". Evaluate before that pick fails with \"This attach session has no tab yet\".",[110,307,308],{},"Firefox allows one BiDi session at a time. Calls without a session open and end one, even on failure. A held session takes the slot. Other calls fail until you release it. The CLI releases attach sessions before exiting.",[110,310,311],{},"There's no crawl, PDF, search, extract or accessibility tree. Sessions expose no CDP URL either.",{"title":252,"searchDepth":313,"depth":313,"links":314},2,[315,316,317,318],{"id":131,"depth":313,"text":132},{"id":186,"depth":313,"text":187},{"id":257,"depth":313,"text":258},{"id":295,"depth":313,"text":32},"Read open tabs in your own logged-in browser","md",null,{},true,{"title":96,"description":319},"cpWQiHtbQfavwEtAsD5BD5SyeEm0TGTmfEu4d_wWxzM",[327,321],{"title":92,"path":93,"stem":94,"description":328,"children":-1},"A local headless browser with no key or bill, plus a cloud option",1795526332760]