[{"data":1,"prerenderedAt":1457},["ShallowReactive",2],{"docs-navigation":3,"docs-\u002Fdocs\u002Fapi\u002Ftypescript-sdk":213},[4],{"title":5,"path":6,"stem":7,"children":8,"page":30},"Docs","\u002Fdocs","docs",[9,31,56,98,118,138,163],{"title":10,"description":11,"group":11,"path":12,"stem":13,"children":14,"page":30},"Getting started",null,"\u002Fdocs\u002Fgetting-started","docs\u002F1.getting-started",[15,20,25],{"title":16,"path":17,"stem":18,"description":19,"group":11},"Overview","\u002Fdocs\u002Fgetting-started\u002Foverview","docs\u002F1.getting-started\u002F1.overview","What Shruwd does and what you get out of it.",{"title":21,"path":22,"stem":23,"description":24,"group":11},"Quickstart","\u002Fdocs\u002Fgetting-started\u002Fquickstart","docs\u002F1.getting-started\u002F2.quickstart","From an empty account to your first measurement.",{"title":26,"path":27,"stem":28,"description":29,"group":11},"Reading your results","\u002Fdocs\u002Fgetting-started\u002Freading-your-results","docs\u002F1.getting-started\u002F3.reading-your-results","What the four numbers mean, and when to trust them.",false,{"title":32,"description":11,"group":11,"path":33,"stem":34,"children":35,"page":30},"What you track","\u002Fdocs\u002Ftracking","docs\u002F2.tracking",[36,41,46,51],{"title":37,"path":38,"stem":39,"description":40,"group":11},"Brands","\u002Fdocs\u002Ftracking\u002Fbrands","docs\u002F2.tracking\u002F1.brands","Add, rename and archive the brands you measure.",{"title":42,"path":43,"stem":44,"description":45,"group":11},"Prompts","\u002Fdocs\u002Ftracking\u002Fprompts","docs\u002F2.tracking\u002F2.prompts","Choose and manage the questions Shruwd asks each engine.",{"title":47,"path":48,"stem":49,"description":50,"group":11},"Competitors","\u002Fdocs\u002Ftracking\u002Fcompetitors","docs\u002F2.tracking\u002F3.competitors","Track the brands you are compared against, and how they are matched.",{"title":52,"path":53,"stem":54,"description":55,"group":11},"Connecting Search Console","\u002Fdocs\u002Ftracking\u002Fconnecting-search-console","docs\u002F2.tracking\u002F4.connecting-search-console","Add per-page search demand so two diagnostics can run.",{"title":57,"description":11,"group":11,"path":58,"stem":59,"children":60,"page":30},"Crawler logs","\u002Fdocs\u002Fcrawler-logs","docs\u002F3.crawler-logs",[61,66,72,77,82,87,93],{"title":62,"path":63,"stem":64,"description":65,"group":11},"Choosing a log path","\u002Fdocs\u002Fcrawler-logs\u002Fchoosing-a-log-path","docs\u002F3.crawler-logs\u002F1.choosing-a-log-path","Pick the way of sending crawler logs that matches your hosting.",{"title":67,"path":68,"stem":69,"description":70,"group":71},"Platform log drains","\u002Fdocs\u002Fcrawler-logs\u002Fplatform-log-drains","docs\u002F3.crawler-logs\u002F2.platform-log-drains","Send logs from Vercel, Netlify, Fly and similar. No code.","Setup guides",{"title":73,"path":74,"stem":75,"description":76,"group":71},"Cloudflare Worker","\u002Fdocs\u002Fcrawler-logs\u002Fcloudflare-worker","docs\u002F3.crawler-logs\u002F3.cloudflare-worker","Forward crawler hits from behind Cloudflare, on any plan.",{"title":78,"path":79,"stem":80,"description":81,"group":71},"Cloudflare Logpush","\u002Fdocs\u002Fcrawler-logs\u002Fcloudflare-logpush","docs\u002F3.crawler-logs\u002F4.cloudflare-logpush","Send zone request logs straight to Shruwd. Enterprise zones, no code.",{"title":83,"path":84,"stem":85,"description":86,"group":71},"Server middleware","\u002Fdocs\u002Fcrawler-logs\u002Fserver-middleware","docs\u002F3.crawler-logs\u002F5.server-middleware","Forward crawler hits from a Nuxt or Nitro origin. Last resort.",{"title":88,"path":89,"stem":90,"description":91,"group":92},"Crawlers tracked","\u002Fdocs\u002Fcrawler-logs\u002Fcrawlers-tracked","docs\u002F3.crawler-logs\u002F6.crawlers-tracked","Which bots Shruwd recognises, and how a hit is verified.","Reference",{"title":94,"path":95,"stem":96,"description":97,"group":92},"Ingest not arriving","\u002Fdocs\u002Fcrawler-logs\u002Fingest-not-arriving","docs\u002F3.crawler-logs\u002F7.ingest-not-arriving","Diagnose a log drain that is not delivering.",{"title":99,"description":11,"group":11,"path":100,"stem":101,"children":102,"page":30},"Findings and fixes","\u002Fdocs\u002Ffindings","docs\u002F4.findings",[103,108,113],{"title":104,"path":105,"stem":106,"description":107,"group":11},"How findings work","\u002Fdocs\u002Ffindings\u002Fhow-findings-work","docs\u002F4.findings\u002F1.how-findings-work","What a finding is, how much to trust it, and how to prove your fix worked.",{"title":109,"path":110,"stem":111,"description":112,"group":11},"Rechecks","\u002Fdocs\u002Ffindings\u002Frechecks","docs\u002F4.findings\u002F2.rechecks","How Shruwd proves whether your fix moved the number.",{"title":114,"path":115,"stem":116,"description":117,"group":11},"Findings reference","\u002Fdocs\u002Ffindings\u002Ffindings-reference","docs\u002F4.findings\u002F3.findings-reference","Every diagnostic Shruwd runs, what triggers it and what to do.",{"title":119,"description":11,"group":11,"path":120,"stem":121,"children":122,"page":30},"Metrics","\u002Fdocs\u002Fmetrics","docs\u002F5.metrics",[123,128,133],{"title":124,"path":125,"stem":126,"description":127,"group":11},"Metric definitions","\u002Fdocs\u002Fmetrics\u002Fmetric-definitions","docs\u002F5.metrics\u002F1.metric-definitions","Exactly what each number counts, and when it is undefined.",{"title":129,"path":130,"stem":131,"description":132,"group":11},"Confidence and sample size","\u002Fdocs\u002Fmetrics\u002Fconfidence-and-sample-size","docs\u002F5.metrics\u002F2.confidence-and-sample-size","Why every number has a range, and why some are withheld.",{"title":134,"path":135,"stem":136,"description":137,"group":11},"When a number has moved","\u002Fdocs\u002Fmetrics\u002Fwhen-a-number-has-moved","docs\u002F5.metrics\u002F3.when-a-number-has-moved","The rule Shruwd uses before calling a change real.",{"title":139,"description":11,"group":11,"path":140,"stem":141,"children":142,"page":30},"Account","\u002Fdocs\u002Faccount","docs\u002F6.account",[143,148,153,158],{"title":144,"path":145,"stem":146,"description":147,"group":11},"Plans and limits","\u002Fdocs\u002Faccount\u002Fplans-and-limits","docs\u002F6.account\u002F1.plans-and-limits","What each plan includes and what happens when you reach a limit.",{"title":149,"path":150,"stem":151,"description":152,"group":11},"Team and roles","\u002Fdocs\u002Faccount\u002Fteam-and-roles","docs\u002F6.account\u002F2.team-and-roles","Invite people, set what they can change, and remove access.",{"title":154,"path":155,"stem":156,"description":157,"group":11},"Billing","\u002Fdocs\u002Faccount\u002Fbilling","docs\u002F6.account\u002F3.billing","Change plan, read your usage, and handle a failed payment.",{"title":159,"path":160,"stem":161,"description":162,"group":11},"Email notifications","\u002Fdocs\u002Faccount\u002Femail-notifications","docs\u002F6.account\u002F4.email-notifications","What Shruwd emails you, and how to turn it off.",{"title":164,"description":11,"group":11,"path":165,"stem":166,"children":167,"page":30},"Build on Shruwd","\u002Fdocs\u002Fapi","docs\u002F7.api",[168,173,178,182,187,192,197,203,208],{"title":169,"path":170,"stem":171,"description":172,"group":11},"API overview","\u002Fdocs\u002Fapi\u002Fapi-overview","docs\u002F7.api\u002F1.api-overview","Authentication, errors, limits and the rules every endpoint follows.",{"title":37,"path":174,"stem":175,"description":176,"group":177},"\u002Fdocs\u002Fapi\u002Fbrands","docs\u002F7.api\u002F2.brands","Create, read, rename and archive brands over the API.","Endpoints",{"title":42,"path":179,"stem":180,"description":181,"group":177},"\u002Fdocs\u002Fapi\u002Fprompts","docs\u002F7.api\u002F3.prompts","Add, edit and retire the questions asked every cycle.",{"title":183,"path":184,"stem":185,"description":186,"group":177},"Entities","\u002Fdocs\u002Fapi\u002Fentities","docs\u002F7.api\u002F4.entities","Manage the brand and its competitors, and the aliases that count.",{"title":188,"path":189,"stem":190,"description":191,"group":177},"Measurement","\u002Fdocs\u002Fapi\u002Fmeasurement","docs\u002F7.api\u002F5.measurement","Run cycles and read visibility, crawlers and individual answers.",{"title":193,"path":194,"stem":195,"description":196,"group":177},"Findings","\u002Fdocs\u002Fapi\u002Ffindings","docs\u002F7.api\u002F6.findings","Read diagnosed findings and move them through their lifecycle.",{"title":198,"path":199,"stem":200,"description":201,"group":202},"TypeScript SDK","\u002Fdocs\u002Fapi\u002Ftypescript-sdk","docs\u002F7.api\u002F7.typescript-sdk","A typed client for the Shruwd API.","Clients and agents",{"title":204,"path":205,"stem":206,"description":207,"group":202},"MCP server","\u002Fdocs\u002Fapi\u002Fmcp-server","docs\u002F7.api\u002F8.mcp-server","Give Claude or Cursor tools to run Shruwd.",{"title":209,"path":210,"stem":211,"description":212,"group":202},"For AI agents","\u002Fdocs\u002Fapi\u002Ffor-ai-agents","docs\u002F7.api\u002F9.for-ai-agents","Machine-readable versions of everything here.",{"id":214,"title":198,"body":215,"description":1451,"extension":1452,"group":202,"meta":1453,"navigation":1454,"path":199,"section":164,"seo":1455,"stem":200,"__hash__":1456},"docs\u002Fdocs\u002F7.api\u002F7.typescript-sdk.md",{"type":216,"value":217,"toc":1441},"minimark",[218,222,239,242,267,271,487,490,495,602,606,801,811,815,1091,1109,1113,1119,1254,1329,1336,1340,1343,1404,1413,1419,1423,1437],[219,220,198],"h1",{"id":221},"typescript-sdk",[223,224,225,229,230,234,235,238],"p",{},[226,227,228],"code",{},"@shruwd\u002Fsdk"," is a typed wrapper over the ",[231,232,233],"a",{"href":170},"API",". ESM, and no\nruntime dependencies beyond ",[226,236,237],{},"fetch",".",[223,240,241],{},"Its types are generated from the OpenAPI document, so the client and the contract cannot\ndrift apart.",[243,244,249],"pre",{"className":245,"code":246,"language":247,"meta":248,"style":248},"language-bash shiki shiki-themes github-light github-dark","npm install @shruwd\u002Fsdk\n","bash","",[226,250,251],{"__ignoreMap":248},[252,253,256,260,264],"span",{"class":254,"line":255},"line",1,[252,257,259],{"class":258},"sScJk","npm",[252,261,263],{"class":262},"sZZnC"," install",[252,265,266],{"class":262}," @shruwd\u002Fsdk\n",[268,269,10],"h2",{"id":270},"getting-started",[243,272,276],{"className":273,"code":274,"language":275,"meta":248,"style":248},"language-ts shiki shiki-themes github-light github-dark","import { Shruwd } from '@shruwd\u002Fsdk';\n\nconst shruwd = new Shruwd({ apiKey: process.env.SHRUWD_API_KEY! });\n\nconst brand = await shruwd.brands.create({ name: 'Waitlister', domain: 'waitlister.me' });\n\n\u002F\u002F Competitors first: the first measurement starts as soon as prompts exist.\nawait shruwd.entities.add(brand.brandId, {\n  name: 'LaunchList',\n  domains: ['getlaunchlist.com'],\n});\n\nawait shruwd.prompts.add(brand.brandId, [\n  { text: 'best waitlist software for a product launch', intent: 'commercial' },\n  { text: 'launchlist alternatives', intent: 'comparison' },\n]);\n","ts",[226,277,278,297,304,335,340,373,378,385,400,412,424,430,435,448,466,481],{"__ignoreMap":248},[252,279,280,284,288,291,294],{"class":254,"line":255},[252,281,283],{"class":282},"szBVR","import",[252,285,287],{"class":286},"sVt8B"," { Shruwd } ",[252,289,290],{"class":282},"from",[252,292,293],{"class":262}," '@shruwd\u002Fsdk'",[252,295,296],{"class":286},";\n",[252,298,300],{"class":254,"line":299},2,[252,301,303],{"emptyLinePlaceholder":302},true,"\n",[252,305,307,310,314,317,320,323,326,329,332],{"class":254,"line":306},3,[252,308,309],{"class":282},"const",[252,311,313],{"class":312},"sj4cs"," shruwd",[252,315,316],{"class":282}," =",[252,318,319],{"class":282}," new",[252,321,322],{"class":258}," Shruwd",[252,324,325],{"class":286},"({ apiKey: process.env.",[252,327,328],{"class":312},"SHRUWD_API_KEY",[252,330,331],{"class":282},"!",[252,333,334],{"class":286}," });\n",[252,336,338],{"class":254,"line":337},4,[252,339,303],{"emptyLinePlaceholder":302},[252,341,343,345,348,350,353,356,359,362,365,368,371],{"class":254,"line":342},5,[252,344,309],{"class":282},[252,346,347],{"class":312}," brand",[252,349,316],{"class":282},[252,351,352],{"class":282}," await",[252,354,355],{"class":286}," shruwd.brands.",[252,357,358],{"class":258},"create",[252,360,361],{"class":286},"({ name: ",[252,363,364],{"class":262},"'Waitlister'",[252,366,367],{"class":286},", domain: ",[252,369,370],{"class":262},"'waitlister.me'",[252,372,334],{"class":286},[252,374,376],{"class":254,"line":375},6,[252,377,303],{"emptyLinePlaceholder":302},[252,379,381],{"class":254,"line":380},7,[252,382,384],{"class":383},"sJ8bj","\u002F\u002F Competitors first: the first measurement starts as soon as prompts exist.\n",[252,386,388,391,394,397],{"class":254,"line":387},8,[252,389,390],{"class":282},"await",[252,392,393],{"class":286}," shruwd.entities.",[252,395,396],{"class":258},"add",[252,398,399],{"class":286},"(brand.brandId, {\n",[252,401,403,406,409],{"class":254,"line":402},9,[252,404,405],{"class":286},"  name: ",[252,407,408],{"class":262},"'LaunchList'",[252,410,411],{"class":286},",\n",[252,413,415,418,421],{"class":254,"line":414},10,[252,416,417],{"class":286},"  domains: [",[252,419,420],{"class":262},"'getlaunchlist.com'",[252,422,423],{"class":286},"],\n",[252,425,427],{"class":254,"line":426},11,[252,428,429],{"class":286},"});\n",[252,431,433],{"class":254,"line":432},12,[252,434,303],{"emptyLinePlaceholder":302},[252,436,438,440,443,445],{"class":254,"line":437},13,[252,439,390],{"class":282},[252,441,442],{"class":286}," shruwd.prompts.",[252,444,396],{"class":258},[252,446,447],{"class":286},"(brand.brandId, [\n",[252,449,451,454,457,460,463],{"class":254,"line":450},14,[252,452,453],{"class":286},"  { text: ",[252,455,456],{"class":262},"'best waitlist software for a product launch'",[252,458,459],{"class":286},", intent: ",[252,461,462],{"class":262},"'commercial'",[252,464,465],{"class":286}," },\n",[252,467,469,471,474,476,479],{"class":254,"line":468},15,[252,470,453],{"class":286},[252,472,473],{"class":262},"'launchlist alternatives'",[252,475,459],{"class":286},[252,477,478],{"class":262},"'comparison'",[252,480,465],{"class":286},[252,482,484],{"class":254,"line":483},16,[252,485,486],{"class":286},"]);\n",[223,488,489],{},"Constructing without a key throws immediately rather than failing on the first request.",[491,492,494],"h3",{"id":493},"options","Options",[496,497,498,513],"table",{},[499,500,501],"thead",{},[502,503,504,508,511],"tr",{},[505,506,507],"th",{},"Option",[505,509,510],{},"Default",[505,512],{},[514,515,516,530,545,559,574,586],"tbody",{},[502,517,518,524,527],{},[519,520,521],"td",{},[226,522,523],{},"apiKey",[519,525,526],{},"—",[519,528,529],{},"Required",[502,531,532,537,542],{},[519,533,534],{},[226,535,536],{},"baseUrl",[519,538,539],{},[226,540,541],{},"https:\u002F\u002Fshruwd.io\u002Fapi\u002Fv1",[519,543,544],{},"Point at a preview deployment",[502,546,547,551,556],{},[519,548,549],{},[226,550,237],{},[519,552,553,554],{},"global ",[226,555,237],{},[519,557,558],{},"Supply your own",[502,560,561,566,571],{},[519,562,563],{},[226,564,565],{},"maxRetries",[519,567,568],{},[226,569,570],{},"3",[519,572,573],{},"See below",[502,575,576,581,583],{},[519,577,578],{},[226,579,580],{},"timeoutMs",[519,582,526],{},[519,584,585],{},"Per request",[502,587,588,593,595],{},[519,589,590],{},[226,591,592],{},"client",[519,594,526],{},[519,596,597,598,601],{},"Your app’s name and version, e.g. ",[226,599,600],{},"acme-reporter\u002F2.1.0",". Sent with the SDK’s own so your usage is attributable. Never a person, an account or a secret",[268,603,605],{"id":604},"methods","Methods",[496,607,608,617],{},[499,609,610],{},[502,611,612,615],{},[505,613,614],{},"Namespace",[505,616,605],{},[514,618,619,631,655,674,692,706,720,731,747,764,776,790],{},[502,620,621,626],{},[519,622,623],{},[226,624,625],{},"workspace",[519,627,628],{},[226,629,630],{},"get()",[502,632,633,638],{},[519,634,635],{},[226,636,637],{},"brands",[519,639,640,643,644,643,647,643,649,643,652],{},[226,641,642],{},"list()"," · ",[226,645,646],{},"create()",[226,648,630],{},[226,650,651],{},"update()",[226,653,654],{},"archive()",[502,656,657,662],{},[519,658,659],{},[226,660,661],{},"prompts",[519,663,664,643,666,643,669,643,671],{},[226,665,642],{},[226,667,668],{},"add()",[226,670,651],{},[226,672,673],{},"remove()",[502,675,676,681],{},[519,677,678],{},[226,679,680],{},"entities",[519,682,683,643,685,643,687,643,690],{},[226,684,642],{},[226,686,668],{},[226,688,689],{},"set()",[226,691,673],{},[502,693,694,699],{},[519,695,696],{},[226,697,698],{},"cycles",[519,700,701,643,703],{},[226,702,642],{},[226,704,705],{},"run()",[502,707,708,713],{},[519,709,710],{},[226,711,712],{},"visibility",[519,714,715,643,717],{},[226,716,630],{},[226,718,719],{},"series()",[502,721,722,727],{},[519,723,724],{},[226,725,726],{},"crawlers",[519,728,729],{},[226,730,630],{},[502,732,733,738],{},[519,734,735],{},[226,736,737],{},"findings",[519,739,740,643,742,643,744],{},[226,741,642],{},[226,743,630],{},[226,745,746],{},"transition()",[502,748,749,754],{},[519,750,751],{},[226,752,753],{},"suggestions",[519,755,756,643,758,643,761],{},[226,757,642],{},[226,759,760],{},"accept()",[226,762,763],{},"dismiss()",[502,765,766,771],{},[519,767,768],{},[226,769,770],{},"connections",[519,772,773],{},[226,774,775],{},"createIngestToken()",[502,777,778,783],{},[519,779,780],{},[226,781,782],{},"setup",[519,784,785,643,787],{},[226,786,630],{},[226,788,789],{},"suggest()",[502,791,792,797],{},[519,793,794],{},[226,795,796],{},"answers",[519,798,799],{},[226,800,642],{},[223,802,803,804,807,808,238],{},"List calls unwrap their envelope, so ",[226,805,806],{},"brands.list()"," returns an array rather than\n",[226,809,810],{},"{ brands: [...] }",[268,812,814],{"id":813},"reading-a-metric","Reading a metric",[243,816,818],{"className":273,"code":817,"language":275,"meta":248,"style":248},"const visibility = await shruwd.visibility.get(brand.brandId, { engine: 'google_aio' });\n\n\u002F\u002F point, lo and hi are proportions from 0 to 1.\nconst pct = (x: number) => (x * 100).toFixed(1);\n\nfor (const entity of visibility.entities) {\n  const rate = entity.mentionRate;\n\n  if (rate.state === 'ok') {\n    console.log(`${entity.canonicalName}: ${pct(rate.point)}% (${pct(rate.lo)}–${pct(rate.hi)}%, n=${rate.n})`);\n  } else {\n    console.log(`${entity.canonicalName}: not enough data yet`);\n  }\n}\n",[226,819,820,845,849,854,906,910,928,941,945,962,1049,1060,1081,1086],{"__ignoreMap":248},[252,821,822,824,827,829,831,834,837,840,843],{"class":254,"line":255},[252,823,309],{"class":282},[252,825,826],{"class":312}," visibility",[252,828,316],{"class":282},[252,830,352],{"class":282},[252,832,833],{"class":286}," shruwd.visibility.",[252,835,836],{"class":258},"get",[252,838,839],{"class":286},"(brand.brandId, { engine: ",[252,841,842],{"class":262},"'google_aio'",[252,844,334],{"class":286},[252,846,847],{"class":254,"line":299},[252,848,303],{"emptyLinePlaceholder":302},[252,850,851],{"class":254,"line":306},[252,852,853],{"class":383},"\u002F\u002F point, lo and hi are proportions from 0 to 1.\n",[252,855,856,858,861,863,866,870,873,876,879,882,885,888,891,894,897,900,903],{"class":254,"line":337},[252,857,309],{"class":282},[252,859,860],{"class":258}," pct",[252,862,316],{"class":282},[252,864,865],{"class":286}," (",[252,867,869],{"class":868},"s4XuR","x",[252,871,872],{"class":282},":",[252,874,875],{"class":312}," number",[252,877,878],{"class":286},") ",[252,880,881],{"class":282},"=>",[252,883,884],{"class":286}," (x ",[252,886,887],{"class":282},"*",[252,889,890],{"class":312}," 100",[252,892,893],{"class":286},").",[252,895,896],{"class":258},"toFixed",[252,898,899],{"class":286},"(",[252,901,902],{"class":312},"1",[252,904,905],{"class":286},");\n",[252,907,908],{"class":254,"line":342},[252,909,303],{"emptyLinePlaceholder":302},[252,911,912,915,917,919,922,925],{"class":254,"line":375},[252,913,914],{"class":282},"for",[252,916,865],{"class":286},[252,918,309],{"class":282},[252,920,921],{"class":312}," entity",[252,923,924],{"class":282}," of",[252,926,927],{"class":286}," visibility.entities) {\n",[252,929,930,933,936,938],{"class":254,"line":380},[252,931,932],{"class":282},"  const",[252,934,935],{"class":312}," rate",[252,937,316],{"class":282},[252,939,940],{"class":286}," entity.mentionRate;\n",[252,942,943],{"class":254,"line":387},[252,944,303],{"emptyLinePlaceholder":302},[252,946,947,950,953,956,959],{"class":254,"line":402},[252,948,949],{"class":282},"  if",[252,951,952],{"class":286}," (rate.state ",[252,954,955],{"class":282},"===",[252,957,958],{"class":262}," 'ok'",[252,960,961],{"class":286},") {\n",[252,963,964,967,970,972,975,978,980,983,986,989,991,994,996,999,1002,1005,1007,1009,1011,1013,1016,1018,1021,1023,1025,1027,1029,1032,1034,1037,1039,1041,1044,1047],{"class":254,"line":414},[252,965,966],{"class":286},"    console.",[252,968,969],{"class":258},"log",[252,971,899],{"class":286},[252,973,974],{"class":262},"`${",[252,976,977],{"class":286},"entity",[252,979,238],{"class":262},[252,981,982],{"class":286},"canonicalName",[252,984,985],{"class":262},"}: ${",[252,987,988],{"class":258},"pct",[252,990,899],{"class":262},[252,992,993],{"class":286},"rate",[252,995,238],{"class":262},[252,997,998],{"class":286},"point",[252,1000,1001],{"class":262},")",[252,1003,1004],{"class":262},"}% (${",[252,1006,988],{"class":258},[252,1008,899],{"class":262},[252,1010,993],{"class":286},[252,1012,238],{"class":262},[252,1014,1015],{"class":286},"lo",[252,1017,1001],{"class":262},[252,1019,1020],{"class":262},"}–${",[252,1022,988],{"class":258},[252,1024,899],{"class":262},[252,1026,993],{"class":286},[252,1028,238],{"class":262},[252,1030,1031],{"class":286},"hi",[252,1033,1001],{"class":262},[252,1035,1036],{"class":262},"}%, n=${",[252,1038,993],{"class":286},[252,1040,238],{"class":262},[252,1042,1043],{"class":286},"n",[252,1045,1046],{"class":262},"})`",[252,1048,905],{"class":286},[252,1050,1051,1054,1057],{"class":254,"line":426},[252,1052,1053],{"class":286},"  } ",[252,1055,1056],{"class":282},"else",[252,1058,1059],{"class":286}," {\n",[252,1061,1062,1064,1066,1068,1070,1072,1074,1076,1079],{"class":254,"line":432},[252,1063,966],{"class":286},[252,1065,969],{"class":258},[252,1067,899],{"class":286},[252,1069,974],{"class":262},[252,1071,977],{"class":286},[252,1073,238],{"class":262},[252,1075,982],{"class":286},[252,1077,1078],{"class":262},"}: not enough data yet`",[252,1080,905],{"class":286},[252,1082,1083],{"class":254,"line":437},[252,1084,1085],{"class":286},"  }\n",[252,1087,1088],{"class":254,"line":450},[252,1089,1090],{"class":286},"}\n",[223,1092,1093,1094,1097,1098,1100,1101,1104,1105,1108],{},"Discriminating on ",[226,1095,1096],{},"state"," is not optional politeness — there is no ",[226,1099,998],{}," to read when\nthe state is ",[226,1102,1103],{},"insufficient_data",", and treating it as ",[226,1106,1107],{},"0"," is the single most common way to\nmisreport these numbers.",[268,1110,1112],{"id":1111},"errors","Errors",[223,1114,1115,1116,238],{},"Every failure throws a ",[226,1117,1118],{},"ShruwdError",[243,1120,1122],{"className":273,"code":1121,"language":275,"meta":248,"style":248},"import { Shruwd, ShruwdError } from '@shruwd\u002Fsdk';\n\ntry {\n  await shruwd.entities.add(brandId, { name: 'Arc' });\n} catch (error) {\n  if (error instanceof ShruwdError && error.code === 'context_terms_required') {\n    await shruwd.entities.add(brandId, { name: 'Arc', contextTerms: ['browser', 'The Browser Company'] });\n  } else {\n    throw error;\n  }\n}\n",[226,1123,1124,1137,1141,1148,1165,1176,1202,1230,1238,1246,1250],{"__ignoreMap":248},[252,1125,1126,1128,1131,1133,1135],{"class":254,"line":255},[252,1127,283],{"class":282},[252,1129,1130],{"class":286}," { Shruwd, ShruwdError } ",[252,1132,290],{"class":282},[252,1134,293],{"class":262},[252,1136,296],{"class":286},[252,1138,1139],{"class":254,"line":299},[252,1140,303],{"emptyLinePlaceholder":302},[252,1142,1143,1146],{"class":254,"line":306},[252,1144,1145],{"class":282},"try",[252,1147,1059],{"class":286},[252,1149,1150,1153,1155,1157,1160,1163],{"class":254,"line":337},[252,1151,1152],{"class":282},"  await",[252,1154,393],{"class":286},[252,1156,396],{"class":258},[252,1158,1159],{"class":286},"(brandId, { name: ",[252,1161,1162],{"class":262},"'Arc'",[252,1164,334],{"class":286},[252,1166,1167,1170,1173],{"class":254,"line":342},[252,1168,1169],{"class":286},"} ",[252,1171,1172],{"class":282},"catch",[252,1174,1175],{"class":286}," (error) {\n",[252,1177,1178,1180,1183,1186,1189,1192,1195,1197,1200],{"class":254,"line":375},[252,1179,949],{"class":282},[252,1181,1182],{"class":286}," (error ",[252,1184,1185],{"class":282},"instanceof",[252,1187,1188],{"class":258}," ShruwdError",[252,1190,1191],{"class":282}," &&",[252,1193,1194],{"class":286}," error.code ",[252,1196,955],{"class":282},[252,1198,1199],{"class":262}," 'context_terms_required'",[252,1201,961],{"class":286},[252,1203,1204,1207,1209,1211,1213,1215,1218,1221,1224,1227],{"class":254,"line":380},[252,1205,1206],{"class":282},"    await",[252,1208,393],{"class":286},[252,1210,396],{"class":258},[252,1212,1159],{"class":286},[252,1214,1162],{"class":262},[252,1216,1217],{"class":286},", contextTerms: [",[252,1219,1220],{"class":262},"'browser'",[252,1222,1223],{"class":286},", ",[252,1225,1226],{"class":262},"'The Browser Company'",[252,1228,1229],{"class":286},"] });\n",[252,1231,1232,1234,1236],{"class":254,"line":387},[252,1233,1053],{"class":286},[252,1235,1056],{"class":282},[252,1237,1059],{"class":286},[252,1239,1240,1243],{"class":254,"line":402},[252,1241,1242],{"class":282},"    throw",[252,1244,1245],{"class":286}," error;\n",[252,1247,1248],{"class":254,"line":414},[252,1249,1085],{"class":286},[252,1251,1252],{"class":254,"line":426},[252,1253,1090],{"class":286},[496,1255,1256,1265],{},[499,1257,1258],{},[502,1259,1260,1263],{},[505,1261,1262],{},"Property",[505,1264],{},[514,1266,1267,1277,1286,1296,1306,1316],{},[502,1268,1269,1274],{},[519,1270,1271],{},[226,1272,1273],{},"status",[519,1275,1276],{},"HTTP status",[502,1278,1279,1283],{},[519,1280,1281],{},[226,1282,226],{},[519,1284,1285],{},"The stable code. Branch on this",[502,1287,1288,1293],{},[519,1289,1290],{},[226,1291,1292],{},"message",[519,1294,1295],{},"Human-readable",[502,1297,1298,1303],{},[519,1299,1300],{},[226,1301,1302],{},"retryable",[519,1304,1305],{},"Whether retrying could succeed",[502,1307,1308,1313],{},[519,1309,1310],{},[226,1311,1312],{},"details",[519,1314,1315],{},"Structured context, when there is any",[502,1317,1318,1323],{},[519,1319,1320],{},[226,1321,1322],{},"retryAfterSeconds",[519,1324,1325,1326],{},"Set on a ",[226,1327,1328],{},"429",[223,1330,1331,1332,1335],{},"A failure with no JSON body becomes ",[226,1333,1334],{},"http_\u003Cstatus>",", so you always get a code to branch on.",[268,1337,1339],{"id":1338},"retries","Retries",[223,1341,1342],{},"Handled for you, with backoff:",[496,1344,1345,1355],{},[499,1346,1347],{},[502,1348,1349,1352],{},[505,1350,1351],{},"Response",[505,1353,1354],{},"Retried",[514,1356,1357,1370,1391],{},[502,1358,1359,1363],{},[519,1360,1361],{},[226,1362,1328],{},[519,1364,1365,1366,1369],{},"Yes, on every method, honouring ",[226,1367,1368],{},"Retry-After"," — unless it asks for more than 30 seconds, which is thrown at once for you to schedule",[502,1371,1372,1378],{},[519,1373,1374,1377],{},[226,1375,1376],{},"5xx"," and network errors",[519,1379,1380,1381,1223,1384,1387,1388],{},"Only on ",[226,1382,1383],{},"GET",[226,1385,1386],{},"PUT"," and ",[226,1389,1390],{},"DELETE",[502,1392,1393,1401],{},[519,1394,1395,1398,1399],{},[226,1396,1397],{},"4xx"," other than ",[226,1400,1328],{},[519,1402,1403],{},"Never",[223,1405,1406,1409,1410,1412],{},[226,1407,1408],{},"POST"," is not retried on ",[226,1411,1376],{}," because it is not idempotent — a brand or a batch of prompts\nmight have been created before the failure. Handle those yourself if you need to.",[223,1414,1415,1416,1418],{},"Up to ",[226,1417,565],{}," attempts, then the error is thrown.",[268,1420,1422],{"id":1421},"next-steps","Next steps",[1424,1425,1426,1432],"ul",{},[1427,1428,1429,1431],"li",{},[231,1430,169],{"href":170}," — the underlying contract",[1427,1433,1434,1436],{},[231,1435,204],{"href":205}," — the same client as agent tools",[1438,1439,1440],"style",{},"html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}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);}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}",{"title":248,"searchDepth":306,"depth":306,"links":1442},[1443,1446,1447,1448,1449,1450],{"id":270,"depth":299,"text":10,"children":1444},[1445],{"id":493,"depth":306,"text":494},{"id":604,"depth":299,"text":605},{"id":813,"depth":299,"text":814},{"id":1111,"depth":299,"text":1112},{"id":1338,"depth":299,"text":1339},{"id":1421,"depth":299,"text":1422},"A typed, dependency-free TypeScript client for the Shruwd API, with retries and structured errors built in.","md",{},{"title":198,"description":201},{"title":198,"description":1451},"x8aqVgV8nER4j-QOPMbkvp0CRF92G0xnr4ebfrwP5zo",1790003439916]