mcp-scraper 0.90.7 → 0.91.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +40 -1
  2. package/README.md +4 -4
  3. package/dist/{analytics-repository-FXS45ZTM.js → analytics-repository-IHOFBSUV.js} +1 -1
  4. package/dist/bin/api-server.js +1 -1
  5. package/dist/bin/mcp-scraper-cli.js +1 -1
  6. package/dist/bin/mcp-scraper-core.js +1 -1
  7. package/dist/bin/mcp-scraper-install.js +1 -1
  8. package/dist/bin/mcp-stdio-server.js +1 -1
  9. package/dist/bin/paa-harvest.js +1 -1
  10. package/dist/{chunk-BDLR4CCL.js → chunk-2SP57VCG.js} +6 -6
  11. package/dist/chunk-3JUD76B6.js +1 -0
  12. package/dist/chunk-6DTXIZY2.js +1 -0
  13. package/dist/{chunk-QUFR3KG2.js → chunk-6KASNPKR.js} +1 -1
  14. package/dist/chunk-72YO6PKN.js +1 -0
  15. package/dist/{chunk-YTEAWZEN.js → chunk-C3QWOZUH.js} +1 -1
  16. package/dist/chunk-EVQA7RMG.js +1 -0
  17. package/dist/{chunk-TBTA7VVZ.js → chunk-IK5BG7MO.js} +1 -1
  18. package/dist/{chunk-I7IS7NTC.js → chunk-KZV2FLGG.js} +1 -1
  19. package/dist/{chunk-UKFNSXP3.js → chunk-LI7WHOII.js} +1 -1
  20. package/dist/{chunk-B2C7JU4O.js → chunk-LSFDB5XE.js} +1 -1
  21. package/dist/chunk-M5TYS4EX.js +16 -0
  22. package/dist/{chunk-ZKQRA6NQ.js → chunk-MWUKEBQA.js} +175 -171
  23. package/dist/chunk-ORB4RHCK.js +63 -0
  24. package/dist/{chunk-LPEIHMYH.js → chunk-POTKJRLE.js} +1 -1
  25. package/dist/{chunk-IGJKAECE.js → chunk-QTDLZTQ7.js} +1 -1
  26. package/dist/chunk-RK2VCTZI.js +1 -0
  27. package/dist/{chunk-OT2HUS2G.js → chunk-VEP42LGR.js} +1 -1
  28. package/dist/{chunk-TOJBPATJ.js → chunk-WJ4XFLS4.js} +159 -115
  29. package/dist/{chunk-74HHYSAZ.js → chunk-X7GZJU5P.js} +1 -1
  30. package/dist/{chunk-5NQY2N7J.js → chunk-YQNMW4XI.js} +2 -2
  31. package/dist/{chunk-R7LCD65B.js → chunk-ZMNUI5LB.js} +7 -7
  32. package/dist/db-B5XJTOGN.js +1 -0
  33. package/dist/{extract-bundle-INT6JMJP.js → extract-bundle-TMS6LLIT.js} +10 -10
  34. package/dist/gmail-service-LXBBOEIQ.js +1 -0
  35. package/dist/index.cjs +18 -18
  36. package/dist/index.js +1 -1
  37. package/dist/{lead-list-enrichment-repository-B6Q4O4DG.js → lead-list-enrichment-repository-AWZZMY2H.js} +1 -1
  38. package/dist/{location-data-repository-CBI5K7MR.js → location-data-repository-6XAVI65Z.js} +1 -1
  39. package/dist/operation-metering-DB5F7SXN.js +1 -0
  40. package/dist/server-MPVSSCAH.js +4963 -0
  41. package/dist/{site-extract-repository-VPYOC3CP.js → site-extract-repository-OKXC3NFC.js} +1 -1
  42. package/dist/stripe-event-worker-KQOQOM22.js +1 -0
  43. package/dist/worker-NKLJTKDQ.js +1 -0
  44. package/package.json +1 -1
  45. package/dist/chunk-CTX3NMZQ.js +0 -1
  46. package/dist/chunk-DSK6RKBS.js +0 -16
  47. package/dist/chunk-KDDU6BW3.js +0 -48
  48. package/dist/chunk-WEPU72WA.js +0 -1
  49. package/dist/db-SVSD2AWJ.js +0 -1
  50. package/dist/gmail-service-YCPMGW3E.js +0 -1
  51. package/dist/server-LYWW6XYE.js +0 -4956
  52. package/dist/stripe-event-worker-AQVRF24K.js +0 -1
  53. package/dist/worker-U43KLOLN.js +0 -1
@@ -1 +1 @@
1
- import{A as s,B as t,C as u,D as v,E as w,F as x,G as y,H as z,I as A,J as B,K as C,L as D,M as E,i as a,j as b,k as c,l as d,m as e,n as f,o as g,p as h,q as i,r as j,s as k,t as l,u as m,v as n,w as o,x as p,y as q,z as r}from"./chunk-LPEIHMYH.js";import"./chunk-TMB56NCA.js";import"./chunk-CTX3NMZQ.js";import"./chunk-TOJBPATJ.js";export{a as XRAY_ENTITLED_EXTRACT_BILLING_CLASS,q as abandonExtractSettlement,p as claimFailedExtractJobForRefinalize,z as completeExtractJob,w as countSuccessfulPages,d as createExtractJob,f as createOrGetExtractJob,b as extractJobLimitInfo,A as failExtractJob,o as failStaleRunningExtractJob,B as failUnfundedExtractJob,E as finalizeXRayEntitledExtractJobCharge,y as finishExtractJob,g as getExtractJob,e as getExtractJobByIdempotencyKey,v as getExtractedImageLinks,u as getExtractedPages,x as getExtractedUrls,h as listExtractJobs,t as listExtractPages,j as listFundedPendingExtractJobs,n as listStaleRunningExtractJobs,i as listUnsettledExtractJobs,k as markExtractJobDispatchAttempt,l as recordExtractJobDispatchFailure,m as recordExtractSettlementFailure,s as saveExtractPages,C as setExtractJobPublicError,r as setExtractJobTotal,D as settleExtractJob,c as terminalExtractJobStatus};
1
+ import{A as s,B as t,C as u,D as v,E as w,F as x,G as y,H as z,I as A,J as B,K as C,L as D,M as E,i as a,j as b,k as c,l as d,m as e,n as f,o as g,p as h,q as i,r as j,s as k,t as l,u as m,v as n,w as o,x as p,y as q,z as r}from"./chunk-POTKJRLE.js";import"./chunk-TMB56NCA.js";import"./chunk-72YO6PKN.js";import"./chunk-WJ4XFLS4.js";export{a as XRAY_ENTITLED_EXTRACT_BILLING_CLASS,q as abandonExtractSettlement,p as claimFailedExtractJobForRefinalize,z as completeExtractJob,w as countSuccessfulPages,d as createExtractJob,f as createOrGetExtractJob,b as extractJobLimitInfo,A as failExtractJob,o as failStaleRunningExtractJob,B as failUnfundedExtractJob,E as finalizeXRayEntitledExtractJobCharge,y as finishExtractJob,g as getExtractJob,e as getExtractJobByIdempotencyKey,v as getExtractedImageLinks,u as getExtractedPages,x as getExtractedUrls,h as listExtractJobs,t as listExtractPages,j as listFundedPendingExtractJobs,n as listStaleRunningExtractJobs,i as listUnsettledExtractJobs,k as markExtractJobDispatchAttempt,l as recordExtractJobDispatchFailure,m as recordExtractSettlementFailure,s as saveExtractPages,C as setExtractJobPublicError,r as setExtractJobTotal,D as settleExtractJob,c as terminalExtractJobStatus};
@@ -0,0 +1 @@
1
+ import{fb as S,hb as h}from"./chunk-YQNMW4XI.js";import"./chunk-C3QWOZUH.js";import"./chunk-LI7WHOII.js";import"./chunk-QTDLZTQ7.js";import"./chunk-YGBTTW5D.js";import"./chunk-72YO6PKN.js";import"./chunk-2SP57VCG.js";import"./chunk-6DTXIZY2.js";import{I as d,J as u,K as l,L as f,M as v}from"./chunk-WJ4XFLS4.js";var g=12;function b(e){return e&&typeof e=="object"&&"code"in e&&typeof e.code=="string"?e.code:e instanceof Error?e.name:"unknown_error"}function k(e){return Math.min(21600,30*2**Math.max(0,e-1))}async function x(e={}){let w=e.stripeClient??S,E=Math.max(1,Math.min(100,e.limit??100)),r=500,i=0,s=0,c=0,m=0;for(;i<r;){let a=await d(Math.min(E,r-i),e.leaseSeconds??300);if(a.length===0)break;i+=a.length;for(let t of a)try{let n=await w.events.retrieve(t.eventId);await h(n),await u(t.eventId,t.token)&&(s+=1)}catch(n){let p=n instanceof Error?n.message:String(n),o=b(n);t.attemptCount>=g||o==="resource_missing"?await f(t.eventId,t.token,p,o)&&(m+=1):await l(t.eventId,t.token,p,o,k(t.attemptCount))&&(c+=1)}}return{claimed:i,processed:s,retried:c,deadLettered:m,capped:i>=r,health:await v()}}export{x as drainStripeEventQueue};
@@ -0,0 +1 @@
1
+ import{n as a,o as b,p as c}from"./chunk-3JUD76B6.js";import"./chunk-XG6GCEUE.js";import"./chunk-ZMNUI5LB.js";import"./chunk-M5QHXNFZ.js";import"./chunk-KZV2FLGG.js";import"./chunk-ORB4RHCK.js";import"./chunk-72YO6PKN.js";import"./chunk-4FROKQJN.js";import"./chunk-2SP57VCG.js";import"./chunk-6DTXIZY2.js";import"./chunk-2TZBO52D.js";import"./chunk-2PXP7TMY.js";import"./chunk-WJ4XFLS4.js";export{b as drainQueue,c as startWorker,a as tickOnce};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcp-scraper",
3
- "version": "0.90.7",
3
+ "version": "0.91.0",
4
4
  "description": "MCP server for MCP Scraper web intelligence tools",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -1 +0,0 @@
