[{"data":1,"prerenderedAt":504},["ShallowReactive",2],{"navigation_docs":3,"-about-shape":124,"-about-shape-surround":499},[4,28],{"title":5,"path":6,"stem":7,"children":8,"icon":27},"About","\u002Fabout","1.about\u002F1.index",[9,11,15,19,23],{"title":10,"path":6,"stem":7},"Overview",{"title":12,"path":13,"stem":14},"The shape","\u002Fabout\u002Fshape","1.about\u002F2.shape",{"title":16,"path":17,"stem":18},"Surfaces","\u002Fabout\u002Fsurfaces","1.about\u002F3.surfaces",{"title":20,"path":21,"stem":22},"Conventions","\u002Fabout\u002Fconventions","1.about\u002F4.conventions",{"title":24,"path":25,"stem":26},"Security","\u002Fabout\u002Fsecurity","1.about\u002F5.security","i-lucide-book-open",{"title":29,"path":30,"stem":31,"children":32,"icon":123},"Libraries","\u002Flibraries","2.libraries\u002F0.index",[33,35,39,43,47,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,111,115,119],{"title":34,"path":30,"stem":31},"All libraries",{"title":36,"path":37,"stem":38},"web","\u002Flibraries\u002Fweb","2.libraries\u002F01.web",{"title":40,"path":41,"stem":42},"archives","\u002Flibraries\u002Farchives","2.libraries\u002F02.archives",{"title":44,"path":45,"stem":46},"registries","\u002Flibraries\u002Fregistries","2.libraries\u002F03.registries",{"title":48,"path":49,"stem":50},"forges","\u002Flibraries\u002Fforges","2.libraries\u002F04.forges",{"title":52,"path":53,"stem":54},"keys","\u002Flibraries\u002Fkeys","2.libraries\u002F05.keys",{"title":56,"path":57,"stem":58},"harnesses","\u002Flibraries\u002Fharnesses","2.libraries\u002F06.harnesses",{"title":60,"path":61,"stem":62},"explorers","\u002Flibraries\u002Fexplorers","2.libraries\u002F07.explorers",{"title":64,"path":65,"stem":66},"chains","\u002Flibraries\u002Fchains","2.libraries\u002F08.chains",{"title":68,"path":69,"stem":70},"ciphers","\u002Flibraries\u002Fciphers","2.libraries\u002F09.ciphers",{"title":72,"path":73,"stem":74},"puzzles","\u002Flibraries\u002Fpuzzles","2.libraries\u002F10.puzzles",{"title":76,"path":77,"stem":78},"browsers","\u002Flibraries\u002Fbrowsers","2.libraries\u002F11.browsers",{"title":80,"path":81,"stem":82},"sessions","\u002Flibraries\u002Fsessions","2.libraries\u002F12.sessions",{"title":84,"path":85,"stem":86},"memory","\u002Flibraries\u002Fmemory","2.libraries\u002F13.memory",{"title":88,"path":89,"stem":90},"urls","\u002Flibraries\u002Furls","2.libraries\u002F14.urls",{"title":92,"path":93,"stem":94},"nodes","\u002Flibraries\u002Fnodes","2.libraries\u002F15.nodes",{"title":96,"path":97,"stem":98},"nfts","\u002Flibraries\u002Fnfts","2.libraries\u002F16.nfts",{"title":100,"path":101,"stem":102},"storages","\u002Flibraries\u002Fstorages","2.libraries\u002F17.storages",{"title":104,"path":105,"stem":106},"maps","\u002Flibraries\u002Fmaps","2.libraries\u002F18.maps",{"title":108,"path":109,"stem":110},"lyrics","\u002Flibraries\u002Flyrics","2.libraries\u002F19.lyrics",{"title":112,"path":113,"stem":114},"books","\u002Flibraries\u002Fbooks","2.libraries\u002F20.books",{"title":116,"path":117,"stem":118},"wiki","\u002Flibraries\u002Fwiki","2.libraries\u002F21.wiki",{"title":120,"path":121,"stem":122},"ox","\u002Flibraries\u002Fox","2.libraries\u002F22.ox","i-lucide-library",{"id":125,"title":12,"body":126,"description":493,"extension":494,"links":495,"meta":496,"navigation":239,"path":13,"seo":497,"stem":14,"__hash__":498},"docs\u002F1.about\u002F2.shape.md",{"type":127,"value":128,"toc":487},"minimark",[129,133,138,158,331,338,342,361,372,376,383,461,476,480,483],[130,131,132],"p",{},"Every library has the same skeleton. Learn one, you know the rest.",[134,135,137],"h2",{"id":136},"registry-and-adapters","Registry and adapters",[130,139,140,141,145,146,149,150,153,154,157],{},"A provider is a class. In most libraries it registers itself under a name when the module loads and ",[142,143,144],"code",{},"create(name)"," looks it up, so there's no switch statement to extend. A custom provider is one class and one ",[142,147,148],{},"register()"," call. A few libraries expose a factory instead, ",[142,151,152],{},"createArchive()"," in archives, ",[142,155,156],{},"createProvider()"," in forges, same idea.",[159,160,165],"pre",{"className":161,"code":162,"language":163,"meta":164,"style":164},"language-ts shiki shiki-themes github-light github-light poimandres","import { create, register } from \"@agntn\u002Fweb\";\nimport { MyEngine } from \".\u002Fmy-engine\";\n\nregister(MyEngine);\n\nconst provider = create(\"my-engine\");\nconst answer = await provider.search({ query: \"typescript 7 native\" });\n","ts","",[142,166,167,211,234,241,258,263,290],{"__ignoreMap":164},[168,169,172,176,180,184,187,190,193,197,201,205,208],"span",{"class":170,"line":171},"line",1,[168,173,175],{"class":174},"sP0CR","import",[168,177,179],{"class":178},"sKlNE"," {",[168,181,183],{"class":182},"snHMy"," create",[168,185,186],{"class":178},",",[168,188,189],{"class":182}," register",[168,191,192],{"class":178}," }",[168,194,196],{"class":195},"stCPd"," from",[168,198,200],{"class":199},"scVjq"," \"",[168,202,204],{"class":203},"sQ7BG","@agntn\u002Fweb",[168,206,207],{"class":199},"\"",[168,209,210],{"class":178},";\n",[168,212,214,216,218,221,223,225,227,230,232],{"class":170,"line":213},2,[168,215,175],{"class":174},[168,217,179],{"class":178},[168,219,220],{"class":182}," MyEngine",[168,222,192],{"class":178},[168,224,196],{"class":195},[168,226,200],{"class":199},[168,228,229],{"class":203},".\u002Fmy-engine",[168,231,207],{"class":199},[168,233,210],{"class":178},[168,235,237],{"class":170,"line":236},3,[168,238,240],{"emptyLinePlaceholder":239},true,"\n",[168,242,244,248,251,255],{"class":170,"line":243},4,[168,245,247],{"class":246},"sULi6","register",[168,249,250],{"class":178},"(",[168,252,254],{"class":253},"spVlQ","MyEngine",[168,256,257],{"class":178},");\n",[168,259,261],{"class":170,"line":260},5,[168,262,240],{"emptyLinePlaceholder":239},[168,264,266,270,274,277,279,281,283,286,288],{"class":170,"line":265},6,[168,267,269],{"class":268},"s1TYA","const",[168,271,273],{"class":272},"saoiD"," provider",[168,275,276],{"class":268}," =",[168,278,183],{"class":246},[168,280,250],{"class":178},[168,282,207],{"class":199},[168,284,285],{"class":203},"my-engine",[168,287,207],{"class":199},[168,289,257],{"class":178},[168,291,293,295,298,300,304,306,309,312,315,318,321,323,326,328],{"class":170,"line":292},7,[168,294,269],{"class":268},[168,296,297],{"class":272}," answer",[168,299,276],{"class":268},[168,301,303],{"class":302},"sZW6a"," await",[168,305,273],{"class":253},[168,307,308],{"class":178},".",[168,310,311],{"class":246},"search",[168,313,314],{"class":178},"({",[168,316,317],{"class":182}," query",[168,319,320],{"class":178},":",[168,322,200],{"class":199},[168,324,325],{"class":203},"typescript 7 native",[168,327,207],{"class":199},[168,329,330],{"class":178}," });\n",[130,332,333,334,337],{},"The registry is also how the tools know what exists. When a tool validates the ",[142,335,336],{},"provider"," argument it asks the registry, so a provider you registered yourself works in a tool call too.",[134,339,341],{"id":340},"normalized-types","Normalized types",[130,343,344,345,348,349,352,353,356,357,360],{},"Every method answers the shared type of its domain. A search result is ",[142,346,347],{},"{ url, title, snippet }"," with score, dates and highlights when the engine has them. A package is ",[142,350,351],{},"{ name, version, license, repository }"," with the license normalized to SPDX. An archived page is ",[142,354,355],{},"{ url, timestamp, snapshot }"," with provider extras under ",[142,358,359],{},"_meta",". Upstream quirks get mapped inside the adapter and never show up in the public types.",[130,362,363,364,367,368,371],{},"When a provider can't do what you asked, the library says so instead of dropping it. A filter the engine can't apply lands in ",[142,365,366],{},"ignoredFilters",". A provider that fails inside a fan out lands in ",[142,369,370],{},"errors"," while the others still answer.",[134,373,375],{"id":374},"typed-errors","Typed errors",[130,377,378,379,382],{},"Failures are values with a class, never a bare ",[142,380,381],{},"Error"," with a string you have to parse. The exact set depends on what can go wrong in the domain. These are the ones the network libraries share:",[384,385,386,401],"table",{},[387,388,389],"thead",{},[390,391,392,395,398],"tr",{},[393,394,381],"th",{},[393,396,397],{},"Meaning",[393,399,400],{},"Found in",[402,403,404,422,435,448],"tbody",{},[390,405,406,412,419],{},[407,408,409],"td",{},[142,410,411],{},"RateLimitError",[407,413,414,415,418],{},"Provider throttled the call, carries ",[142,416,417],{},"retryAfter"," when known",[407,420,421],{},"web, registries, forges, explorers, ciphers",[390,423,424,429,432],{},[407,425,426],{},[142,427,428],{},"NotFoundError",[407,430,431],{},"The thing you asked for doesn't exist upstream",[407,433,434],{},"registries, forges, explorers",[390,436,437,442,445],{},[407,438,439],{},[142,440,441],{},"HTTPError",[407,443,444],{},"Any other upstream failure, key already redacted from the URL",[407,446,447],{},"web, registries, explorers",[390,449,450,455,458],{},[407,451,452],{},[142,453,454],{},"AuthError",[407,456,457],{},"Missing or rejected credential",[407,459,460],{},"web, explorers",[130,462,463,464,467,468,471,472,475],{},"Network calls take an abort ",[142,465,466],{},"signal",", so an agent host can cancel a tool call and the request actually stops. Libraries that fan out over several providers, web and archives among them, also take a ",[142,469,470],{},"concurrency"," bound. web adds a ",[142,473,474],{},"deadline"," on top.",[134,477,479],{"id":478},"configuration","Configuration",[130,481,482],{},"Keys come from the environment when a provider is created. A provider without a key is reported as not configured instead of blowing up later. Hosts and timeouts are constructor options. Nothing is read from a config file the library made up.",[484,485,486],"style",{},"html pre.shiki code .sP0CR, html code.shiki .sP0CR{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#5DE4C7}html pre.shiki code .sKlNE, html code.shiki .sKlNE{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#A6ACCD}html pre.shiki code .snHMy, html code.shiki .snHMy{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#ADD7FF}html pre.shiki code .stCPd, html code.shiki .stCPd{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#A6ACCD}html pre.shiki code .scVjq, html code.shiki .scVjq{--shiki-light:#032F62;--shiki-default:#032F62;--shiki-dark:#A6ACCD}html pre.shiki code .sQ7BG, html code.shiki .sQ7BG{--shiki-light:#032F62;--shiki-default:#032F62;--shiki-dark:#5DE4C7}html pre.shiki code .sULi6, html code.shiki .sULi6{--shiki-light:#6F42C1;--shiki-default:#6F42C1;--shiki-dark:#E4F0FBD0}html pre.shiki code .spVlQ, html code.shiki .spVlQ{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#E4F0FB}html pre.shiki code .s1TYA, html code.shiki .s1TYA{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#91B4D5}html pre.shiki code .saoiD, html code.shiki .saoiD{--shiki-light:#005CC5;--shiki-default:#005CC5;--shiki-dark:#E4F0FB}html pre.shiki code .sZW6a, html code.shiki .sZW6a{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#5DE4C7C0}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":164,"searchDepth":213,"depth":213,"links":488},[489,490,491,492],{"id":136,"depth":213,"text":137},{"id":340,"depth":213,"text":341},{"id":374,"depth":213,"text":375},{"id":478,"depth":213,"text":479},"How an agntn library is built, from the adapter that registers itself to the normalized answer and the typed error.","md",null,{},{"title":12,"description":493},"R49soN7QdQG66MXUdhegHuVze4Wksk2mHbyZM1gZ0BA",[500,502],{"title":10,"path":6,"stem":7,"description":501,"children":-1},"Agnostic TypeScript libraries, one per domain, that give an AI agent and a human the same interface over many providers.",{"title":16,"path":17,"stem":18,"description":503,"children":-1},"Library, CLI, AI SDK tool, MCP server, Pi extension and OMP extension, all calling the same executors.",1789773068617]