1
- var p={schemaVersion:1,ratePolicy:{version:"serp-paa-2026-08-11",effectiveDate:"2026-08-11T00:00:00.000Z"},costEvidence:{id:"serp-paa-rate-basis-2026-08",status:"provisional",minimumRevenueCostRatio:2.5,observedRevenueCostRatio:2.5160607750756583},operationCosts:{serp:{credits:60,unit:"per search",label:"SERP search",notes:"Returns organic results and Google entity IDs by default; optional same-page local pack, forums, videos, AI surfaces, and What People Are Saying are enabled with flags at the same product price. search_serp and the base capture_serp_snapshot search are billed 60 credits per search. Optional SERP Intelligence page snapshots add 1 credit per attempted URL."},paa:{credits:10,unit:"per question (+400 credit base)",label:"PAA harvest",notes:"Returns original-query PAA questions with answers and sources plus organic results and Google entity IDs. Optional same-page SERP modules are flag-controlled. Billed 400 credit base + 10 per question actually returned (unused estimate refunded)."},page_scrape:{credits:1,unit:"per page",label:"Page crawl / extract",notes:"Applies to both single-URL extraction and per-page site crawls."},listing_create:{credits:10,unit:"per new listing",label:"Directory or wiki listing creation",notes:"Fixed total price for a new Local Sourcebook directory listing or Transparent Commons wiki entity. Sourcebook acquisition is included."},listing_edit:{credits:2,unit:"per existing listing revision",label:"Directory or wiki listing edit",notes:"Fixed total price for refreshing an existing Local Sourcebook listing or revising an existing Transparent Commons entity."},url_map:{credits:5,unit:"per mapping operation",label:"Site URL mapping",notes:"Flat rate for the full /map-urls call regardless of URL count discovered."},yt_channel:{credits:2,unit:"per call",label:"YouTube search / channel harvest"},yt_transcription:{credits:200,unit:"base + 2/min of video",label:"YouTube transcription",notes:"Flat 200-credit base plus 2 credits per minute of video, reconciled to the real video length after transcription (e.g. a 10-minute video is about 220 credits)."},fb_ad:{credits:7,unit:"per call",label:"Facebook search / ad lookup"},maps_search:{credits:5,unit:"per search",label:"Maps business search",notes:"Returns up to 50 Google Maps business/profile candidates. Use maps_place_intel to hydrate selected businesses."},maps_place:{credits:60,unit:"per business",label:"Maps business lookup",notes:"Base lookup. Reviews billed separately per card at maps_review rate."},maps_review:{credits:1,unit:"per review card",label:"Maps review",notes:"Charged after extraction when includeReviews is true."},fb_search:{credits:8,unit:"per search",label:"Facebook ad library search",notes:"Browser automation to search Facebook Ads Library by keyword."},google_ads_search:{credits:6,unit:"per search",label:"Google Ads Transparency search",notes:"Browser automation to find advertisers in Google Ads Transparency Center by domain or name."},google_ads_intel:{credits:2,unit:"per call",label:"Google Ads Transparency advertiser intel",notes:"Lists and hydrates an advertiser's creatives with image URLs and video references."},google_ads_transcribe:{credits:200,unit:"base + 2/min of video",label:"Google ad video transcription",notes:"Flat 200-credit base plus 2 credits per minute of video, reconciled to the real video length after transcription (e.g. a 10-minute video is about 220 credits)."},fb_transcribe:{credits:200,unit:"base + 2/min of video",label:"Facebook video / ad transcription",notes:"Flat 200-credit base plus 2 credits per minute of video, reconciled to the real video length after transcription (e.g. a 10-minute video is about 220 credits)."},fb_reels_inventory:{credits:4,unit:"per profile scan",label:"Facebook Reel URL inventory",notes:"Collects canonical Reel URLs from a Facebook profile. Logged-out scans are capped at 60 URLs; saved browser profiles can request larger inventories."},instagram_profile:{credits:4,unit:"per profile scan",label:"Instagram profile content discovery",notes:"Browser extraction of public Instagram profile grid links. Complete history may require a logged-in profile."},instagram_media:{credits:4,unit:"per post or reel",label:"Instagram media download",notes:"Extracts post text, image URLs, and reel audio/video tracks, with local downloads when the server can write files."},instagram_transcribe:{credits:200,unit:"base + 2/min of video",label:"Instagram media transcription",notes:"Whisper transcription of selected Instagram audio/video media. Flat 200-credit base plus 2 credits per minute of video, reconciled to the real video length after transcription (e.g. a 10-minute video is about 220 credits)."},browser_minute:{credits:120,unit:"per minute of use",label:"Interactive browser session",notes:"Metered per minute of use for the whole time the browser session is open. Close the session to stop the meter; abandoned sessions are auto-closed after a short idle window."},reddit_thread:{credits:30,unit:"per thread",label:"Reddit thread base lookup",notes:"Base lookup for the post itself. Comments billed separately per comment at reddit_comment rate. Refunded if the thread cannot be retrieved."},reddit_comment:{credits:2,unit:"per comment",label:"Reddit comment",notes:"Charged per comment actually extracted, billed down automatically if the balance runs out mid-thread."},video_analysis:{credits:6667,unit:"per 120 frames (max 480)",label:"Video breakdown (frame-by-frame + transcript)",notes:"Full multi-lens video breakdown: samples frames across a video (up to 30 minutes), analyzes each with vision AI, transcribes the audio, then produces summary, pacing/energy, words-per-minute, topic outline, key points, hook analysis, visual style, and a how-to-replicate recipe with a quality-control pass. $1 per 120 frames requested (max 480 = $4); billed down automatically if the video cannot use the requested frames, and refunded fully if the run fails."},trustpilot_reviews:{credits:5,unit:"per call",label:"Trustpilot review harvest",notes:"Base lookup. Reviews billed separately per card at trustpilot_review rate. Refunded if no reviews are found."},trustpilot_review:{credits:1,unit:"per review card",label:"Trustpilot review card",notes:"Charged per review actually extracted, billed down automatically if the balance runs out mid-page."},g2_reviews:{credits:5,unit:"per call",label:"G2 review harvest",notes:"Base lookup. Reviews billed separately per card at g2_review rate. Refunded if no reviews are found."},g2_review:{credits:2,unit:"per review card",label:"G2 review card",notes:"Charged per review actually extracted (each card carries up to 3 Q&A sections), billed down automatically if the balance runs out mid-page."},diff_page:{credits:1,unit:"per check",label:"Page change check",notes:"Same cost as a single page extract \u2014 one scrape is performed per check, then compared against your last stored snapshot for that URL."}},publicTiers:[{tier:"starter",label:"Starter",monthlyUsd:12,credits:8e4,concurrency:3},{tier:"growth",label:"Growth",monthlyUsd:40,credits:266667,concurrency:10},{tier:"scale",label:"Scale",monthlyUsd:100,credits:8e5,concurrency:20}],credits:{mcPerCredit:100,freeSignupCredits:0},inventory:{totalTools:361,scraperTools:235,memoryTools:126},concurrencyPack:{ratePolicyVersion:"2026-08-14.concurrency-pack-v1",monthlyUsd:5,currency:"usd",interval:"month",billingUnit:"pack",slotsPerPack:2},scaleCreditPack:{ratePolicyVersion:"2026-09-21.scale-credit-pack-v1",eligibleTier:"scale",incrementUsd:10,creditsPerIncrement:8e4,maxQuantity:100,currency:"usd",expiryMonths:3},addons:{memory:{monthlyUsd:19,quotaGb:5,freeQuotaGb:.01},scheduling:{billingMode:"credits",entitlement:"paid_plan_included",separateSubscriptionRequired:!1,chargeEvent:"started_occurrence",runBaseCredits:75,runBaseMc:7500,llmCostMultiplier:1.5,llmCostMultiplierBps:15e3,modes:{connection_sync:{runBaseCredits:75,modelCostBilling:"none",modelCostMultiplier:0},agent:{runBaseCredits:75,modelCostBilling:"actual_reported_cost",modelCostMultiplier:1.5,modelCostMultiplierBps:15e3}}},connectedAccounts:{schemaVersion:2,ratePolicyVersion:"2026-08-03.connected-usage-v3",effectiveAt:"2026-08-03T00:00:00.000Z",entitlement:"paid_plan_add_on",connection:{billingMode:"flat_recurring_credits",amountCredits:15e3,interval:"month",unit:"active_connection",proration:"none"},usage:{billingMode:"credits",settlementMode:"authoritative_receipt",rounding:"aggregate_then_ceil_to_mc",functionRun:{credits:2,mc:200,unit:"per_function_run"},proxyRequest:{credits:2,mc:200,unit:"per_proxy_request"},compute:{creditsPerSecond:5,mcPerSecond:500,sourceUnit:"millisecond",unit:"per_compute_second",formula:"ceil(computeMilliseconds * mcPerSecond / 1000)"}}}}};var t={serp:6e3,serp_headless:6e3,serp_headful:6e3,paa:1e3,paa_base:4e4,page_scrape:100,url_map:500,yt_channel:200,yt_transcription:200,fb_ad:700,maps_search:500,maps_place:6e3,maps_review:100,fb_search:800,fb_search_result:100,fb_page_intel:700,fb_page_intel_ad:50,fb_reels_inventory:400,fb_transcribe:33300,google_ads_search:600,google_ads_intel:200,google_ads_transcribe:33300,instagram_profile:400,instagram_media:400,instagram_transcribe:33300,browser_minute:12e3,reddit_thread:3e3,reddit_comment:200,video_analysis:666700,trustpilot_reviews:500,trustpilot_review:100,g2_reviews:500,g2_review:200,diff_page:100,listing_create:1e3,listing_edit:200};function se(e){return e===!0?t.serp_headless:t.serp_headful}var G=t.browser_minute/6e4;function ae(e){return Math.round(e*G)}var oe=1e3,a=100,ce=t.serp_headful/a,le=t.paa_base/a,_e=t.paa/a,de=t.page_scrape/a,Y={billingMode:"credits",chargeEvent:"accepted_write",validationCredits:0,create:{credits:t.listing_create/a,mc:t.listing_create},edit:{credits:t.listing_edit/a,mc:t.listing_edit},surfaces:["local_sourcebook","transparent_commons"],sourcebookAcquisitionIncluded:!0},q=2e6,V=3,y=1e4,C=1e9,H=75,ue=H*a,K=15e3,pe=K/y,me=5e3,W="2026-08-03.connected-usage-v3",T=15e3,ge=T*a,v=2,A=2,S=5,N=v*a,I=A*a,w=S*a,be={schemaVersion:2,ratePolicyVersion:W,effectiveAt:"2026-08-03T00:00:00.000Z",provider:"nango",entitlement:"paid_plan_add_on",connection:{billingMode:"flat_recurring_credits",amountCredits:T,interval:"month",unit:"active_connection",proration:"none"},usage:{billingMode:"credits",settlementMode:"authoritative_receipt",rounding:"aggregate_then_ceil_to_mc",functionRun:{credits:v,mc:N,unit:"per_function_run"},proxyRequest:{credits:A,mc:I,unit:"per_proxy_request"},compute:{creditsPerSecond:S,mcPerSecond:w,sourceUnit:"millisecond",unit:"per_compute_second",formula:"ceil(computeMilliseconds * mcPerSecond / 1000)"}}};function m(e,r){if(!Number.isSafeInteger(e)||e<0)throw new Error(`${r} must be a non-negative safe integer`);return BigInt(e)}function _(e){if(e>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("connected usage charge exceeds the safe integer range");return Number(e)}function fe(e){let r=m(e.functionRuns,"functionRuns"),o=m(e.proxyRequests,"proxyRequests"),s=m(e.computeMilliseconds,"computeMilliseconds"),n=r*BigInt(N),c=o*BigInt(I),l=s*BigInt(w),u=l===0n?0n:(l+999n)/1000n,R=n+c+u;return{functionRunMc:_(n),proxyRequestMc:_(c),computeMc:_(u),amountMc:_(R),credits:_(R)/a}}function Ee(e,r){if(!Number.isFinite(e)||e<0)throw new Error("costUsd must be a finite non-negative number");if(!Number.isInteger(r)||r<0)throw new Error("markupBps must be a non-negative integer");let s=BigInt(Math.round(e*C))*BigInt(r)*BigInt(q),n=BigInt(C)*BigInt(y)*BigInt(V),c=s===0n?0n:(s+n-1n)/n;if(c>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("calculated mc exceeds the safe integer range");return Number(c)}var $=[{key:"serp",label:"SERP search",aliases:["search_serp","serp","google search","organic results"],credits:i(t.serp_headful),unit:"per search",notes:`Returns organic results and Google entity IDs by default; optional same-page local pack, forums, videos, AI surfaces, and What People Are Saying are enabled with flags at the same product price. search_serp and the base capture_serp_snapshot search are billed ${i(t.serp_headful)} credits per search. Optional SERP Intelligence page snapshots add ${i(t.page_scrape)} credit per attempted URL.`},{key:"paa",label:"PAA harvest",aliases:["harvest_paa","paa","people also ask","questions"],credits:i(t.paa),unit:`per question (+${i(t.paa_base)} credit base)`,notes:`Returns original-query PAA questions with answers and sources plus organic results and Google entity IDs. Optional same-page SERP modules are flag-controlled. Billed ${i(t.paa_base)} credit base + ${i(t.paa)} per question actually returned (unused estimate refunded).`},{key:"page_scrape",label:"Page crawl / extract",aliases:["extract_url","extract_site","page scrape","url scrape","single page","site crawl"],credits:i(t.page_scrape),unit:"per page",notes:"Applies to both single-URL extraction and per-page site crawls."},{key:"listing_create",label:"Directory or wiki listing creation",aliases:["local-sourcebook-capture","commons_submit_entity","directory listing","wiki listing"],credits:i(t.listing_create),unit:"per new listing",notes:"Fixed total price for a new Local Sourcebook directory listing or Transparent Commons wiki entity. Sourcebook acquisition is included."},{key:"listing_edit",label:"Directory or wiki listing edit",aliases:["local_sourcebook_refresh","commons_submit_entity","listing refresh","wiki edit"],credits:i(t.listing_edit),unit:"per existing listing revision",notes:"Fixed total price for refreshing an existing Local Sourcebook listing or revising an existing Transparent Commons entity."},{key:"url_map",label:"Site URL mapping",aliases:["map_site_urls","url map","site map","crawl urls"],credits:i(t.url_map),unit:"per mapping operation",notes:"Flat rate for the full /map-urls call regardless of URL count discovered."},{key:"yt_channel",label:"YouTube search / channel harvest",aliases:["youtube_harvest","youtube search","youtube channel","yt_channel"],credits:i(t.yt_channel),unit:"per call"},{key:"yt_transcription",label:"YouTube transcription",aliases:["youtube_transcribe","youtube transcript","transcription","yt_transcription"],credits:i(2e4),unit:"base + 2/min of video",notes:"Flat 200-credit base plus 2 credits per minute of video, reconciled to the real video length after transcription (e.g. a 10-minute video is about 220 credits)."},{key:"fb_ad",label:"Facebook search / ad lookup",aliases:["facebook_page_intel","facebook_ad_search","facebook_ad","facebook ads","fb ads"],credits:i(t.fb_ad),unit:"per call"},{key:"maps_search",label:"Maps business search",aliases:["maps_search","google maps search","gmb search","gbp search","business profiles"],credits:i(t.maps_search),unit:"per search",notes:"Returns up to 50 Google Maps business/profile candidates. Use maps_place_intel to hydrate selected businesses."},{key:"maps_place",label:"Maps business lookup",aliases:["maps_place_intel","google maps","maps place","place intel"],credits:i(t.maps_place),unit:"per business",notes:"Base lookup. Reviews billed separately per card at maps_review rate."},{key:"maps_review",label:"Maps review",aliases:["maps_reviews","google reviews","review cards","reviews"],credits:i(t.maps_review),unit:"per review card",notes:"Charged after extraction when includeReviews is true."},{key:"fb_search",label:"Facebook ad library search",aliases:["facebook_search","fb_search","fb ad search"],credits:i(t.fb_search),unit:"per search",notes:"Browser automation to search Facebook Ads Library by keyword."},{key:"google_ads_search",label:"Google Ads Transparency search",aliases:["google_ads_search","google ads search","ads transparency search"],credits:i(t.google_ads_search),unit:"per search",notes:"Browser automation to find advertisers in Google Ads Transparency Center by domain or name."},{key:"google_ads_intel",label:"Google Ads Transparency advertiser intel",aliases:["google_ads_page_intel","google ads intel","ads transparency intel"],credits:i(t.google_ads_intel),unit:"per call",notes:"Lists and hydrates an advertiser's creatives with image URLs and video references."},{key:"google_ads_transcribe",label:"Google ad video transcription",aliases:["google_ads_transcribe","google ad transcript"],credits:i(2e4),unit:"base + 2/min of video",notes:"Flat 200-credit base plus 2 credits per minute of video, reconciled to the real video length after transcription (e.g. a 10-minute video is about 220 credits)."},{key:"fb_transcribe",label:"Facebook video / ad transcription",aliases:["facebook_transcribe","facebook_video_transcribe","fb_transcribe","fb ad transcript"],credits:i(2e4),unit:"base + 2/min of video",notes:"Flat 200-credit base plus 2 credits per minute of video, reconciled to the real video length after transcription (e.g. a 10-minute video is about 220 credits)."},{key:"fb_reels_inventory",label:"Facebook Reel URL inventory",aliases:["facebook_reels_inventory","facebook reels","facebook reel urls","facebook profile reels"],credits:i(t.fb_reels_inventory),unit:"per profile scan",notes:"Collects canonical Reel URLs from a Facebook profile. Logged-out scans are capped at 60 URLs; saved browser profiles can request larger inventories."},{key:"instagram_profile",label:"Instagram profile content discovery",aliases:["instagram_profile_content","instagram profile","instagram content list","ig profile"],credits:i(t.instagram_profile),unit:"per profile scan",notes:"Browser extraction of public Instagram profile grid links. Complete history may require a logged-in profile."},{key:"instagram_media",label:"Instagram media download",aliases:["instagram_media_download","instagram reel download","instagram post download","ig media"],credits:i(t.instagram_media),unit:"per post or reel",notes:"Extracts post text, image URLs, and reel audio/video tracks, with local downloads when the server can write files."},{key:"instagram_transcribe",label:"Instagram media transcription",aliases:["instagram transcript","instagram reel transcript","ig transcribe"],credits:i(2e4),unit:"base + 2/min of video",notes:"Whisper transcription of selected Instagram audio/video media. Flat 200-credit base plus 2 credits per minute of video, reconciled to the real video length after transcription (e.g. a 10-minute video is about 220 credits)."},{key:"browser_minute",label:"Interactive browser session",aliases:["browser_open","browser agent","browser_agent","live browser","browse","browser control","interactive browser"],credits:i(t.browser_minute),unit:"per minute of use",notes:"Metered per minute of use for the whole time the browser session is open. Close the session to stop the meter; abandoned sessions are auto-closed after a short idle window."},{key:"reddit_thread",label:"Reddit thread base lookup",aliases:["reddit","reddit_thread","reddit comments","subreddit","reddit post"],credits:i(t.reddit_thread),unit:"per thread",notes:"Base lookup for the post itself. Comments billed separately per comment at reddit_comment rate. Refunded if the thread cannot be retrieved."},{key:"reddit_comment",label:"Reddit comment",aliases:["reddit_comment","reddit comments"],credits:i(t.reddit_comment),unit:"per comment",notes:"Charged per comment actually extracted, billed down automatically if the balance runs out mid-thread."},{key:"video_analysis",label:"Video breakdown (frame-by-frame + transcript)",aliases:["video_frame_analysis","video breakdown","video analysis","analyze video"],credits:i(t.video_analysis),unit:"per 120 frames (max 480)",notes:"Full multi-lens video breakdown: samples frames across a video (up to 30 minutes), analyzes each with vision AI, transcribes the audio, then produces summary, pacing/energy, words-per-minute, topic outline, key points, hook analysis, visual style, and a how-to-replicate recipe with a quality-control pass. $1 per 120 frames requested (max 480 = $4); billed down automatically if the video cannot use the requested frames, and refunded fully if the run fails."},{key:"trustpilot_reviews",label:"Trustpilot review harvest",aliases:["trustpilot_reviews","trustpilot","trustpilot reviews"],credits:i(t.trustpilot_reviews),unit:"per call",notes:"Base lookup. Reviews billed separately per card at trustpilot_review rate. Refunded if no reviews are found."},{key:"trustpilot_review",label:"Trustpilot review card",aliases:["trustpilot_review","trustpilot card"],credits:i(t.trustpilot_review),unit:"per review card",notes:"Charged per review actually extracted, billed down automatically if the balance runs out mid-page."},{key:"g2_reviews",label:"G2 review harvest",aliases:["g2_reviews","g2","g2 reviews"],credits:i(t.g2_reviews),unit:"per call",notes:"Base lookup. Reviews billed separately per card at g2_review rate. Refunded if no reviews are found."},{key:"g2_review",label:"G2 review card",aliases:["g2_review","g2 card"],credits:i(t.g2_review),unit:"per review card",notes:"Charged per review actually extracted (each card carries up to 3 Q&A sections), billed down automatically if the balance runs out mid-page."},{key:"diff_page",label:"Page change check",aliases:["diff_page","page diff","change detection"],credits:i(t.diff_page),unit:"per check",notes:"Same cost as a single page extract \u2014 one scrape is performed per check, then compared against your last stored snapshot for that URL."}],Re="price_1Ta1NRS8aAcsk3TGwsRnYbix";function O(e){return e.billing_interval??"month"}function M(e){return e.billed_usd??e.monthly_usd}function x(e){return e.credits_mc/a}var d={price_1TmiHRS8aAcsk3TGwmSNfNIa:{tier:"starter",label:"Starter",price_id:"price_1TmiHRS8aAcsk3TGwmSNfNIa",monthly_usd:12,credits_mc:8e6,concurrency:3,intro_coupon:"mcp-starter-1dollar-intro-12"},price_1TrgihS8aAcsk3TG5cglrq4D:{tier:"growth",label:"Growth",price_id:"price_1TrgihS8aAcsk3TG5cglrq4D",monthly_usd:40,credits_mc:26666700,concurrency:10,intro_coupon:null},price_1TrgihS8aAcsk3TG4HnG4gbY:{tier:"scale",label:"Scale",price_id:"price_1TrgihS8aAcsk3TG4HnG4gbY",monthly_usd:100,credits_mc:8e7,concurrency:20,intro_coupon:null},price_1TwqIVS8aAcsk3TG0FE3ddDM:{tier:"sonic",label:"Sonic Annual",price_id:"price_1TwqIVS8aAcsk3TG0FE3ddDM",monthly_usd:25,billed_usd:300,credits_mc:25e7,concurrency:3,intro_coupon:null,billing_interval:"year",credits_never_expire:!0,private_offer:!0},price_1TwqIWS8aAcsk3TGbGbtlLak:{tier:"sonic-memory",label:"Sonic Annual + Memory Pro",price_id:"price_1TwqIWS8aAcsk3TGbGbtlLak",monthly_usd:34.5,billed_usd:414,credits_mc:25e7,concurrency:3,intro_coupon:null,billing_interval:"year",credits_never_expire:!0,includes_memory:!0,private_offer:!0}},b=Object.fromEntries(Object.values(d).map(e=>[e.tier,e])),f={sonic:{slug:"sonic",label:"Sonic annual partner offer",headline:"A full year of MCP Scraper, with Credits that never expire.",tier_keys:["sonic","sonic-memory"]}};function Q(e){let r=Object.values(f).find(o=>o.tier_keys.includes(e));return r?`/${r.slug}/claim`:null}function Z(e){return e?Object.values(f).find(r=>r.tier_keys.includes(e))??null:null}function Ce(e,r){let o=Z(e);return o?!o.tier_keys.includes(r):!1}function he(e){if(!e)return null;let r=b[e];return r?{tier:r.tier,label:r.label,amount_usd:M(r),interval:O(r),monthly_equivalent_usd:r.monthly_usd,credits_per_interval:x(r),concurrency:r.concurrency,credits_never_expire:!!r.credits_never_expire,includes_memory:!!r.includes_memory,private_offer:!!r.private_offer,offer_claim_path:Q(r.tier)}:null}function ye(e){let r=f[e];if(!r)return null;let o=r.tier_keys.map(s=>b[s]).filter(s=>!!s).map(s=>({tier:s.tier,label:s.label,amount_usd:M(s),interval:O(s),monthly_equivalent_usd:s.monthly_usd,credits:x(s),credits_never_expire:!!s.credits_never_expire,includes_memory:!!s.includes_memory,concurrency:s.concurrency}));return o.length?{slug:r.slug,label:r.label,headline:r.headline,options:o}:null}function Te(){let e=b.starter,r=$.map(({aliases:n,...c})=>({...c,...c.notes?{notes:c.notes.replace(/ via fal\.ai/g,"")}:{}})),o=Object.fromEntries(r.map(n=>[n.key,{credits:n.credits,unit:n.unit,label:n.label,...n.notes?{notes:n.notes}:{}}])),s=Object.values(d).filter(n=>!n.private_offer).map(n=>({tier:n.tier,label:n.label,monthlyUsd:n.monthly_usd,credits:n.credits_mc/a,concurrency:n.concurrency}));return{...p,operationCosts:o,publicTiers:s,concurrencyPack:{ratePolicyVersion:L,monthlyUsd:P,currency:k,interval:U,billingUnit:"pack",slotsPerPack:g},scaleCreditPack:{ratePolicyVersion:j,eligibleTier:"scale",incrementUsd:D,creditsPerIncrement:E,maxQuantity:z,currency:"usd",expiryMonths:3},creditsPerDollarStarter:Math.round(i(e.credits_mc)/e.monthly_usd),costs:r,scheduling:p.addons.scheduling,connectedAccounts:p.addons.connectedAccounts,listingWrites:Y}}var P=5,k="usd",U="month",g=2,L="2026-08-14.concurrency-pack-v1",X="$5/month for 2 extra browsers",ve="MCP Scraper browser concurrency pack \u2014 each $5 monthly pack adds 2 browsers.",Ae="Billed monthly until canceled. A receipt is emailed after each successful payment.",h="npx -y -p mcp-scraper@latest mcp-scraper-cli billing concurrency checkout",j="2026-09-21.scale-credit-pack-v1",D=10,E=8e4,Se=E*a,z=100;function Ne(){let e=process.env.CONCURRENCY_BILLING_URL??"https://mcpscraper.dev/billing";return{product:"Extra browser concurrency pack",rate_policy_version:L,price_label:X,unit_amount_usd:P,currency:k,interval:U,billing_unit:"pack",pack_quantity:1,slots_per_pack:g,extra_slots:g,billing_url:e,terminal_command:h,terminal_command_with_api_key_env:`MCP_SCRAPER_API_KEY=sk_live_your_key ${h}`}}function i(e){return e/a}var J="npx -y -p mcp-scraper@latest mcp-scraper-cli billing subscribe";function ee(){return Object.values(d).filter(e=>!e.private_offer).sort((e,r)=>e.credits_mc-r.credits_mc)}function Ie(e,r){let o=process.env.TOPUP_URL??"https://mcpscraper.dev/billing",s=i(e),n=i(r),c=ee().map(u=>u.tier).join("|"),l=`${J} <${c}>`;return{error:"insufficient_balance",error_code:"insufficient_balance",message:`Insufficient credits. Balance: ${s} credits. This call requires ${n} credits. Credits refresh when your plan renews. Scale customers can buy ${E} Credits per $${D} increment; other customers can move to a larger plan at ${o} (terminal: ${l})`,balance_credits:s,required_credits:n,topup_url:o,upgrade_command:l}}var re=1e7*1,we={price_1TnMSTS8aAcsk3TGBgiwuvqL:{plan:"pro",label:"Pro",price_id:"price_1TnMSTS8aAcsk3TGBgiwuvqL",interval:"month",monthly_usd:19,quota_bytes:5e9},price_1TnMSTS8aAcsk3TGWBVU2agY:{plan:"pro",label:"Pro",price_id:"price_1TnMSTS8aAcsk3TGWBVU2agY",interval:"year",monthly_usd:19,quota_bytes:5e9}},Oe={free:re,pro:5e9,team:5e10},te=3;var Me=19/te,xe={TOPUP:"topup",SUBSCRIPTION:"subscription",SIGNUP_GRANT:"signup_grant",MONTHLY_REFRESH:"monthly_free_refresh",PAA:"paa",PAA_REFUND:"paa_refund",SERP:"serp",SERP_REFUND:"serp_refund",REFUND:"refund",TRANSCRIPTION:"transcription",TRANSCRIPTION_HOLD:"transcription_hold",TRANSCRIPTION_REFUND:"transcription_refund",YT_CHANNEL:"yt_channel",FB_AD:"fb_ad",MAPS_SEARCH:"maps_search",DIRECTORY_WORKFLOW_HOLD:"directory_workflow_hold",DIRECTORY_WORKFLOW_REFUND:"directory_workflow_refund",LEAD_LIST_ENRICHMENT_HOLD:"lead_list_enrichment_hold",LEAD_LIST_ENRICHMENT_REFUND:"lead_list_enrichment_refund",MAPS_PLACE:"maps_place",MAPS_REVIEW:"maps_review",MAPS_REVIEW_REFUND:"maps_review_refund",EXTRACT_SITE:"extract_site",EXTRACT_SITE_REFUND:"extract_site_refund",EXTRACT_URL:"page_scrape",URL_MAP:"url_map",EXTRACT_SITE_HOLD:"extract_site_hold",YT_CHANNEL_REFUND:"yt_channel_refund",FB_AD_REFUND:"fb_ad_refund",URL_MAP_REFUND:"url_map_refund",FB_SEARCH:"fb_search",FB_REELS_INVENTORY:"fb_reels_inventory",FB_REELS_INVENTORY_REFUND:"fb_reels_inventory_refund",FB_TRANSCRIBE:"fb_transcribe",FB_SEARCH_REFUND:"fb_search_refund",FB_SEARCH_RESULT:"fb_search_result",FB_SEARCH_RESULT_REFUND:"fb_search_result_refund",FB_PAGE_INTEL:"fb_page_intel",FB_PAGE_INTEL_REFUND:"fb_page_intel_refund",FB_PAGE_INTEL_AD:"fb_page_intel_ad",FB_PAGE_INTEL_AD_REFUND:"fb_page_intel_ad_refund",FB_TRANSCRIBE_REFUND:"fb_transcribe_refund",GOOGLE_ADS_SEARCH:"google_ads_search",GOOGLE_ADS_SEARCH_REFUND:"google_ads_search_refund",GOOGLE_ADS_INTEL:"google_ads_intel",GOOGLE_ADS_INTEL_REFUND:"google_ads_intel_refund",GOOGLE_ADS_TRANSCRIBE:"google_ads_transcribe",GOOGLE_ADS_TRANSCRIBE_REFUND:"google_ads_transcribe_refund",INSTAGRAM_PROFILE:"instagram_profile",INSTAGRAM_PROFILE_REFUND:"instagram_profile_refund",INSTAGRAM_MEDIA:"instagram_media",INSTAGRAM_MEDIA_REFUND:"instagram_media_refund",INSTAGRAM_TRANSCRIBE:"instagram_transcribe",INSTAGRAM_TRANSCRIBE_REFUND:"instagram_transcribe_refund",BROWSER_SESSION:"browser_session",REDDIT_THREAD:"reddit_thread",REDDIT_THREAD_REFUND:"reddit_thread_refund",REDDIT_COMMENT:"reddit_comment",REDDIT_COMMENT_REFUND:"reddit_comment_refund",VIDEO_ANALYSIS:"video_analysis",VIDEO_ANALYSIS_REFUND:"video_analysis_refund",VIDEO_ANALYSIS_ADJUST:"video_analysis_adjust",VIDEO_ANALYSIS_LLM:"video_analysis_llm",MEMORY_AI:"memory_ai",MEMORY_AI_REFUND:"memory_ai_refund",TRUSTPILOT_REVIEWS:"trustpilot_reviews",TRUSTPILOT_REVIEWS_REFUND:"trustpilot_reviews_refund",TRUSTPILOT_REVIEW:"trustpilot_review",TRUSTPILOT_REVIEW_REFUND:"trustpilot_review_refund",G2_REVIEWS:"g2_reviews",G2_REVIEWS_REFUND:"g2_reviews_refund",G2_REVIEW:"g2_review",G2_REVIEW_REFUND:"g2_review_refund",DIFF_PAGE:"diff_page",DIFF_PAGE_REFUND:"diff_page_refund",LOCAL_SOURCEBOOK_CREATE:"local_sourcebook_create",LOCAL_SOURCEBOOK_CREATE_REFUND:"local_sourcebook_create_refund",LOCAL_SOURCEBOOK_EDIT:"local_sourcebook_edit",LOCAL_SOURCEBOOK_EDIT_REFUND:"local_sourcebook_edit_refund",COMMONS_CREATE:"commons_create",COMMONS_CREATE_REFUND:"commons_create_refund",COMMONS_EDIT:"commons_edit",COMMONS_EDIT_REFUND:"commons_edit_refund",SITE_AUDIT_LLM:"site_audit_llm",SCHEDULED_RUN:"scheduled_run",CONNECTED_USAGE:"connected_usage",CONNECTED_ACCOUNT_FEE:"connected_account_fee",ADMIN_GRANT:"admin_grant",ADMIN_REVOKE:"admin_revoke"},Pe=3,ke=1.5,Ue=1.5,B=2e4,F=200;function Le(e){let r=Math.max(1,Math.ceil((e||60)/60));return B+F*r}var De=B+F*30,Be=d.price_1TmiHRS8aAcsk3TGwmSNfNIa.credits_mc/d.price_1TmiHRS8aAcsk3TGwmSNfNIa.monthly_usd;export{t as a,se as b,ae as c,oe as d,a as e,ce as f,le as g,_e as h,de as i,Y as j,C as k,H as l,ue as m,K as n,pe as o,me as p,W as q,T as r,ge as s,v as t,A as u,S as v,N as w,be as x,fe as y,Ee as z,$ as A,Re as B,O as C,M as D,x as E,d as F,b as G,Q as H,Z as I,Ce as J,he as K,ye as L,Te as M,P as N,g as O,ve as P,Ae as Q,D as R,E as S,Se as T,z as U,Ne as V,i as W,Ie as X,we as Y,Oe as Z,xe as _,Pe as $,ke as aa,Ue as ba,Le as ca,De as da,Be as ea};
@@ -1,16 +0,0 @@
1
- var s={message:"Hosted background work now runs on schedules matched to how quickly each result matters, form deliveries and billing changes apply immediately, and X-Ray privacy retention is running again."};var _={reset:"\x1B[0m",cyan:"\x1B[36m",lime:"\x1B[32m",amber:"\x1B[33m",red:"\x1B[31m",muted:"\x1B[90m",bold:"\x1B[1m"};function r(t,e,n){return n?`${_[e]}${t}${_.reset}`:t}function o(t,e,n){let a=t.padEnd(9," ");return` ${r(a,"muted",n)} ${e.join(r(" . ","muted",n))}`}function p(t){let e=t.color??!0,n=t.apiKeyConfigured?"$MCP_SCRAPER_API_KEY":"sk_live_your_key",a=String.raw`
2
- __ __ ____ ____
3
- | \/ |/ ___| _ \
4
- | |\/| | | | |_) |
5
- | | | | |___| __/
6
- |_| |_|\____|_|
7
-
8
- ____ ____ ____ _ ____ _____ ____
9
- / ___| / ___| _ \ / \ | _ \| ____| _ \
10
- \___ \| | | |_) | / _ \ | |_) | _| | |_) |
11
- ___) | |___| _ < / ___ \| __/| |___| _ <
12
- |____/ \____|_| \_\/_/ \_\_| |_____|_| \_\
13
- `,c=[`MCP_SCRAPER_API_KEY=${n} npx -y -p mcp-scraper@latest \\`," mcp-scraper-cli agent install claude --apply"].join(`
14
- `),i=["[mcp_servers.mcp-scraper]",'command = "npx"','args = ["-y", "-p", "mcp-scraper@latest", "mcp-scraper"]',`env = { MCP_SCRAPER_API_KEY = "${n}" }`].join(`
15
- `);return[r(`mcp-scraper v${t.version}`,"bold",e),r("> mcp-scraper-install","muted",e),r(a,"amber",e),`${r("MCP Scraper Agent","cyan",e)} . v${t.version} . mcpscraper.dev`,"1/1 install surfaces ready",r(`Newest in v${t.version}: ${s.message}`,"lime",e),"",`${r("Tools","cyan",e)} ${r("(361 MCP tools)","muted",e)}`,o("search",["harvest_paa","search_serp","maps_search","maps_place_intel"],e),o("extract",["extract_url","map_site_urls","extract_site","audit_site","directory_workflow"],e),o("build",["create_editorial_reading_room","rank_tracker_workflow","portable HTML"],e),o("media",["youtube_harvest","youtube_transcribe","facebook_reels_inventory","facebook_ad_search","facebook_page_intel","facebook_ad_transcribe","facebook_video_transcribe","instagram_profile_content","instagram_media_download","reddit_thread"],e),o("browser",["serp_identity_create","serp_identity_list","browser_open","browser_profile_connect","browser_profile_list","browser_close","browser_screenshot","browser_read","browser_locate","browser_replay_mark","browser_replay_annotate"],e),o("connect",["list_service_connections","describe_service_connection_tool","import_service_connection_to_memory","export_connected_service_data","renew_connected_data_download","read_service_connection","call_service_connection_action"],e),o("commons",["commons_search_entities","commons_get_entity_linkset","commons_prepare_entity","commons_submit_entity","commons_prepare_publication","commons_claim_publication","commons_publish_editorial","commons_get_publication"],e),o("account",["credits_info","reports","MCP resources"],e),o("memory",["memory-put","memory-get","memory-search","list-vaults","record-fact","list-scheduled-actions"],e),`${r("Workflows","cyan",e)} ${r("(MCP + CLI + API)","muted",e)}`,o("route",["workflow_list","workflow_suggest","workflow_run","workflow_step","workflow_status","workflow_artifact_read"],e),o("seo",["directory","agent-packet","competitive audit","map/serp comparison","PAA/AIO briefs","scheduled runs"],e),"",r("Usage tips:","amber",e),"Run mcp-scraper-install for this visible card. Run mcp-scraper-cli for setup utilities and subcommands.","Run mcp-scraper in a human terminal to print this card; MCP clients get the same command as a silent stdio server.","Explicit card command: npx -y -p mcp-scraper@latest mcp-scraper-install","Hosted browser sessions use direct/no-proxy egress by default.","Customer auth setup: run browser_profile_connect, send the watch_url, let the user sign in, then call browser_profile_list until AUTHENTICATED.","Connected account ranges: call export_connected_service_data once. It handles Gmail, Calendar, Zoom, and Resend pagination; do not loop read_service_connection over individual records.","Connected account RAG: call import_service_connection_to_memory for one bounded approved read. It writes a redacted, untrusted snapshot to a stable Memory path and embeds it for search.","Stack logins / reconnect: run browser_profile_connect again with the same profile name and another domain to add accounts or refresh a login.","Start with workflow_suggest for broad jobs like market analysis, ICP research, CRO audits, brand briefs, content gaps, and AI visibility.","For MCP clients, use mcp-scraper so one install can mix SERP, Maps, browser, reports, and saved MCP resources.","If you hit the concurrency limit, add 2 browsers for $5/month with mcp-scraper-cli billing concurrency checkout.","",`${r("Ready.","lime",e)} Install the combined MCP server with one command:`,"",r("Setup doctor","amber",e),"npx -y -p mcp-scraper@latest mcp-scraper-cli doctor","",r("Hosted profile setup","amber",e),'In your MCP client, call browser_profile_connect with email="seo@example.com" and domain="chatgpt.com".',"Give the returned watch_url to the user. After they sign in, call browser_profile_list, then browser_open with the returned profile. Add more logins by calling browser_profile_connect again with the same profile and a new domain.","",r("Claude Code one-command setup","amber",e),c,"Then fully exit Claude Code and open a new Claude terminal. Check with: claude mcp list","",r("Codex config","amber",e),i,"",r("Claude Desktop Extension","amber",e),"Download: https://mcpscraper.dev/downloads/mcp-scraper.mcpb","",r("Safety note:","muted",e),"mcp-scraper prints this card only when stdin/stdout are an interactive TTY. In MCP clients it writes only JSON-RPC to stdout.","Use --stdio or MCP_SCRAPER_FORCE_STDIO=1 to force server mode from a terminal.",""].join(`
16
- `)}export{p as a};
@@ -1,48 +0,0 @@
1
- import{a as re}from"./chunk-XG6GCEUE.js";import{w as Z}from"./chunk-R7LCD65B.js";import{b as N,c as ee}from"./chunk-I7IS7NTC.js";import{a as x,b as k}from"./chunk-CTX3NMZQ.js";import{a as F}from"./chunk-4FROKQJN.js";import{b as j,d as Y,g as X}from"./chunk-BDLR4CCL.js";import{Mb as b,Qb as A,Sb as I,Ua as R,b as S,g as p,gb as G,h as z,ha as J,ia as V,ib as O,j as $,ka as Q,m as W,na as E,o as B,t as l}from"./chunk-TOJBPATJ.js";async function P(e,r,t=3){for(let i=1;i<=t;i++){try{let a=await fetch(e,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(r),signal:AbortSignal.timeout(1e4)});if(a.ok)return;console.warn(`[webhook] attempt ${i} \u2192 ${a.status} from ${e}`)}catch(a){console.warn(`[webhook] attempt ${i} failed:`,a instanceof Error?a.message:a)}i<t&&await new Promise(a=>setTimeout(a,1e3*i*2))}console.error(`[webhook] gave up after ${t} attempts for ${e}`)}function fe(e){return e instanceof Error?e.message:String(e)}function be(e,r){return e instanceof DOMException&&(e.name==="TimeoutError"||e.name==="AbortError")?!0:/timeout|timed out|Timeout \d+ms exceeded|deadline/i.test(r)}function ye(e){return/captcha|recaptcha|unusual traffic|google\.com\/sorry|blocked/i.test(e)}function he(e){return/ERR_TUNNEL_CONNECTION_FAILED|ERR_PROXY_CONNECTION_FAILED|ERR_SOCKS_CONNECTION_FAILED|tunnel connection failed|proxy connection failed|transport error: proxy/i.test(e)}function we(e){return/proxy unavailable|proxy_unavailable|connection_test_failed|did not return a proxy id|configured fallback/i.test(e)}function ve(e){return/(?:spending|billing|organization|account).{0,80}(?:cap|limit|blocked|disabled)|(?:quota|capacity).{0,40}(?:reached|exceeded)|https?:\/\/\S*dashboard/i.test(e)}function Se(e){return/browser (?:has been )?closed|context (?:has been )?closed|target page, context or browser has been closed|session closed|page has been closed/i.test(e)}function C(e){let r=fe(e);return e instanceof W?{error_code:"request_aborted",error_type:"request_aborted",message:p("request_aborted"),retryable:!0,httpStatus:408,terminalStatus:"cancelled"}:e instanceof $||ye(r)?{error_code:"captcha_exhausted",error_type:"captcha",message:p("captcha_exhausted"),retryable:!0,httpStatus:503,terminalStatus:"failed"}:re(e,r)?{error_code:"vendor_unavailable",error_type:"service_unavailable",message:p("vendor_unavailable"),retryable:!0,httpStatus:503,terminalStatus:"failed"}:e instanceof B?{error_code:"location_mismatch",error_type:"location_mismatch",message:p("location_mismatch"),retryable:!0,httpStatus:503,terminalStatus:"failed"}:he(r)?{error_code:"proxy_tunnel_failed",error_type:"connection",message:p("proxy_tunnel_failed"),retryable:!0,httpStatus:503,terminalStatus:"failed"}:we(r)?{error_code:"proxy_unavailable",error_type:"connection",message:p("proxy_unavailable"),retryable:!0,httpStatus:503,terminalStatus:"failed"}:Se(r)?{error_code:"browser_session_interrupted",error_type:"extraction",message:p("browser_session_interrupted"),retryable:!0,httpStatus:503,terminalStatus:"failed"}:be(e,r)?{error_code:"harvest_timeout",error_type:"timeout",message:p("harvest_timeout"),retryable:!0,httpStatus:504,terminalStatus:"failed"}:ve(r)?{error_code:"service_unavailable",error_type:"service_unavailable",message:S,retryable:!0,httpStatus:503,terminalStatus:"failed"}:{error_code:"extraction_failed",error_type:"extraction",message:S,retryable:!1,httpStatus:500,terminalStatus:"failed"}}function T(e){return JSON.stringify({error_code:e.error_code,error_type:e.error_type,message:e.message,retryable:e.retryable})}function y(e,r={}){let t=z({errorCode:e.error_code,errorType:e.error_type,retryable:e.retryable,retryAfterSeconds:r.retryAfterSeconds,chargeStatus:r.chargeStatus,details:r.details});return{error:t.message,...t}}function L(e,r={}){let{error:t,...i}=y(e,r);return i}function Ce(e,r={}){let t=C(e);return{body:y(t,r),status:t.httpStatus}}import{createHash as Re}from"crypto";import{createHash as Ee,randomUUID as h}from"crypto";var M=class extends Error{constructor(){super("This idempotency key was already used with different normalized inputs."),this.name="OperationIdempotencyConflictError"}};function g(e){return Ee("sha256").update(e).digest("hex")}function H(e){return Array.isArray(e)?e.map(H):e&&typeof e=="object"?Object.fromEntries(Object.entries(e).sort(([r],[t])=>r.localeCompare(t)).map(([r,t])=>[r,H(t)])):e}function te(e){return JSON.stringify(H(e??{}))}function d(e,r){let t=e.trim();if(!t)throw new Error(`${r} is required`);return t}function m(e,r=2e3){return e==null?null:e.slice(0,r)}async function oe(e){let r=l(),t=d(e.tool,"tool"),i=d(e.ownerScope,"ownerScope"),a=e.idempotencyKey?.trim()||null,o=e.requestFingerprint?.trim()||null;if(a==null!=(o==null))throw new Error("idempotencyKey and requestFingerprint must be supplied together");let n=a?g(`${i}\0${t}\0${a}`):null,s=e.id??h(),u=[s,e.userId??null,g(i),t,n,o,e.jobId??null,e.requestId??null,e.deploymentCommit??null,te(e.normalizedFlags),e.startedAt??new Date().toISOString()];if(n){await r.execute({sql:`INSERT OR IGNORE INTO operation_runs
2
- (id, user_id, owner_scope_hash, tool, idempotency_scope_hash, request_fingerprint,
3
- job_id, request_id, deployment_commit, normalized_flags_json, started_at)
4
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,args:u});let f=(await r.execute({sql:"SELECT id, request_fingerprint FROM operation_runs WHERE idempotency_scope_hash = ?",args:[n]})).rows[0];if(!f)throw new Error("Operation run insert did not produce an idempotency receipt");if(String(f.request_fingerprint)!==o)throw new M;return{id:String(f.id),replayed:String(f.id)!==s}}return await r.execute({sql:`INSERT INTO operation_runs
5
- (id, user_id, owner_scope_hash, tool, idempotency_scope_hash, request_fingerprint,
6
- job_id, request_id, deployment_commit, normalized_flags_json, started_at)
7
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,args:u}),{id:s,replayed:!1}}async function ne(e){let r=e.endedAt??new Date().toISOString();if((await l().execute({sql:`UPDATE operation_runs
8
- SET status = ?, failure_class = ?, ended_at = ?, updated_at = ?
9
- WHERE id = ? AND status = 'running'`,args:[e.status,m(e.failureClass,200),r,r,e.runId]})).rowsAffected===1)return;let i=m(e.failureClass,200),a=await l().execute({sql:"SELECT status, failure_class FROM operation_runs WHERE id = ?",args:[e.runId]});if(a.rows.length===0)throw new Error(`Unknown operation run: ${e.runId}`);let o=a.rows[0]?.failure_class==null?null:String(a.rows[0]?.failure_class);if(String(a.rows[0]?.status)!==e.status||o!==i)throw new Error(`Operation run ${e.runId} is already terminal as ${String(a.rows[0]?.status)}`)}async function ie(e){if(!Number.isInteger(e.attemptNumber)||e.attemptNumber<1)throw new Error("attemptNumber must be a positive integer");if(e.attemptNumber===1&&(e.parentAttemptId||e.edgeKind||e.retryKind))throw new Error("The first attempt cannot have a parent or retry edge");if(e.attemptNumber>1&&(!e.parentAttemptId||!e.edgeKind))throw new Error("Every non-first attempt requires a parentAttemptId and edgeKind");if(e.retryKind&&!["same_method_retry","provider_fallback","durable_resume","reconciliation"].includes(e.edgeKind??""))throw new Error("retryKind requires a retry or reconciliation edgeKind");let r=e.id??h();return await l().execute({sql:`INSERT INTO operation_attempts
10
- (id, run_id, parent_attempt_id, attempt_number, edge_kind, retry_kind, retry_reason, retry_owner,
11
- method, provider, normalized_flags_json, started_at)
12
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,args:[r,e.runId,e.parentAttemptId??null,e.attemptNumber,e.edgeKind??null,e.retryKind??null,m(e.retryReason,500),m(e.retryOwner,100),d(e.method,"method"),e.provider??null,te(e.normalizedFlags),e.startedAt??new Date().toISOString()]}),r}async function ae(e){if(!Number.isInteger(e.durationMs)||e.durationMs<0)throw new Error("durationMs must be a non-negative integer");let r=e.endedAt??new Date().toISOString();if((await l().execute({sql:`UPDATE operation_attempts SET
13
- status = ?, error_code = ?, error_message = ?, ended_at = ?, duration_ms = ?, updated_at = ?
14
- WHERE id = ? AND status = 'running'`,args:[e.status,m(e.errorCode,200),m(e.errorMessage),r,e.durationMs,r,e.attemptId]})).rowsAffected===1)return;let i=await l().execute({sql:"SELECT status, duration_ms FROM operation_attempts WHERE id = ?",args:[e.attemptId]});if(i.rows.length===0)throw new Error(`Unknown operation attempt: ${e.attemptId}`);if(String(i.rows[0]?.status)!==e.status||Number(i.rows[0]?.duration_ms)!==e.durationMs)throw new Error(`Operation attempt ${e.attemptId} is already terminal as ${String(i.rows[0]?.status)}`)}async function D(e){let r=d(e.provider,"provider"),t=d(e.method,"method"),i=g(d(e.accountScope,"accountScope")),a=e.providerSourceKey?.trim()||null,o=a?g(a):null,n=e.id??h(),s=await l().execute({sql:`INSERT OR IGNORE INTO provider_usage_receipts
15
- (id, attempt_id, provider, account_scope_hash, method, provider_source_key,
16
- provider_source_key_hash, provider_status)
17
- VALUES (?, ?, ?, ?, ?, ?, ?, ?)`,args:[n,e.attemptId,r,i,t,a,o,e.providerStatus??null]});if(!o){if(s.rowsAffected===1)return{id:n,replayed:!1};let _=(await l().execute({sql:"SELECT attempt_id, provider, method FROM provider_usage_receipts WHERE id = ?",args:[n]})).rows[0];if(!_||String(_.attempt_id)!==e.attemptId||String(_.provider)!==r||String(_.method)!==t)throw new Error("Provider receipt ID is already used by a different receipt");return{id:n,replayed:!0}}let c=(await l().execute({sql:`SELECT id, attempt_id FROM provider_usage_receipts
18
- WHERE provider = ? AND account_scope_hash = ? AND method = ? AND provider_source_key_hash = ?`,args:[r,i,t,o]})).rows[0];if(!c)throw new Error("Provider receipt insert did not produce a source receipt");if(String(c.attempt_id)!==e.attemptId)throw new Error("Provider source identity is already attached to a different attempt");return{id:String(c.id),replayed:String(c.id)!==n}}async function se(e,r){let t=d(r,"providerSourceKey"),i=g(t);if((await l().execute({sql:`UPDATE provider_usage_receipts
19
- SET provider_source_key = ?, provider_source_key_hash = ?, updated_at = datetime('now')
20
- WHERE id = ? AND provider_source_key IS NULL`,args:[t,i,e]})).rowsAffected===1)return;let o=await l().execute({sql:"SELECT provider_source_key_hash FROM provider_usage_receipts WHERE id = ?",args:[e]});if(!o.rows[0])throw new Error(`Unknown provider receipt: ${e}`);if(String(o.rows[0].provider_source_key_hash)!==i)throw new Error(`Provider receipt ${e} already has a different source identity`)}async function w(e){if(e.units!=null&&(!Number.isFinite(e.units)||e.units<0))throw new Error("units must be non-negative");if(e.amountUsdNanos!=null&&(!Number.isSafeInteger(e.amountUsdNanos)||e.amountUsdNanos<0))throw new Error("amountUsdNanos must be a non-negative safe integer");if(e.costState==="actual"&&e.amountUsdNanos==null)throw new Error("actual receipts require amountUsdNanos");if(e.costState==="actual"&&e.amountUsdNanos===0&&!e.zeroCostReason?.trim())throw new Error("actual zero-cost receipts require zeroCostReason");let r=e.checkedAt??new Date().toISOString(),t=e.finalizedAt??r;if((await l().execute({sql:`UPDATE provider_usage_receipts SET
21
- cost_state = ?, units = ?, unit_type = ?, amount_usd_nanos = ?, rate_source = ?, zero_cost_reason = ?,
22
- provider_status = ?, provider_duration_ms = ?, provider_captcha = ?, error_code = ?, error_message = ?,
23
- checked_at = ?, finalized_at = ?, updated_at = ?
24
- WHERE id = ? AND (cost_state = 'pending' OR (cost_state = 'estimated' AND ? = 'actual'))`,args:[e.costState,e.units??null,e.unitType??null,e.amountUsdNanos??null,e.rateSource??null,e.zeroCostReason??null,e.providerStatus??null,e.providerDurationMs??null,e.providerCaptcha==null?null:e.providerCaptcha?1:0,m(e.errorCode,200),m(e.errorMessage),r,t,t,e.receiptId,e.costState]})).rowsAffected===1)return;let a=await l().execute({sql:"SELECT cost_state, units, unit_type, amount_usd_nanos FROM provider_usage_receipts WHERE id = ?",args:[e.receiptId]});if(a.rows.length===0)throw new Error(`Unknown provider receipt: ${e.receiptId}`);let o=a.rows[0],n=o?.units==null&&e.units==null||Number(o?.units)===e.units,s=o?.amount_usd_nanos==null&&e.amountUsdNanos==null||Number(o?.amount_usd_nanos)===e.amountUsdNanos,u=o?.unit_type==null&&e.unitType==null||String(o?.unit_type)===e.unitType;if(String(o?.cost_state)!==e.costState||!n||!s||!u)throw new Error(`Provider receipt ${e.receiptId} is already finalized as ${String(a.rows[0]?.cost_state)}`)}async function He(e){let t=(await l().execute({sql:`SELECT id FROM provider_usage_receipts
25
- WHERE provider = ? AND account_scope_hash = ? AND method = ? AND provider_source_key_hash = ?`,args:[d(e.provider,"provider"),g(d(e.accountScope,"accountScope")),d(e.method,"method"),g(d(e.providerSourceKey,"providerSourceKey"))]})).rows[0];if(!t)return!1;let{provider:i,accountScope:a,method:o,providerSourceKey:n,...s}=e;return await w({...s,receiptId:String(t.id)}),!0}async function De(e=30){if(!Number.isInteger(e)||e<1||e>365)throw new Error("retentionDays must be an integer between 1 and 365");let r=`-${e} days`,t=l(),[i,a,o]=await Promise.all([t.execute({sql:`UPDATE operation_attempts
26
- SET error_message = NULL, updated_at = datetime('now')
27
- WHERE ended_at < datetime('now', ?) AND error_message IS NOT NULL`,args:[r]}),t.execute({sql:`UPDATE provider_usage_receipts
28
- SET provider_source_key = NULL, error_message = NULL, updated_at = datetime('now')
29
- WHERE finalized_at < datetime('now', ?)
30
- AND (provider_source_key IS NOT NULL OR error_message IS NOT NULL)`,args:[r]}),t.execute({sql:`UPDATE harvest_attempts
31
- SET provider_session_id = NULL, \u006b\u0065\u0072\u006e\u0065\u006c_session_id = NULL, error = NULL,
32
- \u006b\u0065\u0072\u006e\u0065\u006c_delete_error = NULL, browser_close_error = NULL,
33
- provider_error_message = NULL, provider_detail_json = NULL,
34
- provider_disconnect_message = NULL, debug_json = NULL
35
- WHERE completed_at < datetime('now', ?)
36
- AND (provider_session_id IS NOT NULL OR \u006b\u0065\u0072\u006e\u0065\u006c_session_id IS NOT NULL OR error IS NOT NULL
37
- OR \u006b\u0065\u0072\u006e\u0065\u006c_delete_error IS NOT NULL OR browser_close_error IS NOT NULL
38
- OR provider_error_message IS NOT NULL OR provider_detail_json IS NOT NULL
39
- OR provider_disconnect_message IS NOT NULL OR debug_json IS NOT NULL)`,args:[r]})]);return{operationAttempts:i.rowsAffected,providerReceipts:a.rowsAffected,legacyHarvestAttempts:o.rowsAffected}}async function le(e){let t={billing_authorizations:{column:"id"},billing_events:{column:"id"},billing_debits:{column:"idempotency_key"},billing_credits:{column:"idempotency_key"},ledger:{column:"id"}}[e.billingTable],i=d(e.billingKey,"billingKey"),a=await l().execute({sql:`SELECT b.user_id AS billing_user_id, r.user_id AS run_user_id
40
- FROM operation_runs r
41
- JOIN ${e.billingTable} b ON CAST(b.${t.column} AS TEXT) = ?
42
- WHERE r.id = ?`,args:[i,e.runId]});if(!a.rows[0])throw new Error("Billing link target or operation run does not exist");let o=a.rows[0].billing_user_id,n=a.rows[0].run_user_id;if(n!=null&&o!=null&&String(n)!==String(o))throw new Error("Billing link owner does not match operation run owner");await l().execute({sql:`INSERT OR IGNORE INTO operation_billing_links
43
- (run_id, billing_table, billing_key, relation, amount_mc) VALUES (?, ?, ?, ?, ?)`,args:[e.runId,e.billingTable,i,e.relation,e.amountMc??null]})}async function Ue(e,r=new Date().toISOString()){let t=h();return await l().execute({sql:"INSERT INTO provider_reconciliation_runs (id, provider, started_at) VALUES (?, ?, ?)",args:[t,d(e,"provider"),r]}),t}async function qe(e){if([e.checkedCount,e.completedCount,e.pendingCount,e.unavailableCount,e.failedCount].some(a=>!Number.isInteger(a)||a<0))throw new Error("Reconciliation counts must be non-negative integers");if(e.completedCount+e.pendingCount+e.unavailableCount+e.failedCount>e.checkedCount)throw new Error("Reconciliation outcome counts cannot exceed checkedCount");let t=e.completedAt??new Date().toISOString();if((await l().execute({sql:`UPDATE provider_reconciliation_runs SET
44
- status = ?, checked_count = ?, completed_count = ?, pending_count = ?, unavailable_count = ?,
45
- failed_count = ?, error_code = ?, completed_at = ?
46
- WHERE id = ? AND status = 'running'`,args:[e.status,e.checkedCount,e.completedCount,e.pendingCount,e.unavailableCount,e.failedCount,m(e.errorCode,200),t,e.id]})).rowsAffected!==1)throw new Error(`Unknown or terminal provider reconciliation run: ${e.id}`)}async function de(e){let r=l(),[t,i,a,o]=await Promise.all([r.execute({sql:"SELECT * FROM operation_runs WHERE id = ?",args:[e]}),r.execute({sql:"SELECT * FROM operation_attempts WHERE run_id = ? ORDER BY attempt_number",args:[e]}),r.execute({sql:`SELECT r.* FROM provider_usage_receipts r
47
- JOIN operation_attempts a ON a.id = r.attempt_id
48
- WHERE a.run_id = ? ORDER BY a.attempt_number, r.rowid`,args:[e]}),r.execute({sql:"SELECT * FROM operation_billing_links WHERE run_id = ? ORDER BY created_at, billing_table, billing_key",args:[e]})]);return t.rows[0]?{run:t.rows[0],attempts:[...i.rows],providerReceipts:[...a.rows],billingLinks:[...o.rows]}:null}var Oe=1e9;function Ae(e){return Re("sha256").update(JSON.stringify(e)).digest("hex")}function v(e){return`harvest:${e}`}async function We(e){let r=v(e.jobId);try{return(await oe({id:r,userId:e.userId,ownerScope:`user:${e.userId}`,tool:e.tool,normalizedFlags:e.normalizedFlags,idempotencyKey:`job:${e.jobId}`,requestFingerprint:Ae(e.normalizedFlags),jobId:e.jobId,requestId:e.requestId??null,deploymentCommit:process.env.VERCEL_GIT_COMMIT_SHA?.trim()||process.env.GIT_COMMIT_SHA?.trim()||null})).id}catch(t){return console.warn(JSON.stringify({event:"operation_run_start_failed",job_id:e.jobId,tool:e.tool,message:t instanceof Error?t.message:String(t)})),null}}async function q(e,r,t){if(e)try{await ne({runId:e,status:r,failureClass:t})}catch(i){console.warn(JSON.stringify({event:"operation_run_finish_failed",operation_run_id:e,message:i instanceof Error?i.message:String(i)}))}}async function Be(e,r,t,i){if(!(!e||!r))try{await le({runId:e,billingTable:"billing_debits",billingKey:r,relation:t,amountMc:i})}catch(a){console.warn(JSON.stringify({event:"operation_billing_link_failed",operation_run_id:e,relation:t,message:a instanceof Error?a.message:String(a)}))}}function U(e){return e==="timeout"?"timed_out":e==="request_aborted"?"cancelled":e==="browser_session_interrupted"?"interrupted":e==="captcha"||e==="proxy_tunnel_failed"||e==="proxy_unavailable"||e==="location_mismatch"||e==="error"?"failed":"succeeded"}function Ie(e){return e==="\u0062\u0072\u0069\u0067\u0068\u0074_\u0064\u0061\u0074\u0061_browser_api"?"\u0062\u0072\u0069\u0067\u0068\u0074\u0064\u0061\u0074\u0061":"\u006b\u0065\u0072\u006e\u0065\u006c"}function ue(e,r,t=0){let i=new Map,a=null;return async o=>{if(e)try{if(o.type==="started"){let s=t+o.attemptNumber;if(s>1&&!a){let _=(await de(e))?.attempts.at(-1);a=_?.id==null?null:String(_.id)}let u=await ie({runId:e,attemptNumber:s,method:o.method,provider:o.provider,parentAttemptId:s===1?null:a,edgeKind:s===1?null:t>0&&o.attemptNumber===1?"durable_resume":o.retryKind==="provider_fallback"?"provider_fallback":"same_method_retry",retryKind:s===1?null:t>0&&o.attemptNumber===1?"durable_resume":o.retryKind,retryReason:s===1?null:t>0&&o.attemptNumber===1?"durable_worker_resume":o.retryReason,retryOwner:s===1?null:t>0&&o.attemptNumber===1?"durable_reconciler":"harvest",normalizedFlags:{maxAttempts:o.maxAttempts,maxQuestions:o.maxQuestions,hasLocation:!!o.location,plannedProvider:o.provider,planReason:o.planReason??null,planTimeoutMs:o.planTimeoutMs??null},startedAt:o.startedAt}),c=await D({attemptId:u,provider:o.provider,accountScope:r,method:o.method,providerStatus:"started"});i.set(o.attemptNumber,{attemptId:u,receiptId:c.id,plannedProvider:o.provider,observedProvider:null,providerMismatch:!1,method:o.method,startedAtMs:Date.parse(o.startedAt)}),a=u;return}let n=i.get(o.attemptNumber);if(!n)throw new Error(`Missing operation attempt state for attempt ${o.attemptNumber}`);if(o.type==="provider_session_started"){let s=Ie(o.provider);if(n.observedProvider=s,s!==n.plannedProvider){n.providerMismatch=!0,await w({receiptId:n.receiptId,costState:"unavailable",providerStatus:"provider_mismatch",errorCode:"provider_mismatch",errorMessage:`Planned ${n.plannedProvider}; observed ${s}`,finalizedAt:o.observedAt});let u=s==="\u0062\u0072\u0069\u0067\u0068\u0074\u0064\u0061\u0074\u0061"?"\u0062\u0072\u0069\u0067\u0068\u0074\u0064\u0061\u0074\u0061_browser":"\u006b\u0065\u0072\u006e\u0065\u006c_browser",c=await D({attemptId:n.attemptId,provider:s,accountScope:r,method:u,providerStatus:"observed_provider_mismatch"});n.receiptId=c.id,n.method=u}await se(n.receiptId,o.providerSessionId);return}if(await ae({attemptId:n.attemptId,status:n.providerMismatch?"failed":U(o.outcome),errorCode:n.providerMismatch?"provider_mismatch":U(o.outcome)==="succeeded"?null:o.outcome,errorMessage:o.error,durationMs:o.durationMs,endedAt:o.completedAt}),(n.observedProvider??n.plannedProvider)==="\u006b\u0065\u0072\u006e\u0065\u006c"){let s=X(o.durationMs,!0);await w({receiptId:n.receiptId,costState:"estimated",units:o.durationMs/1e3,unitType:"browser_second",amountUsdNanos:Math.round(s*Oe),rateSource:`\u006b\u0065\u0072\u006e\u0065\u006c_headful_usd_per_second:${Y}`,providerStatus:n.providerMismatch?"provider_mismatch":o.outcome,providerDurationMs:o.durationMs,errorCode:n.providerMismatch?"provider_mismatch":U(o.outcome)==="succeeded"?null:o.outcome,errorMessage:o.error,finalizedAt:o.completedAt})}}catch(n){console.warn(JSON.stringify({event:"operation_attempt_telemetry_failed",operation_run_id:e,attempt_number:o.attemptNumber,message:n instanceof Error?n.message:String(n)}))}}}function ce(e,r,t=null,i="production-default",a=0){let o=ue(t,i,a);return async n=>{if(await o(n),n.type==="started"){await J({jobId:e,userId:r,attemptNumber:n.attemptNumber,maxAttempts:n.maxAttempts,query:n.query,location:n.location,maxQuestions:n.maxQuestions,startedAt:n.startedAt});return}if(n.type==="provider_session_started"){await V({jobId:e,attemptNumber:n.attemptNumber,browserProvider:n.provider,providerSessionId:n.providerSessionId,observedAt:n.observedAt});return}await Q({jobId:e,attemptNumber:n.attemptNumber,outcome:n.outcome,\u006b\u0065\u0072\u006e\u0065\u006cSessionId:n.\u006b\u0065\u0072\u006e\u0065\u006cSessionId,questionCount:n.questionCount,durationMs:n.durationMs,error:n.error,willRetry:n.willRetry,\u006b\u0065\u0072\u006e\u0065\u006cDeleteStarted:n.cleanup.\u006b\u0065\u0072\u006e\u0065\u006cDeleteStarted,\u006b\u0065\u0072\u006e\u0065\u006cDeleteSucceeded:n.cleanup.\u006b\u0065\u0072\u006e\u0065\u006cDeleteSucceeded,\u006b\u0065\u0072\u006e\u0065\u006cDeleteError:n.cleanup.\u006b\u0065\u0072\u006e\u0065\u006cDeleteError,browserCloseSucceeded:n.cleanup.browserCloseSucceeded,browserCloseError:n.cleanup.browserCloseError,browserProvider:n.cleanup.provider??null,providerSessionId:n.cleanup.providerSessionId??null,providerLookupStatus:n.cleanup.providerSessionId?"pending":"not_applicable",providerErrorCode:n.cleanup.providerDisconnectObserved?"browser_session_interrupted":null,providerErrorMessage:n.cleanup.providerDisconnectMessage??null,providerReasonSource:n.cleanup.providerDisconnectObserved?"client_runtime":null,providerDisconnectObserved:n.cleanup.providerDisconnectObserved??!1,providerDisconnectMessage:n.cleanup.providerDisconnectMessage??null,debug:n.debug,completedAt:n.completedAt})}}var pe=2,K=0;function me(e){if(!e||typeof e!="object")return 0;let r=e;return typeof r.totalQuestions=="number"?r.totalQuestions:Array.isArray(r.flat)?r.flat.length:0}function _e(e){return x.paa_base+Math.max(1,e)*x.paa}async function ge(e){K++;try{let r=typeof e.options=="string"?JSON.parse(e.options):e.options,t={value:null},i=v(e.id),a=await j({op:r.serpOnly?"serp":"paa",userId:Number(e.user_id),headlessSentOut:t,operationRunId:i,operationAccountScope:"production-default"},()=>Z({...r,\u006b\u0065\u0072\u006e\u0065\u006cApiKey:F(),headless:!0,format:"json",outputDir:"/tmp/paa-output-api",onAttemptEvent:ce(e.id,e.user_id,i)}));await G(e.id,a),await q(i,"succeeded");let o=await E(e.id,e.user_id);if(typeof r.billingHoldMc=="number"&&r.billingDebitKey){let n=r.serpOnly?k(t.value):_e(me(a));await I(Number(e.user_id),r.billingDebitKey,n,r.serpOnly?"serp_refund":"paa_refund",r.serpOnly?"SERP search settlement":"PAA harvest settlement",r.serpOnly?"serp_search":"paa_harvest")}else if(!r.serpOnly&&typeof r.billingHoldMc=="number"){let n=_e(me(a)),s=r.billingHoldMc-n;s>0?await b(e.user_id,s,"paa_refund","overestimate refund"):s<0&&await A(e.user_id,-s,"paa",r.query??e.query)}else if(r.serpOnly&&typeof r.billingHoldMc=="number"){let n=k(t.value),s=r.billingHoldMc-n;s>0?await b(e.user_id,s,"serp_refund","headless-mode pricing settle"):s<0&&await A(e.user_id,-s,"serp",r.query??e.query)}e.callback_url&&await P(e.callback_url,{job_id:e.id,status:"done",result:ee(a),attempts:N(o)})}catch(r){console.error("[harvest/worker] failed",{jobId:e.id,error:r instanceof Error?r.message:String(r)});let t=C(r);await q(v(e.id),t.error_code==="harvest_timeout"?"timed_out":t.terminalStatus,t.error_code);let i=typeof e.options=="string"?JSON.parse(e.options):e.options,a=typeof i.billingHoldMc=="number"&&i.billingHoldMc>0;await O(e.id,T(t),L(t,{chargeStatus:a?"refund_pending":"not_charged"}));let o=await E(e.id,e.user_id);try{a&&(i.billingDebitKey?await I(Number(e.user_id),i.billingDebitKey,0,i.serpOnly?"serp_refund":"paa_refund","failed call",i.serpOnly?"serp_search":"paa_harvest"):await b(e.user_id,i.billingHoldMc,"refund","failed call"),await O(e.id,T(t),L(t,{chargeStatus:"refunded"})))}catch{}e.callback_url&&await P(e.callback_url,{job_id:e.id,status:"failed",...y(t),attempts:N(o)})}finally{K--}}async function Ne(){let e=await R();if(!e)return{claimed:!1};let r=Date.now();return await ge(e),{claimed:!0,jobId:e.id,completed:!0,durationMs:Date.now()-r}}async function ar(e){let r=[];for(let t=0;t<e.maxJobs&&!(Date.now()>=e.deadlineMs);t++){let i=await Ne();if(r.push(i),!i.claimed)break}return r}function sr(){setInterval(async()=>{if(K>=pe)return;let e=await R();e&&ge(e)},2e3),console.log(`[worker] started \u2014 polling every 2s, max ${pe} concurrent`)}export{ie as a,ae as b,D as c,se as d,w as e,He as f,De as g,Ue as h,qe as i,C as j,T as k,y as l,L as m,Ce as n,v as o,We as p,q,Be as r,ce as s,P as t,Ne as u,ar as v,sr as w};
@@ -1 +0,0 @@
1
- var o="0.90.7";export{o as a};
@@ -1 +0,0 @@
1
- import{$ as M,$a as Ma,$b as Mb,A as l,Aa as la,Ab as lb,B as m,Ba as ma,Bb as mb,C as n,Ca as na,Cb as nb,D as o,Da as oa,Db as ob,E as p,Ea as pa,Eb as pb,F as q,Fa as qa,Fb as qb,G as r,Ga as ra,Gb as rb,H as s,Ha as sa,Hb as sb,I as t,Ia as ta,Ib as tb,J as u,Ja as ua,Jb as ub,K as v,Ka as va,Kb as vb,L as w,La as wa,Lb as wb,M as x,Ma as xa,Mb as xb,N as y,Na as ya,Nb as yb,O as z,Oa as za,Ob as zb,P as A,Pa as Aa,Pb as Ab,Q as B,Qa as Ba,Qb as Bb,R as C,Ra as Ca,Rb as Cb,S as D,Sa as Da,Sb as Db,T as E,Ta as Ea,Tb as Eb,U as F,Ua as Fa,Ub as Fb,V as G,Va as Ga,Vb as Gb,W as H,Wa as Ha,Wb as Hb,X as I,Xa as Ia,Xb as Ib,Y as J,Ya as Ja,Yb as Jb,Z as K,Za as Ka,Zb as Kb,_ as L,_a as La,_b as Lb,aa as N,ab as Na,ac as Nb,ba as O,bb as Oa,bc as Ob,ca as P,cb as Pa,cc as Pb,da as Q,db as Qa,ea as R,eb as Ra,fa as S,fb as Sa,ga as T,gb as Ta,ha as U,hb as Ua,ia as V,ib as Va,ja as W,jb as Wa,ka as X,kb as Xa,la as Y,lb as Ya,ma as Z,mb as Za,na as _,nb as _a,oa as $,ob as $a,p as a,pa as aa,pb as ab,q as b,qa as ba,qb as bb,r as c,ra as ca,rb as cb,s as d,sa as da,sb as db,t as e,ta as ea,tb as eb,u as f,ua as fa,ub as fb,v as g,va as ga,vb as gb,w as h,wa as ha,wb as hb,x as i,xa as ia,xb as ib,y as j,ya as ja,yb as jb,z as k,za as ka,zb as kb}from"./chunk-TOJBPATJ.js";export{b as CORE_SCHEMA_VERSION,a as CREDIT_LOTS_EPOCH,ub as CREDIT_LOT_TTL,c as SITE_EXTRACT_COUNTER_REPAIR_VERSION,Ib as SiteAuditJobRowSchema,Jb as SiteAuditPhaseLogRowSchema,za as advanceWorkflowRunStep,xa as appendWorkflowArtifacts,lb as applySubscriptionInvoiceGrant,V as attachHarvestAttemptProviderSession,Xa as cancelJob,J as checkRateLimit,Ia as checkpointDurablePaaJob,Ha as checkpointJob,s as claimDueStripeEvents,Ga as claimDurablePaaJob,Ab as claimMonthlyFreeRefresh,Fa as claimPendingJob,Za as claimPendingKpoJob,Ka as completeDurablePaaJob,Na as completeExpiredDurablePaaJob,Ta as completeJob,ab as completeKpoJob,Ua as completeRunningJob,t as completeStripeEvent,ua as completeWorkflowRunRecord,m as consumeCode,L as consumePasswordResetToken,Ea as countActiveJobsForUser,Da as countActiveUsers,Q as createJob,R as createJobWithId,Ya as createKpoJob,K as createPasswordResetToken,S as createRunningJob,I as createUser,pa as createWorkflowRun,ia as createWorkflowSchedule,xb as creditMc,yb as creditMcIdempotent,P as deactivateUser,v as deadLetterStripeEvent,Bb as debitMc,Cb as debitMcIdempotent,ma as deleteWorkflowSchedule,r as enqueueStripeEvent,vb as expireOldLots,La as failDurablePaaJob,Oa as failExpiredDurablePaaJob,Va as failJob,bb as failKpoJob,Wa as failRunningJob,va as failWorkflowRunRecord,W as finalizeExpiredHarvestAttempts,X as finishHarvestAttempt,y as generateApiKey,Fb as getBillingLedgerSummary,k as getClient,mb as getConnectedAccountBillingState,e as getDb,Lb as getInboxMessage,$ as getJob,_a as getKpoJob,db as getKpoPhaseLog,Eb as getLedger,qb as getMemoryPlan,rb as getMemoryProvisioned,T as getOrCreateRunningJob,ea as getPageSnapshot,o as getRefresh,w as getStripeEventQueueHealth,C as getUserByApiKey,B as getUserByEmail,D as getUserById,fb as getUserByStripeCustomerId,E as getUserMemoryCreds,H as getUserStats,Ba as getWorkflowArtifact,qa as getWorkflowRun,ra as getWorkflowRunByIdempotencyKey,ya as getWorkflowRunStepState,ja as getWorkflowSchedule,z as hashPassword,Ob as insertInboxMessage,d as inspectCurrentCoreSchema,zb as ledgerExistsForOperation,Gb as ledgerExistsForStripePI,Pb as listActiveUserIds,na as listDueWorkflowSchedules,_ as listHarvestAttempts,Z as listHarvestAttemptsPendingProviderTelemetry,Kb as listInboxMessages,da as listJobs,eb as listKpoJobs,ba as listPendingExtractUrlDispatches,Pa as listRecentTerminalDurablePaaJobs,Ra as listRecoverableDurablePaaJobs,ha as listRequestEvents,Qa as listStaleRunningDurablePaaJobs,O as listUsers,ob as listUsersDueForConnectedAccountBillingReconciliation,Aa as listWorkflowArtifacts,sa as listWorkflowRuns,ka as listWorkflowSchedules,cb as logKpoPhaseComplete,ga as logRequestEvent,aa as markDispatchedJobRunning,Mb as markInboxMessageOpened,Sa as markJobBillingSettled,ta as markWorkflowRunRunning,oa as markWorkflowScheduleRan,i as migrate,wb as migrateExistingBalancesToLots,g as migrateSecuredMainOAuthSchema,la as patchWorkflowSchedule,l as putCode,n as putRefresh,Hb as reconcileBalanceMc,ca as recordExtractUrlDispatchAttempt,Ca as recordWorkflowWebhookDelivery,j as registerClient,Ja as renewDurablePaaLease,wa as replaceWorkflowArtifacts,Ma as requeueExpiredDurablePaaJob,tb as resolveUserByMemorySubscription,u as retryStripeEvent,N as revokeApiKey,p as revokeRefresh,M as rotateApiKey,q as rotateRefresh,ib as setConcurrencyPackQuantity,jb as setConcurrencySubId,nb as setConnectedAccountBillingState,f as setDbForTesting,hb as setExtraConcurrencySlots,pb as setMemoryPlan,sb as setMemoryProvisioned,G as setPassword,gb as setStripeCustomerId,kb as setSubscriptionTier,F as setUserMemoryCreds,Db as settleDebitMcIdempotent,Nb as softDeleteInboxMessage,U as startHarvestAttempt,x as stripeEventAlreadyProcessed,Y as updateHarvestAttemptProviderTelemetry,$a as updateKpoJobState,fa as upsertPageSnapshot,A as verifyPassword,h as verifySecuredMainOAuthSchema};
@@ -1 +0,0 @@
1
- import{e as a,f as b,g as c,h as d,i as e,j as f,k as g,l as h}from"./chunk-OT2HUS2G.js";import"./chunk-YTEAWZEN.js";import"./chunk-IGJKAECE.js";import"./chunk-HUV2WTRW.js";import"./chunk-CTX3NMZQ.js";import"./chunk-BDLR4CCL.js";import"./chunk-TOJBPATJ.js";export{d as GMAIL_ATTACHMENT_REF_TTL_MS,c as GMAIL_INLINE_BODY_BYTES,b as GMAIL_MAIN_CONTRACT_HASH,a as GMAIL_MAIN_CONTRACT_VERSION,h as GmailService,e as GmailServiceError,g as normalizeGmailMessage,f as parseGmailAddresses};