mcp-scraper 0.57.3 → 0.60.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 (38) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +2 -2
  3. package/dist/bin/api-server.cjs +549 -107
  4. package/dist/bin/api-server.cjs.map +1 -1
  5. package/dist/bin/api-server.js +2 -2
  6. package/dist/bin/mcp-scraper-cli.cjs +1 -1
  7. package/dist/bin/mcp-scraper-cli.cjs.map +1 -1
  8. package/dist/bin/mcp-scraper-cli.js +1 -1
  9. package/dist/bin/mcp-scraper-install.cjs +2 -2
  10. package/dist/bin/mcp-scraper-install.cjs.map +1 -1
  11. package/dist/bin/mcp-scraper-install.js +2 -2
  12. package/dist/bin/mcp-stdio-server.cjs +36 -8
  13. package/dist/bin/mcp-stdio-server.cjs.map +1 -1
  14. package/dist/bin/mcp-stdio-server.js +4 -4
  15. package/dist/{chunk-R6CO77BN.js → chunk-2U2ZDDSI.js} +3 -3
  16. package/dist/{chunk-R6CO77BN.js.map → chunk-2U2ZDDSI.js.map} +1 -1
  17. package/dist/{chunk-QSUSTYB3.js → chunk-AIA3MFT2.js} +38 -9
  18. package/dist/chunk-AIA3MFT2.js.map +1 -0
  19. package/dist/chunk-AQA2ZL4X.js +7 -0
  20. package/dist/chunk-AQA2ZL4X.js.map +1 -0
  21. package/dist/{chunk-HU4R6BP2.js → chunk-IMBMDZUO.js} +2 -2
  22. package/dist/{chunk-HU4R6BP2.js.map → chunk-IMBMDZUO.js.map} +1 -1
  23. package/dist/{chunk-5XYBKE3X.js → chunk-KMGRM4FL.js} +2 -2
  24. package/dist/editorial-reading-room/assets/app.js +17 -3
  25. package/dist/{extract-bundle-H7JEELY7.js → extract-bundle-XRRN6NAZ.js} +3 -3
  26. package/dist/{server-EP2SK2ID.js → server-IRKNU6LO.js} +505 -105
  27. package/dist/server-IRKNU6LO.js.map +1 -0
  28. package/dist/{site-extract-repository-CFMSWAVL.js → site-extract-repository-XAA2FVDN.js} +3 -3
  29. package/dist/{worker-S2WXELUC.js → worker-QFSOMF2N.js} +2 -2
  30. package/package.json +1 -1
  31. package/dist/chunk-LHH3GX3W.js +0 -7
  32. package/dist/chunk-LHH3GX3W.js.map +0 -1
  33. package/dist/chunk-QSUSTYB3.js.map +0 -1
  34. package/dist/server-EP2SK2ID.js.map +0 -1
  35. /package/dist/{chunk-5XYBKE3X.js.map → chunk-KMGRM4FL.js.map} +0 -0
  36. /package/dist/{extract-bundle-H7JEELY7.js.map → extract-bundle-XRRN6NAZ.js.map} +0 -0
  37. /package/dist/{site-extract-repository-CFMSWAVL.js.map → site-extract-repository-XAA2FVDN.js.map} +0 -0
  38. /package/dist/{worker-S2WXELUC.js.map → worker-QFSOMF2N.js.map} +0 -0
@@ -13,17 +13,17 @@ import {
13
13
  registerScheduledResultsMcpTools,
14
14
  registerSerpIntelligenceCaptureTools,
15
15
  resolveDeploymentProfile
16
- } from "../chunk-QSUSTYB3.js";
16
+ } from "../chunk-AIA3MFT2.js";
17
17
  import "../chunk-2K74LVV7.js";
18
18
  import "../chunk-4PNMJUSG.js";
19
19
  import "../chunk-AK2NNIYA.js";
20
20
  import {
21
21
  renderInstallTerminal
22
- } from "../chunk-HU4R6BP2.js";
22
+ } from "../chunk-IMBMDZUO.js";
23
23
  import {
24
24
  PACKAGE_VERSION
25
- } from "../chunk-LHH3GX3W.js";
26
- import "../chunk-R6CO77BN.js";
25
+ } from "../chunk-AQA2ZL4X.js";
26
+ import "../chunk-2U2ZDDSI.js";
27
27
  import "../chunk-NDIAJIKQ.js";
28
28
  import "../chunk-KSAXVGKC.js";
29
29
 
@@ -213,8 +213,8 @@ var PUBLIC_PRODUCT_CONTRACT = {
213
213
  "freeSignupCredits": 0
214
214
  },
215
215
  "inventory": {
216
- "totalTools": 251,
217
- "scraperTools": 150,
216
+ "totalTools": 252,
217
+ "scraperTools": 151,
218
218
  "memoryTools": 101
219
219
  },
220
220
  "concurrencyPack": {
@@ -1002,4 +1002,4 @@ export {
1002
1002
  MEDIA_TRANSCRIBE_HOLD_MC,
1003
1003
  MC_PER_USD
1004
1004
  };
1005
- //# sourceMappingURL=chunk-R6CO77BN.js.map
1005
+ //# sourceMappingURL=chunk-2U2ZDDSI.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/product-contract.generated.ts","../src/api/rates.ts"],"sourcesContent":["// Generated by scripts/gen-rates.ts. Do not edit by hand.\nexport const PUBLIC_PRODUCT_CONTRACT = {\n \"schemaVersion\": 1,\n \"ratePolicy\": {\n \"version\": \"serp-paa-2026-08-11\",\n \"effectiveDate\": \"2026-08-11T00:00:00.000Z\"\n },\n \"costEvidence\": {\n \"id\": \"serp-paa-rate-basis-2026-08\",\n \"status\": \"provisional\",\n \"minimumRevenueCostRatio\": 2.5,\n \"observedRevenueCostRatio\": 2.5160607750756583\n },\n \"operationCosts\": {\n \"serp\": {\n \"credits\": 60,\n \"unit\": \"per search\",\n \"label\": \"SERP search\",\n \"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.\"\n },\n \"paa\": {\n \"credits\": 10,\n \"unit\": \"per question (+400 credit base)\",\n \"label\": \"PAA harvest\",\n \"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).\"\n },\n \"page_scrape\": {\n \"credits\": 1,\n \"unit\": \"per page\",\n \"label\": \"Page crawl / extract\",\n \"notes\": \"Applies to both single-URL extraction and per-page site crawls.\"\n },\n \"listing_create\": {\n \"credits\": 10,\n \"unit\": \"per new listing\",\n \"label\": \"Directory or wiki listing creation\",\n \"notes\": \"Fixed total price for a new Local Sourcebook directory listing or Transparent Commons wiki entity. Sourcebook acquisition is included.\"\n },\n \"listing_edit\": {\n \"credits\": 2,\n \"unit\": \"per existing listing revision\",\n \"label\": \"Directory or wiki listing edit\",\n \"notes\": \"Fixed total price for refreshing an existing Local Sourcebook listing or revising an existing Transparent Commons entity.\"\n },\n \"url_map\": {\n \"credits\": 5,\n \"unit\": \"per mapping operation\",\n \"label\": \"Site URL mapping\",\n \"notes\": \"Flat rate for the full /map-urls call regardless of URL count discovered.\"\n },\n \"yt_channel\": {\n \"credits\": 2,\n \"unit\": \"per call\",\n \"label\": \"YouTube search / channel harvest\"\n },\n \"yt_transcription\": {\n \"credits\": 200,\n \"unit\": \"base + 2/min of video\",\n \"label\": \"YouTube transcription\",\n \"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).\"\n },\n \"fb_ad\": {\n \"credits\": 7,\n \"unit\": \"per call\",\n \"label\": \"Facebook search / ad lookup\"\n },\n \"maps_search\": {\n \"credits\": 5,\n \"unit\": \"per search\",\n \"label\": \"Maps business search\",\n \"notes\": \"Returns up to 50 Google Maps business/profile candidates. Use maps_place_intel to hydrate selected businesses.\"\n },\n \"maps_place\": {\n \"credits\": 60,\n \"unit\": \"per business\",\n \"label\": \"Maps business lookup\",\n \"notes\": \"Base lookup. Reviews billed separately per card at maps_review rate.\"\n },\n \"maps_review\": {\n \"credits\": 1,\n \"unit\": \"per review card\",\n \"label\": \"Maps review\",\n \"notes\": \"Charged after extraction when includeReviews is true.\"\n },\n \"fb_search\": {\n \"credits\": 8,\n \"unit\": \"per search\",\n \"label\": \"Facebook ad library search\",\n \"notes\": \"Browser automation to search Facebook Ads Library by keyword.\"\n },\n \"google_ads_search\": {\n \"credits\": 6,\n \"unit\": \"per search\",\n \"label\": \"Google Ads Transparency search\",\n \"notes\": \"Browser automation to find advertisers in Google Ads Transparency Center by domain or name.\"\n },\n \"google_ads_intel\": {\n \"credits\": 2,\n \"unit\": \"per call\",\n \"label\": \"Google Ads Transparency advertiser intel\",\n \"notes\": \"Lists and hydrates an advertiser's creatives with image URLs and video references.\"\n },\n \"google_ads_transcribe\": {\n \"credits\": 200,\n \"unit\": \"base + 2/min of video\",\n \"label\": \"Google ad video transcription\",\n \"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).\"\n },\n \"fb_transcribe\": {\n \"credits\": 200,\n \"unit\": \"base + 2/min of video\",\n \"label\": \"Facebook video / ad transcription\",\n \"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).\"\n },\n \"instagram_profile\": {\n \"credits\": 4,\n \"unit\": \"per profile scan\",\n \"label\": \"Instagram profile content discovery\",\n \"notes\": \"Browser extraction of public Instagram profile grid links. Complete history may require a logged-in profile.\"\n },\n \"instagram_media\": {\n \"credits\": 4,\n \"unit\": \"per post or reel\",\n \"label\": \"Instagram media download\",\n \"notes\": \"Extracts post text, image URLs, and reel audio/video tracks, with local downloads when the server can write files.\"\n },\n \"instagram_transcribe\": {\n \"credits\": 200,\n \"unit\": \"base + 2/min of video\",\n \"label\": \"Instagram media transcription\",\n \"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).\"\n },\n \"browser_minute\": {\n \"credits\": 120,\n \"unit\": \"per minute of use\",\n \"label\": \"Interactive browser session\",\n \"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.\"\n },\n \"reddit_thread\": {\n \"credits\": 30,\n \"unit\": \"per thread\",\n \"label\": \"Reddit thread base lookup\",\n \"notes\": \"Base lookup for the post itself. Comments billed separately per comment at reddit_comment rate. Refunded if the thread cannot be retrieved.\"\n },\n \"reddit_comment\": {\n \"credits\": 2,\n \"unit\": \"per comment\",\n \"label\": \"Reddit comment\",\n \"notes\": \"Charged per comment actually extracted, billed down automatically if the balance runs out mid-thread.\"\n },\n \"video_analysis\": {\n \"credits\": 6667,\n \"unit\": \"per 120 frames (max 480)\",\n \"label\": \"Video breakdown (frame-by-frame + transcript)\",\n \"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.\"\n },\n \"trustpilot_reviews\": {\n \"credits\": 5,\n \"unit\": \"per call\",\n \"label\": \"Trustpilot review harvest\",\n \"notes\": \"Base lookup. Reviews billed separately per card at trustpilot_review rate. Refunded if no reviews are found.\"\n },\n \"trustpilot_review\": {\n \"credits\": 1,\n \"unit\": \"per review card\",\n \"label\": \"Trustpilot review card\",\n \"notes\": \"Charged per review actually extracted, billed down automatically if the balance runs out mid-page.\"\n },\n \"g2_reviews\": {\n \"credits\": 5,\n \"unit\": \"per call\",\n \"label\": \"G2 review harvest\",\n \"notes\": \"Base lookup. Reviews billed separately per card at g2_review rate. Refunded if no reviews are found.\"\n },\n \"g2_review\": {\n \"credits\": 2,\n \"unit\": \"per review card\",\n \"label\": \"G2 review card\",\n \"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.\"\n },\n \"diff_page\": {\n \"credits\": 1,\n \"unit\": \"per check\",\n \"label\": \"Page change check\",\n \"notes\": \"Same cost as a single page extract — one scrape is performed per check, then compared against your last stored snapshot for that URL.\"\n }\n },\n \"publicTiers\": [\n {\n \"tier\": \"starter\",\n \"label\": \"Starter\",\n \"monthlyUsd\": 12,\n \"credits\": 80000,\n \"concurrency\": 3\n },\n {\n \"tier\": \"growth\",\n \"label\": \"Growth\",\n \"monthlyUsd\": 40,\n \"credits\": 266667,\n \"concurrency\": 10\n },\n {\n \"tier\": \"scale\",\n \"label\": \"Scale\",\n \"monthlyUsd\": 100,\n \"credits\": 800000,\n \"concurrency\": 20\n }\n ],\n \"credits\": {\n \"mcPerCredit\": 100,\n \"freeSignupCredits\": 0\n },\n \"inventory\": {\n \"totalTools\": 251,\n \"scraperTools\": 150,\n \"memoryTools\": 101\n },\n \"concurrencyPack\": {\n \"ratePolicyVersion\": \"2026-08-14.concurrency-pack-v1\",\n \"monthlyUsd\": 5,\n \"currency\": \"usd\",\n \"interval\": \"month\",\n \"billingUnit\": \"pack\",\n \"slotsPerPack\": 2\n },\n \"addons\": {\n \"memory\": {\n \"monthlyUsd\": 19,\n \"quotaGb\": 5,\n \"freeQuotaGb\": 0.01\n },\n \"scheduling\": {\n \"billingMode\": \"credits\",\n \"entitlement\": \"paid_plan_included\",\n \"separateSubscriptionRequired\": false,\n \"chargeEvent\": \"started_occurrence\",\n \"runBaseCredits\": 75,\n \"runBaseMc\": 7500,\n \"llmCostMultiplier\": 1.5,\n \"llmCostMultiplierBps\": 15000,\n \"modes\": {\n \"connection_sync\": {\n \"runBaseCredits\": 75,\n \"modelCostBilling\": \"none\",\n \"modelCostMultiplier\": 0\n },\n \"agent\": {\n \"runBaseCredits\": 75,\n \"modelCostBilling\": \"actual_reported_cost\",\n \"modelCostMultiplier\": 1.5,\n \"modelCostMultiplierBps\": 15000\n }\n }\n },\n \"connectedAccounts\": {\n \"schemaVersion\": 2,\n \"ratePolicyVersion\": \"2026-08-03.connected-usage-v3\",\n \"effectiveAt\": \"2026-08-03T00:00:00.000Z\",\n \"entitlement\": \"paid_plan_add_on\",\n \"connection\": {\n \"billingMode\": \"flat_recurring_credits\",\n \"amountCredits\": 15000,\n \"interval\": \"month\",\n \"unit\": \"active_connection\",\n \"proration\": \"none\"\n },\n \"usage\": {\n \"billingMode\": \"credits\",\n \"settlementMode\": \"authoritative_receipt\",\n \"rounding\": \"aggregate_then_ceil_to_mc\",\n \"functionRun\": {\n \"credits\": 2,\n \"mc\": 200,\n \"unit\": \"per_function_run\"\n },\n \"proxyRequest\": {\n \"credits\": 2,\n \"mc\": 200,\n \"unit\": \"per_proxy_request\"\n },\n \"compute\": {\n \"creditsPerSecond\": 5,\n \"mcPerSecond\": 500,\n \"sourceUnit\": \"millisecond\",\n \"unit\": \"per_compute_second\",\n \"formula\": \"ceil(computeMilliseconds * mcPerSecond / 1000)\"\n }\n }\n }\n }\n} as const\nexport type PublicProductContract = typeof PUBLIC_PRODUCT_CONTRACT\n","import { PUBLIC_PRODUCT_CONTRACT } from '../product-contract.generated.js'\n\nexport const MC_COSTS = {\n serp: 6_000,\n serp_headless: 6_000,\n serp_headful: 6_000,\n paa: 1_000,\n paa_base: 40_000,\n page_scrape: 100,\n url_map: 500,\n yt_channel: 200,\n yt_transcription: 200,\n fb_ad: 700,\n maps_search: 500,\n maps_place: 6_000,\n maps_review: 100,\n fb_search: 800,\n fb_search_result: 100,\n fb_page_intel: 700,\n fb_page_intel_ad: 50,\n fb_transcribe: 33_300,\n google_ads_search: 600,\n google_ads_intel: 200,\n google_ads_transcribe: 33_300,\n instagram_profile: 400,\n instagram_media: 400,\n instagram_transcribe: 33_300,\n browser_minute: 12_000,\n reddit_thread: 3_000,\n reddit_comment: 200,\n video_analysis: 666_700,\n trustpilot_reviews: 500,\n trustpilot_review: 100,\n g2_reviews: 500,\n g2_review: 200,\n diff_page: 100,\n listing_create: 1_000,\n listing_edit: 200,\n} as const\n\nexport type McCostKey = keyof typeof MC_COSTS\n\n/**\n * Kernel omits the `headless` field for a headful session, so the runtime\n * records headless as `true` and headful/unknown as `null`. Unknown is billed\n * at the conservative headful rate because no cheaper mode was proven.\n */\nexport function serpActualCostMc(headlessSent: boolean | null | undefined): number {\n return headlessSent === true ? MC_COSTS.serp_headless : MC_COSTS.serp_headful\n}\n\nexport const MC_PER_BROWSER_MS = MC_COSTS.browser_minute / 60_000\n\nexport function browserActiveCostMc(activeMs: number): number {\n return Math.round(activeMs * MC_PER_BROWSER_MS)\n}\n\nexport const BROWSER_OPEN_MIN_BALANCE_MC = 1_000\n\nexport const MC_PER_CREDIT = 100\n\n// Public MCP descriptions import these values so the AI-visible routing\n// contract cannot drift from the billing ledger's canonical rates.\nexport const SERP_SEARCH_CREDITS = MC_COSTS.serp_headful / MC_PER_CREDIT\nexport const PAA_BASE_CREDITS = MC_COSTS.paa_base / MC_PER_CREDIT\nexport const PAA_QUESTION_CREDITS = MC_COSTS.paa / MC_PER_CREDIT\nexport const PAGE_SCRAPE_CREDITS = MC_COSTS.page_scrape / MC_PER_CREDIT\n\nexport const LISTING_WRITE_RATE_POLICY = {\n billingMode: 'credits',\n chargeEvent: 'accepted_write',\n validationCredits: 0,\n create: {\n credits: MC_COSTS.listing_create / MC_PER_CREDIT,\n mc: MC_COSTS.listing_create,\n },\n edit: {\n credits: MC_COSTS.listing_edit / MC_PER_CREDIT,\n mc: MC_COSTS.listing_edit,\n },\n surfaces: ['local_sourcebook', 'transparent_commons'],\n sourcebookAcquisitionIncluded: true,\n} as const\n\n// Billing conversion is intentionally explicit rather than derived from a\n// Stripe plan. Plan grant changes must not silently reprice vendor-backed work.\nexport const BILLING_MC_PER_USD_NUMERATOR = 2_000_000\nexport const BILLING_MC_PER_USD_DENOMINATOR = 3\nexport const BILLING_BASIS_POINTS = 10_000\nexport const USD_NANOS = 1_000_000_000\n\nexport const SCHEDULED_RUN_BASE_CREDITS = 75\nexport const SCHEDULED_RUN_BASE_MC = SCHEDULED_RUN_BASE_CREDITS * MC_PER_CREDIT\nexport const SCHEDULED_AGENT_LLM_MARKUP_BPS = 15_000\nexport const SCHEDULED_AGENT_LLM_MARKUP = SCHEDULED_AGENT_LLM_MARKUP_BPS / BILLING_BASIS_POINTS\nexport const SCHEDULED_RUN_DEFAULT_MAX_CREDITS = 5_000\n\nexport const CONNECTED_USAGE_RATE_POLICY_VERSION = '2026-08-03.connected-usage-v3'\nexport const CONNECTED_ACTIVE_CONNECTION_MONTHLY_CREDITS = 15_000\nexport const CONNECTED_ACTIVE_CONNECTION_MONTHLY_MC = CONNECTED_ACTIVE_CONNECTION_MONTHLY_CREDITS * MC_PER_CREDIT\nexport const CONNECTED_FUNCTION_RUN_CREDITS = 2\nexport const CONNECTED_PROXY_REQUEST_CREDITS = 2\nexport const CONNECTED_COMPUTE_CREDITS_PER_SECOND = 5\nexport const CONNECTED_FUNCTION_RUN_MC = CONNECTED_FUNCTION_RUN_CREDITS * MC_PER_CREDIT\nexport const CONNECTED_PROXY_REQUEST_MC = CONNECTED_PROXY_REQUEST_CREDITS * MC_PER_CREDIT\nexport const CONNECTED_COMPUTE_MC_PER_SECOND = CONNECTED_COMPUTE_CREDITS_PER_SECOND * MC_PER_CREDIT\n\n/**\n * Versioned commercial contract for tenant-owned Nango connections.\n *\n * The recurring connection line item is denominated in USD and is deliberately\n * separate from usage debits in the Credit wallet. Usage receipts are reported\n * in aggregate milliseconds and rounded once to the smallest ledger unit (mc),\n * never up to a whole compute second.\n */\nexport const CONNECTED_USAGE_RATE_POLICY = {\n schemaVersion: 2,\n ratePolicyVersion: CONNECTED_USAGE_RATE_POLICY_VERSION,\n effectiveAt: '2026-08-03T00:00:00.000Z',\n provider: 'nango',\n entitlement: 'paid_plan_add_on',\n connection: {\n billingMode: 'flat_recurring_credits',\n amountCredits: CONNECTED_ACTIVE_CONNECTION_MONTHLY_CREDITS,\n interval: 'month',\n unit: 'active_connection',\n proration: 'none',\n },\n usage: {\n billingMode: 'credits',\n settlementMode: 'authoritative_receipt',\n rounding: 'aggregate_then_ceil_to_mc',\n functionRun: {\n credits: CONNECTED_FUNCTION_RUN_CREDITS,\n mc: CONNECTED_FUNCTION_RUN_MC,\n unit: 'per_function_run',\n },\n proxyRequest: {\n credits: CONNECTED_PROXY_REQUEST_CREDITS,\n mc: CONNECTED_PROXY_REQUEST_MC,\n unit: 'per_proxy_request',\n },\n compute: {\n creditsPerSecond: CONNECTED_COMPUTE_CREDITS_PER_SECOND,\n mcPerSecond: CONNECTED_COMPUTE_MC_PER_SECOND,\n sourceUnit: 'millisecond',\n unit: 'per_compute_second',\n formula: 'ceil(computeMilliseconds * mcPerSecond / 1000)',\n },\n },\n} as const\n\nexport interface ConnectedUsageQuantities {\n functionRuns: number\n proxyRequests: number\n computeMilliseconds: number\n}\n\nexport interface ConnectedUsageCharge {\n functionRunMc: number\n proxyRequestMc: number\n computeMc: number\n amountMc: number\n credits: number\n}\n\nfunction nonNegativeSafeInteger(value: number, field: string): bigint {\n if (!Number.isSafeInteger(value) || value < 0) {\n throw new Error(`${field} must be a non-negative safe integer`)\n }\n return BigInt(value)\n}\n\nfunction safeMc(value: bigint): number {\n if (value > BigInt(Number.MAX_SAFE_INTEGER)) throw new Error('connected usage charge exceeds the safe integer range')\n return Number(value)\n}\n\n/** Calculate one receipt after aggregating its raw Nango usage counters. */\nexport function calculateConnectedUsageCharge(usage: ConnectedUsageQuantities): ConnectedUsageCharge {\n const functionRuns = nonNegativeSafeInteger(usage.functionRuns, 'functionRuns')\n const proxyRequests = nonNegativeSafeInteger(usage.proxyRequests, 'proxyRequests')\n const computeMilliseconds = nonNegativeSafeInteger(usage.computeMilliseconds, 'computeMilliseconds')\n const functionRunMc = functionRuns * BigInt(CONNECTED_FUNCTION_RUN_MC)\n const proxyRequestMc = proxyRequests * BigInt(CONNECTED_PROXY_REQUEST_MC)\n const computeNumerator = computeMilliseconds * BigInt(CONNECTED_COMPUTE_MC_PER_SECOND)\n const computeMc = computeNumerator === 0n ? 0n : (computeNumerator + 999n) / 1_000n\n const amountMc = functionRunMc + proxyRequestMc + computeMc\n\n return {\n functionRunMc: safeMc(functionRunMc),\n proxyRequestMc: safeMc(proxyRequestMc),\n computeMc: safeMc(computeMc),\n amountMc: safeMc(amountMc),\n credits: safeMc(amountMc) / MC_PER_CREDIT,\n }\n}\n\n/**\n * Public, machine-readable Scheduled Actions billing contract.\n *\n * Keep every API/UI surface on this object instead of restating the policy.\n * The primitive constants above remain the execution-time source of truth;\n * this object gives clients stable semantic fields for displaying and applying\n * those rates without having to infer behavior from prose.\n */\nexport const SCHEDULED_ACTIONS_RATE_POLICY = {\n billingMode: 'credits',\n entitlement: 'paid_plan_included',\n separateSubscriptionRequired: false,\n chargeEvent: 'started_occurrence',\n runBaseCredits: SCHEDULED_RUN_BASE_CREDITS,\n runBaseMc: SCHEDULED_RUN_BASE_MC,\n llmCostMultiplier: SCHEDULED_AGENT_LLM_MARKUP,\n llmCostMultiplierBps: SCHEDULED_AGENT_LLM_MARKUP_BPS,\n modes: {\n connection_sync: {\n runBaseCredits: SCHEDULED_RUN_BASE_CREDITS,\n modelCostBilling: 'none',\n modelCostMultiplier: 0,\n },\n agent: {\n runBaseCredits: SCHEDULED_RUN_BASE_CREDITS,\n modelCostBilling: 'actual_reported_cost',\n modelCostProvider: 'openrouter',\n modelCostMultiplier: SCHEDULED_AGENT_LLM_MARKUP,\n modelCostMultiplierBps: SCHEDULED_AGENT_LLM_MARKUP_BPS,\n },\n },\n} as const\n\nexport function vendorCostUsdToMc(costUsd: number, markupBps: number): number {\n if (!Number.isFinite(costUsd) || costUsd < 0) throw new Error('costUsd must be a finite non-negative number')\n if (!Number.isInteger(markupBps) || markupBps < 0) throw new Error('markupBps must be a non-negative integer')\n\n const rawCostNanos = BigInt(Math.round(costUsd * USD_NANOS))\n const numerator =\n rawCostNanos *\n BigInt(markupBps) *\n BigInt(BILLING_MC_PER_USD_NUMERATOR)\n const denominator =\n BigInt(USD_NANOS) *\n BigInt(BILLING_BASIS_POINTS) *\n BigInt(BILLING_MC_PER_USD_DENOMINATOR)\n const mc = numerator === 0n ? 0n : (numerator + denominator - 1n) / denominator\n if (mc > BigInt(Number.MAX_SAFE_INTEGER)) throw new Error('calculated mc exceeds the safe integer range')\n return Number(mc)\n}\n\nexport const CREDIT_COST_CATALOG: Array<{\n key: McCostKey\n label: string\n aliases: string[]\n credits: number\n unit: string\n notes?: string\n}> = [\n {\n key: 'serp',\n label: 'SERP search',\n aliases: ['search_serp', 'serp', 'google search', 'organic results'],\n credits: mcToCredits(MC_COSTS.serp_headful),\n unit: 'per search',\n 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 ${mcToCredits(MC_COSTS.serp_headful)} credits per search. Optional SERP Intelligence page snapshots add ${mcToCredits(MC_COSTS.page_scrape)} credit per attempted URL.`,\n },\n {\n key: 'paa',\n label: 'PAA harvest',\n aliases: ['harvest_paa', 'paa', 'people also ask', 'questions'],\n credits: mcToCredits(MC_COSTS.paa),\n unit: `per question (+${mcToCredits(MC_COSTS.paa_base)} credit base)`,\n 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 ${mcToCredits(MC_COSTS.paa_base)} credit base + ${mcToCredits(MC_COSTS.paa)} per question actually returned (unused estimate refunded).`,\n },\n {\n key: 'page_scrape',\n label: 'Page crawl / extract',\n aliases: ['extract_url', 'extract_site', 'page scrape', 'url scrape', 'single page', 'site crawl'],\n credits: mcToCredits(MC_COSTS.page_scrape),\n unit: 'per page',\n notes: 'Applies to both single-URL extraction and per-page site crawls.',\n },\n {\n key: 'listing_create',\n label: 'Directory or wiki listing creation',\n aliases: ['local-sourcebook-capture', 'commons_submit_entity', 'directory listing', 'wiki listing'],\n credits: mcToCredits(MC_COSTS.listing_create),\n unit: 'per new listing',\n notes: 'Fixed total price for a new Local Sourcebook directory listing or Transparent Commons wiki entity. Sourcebook acquisition is included.',\n },\n {\n key: 'listing_edit',\n label: 'Directory or wiki listing edit',\n aliases: ['local_sourcebook_refresh', 'commons_submit_entity', 'listing refresh', 'wiki edit'],\n credits: mcToCredits(MC_COSTS.listing_edit),\n unit: 'per existing listing revision',\n notes: 'Fixed total price for refreshing an existing Local Sourcebook listing or revising an existing Transparent Commons entity.',\n },\n {\n key: 'url_map',\n label: 'Site URL mapping',\n aliases: ['map_site_urls', 'url map', 'site map', 'crawl urls'],\n credits: mcToCredits(MC_COSTS.url_map),\n unit: 'per mapping operation',\n notes: 'Flat rate for the full /map-urls call regardless of URL count discovered.',\n },\n {\n key: 'yt_channel',\n label: 'YouTube search / channel harvest',\n aliases: ['youtube_harvest', 'youtube search', 'youtube channel', 'yt_channel'],\n credits: mcToCredits(MC_COSTS.yt_channel),\n unit: 'per call',\n },\n {\n key: 'yt_transcription',\n label: 'YouTube transcription',\n aliases: ['youtube_transcribe', 'youtube transcript', 'transcription', 'yt_transcription'],\n credits: mcToCredits(20_000),\n unit: 'base + 2/min of video',\n 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).',\n },\n {\n key: 'fb_ad',\n label: 'Facebook search / ad lookup',\n aliases: ['facebook_page_intel', 'facebook_ad_search', 'facebook_ad', 'facebook ads', 'fb ads'],\n credits: mcToCredits(MC_COSTS.fb_ad),\n unit: 'per call',\n },\n {\n key: 'maps_search',\n label: 'Maps business search',\n aliases: ['maps_search', 'google maps search', 'gmb search', 'gbp search', 'business profiles'],\n credits: mcToCredits(MC_COSTS.maps_search),\n unit: 'per search',\n notes: 'Returns up to 50 Google Maps business/profile candidates. Use maps_place_intel to hydrate selected businesses.',\n },\n {\n key: 'maps_place',\n label: 'Maps business lookup',\n aliases: ['maps_place_intel', 'google maps', 'maps place', 'place intel'],\n credits: mcToCredits(MC_COSTS.maps_place),\n unit: 'per business',\n notes: 'Base lookup. Reviews billed separately per card at maps_review rate.',\n },\n {\n key: 'maps_review',\n label: 'Maps review',\n aliases: ['maps_reviews', 'google reviews', 'review cards', 'reviews'],\n credits: mcToCredits(MC_COSTS.maps_review),\n unit: 'per review card',\n notes: 'Charged after extraction when includeReviews is true.',\n },\n {\n key: 'fb_search',\n label: 'Facebook ad library search',\n aliases: ['facebook_search', 'fb_search', 'fb ad search'],\n credits: mcToCredits(MC_COSTS.fb_search),\n unit: 'per search',\n notes: 'Browser automation to search Facebook Ads Library by keyword.',\n },\n {\n key: 'google_ads_search',\n label: 'Google Ads Transparency search',\n aliases: ['google_ads_search', 'google ads search', 'ads transparency search'],\n credits: mcToCredits(MC_COSTS.google_ads_search),\n unit: 'per search',\n notes: 'Browser automation to find advertisers in Google Ads Transparency Center by domain or name.',\n },\n {\n key: 'google_ads_intel',\n label: 'Google Ads Transparency advertiser intel',\n aliases: ['google_ads_page_intel', 'google ads intel', 'ads transparency intel'],\n credits: mcToCredits(MC_COSTS.google_ads_intel),\n unit: 'per call',\n notes: 'Lists and hydrates an advertiser\\'s creatives with image URLs and video references.',\n },\n {\n key: 'google_ads_transcribe',\n label: 'Google ad video transcription',\n aliases: ['google_ads_transcribe', 'google ad transcript'],\n credits: mcToCredits(20_000),\n unit: 'base + 2/min of video',\n 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).',\n },\n {\n key: 'fb_transcribe',\n label: 'Facebook video / ad transcription',\n aliases: ['facebook_transcribe', 'facebook_video_transcribe', 'fb_transcribe', 'fb ad transcript'],\n credits: mcToCredits(20_000),\n unit: 'base + 2/min of video',\n 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).',\n },\n {\n key: 'instagram_profile',\n label: 'Instagram profile content discovery',\n aliases: ['instagram_profile_content', 'instagram profile', 'instagram content list', 'ig profile'],\n credits: mcToCredits(MC_COSTS.instagram_profile),\n unit: 'per profile scan',\n notes: 'Browser extraction of public Instagram profile grid links. Complete history may require a logged-in profile.',\n },\n {\n key: 'instagram_media',\n label: 'Instagram media download',\n aliases: ['instagram_media_download', 'instagram reel download', 'instagram post download', 'ig media'],\n credits: mcToCredits(MC_COSTS.instagram_media),\n unit: 'per post or reel',\n notes: 'Extracts post text, image URLs, and reel audio/video tracks, with local downloads when the server can write files.',\n },\n {\n key: 'instagram_transcribe',\n label: 'Instagram media transcription',\n aliases: ['instagram transcript', 'instagram reel transcript', 'ig transcribe'],\n credits: mcToCredits(20_000),\n unit: 'base + 2/min of video',\n 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).',\n },\n {\n key: 'browser_minute',\n label: 'Interactive browser session',\n aliases: ['browser_open', 'browser agent', 'browser_agent', 'live browser', 'browse', 'browser control', 'interactive browser'],\n credits: mcToCredits(MC_COSTS.browser_minute),\n unit: 'per minute of use',\n 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.',\n },\n {\n key: 'reddit_thread',\n label: 'Reddit thread base lookup',\n aliases: ['reddit', 'reddit_thread', 'reddit comments', 'subreddit', 'reddit post'],\n credits: mcToCredits(MC_COSTS.reddit_thread),\n unit: 'per thread',\n notes: 'Base lookup for the post itself. Comments billed separately per comment at reddit_comment rate. Refunded if the thread cannot be retrieved.',\n },\n {\n key: 'reddit_comment',\n label: 'Reddit comment',\n aliases: ['reddit_comment', 'reddit comments'],\n credits: mcToCredits(MC_COSTS.reddit_comment),\n unit: 'per comment',\n notes: 'Charged per comment actually extracted, billed down automatically if the balance runs out mid-thread.',\n },\n {\n key: 'video_analysis',\n label: 'Video breakdown (frame-by-frame + transcript)',\n aliases: ['video_frame_analysis', 'video breakdown', 'video analysis', 'analyze video'],\n credits: mcToCredits(MC_COSTS.video_analysis),\n unit: 'per 120 frames (max 480)',\n 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.',\n },\n {\n key: 'trustpilot_reviews',\n label: 'Trustpilot review harvest',\n aliases: ['trustpilot_reviews', 'trustpilot', 'trustpilot reviews'],\n credits: mcToCredits(MC_COSTS.trustpilot_reviews),\n unit: 'per call',\n notes: 'Base lookup. Reviews billed separately per card at trustpilot_review rate. Refunded if no reviews are found.',\n },\n {\n key: 'trustpilot_review',\n label: 'Trustpilot review card',\n aliases: ['trustpilot_review', 'trustpilot card'],\n credits: mcToCredits(MC_COSTS.trustpilot_review),\n unit: 'per review card',\n notes: 'Charged per review actually extracted, billed down automatically if the balance runs out mid-page.',\n },\n {\n key: 'g2_reviews',\n label: 'G2 review harvest',\n aliases: ['g2_reviews', 'g2', 'g2 reviews'],\n credits: mcToCredits(MC_COSTS.g2_reviews),\n unit: 'per call',\n notes: 'Base lookup. Reviews billed separately per card at g2_review rate. Refunded if no reviews are found.',\n },\n {\n key: 'g2_review',\n label: 'G2 review card',\n aliases: ['g2_review', 'g2 card'],\n credits: mcToCredits(MC_COSTS.g2_review),\n unit: 'per review card',\n 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.',\n },\n {\n key: 'diff_page',\n label: 'Page change check',\n aliases: ['diff_page', 'page diff', 'change detection'],\n credits: mcToCredits(MC_COSTS.diff_page),\n unit: 'per check',\n notes: 'Same cost as a single page extract — one scrape is performed per check, then compared against your last stored snapshot for that URL.',\n },\n]\n\nexport const CONCURRENCY_PRICE_ID = 'price_1Ta1NRS8aAcsk3TGwsRnYbix'\n\nexport interface SubscriptionTier {\n tier: string\n label: string\n price_id: string\n monthly_usd: number\n billed_usd?: number\n credits_mc: number\n concurrency: number\n intro_coupon: string | null\n billing_interval?: 'month' | 'year'\n credits_never_expire?: boolean\n includes_memory?: boolean\n private_offer?: boolean\n}\n\nexport function tierBillingInterval(tier: SubscriptionTier): 'month' | 'year' {\n return tier.billing_interval ?? 'month'\n}\n\nexport function tierAmountChargedUsd(tier: SubscriptionTier): number {\n return tier.billed_usd ?? tier.monthly_usd\n}\n\nexport function tierCreditsPerInterval(tier: SubscriptionTier): number {\n return tier.credits_mc / MC_PER_CREDIT\n}\n\nexport const SUBSCRIPTION_TIERS: Record<string, SubscriptionTier> = {\n 'price_1TmiHRS8aAcsk3TGwmSNfNIa': { tier: 'starter', label: 'Starter', price_id: 'price_1TmiHRS8aAcsk3TGwmSNfNIa', monthly_usd: 12, credits_mc: 8_000_000, concurrency: 3, intro_coupon: 'mcp-starter-1dollar-intro-12' },\n 'price_1TrgihS8aAcsk3TG5cglrq4D': { tier: 'growth', label: 'Growth', price_id: 'price_1TrgihS8aAcsk3TG5cglrq4D', monthly_usd: 40, credits_mc: 26_666_700, concurrency: 10, intro_coupon: null },\n 'price_1TrgihS8aAcsk3TG4HnG4gbY': { tier: 'scale', label: 'Scale', price_id: 'price_1TrgihS8aAcsk3TG4HnG4gbY', monthly_usd: 100, credits_mc: 80_000_000, concurrency: 20, intro_coupon: null },\n 'price_1TwqIVS8aAcsk3TG0FE3ddDM': { tier: 'sonic', label: 'Sonic Annual', price_id: 'price_1TwqIVS8aAcsk3TG0FE3ddDM', monthly_usd: 25, billed_usd: 300, credits_mc: 250_000_000, concurrency: 3, intro_coupon: null, billing_interval: 'year', credits_never_expire: true, private_offer: true },\n 'price_1TwqIWS8aAcsk3TGbGbtlLak': { tier: 'sonic-memory', label: 'Sonic Annual + Memory Pro', price_id: 'price_1TwqIWS8aAcsk3TGbGbtlLak', monthly_usd: 34.5, billed_usd: 414, credits_mc: 250_000_000, concurrency: 3, intro_coupon: null, billing_interval: 'year', credits_never_expire: true, includes_memory: true, private_offer: true },\n}\n\nexport const SUBSCRIPTION_TIER_BY_KEY: Record<string, SubscriptionTier> = Object.fromEntries(\n Object.values(SUBSCRIPTION_TIERS).map(t => [t.tier, t]),\n)\n\nexport interface PrivateOffer {\n slug: string\n label: string\n headline: string\n tier_keys: string[]\n}\n\nexport const PRIVATE_OFFERS: Record<string, PrivateOffer> = {\n sonic: {\n slug: 'sonic',\n label: 'Sonic annual partner offer',\n headline: 'A full year of MCP Scraper, with Credits that never expire.',\n tier_keys: ['sonic', 'sonic-memory'],\n },\n}\n\nexport function offerClaimPathForTier(tierKey: string): string | null {\n const offer = Object.values(PRIVATE_OFFERS).find(o => o.tier_keys.includes(tierKey))\n return offer ? `/${offer.slug}/claim` : null\n}\n\nexport function offerForTier(tierKey: string | null | undefined): PrivateOffer | null {\n if (!tierKey) return null\n return Object.values(PRIVATE_OFFERS).find(o => o.tier_keys.includes(tierKey)) ?? null\n}\n\nexport function tierChangeLeavesPrivateOffer(\n fromTier: string | null | undefined,\n toTier: string,\n): boolean {\n const from = offerForTier(fromTier)\n if (!from) return false\n return !from.tier_keys.includes(toTier)\n}\n\nexport interface SubscriptionPlanView {\n tier: string\n label: string\n amount_usd: number\n interval: 'month' | 'year'\n monthly_equivalent_usd: number\n credits_per_interval: number\n concurrency: number\n credits_never_expire: boolean\n includes_memory: boolean\n private_offer: boolean\n offer_claim_path: string | null\n}\n\nexport function getSubscriptionPlanView(tierKey: string | null | undefined): SubscriptionPlanView | null {\n if (!tierKey) return null\n const tier = SUBSCRIPTION_TIER_BY_KEY[tierKey]\n if (!tier) return null\n return {\n tier: tier.tier,\n label: tier.label,\n amount_usd: tierAmountChargedUsd(tier),\n interval: tierBillingInterval(tier),\n monthly_equivalent_usd: tier.monthly_usd,\n credits_per_interval: tierCreditsPerInterval(tier),\n concurrency: tier.concurrency,\n credits_never_expire: !!tier.credits_never_expire,\n includes_memory: !!tier.includes_memory,\n private_offer: !!tier.private_offer,\n offer_claim_path: offerClaimPathForTier(tier.tier),\n }\n}\n\nexport function getPrivateOfferPayload(slug: string) {\n const offer = PRIVATE_OFFERS[slug]\n if (!offer) return null\n const options = offer.tier_keys\n .map(key => SUBSCRIPTION_TIER_BY_KEY[key])\n .filter((t): t is SubscriptionTier => !!t)\n .map(t => ({\n tier: t.tier,\n label: t.label,\n amount_usd: tierAmountChargedUsd(t),\n interval: tierBillingInterval(t),\n monthly_equivalent_usd: t.monthly_usd,\n credits: tierCreditsPerInterval(t),\n credits_never_expire: !!t.credits_never_expire,\n includes_memory: !!t.includes_memory,\n concurrency: t.concurrency,\n }))\n if (!options.length) return null\n return { slug: offer.slug, label: offer.label, headline: offer.headline, options }\n}\n\nexport function getPublicRatesPayload() {\n const starter = SUBSCRIPTION_TIER_BY_KEY.starter\n const costs = CREDIT_COST_CATALOG.map(({ aliases, ...cost }) => ({\n ...cost,\n ...(cost.notes ? { notes: cost.notes.replace(/ via fal\\.ai/g, '') } : {}),\n }))\n\n const operationCosts = Object.fromEntries(costs.map((cost) => [cost.key, {\n credits: cost.credits,\n unit: cost.unit,\n label: cost.label,\n ...(cost.notes ? { notes: cost.notes } : {}),\n }]))\n const publicTiers = Object.values(SUBSCRIPTION_TIERS).filter((tier) => !tier.private_offer).map((tier) => ({\n tier: tier.tier,\n label: tier.label,\n monthlyUsd: tier.monthly_usd,\n credits: tier.credits_mc / MC_PER_CREDIT,\n concurrency: tier.concurrency,\n }))\n\n return {\n ...PUBLIC_PRODUCT_CONTRACT,\n operationCosts,\n publicTiers,\n concurrencyPack: {\n ratePolicyVersion: CONCURRENCY_PACK_RATE_POLICY_VERSION,\n monthlyUsd: CONCURRENCY_PACK_PRICE_USD,\n currency: CONCURRENCY_PACK_PRICE_CURRENCY,\n interval: CONCURRENCY_PACK_PRICE_INTERVAL,\n billingUnit: 'pack' as const,\n slotsPerPack: CONCURRENCY_SLOTS_PER_PACK,\n },\n creditsPerDollarStarter: Math.round(mcToCredits(starter.credits_mc) / starter.monthly_usd),\n costs,\n scheduling: PUBLIC_PRODUCT_CONTRACT.addons.scheduling,\n connectedAccounts: PUBLIC_PRODUCT_CONTRACT.addons.connectedAccounts,\n listingWrites: LISTING_WRITE_RATE_POLICY,\n }\n}\n\nexport const CONCURRENCY_PACK_PRICE_USD = 5\nexport const CONCURRENCY_PACK_PRICE_CURRENCY = 'usd'\nexport const CONCURRENCY_PACK_PRICE_INTERVAL = 'month'\nexport const CONCURRENCY_SLOTS_PER_PACK = 2\nexport const CONCURRENCY_PACK_RATE_POLICY_VERSION = '2026-08-14.concurrency-pack-v1'\nexport const CONCURRENCY_PACK_PRICE_LABEL = '$5/month for 2 extra browsers'\nexport const CONCURRENCY_PACK_INVOICE_DESCRIPTION = 'MCP Scraper browser concurrency pack — each $5 monthly pack adds 2 browsers.'\nexport const CONCURRENCY_PACK_INVOICE_FOOTER = 'Billed monthly until canceled. A receipt is emailed after each successful payment.'\nexport const CONCURRENCY_PACK_TERMINAL_COMMAND = 'npx -y -p mcp-scraper@latest mcp-scraper-cli billing concurrency checkout'\n\n// Compatibility aliases keep existing SDK consumers compiling while the\n// commercial unit changes from one slot to one two-browser pack.\nexport const CONCURRENCY_SLOT_PRICE_USD = CONCURRENCY_PACK_PRICE_USD\nexport const CONCURRENCY_SLOT_PRICE_CURRENCY = CONCURRENCY_PACK_PRICE_CURRENCY\nexport const CONCURRENCY_SLOT_PRICE_INTERVAL = CONCURRENCY_PACK_PRICE_INTERVAL\nexport const CONCURRENCY_SLOT_PRICE_LABEL = CONCURRENCY_PACK_PRICE_LABEL\nexport const CONCURRENCY_SLOT_TERMINAL_COMMAND = CONCURRENCY_PACK_TERMINAL_COMMAND\n\nexport function concurrencyPackBillingInfo() {\n const billingUrl = process.env.CONCURRENCY_BILLING_URL ?? 'https://mcpscraper.dev/billing'\n return {\n product: 'Extra browser concurrency pack',\n rate_policy_version: CONCURRENCY_PACK_RATE_POLICY_VERSION,\n price_label: CONCURRENCY_PACK_PRICE_LABEL,\n unit_amount_usd: CONCURRENCY_PACK_PRICE_USD,\n currency: CONCURRENCY_PACK_PRICE_CURRENCY,\n interval: CONCURRENCY_PACK_PRICE_INTERVAL,\n billing_unit: 'pack',\n pack_quantity: 1,\n slots_per_pack: CONCURRENCY_SLOTS_PER_PACK,\n extra_slots: CONCURRENCY_SLOTS_PER_PACK,\n billing_url: billingUrl,\n terminal_command: CONCURRENCY_PACK_TERMINAL_COMMAND,\n terminal_command_with_api_key_env: `MCP_SCRAPER_API_KEY=sk_live_your_key ${CONCURRENCY_PACK_TERMINAL_COMMAND}`,\n }\n}\n\n/** @deprecated Use concurrencyPackBillingInfo. */\nexport const concurrencySlotBillingInfo = concurrencyPackBillingInfo\n\n// The free tier is retired. Keep these exported compatibility constants at zero\n// so older consumers do not advertise or grant credits that no longer exist.\nexport const FREE_SIGNUP_MC = 0\nexport const FREE_MONTHLY_REFRESH_MC = 0\n\nexport const BALANCE_PRICE_IDS: Record<string, number> = {\n 'price_1TZx6rS8aAcsk3TGNMc1Vgpo': 11_000_000,\n 'price_1TZx6sS8aAcsk3TGxgqB7khO': 27_500_000,\n 'price_1TZx6tS8aAcsk3TG8PnJqHlG': 60_500_000,\n 'price_1TZx6tS8aAcsk3TGNgRMpy0e': 121_000_000,\n}\n\nexport const BALANCE_PACK_LABELS: Record<string, string> = {\n 'price_1TZx6rS8aAcsk3TGNMc1Vgpo': '$10',\n 'price_1TZx6sS8aAcsk3TGxgqB7khO': '$25',\n 'price_1TZx6tS8aAcsk3TG8PnJqHlG': '$50',\n 'price_1TZx6tS8aAcsk3TGNgRMpy0e': '$100',\n}\n\nexport function mcToCredits(mc: number): number {\n return mc / MC_PER_CREDIT\n}\n\nexport function insufficientBalanceResponse(balanceMc: number, requiredMc: number) {\n const topupUrl = process.env.TOPUP_URL ?? 'https://mcpscraper.dev/billing'\n const balanceCredits = mcToCredits(balanceMc)\n const requiredCredits = mcToCredits(requiredMc)\n return {\n error: 'insufficient_balance',\n error_code: 'insufficient_balance' as const,\n message: `Insufficient credits. Balance: ${balanceCredits} credits. This call requires ${requiredCredits} credits. Top up at ${topupUrl}`,\n balance_credits: balanceCredits,\n required_credits: requiredCredits,\n topup_url: topupUrl,\n }\n}\n\nexport interface MemoryPlan {\n plan: 'pro' | 'team'\n label: string\n price_id: string\n interval: 'month' | 'year'\n monthly_usd: number\n quota_bytes: number\n}\n\nexport const MEMORY_FREE_QUOTA_BYTES = 0.01e9 * 1\n\nexport const MEMORY_PLANS: Record<string, MemoryPlan> = {\n 'price_1TnMSTS8aAcsk3TGBgiwuvqL': { plan: 'pro', label: 'Pro', price_id: 'price_1TnMSTS8aAcsk3TGBgiwuvqL', interval: 'month', monthly_usd: 19, quota_bytes: 5e9 },\n 'price_1TnMSTS8aAcsk3TGWBVU2agY': { plan: 'pro', label: 'Pro', price_id: 'price_1TnMSTS8aAcsk3TGWBVU2agY', interval: 'year', monthly_usd: 19, quota_bytes: 5e9 },\n}\n\nexport const MEMORY_PLAN_QUOTA: Record<string, number> = { free: MEMORY_FREE_QUOTA_BYTES, pro: 5e9, team: 50e9 }\n\nexport const MEMORY_MARGIN_MULTIPLE = 3\nexport const MEMORY_FREE_COST_CAP_USD = 1.0\nexport const MEMORY_PRO_COST_BUDGET_USD = 19 / MEMORY_MARGIN_MULTIPLE\n\nexport const LedgerOperation = {\n TOPUP: 'topup',\n SUBSCRIPTION: 'subscription',\n SIGNUP_GRANT: 'signup_grant',\n MONTHLY_REFRESH: 'monthly_free_refresh',\n PAA: 'paa',\n PAA_REFUND: 'paa_refund',\n SERP: 'serp',\n SERP_REFUND: 'serp_refund',\n REFUND: 'refund',\n TRANSCRIPTION: 'transcription',\n TRANSCRIPTION_HOLD: 'transcription_hold',\n TRANSCRIPTION_REFUND: 'transcription_refund',\n YT_CHANNEL: 'yt_channel',\n FB_AD: 'fb_ad',\n MAPS_SEARCH: 'maps_search',\n DIRECTORY_WORKFLOW_HOLD: 'directory_workflow_hold',\n DIRECTORY_WORKFLOW_REFUND: 'directory_workflow_refund',\n MAPS_PLACE: 'maps_place',\n MAPS_REVIEW: 'maps_review',\n MAPS_REVIEW_REFUND: 'maps_review_refund',\n EXTRACT_SITE: 'extract_site',\n EXTRACT_SITE_REFUND: 'extract_site_refund',\n EXTRACT_URL: 'page_scrape',\n URL_MAP: 'url_map',\n EXTRACT_SITE_HOLD: 'extract_site_hold',\n YT_CHANNEL_REFUND: 'yt_channel_refund',\n FB_AD_REFUND: 'fb_ad_refund',\n URL_MAP_REFUND: 'url_map_refund',\n FB_SEARCH: 'fb_search',\n FB_TRANSCRIBE: 'fb_transcribe',\n FB_SEARCH_REFUND: 'fb_search_refund',\n FB_SEARCH_RESULT: 'fb_search_result',\n FB_SEARCH_RESULT_REFUND: 'fb_search_result_refund',\n FB_PAGE_INTEL: 'fb_page_intel',\n FB_PAGE_INTEL_REFUND: 'fb_page_intel_refund',\n FB_PAGE_INTEL_AD: 'fb_page_intel_ad',\n FB_PAGE_INTEL_AD_REFUND: 'fb_page_intel_ad_refund',\n FB_TRANSCRIBE_REFUND: 'fb_transcribe_refund',\n GOOGLE_ADS_SEARCH: 'google_ads_search',\n GOOGLE_ADS_SEARCH_REFUND: 'google_ads_search_refund',\n GOOGLE_ADS_INTEL: 'google_ads_intel',\n GOOGLE_ADS_INTEL_REFUND: 'google_ads_intel_refund',\n GOOGLE_ADS_TRANSCRIBE: 'google_ads_transcribe',\n GOOGLE_ADS_TRANSCRIBE_REFUND: 'google_ads_transcribe_refund',\n INSTAGRAM_PROFILE: 'instagram_profile',\n INSTAGRAM_PROFILE_REFUND: 'instagram_profile_refund',\n INSTAGRAM_MEDIA: 'instagram_media',\n INSTAGRAM_MEDIA_REFUND:'instagram_media_refund',\n INSTAGRAM_TRANSCRIBE: 'instagram_transcribe',\n INSTAGRAM_TRANSCRIBE_REFUND: 'instagram_transcribe_refund',\n BROWSER_SESSION: 'browser_session',\n REDDIT_THREAD: 'reddit_thread',\n REDDIT_THREAD_REFUND: 'reddit_thread_refund',\n REDDIT_COMMENT: 'reddit_comment',\n REDDIT_COMMENT_REFUND: 'reddit_comment_refund',\n VIDEO_ANALYSIS: 'video_analysis',\n VIDEO_ANALYSIS_REFUND: 'video_analysis_refund',\n VIDEO_ANALYSIS_ADJUST: 'video_analysis_adjust',\n VIDEO_ANALYSIS_LLM: 'video_analysis_llm',\n MEMORY_AI: 'memory_ai',\n MEMORY_AI_REFUND: 'memory_ai_refund',\n TRUSTPILOT_REVIEWS: 'trustpilot_reviews',\n TRUSTPILOT_REVIEWS_REFUND: 'trustpilot_reviews_refund',\n TRUSTPILOT_REVIEW: 'trustpilot_review',\n TRUSTPILOT_REVIEW_REFUND: 'trustpilot_review_refund',\n G2_REVIEWS: 'g2_reviews',\n G2_REVIEWS_REFUND: 'g2_reviews_refund',\n G2_REVIEW: 'g2_review',\n G2_REVIEW_REFUND: 'g2_review_refund',\n DIFF_PAGE: 'diff_page',\n DIFF_PAGE_REFUND: 'diff_page_refund',\n LOCAL_SOURCEBOOK_CREATE: 'local_sourcebook_create',\n LOCAL_SOURCEBOOK_CREATE_REFUND: 'local_sourcebook_create_refund',\n LOCAL_SOURCEBOOK_EDIT: 'local_sourcebook_edit',\n LOCAL_SOURCEBOOK_EDIT_REFUND: 'local_sourcebook_edit_refund',\n COMMONS_CREATE: 'commons_create',\n COMMONS_CREATE_REFUND: 'commons_create_refund',\n COMMONS_EDIT: 'commons_edit',\n COMMONS_EDIT_REFUND: 'commons_edit_refund',\n SITE_AUDIT_LLM: 'site_audit_llm',\n SCHEDULED_RUN: 'scheduled_run',\n CONNECTED_USAGE: 'connected_usage',\n CONNECTED_ACCOUNT_FEE: 'connected_account_fee',\n ADMIN_GRANT: 'admin_grant',\n ADMIN_REVOKE: 'admin_revoke',\n} as const\n\nexport type LedgerOperation = typeof LedgerOperation[keyof typeof LedgerOperation]\n\nexport const MEMORY_AI_MARGIN_MULTIPLE = 3\nexport const SITE_AUDIT_LLM_MARGIN_MULTIPLE = 1.5\nexport const VIDEO_ANALYSIS_LLM_MARGIN_MULTIPLE = 1.5\nexport const MEDIA_TRANSCRIBE_FLAT_MC = 20_000\nexport const MEDIA_TRANSCRIBE_PER_MIN_MC = 200\n\nexport function mediaTranscribeChargeMc(durationSecs: number): number {\n const mins = Math.max(1, Math.ceil((durationSecs || 60) / 60))\n return MEDIA_TRANSCRIBE_FLAT_MC + MEDIA_TRANSCRIBE_PER_MIN_MC * mins\n}\n\nexport const MEDIA_TRANSCRIBE_MARGIN_MULTIPLE = 3\nexport const MEDIA_TRANSCRIBE_HOLD_MC = MEDIA_TRANSCRIBE_FLAT_MC + MEDIA_TRANSCRIBE_PER_MIN_MC * 30\n\nexport const MC_PER_USD =\n SUBSCRIPTION_TIERS['price_1TmiHRS8aAcsk3TGwmSNfNIa'].credits_mc /\n SUBSCRIPTION_TIERS['price_1TmiHRS8aAcsk3TGwmSNfNIa'].monthly_usd\n"],"mappings":";AACO,IAAM,0BAA0B;AAAA,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C,IAAM,8BAA8B;AAEpC,SAAS,wBAAwB,cAA8B;AACpE,QAAM,OAAO,KAAK,IAAI,GAAG,KAAK,MAAM,gBAAgB,MAAM,EAAE,CAAC;AAC7D,SAAO,2BAA2B,8BAA8B;AAClE;AAGO,IAAM,2BAA2B,2BAA2B,8BAA8B;AAE1F,IAAM,aACX,mBAAmB,gCAAgC,EAAE,aACrD,mBAAmB,gCAAgC,EAAE;","names":[]}
1
+ {"version":3,"sources":["../src/product-contract.generated.ts","../src/api/rates.ts"],"sourcesContent":["// Generated by scripts/gen-rates.ts. Do not edit by hand.\nexport const PUBLIC_PRODUCT_CONTRACT = {\n \"schemaVersion\": 1,\n \"ratePolicy\": {\n \"version\": \"serp-paa-2026-08-11\",\n \"effectiveDate\": \"2026-08-11T00:00:00.000Z\"\n },\n \"costEvidence\": {\n \"id\": \"serp-paa-rate-basis-2026-08\",\n \"status\": \"provisional\",\n \"minimumRevenueCostRatio\": 2.5,\n \"observedRevenueCostRatio\": 2.5160607750756583\n },\n \"operationCosts\": {\n \"serp\": {\n \"credits\": 60,\n \"unit\": \"per search\",\n \"label\": \"SERP search\",\n \"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.\"\n },\n \"paa\": {\n \"credits\": 10,\n \"unit\": \"per question (+400 credit base)\",\n \"label\": \"PAA harvest\",\n \"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).\"\n },\n \"page_scrape\": {\n \"credits\": 1,\n \"unit\": \"per page\",\n \"label\": \"Page crawl / extract\",\n \"notes\": \"Applies to both single-URL extraction and per-page site crawls.\"\n },\n \"listing_create\": {\n \"credits\": 10,\n \"unit\": \"per new listing\",\n \"label\": \"Directory or wiki listing creation\",\n \"notes\": \"Fixed total price for a new Local Sourcebook directory listing or Transparent Commons wiki entity. Sourcebook acquisition is included.\"\n },\n \"listing_edit\": {\n \"credits\": 2,\n \"unit\": \"per existing listing revision\",\n \"label\": \"Directory or wiki listing edit\",\n \"notes\": \"Fixed total price for refreshing an existing Local Sourcebook listing or revising an existing Transparent Commons entity.\"\n },\n \"url_map\": {\n \"credits\": 5,\n \"unit\": \"per mapping operation\",\n \"label\": \"Site URL mapping\",\n \"notes\": \"Flat rate for the full /map-urls call regardless of URL count discovered.\"\n },\n \"yt_channel\": {\n \"credits\": 2,\n \"unit\": \"per call\",\n \"label\": \"YouTube search / channel harvest\"\n },\n \"yt_transcription\": {\n \"credits\": 200,\n \"unit\": \"base + 2/min of video\",\n \"label\": \"YouTube transcription\",\n \"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).\"\n },\n \"fb_ad\": {\n \"credits\": 7,\n \"unit\": \"per call\",\n \"label\": \"Facebook search / ad lookup\"\n },\n \"maps_search\": {\n \"credits\": 5,\n \"unit\": \"per search\",\n \"label\": \"Maps business search\",\n \"notes\": \"Returns up to 50 Google Maps business/profile candidates. Use maps_place_intel to hydrate selected businesses.\"\n },\n \"maps_place\": {\n \"credits\": 60,\n \"unit\": \"per business\",\n \"label\": \"Maps business lookup\",\n \"notes\": \"Base lookup. Reviews billed separately per card at maps_review rate.\"\n },\n \"maps_review\": {\n \"credits\": 1,\n \"unit\": \"per review card\",\n \"label\": \"Maps review\",\n \"notes\": \"Charged after extraction when includeReviews is true.\"\n },\n \"fb_search\": {\n \"credits\": 8,\n \"unit\": \"per search\",\n \"label\": \"Facebook ad library search\",\n \"notes\": \"Browser automation to search Facebook Ads Library by keyword.\"\n },\n \"google_ads_search\": {\n \"credits\": 6,\n \"unit\": \"per search\",\n \"label\": \"Google Ads Transparency search\",\n \"notes\": \"Browser automation to find advertisers in Google Ads Transparency Center by domain or name.\"\n },\n \"google_ads_intel\": {\n \"credits\": 2,\n \"unit\": \"per call\",\n \"label\": \"Google Ads Transparency advertiser intel\",\n \"notes\": \"Lists and hydrates an advertiser's creatives with image URLs and video references.\"\n },\n \"google_ads_transcribe\": {\n \"credits\": 200,\n \"unit\": \"base + 2/min of video\",\n \"label\": \"Google ad video transcription\",\n \"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).\"\n },\n \"fb_transcribe\": {\n \"credits\": 200,\n \"unit\": \"base + 2/min of video\",\n \"label\": \"Facebook video / ad transcription\",\n \"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).\"\n },\n \"instagram_profile\": {\n \"credits\": 4,\n \"unit\": \"per profile scan\",\n \"label\": \"Instagram profile content discovery\",\n \"notes\": \"Browser extraction of public Instagram profile grid links. Complete history may require a logged-in profile.\"\n },\n \"instagram_media\": {\n \"credits\": 4,\n \"unit\": \"per post or reel\",\n \"label\": \"Instagram media download\",\n \"notes\": \"Extracts post text, image URLs, and reel audio/video tracks, with local downloads when the server can write files.\"\n },\n \"instagram_transcribe\": {\n \"credits\": 200,\n \"unit\": \"base + 2/min of video\",\n \"label\": \"Instagram media transcription\",\n \"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).\"\n },\n \"browser_minute\": {\n \"credits\": 120,\n \"unit\": \"per minute of use\",\n \"label\": \"Interactive browser session\",\n \"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.\"\n },\n \"reddit_thread\": {\n \"credits\": 30,\n \"unit\": \"per thread\",\n \"label\": \"Reddit thread base lookup\",\n \"notes\": \"Base lookup for the post itself. Comments billed separately per comment at reddit_comment rate. Refunded if the thread cannot be retrieved.\"\n },\n \"reddit_comment\": {\n \"credits\": 2,\n \"unit\": \"per comment\",\n \"label\": \"Reddit comment\",\n \"notes\": \"Charged per comment actually extracted, billed down automatically if the balance runs out mid-thread.\"\n },\n \"video_analysis\": {\n \"credits\": 6667,\n \"unit\": \"per 120 frames (max 480)\",\n \"label\": \"Video breakdown (frame-by-frame + transcript)\",\n \"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.\"\n },\n \"trustpilot_reviews\": {\n \"credits\": 5,\n \"unit\": \"per call\",\n \"label\": \"Trustpilot review harvest\",\n \"notes\": \"Base lookup. Reviews billed separately per card at trustpilot_review rate. Refunded if no reviews are found.\"\n },\n \"trustpilot_review\": {\n \"credits\": 1,\n \"unit\": \"per review card\",\n \"label\": \"Trustpilot review card\",\n \"notes\": \"Charged per review actually extracted, billed down automatically if the balance runs out mid-page.\"\n },\n \"g2_reviews\": {\n \"credits\": 5,\n \"unit\": \"per call\",\n \"label\": \"G2 review harvest\",\n \"notes\": \"Base lookup. Reviews billed separately per card at g2_review rate. Refunded if no reviews are found.\"\n },\n \"g2_review\": {\n \"credits\": 2,\n \"unit\": \"per review card\",\n \"label\": \"G2 review card\",\n \"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.\"\n },\n \"diff_page\": {\n \"credits\": 1,\n \"unit\": \"per check\",\n \"label\": \"Page change check\",\n \"notes\": \"Same cost as a single page extract — one scrape is performed per check, then compared against your last stored snapshot for that URL.\"\n }\n },\n \"publicTiers\": [\n {\n \"tier\": \"starter\",\n \"label\": \"Starter\",\n \"monthlyUsd\": 12,\n \"credits\": 80000,\n \"concurrency\": 3\n },\n {\n \"tier\": \"growth\",\n \"label\": \"Growth\",\n \"monthlyUsd\": 40,\n \"credits\": 266667,\n \"concurrency\": 10\n },\n {\n \"tier\": \"scale\",\n \"label\": \"Scale\",\n \"monthlyUsd\": 100,\n \"credits\": 800000,\n \"concurrency\": 20\n }\n ],\n \"credits\": {\n \"mcPerCredit\": 100,\n \"freeSignupCredits\": 0\n },\n \"inventory\": {\n \"totalTools\": 252,\n \"scraperTools\": 151,\n \"memoryTools\": 101\n },\n \"concurrencyPack\": {\n \"ratePolicyVersion\": \"2026-08-14.concurrency-pack-v1\",\n \"monthlyUsd\": 5,\n \"currency\": \"usd\",\n \"interval\": \"month\",\n \"billingUnit\": \"pack\",\n \"slotsPerPack\": 2\n },\n \"addons\": {\n \"memory\": {\n \"monthlyUsd\": 19,\n \"quotaGb\": 5,\n \"freeQuotaGb\": 0.01\n },\n \"scheduling\": {\n \"billingMode\": \"credits\",\n \"entitlement\": \"paid_plan_included\",\n \"separateSubscriptionRequired\": false,\n \"chargeEvent\": \"started_occurrence\",\n \"runBaseCredits\": 75,\n \"runBaseMc\": 7500,\n \"llmCostMultiplier\": 1.5,\n \"llmCostMultiplierBps\": 15000,\n \"modes\": {\n \"connection_sync\": {\n \"runBaseCredits\": 75,\n \"modelCostBilling\": \"none\",\n \"modelCostMultiplier\": 0\n },\n \"agent\": {\n \"runBaseCredits\": 75,\n \"modelCostBilling\": \"actual_reported_cost\",\n \"modelCostMultiplier\": 1.5,\n \"modelCostMultiplierBps\": 15000\n }\n }\n },\n \"connectedAccounts\": {\n \"schemaVersion\": 2,\n \"ratePolicyVersion\": \"2026-08-03.connected-usage-v3\",\n \"effectiveAt\": \"2026-08-03T00:00:00.000Z\",\n \"entitlement\": \"paid_plan_add_on\",\n \"connection\": {\n \"billingMode\": \"flat_recurring_credits\",\n \"amountCredits\": 15000,\n \"interval\": \"month\",\n \"unit\": \"active_connection\",\n \"proration\": \"none\"\n },\n \"usage\": {\n \"billingMode\": \"credits\",\n \"settlementMode\": \"authoritative_receipt\",\n \"rounding\": \"aggregate_then_ceil_to_mc\",\n \"functionRun\": {\n \"credits\": 2,\n \"mc\": 200,\n \"unit\": \"per_function_run\"\n },\n \"proxyRequest\": {\n \"credits\": 2,\n \"mc\": 200,\n \"unit\": \"per_proxy_request\"\n },\n \"compute\": {\n \"creditsPerSecond\": 5,\n \"mcPerSecond\": 500,\n \"sourceUnit\": \"millisecond\",\n \"unit\": \"per_compute_second\",\n \"formula\": \"ceil(computeMilliseconds * mcPerSecond / 1000)\"\n }\n }\n }\n }\n} as const\nexport type PublicProductContract = typeof PUBLIC_PRODUCT_CONTRACT\n","import { PUBLIC_PRODUCT_CONTRACT } from '../product-contract.generated.js'\n\nexport const MC_COSTS = {\n serp: 6_000,\n serp_headless: 6_000,\n serp_headful: 6_000,\n paa: 1_000,\n paa_base: 40_000,\n page_scrape: 100,\n url_map: 500,\n yt_channel: 200,\n yt_transcription: 200,\n fb_ad: 700,\n maps_search: 500,\n maps_place: 6_000,\n maps_review: 100,\n fb_search: 800,\n fb_search_result: 100,\n fb_page_intel: 700,\n fb_page_intel_ad: 50,\n fb_transcribe: 33_300,\n google_ads_search: 600,\n google_ads_intel: 200,\n google_ads_transcribe: 33_300,\n instagram_profile: 400,\n instagram_media: 400,\n instagram_transcribe: 33_300,\n browser_minute: 12_000,\n reddit_thread: 3_000,\n reddit_comment: 200,\n video_analysis: 666_700,\n trustpilot_reviews: 500,\n trustpilot_review: 100,\n g2_reviews: 500,\n g2_review: 200,\n diff_page: 100,\n listing_create: 1_000,\n listing_edit: 200,\n} as const\n\nexport type McCostKey = keyof typeof MC_COSTS\n\n/**\n * Kernel omits the `headless` field for a headful session, so the runtime\n * records headless as `true` and headful/unknown as `null`. Unknown is billed\n * at the conservative headful rate because no cheaper mode was proven.\n */\nexport function serpActualCostMc(headlessSent: boolean | null | undefined): number {\n return headlessSent === true ? MC_COSTS.serp_headless : MC_COSTS.serp_headful\n}\n\nexport const MC_PER_BROWSER_MS = MC_COSTS.browser_minute / 60_000\n\nexport function browserActiveCostMc(activeMs: number): number {\n return Math.round(activeMs * MC_PER_BROWSER_MS)\n}\n\nexport const BROWSER_OPEN_MIN_BALANCE_MC = 1_000\n\nexport const MC_PER_CREDIT = 100\n\n// Public MCP descriptions import these values so the AI-visible routing\n// contract cannot drift from the billing ledger's canonical rates.\nexport const SERP_SEARCH_CREDITS = MC_COSTS.serp_headful / MC_PER_CREDIT\nexport const PAA_BASE_CREDITS = MC_COSTS.paa_base / MC_PER_CREDIT\nexport const PAA_QUESTION_CREDITS = MC_COSTS.paa / MC_PER_CREDIT\nexport const PAGE_SCRAPE_CREDITS = MC_COSTS.page_scrape / MC_PER_CREDIT\n\nexport const LISTING_WRITE_RATE_POLICY = {\n billingMode: 'credits',\n chargeEvent: 'accepted_write',\n validationCredits: 0,\n create: {\n credits: MC_COSTS.listing_create / MC_PER_CREDIT,\n mc: MC_COSTS.listing_create,\n },\n edit: {\n credits: MC_COSTS.listing_edit / MC_PER_CREDIT,\n mc: MC_COSTS.listing_edit,\n },\n surfaces: ['local_sourcebook', 'transparent_commons'],\n sourcebookAcquisitionIncluded: true,\n} as const\n\n// Billing conversion is intentionally explicit rather than derived from a\n// Stripe plan. Plan grant changes must not silently reprice vendor-backed work.\nexport const BILLING_MC_PER_USD_NUMERATOR = 2_000_000\nexport const BILLING_MC_PER_USD_DENOMINATOR = 3\nexport const BILLING_BASIS_POINTS = 10_000\nexport const USD_NANOS = 1_000_000_000\n\nexport const SCHEDULED_RUN_BASE_CREDITS = 75\nexport const SCHEDULED_RUN_BASE_MC = SCHEDULED_RUN_BASE_CREDITS * MC_PER_CREDIT\nexport const SCHEDULED_AGENT_LLM_MARKUP_BPS = 15_000\nexport const SCHEDULED_AGENT_LLM_MARKUP = SCHEDULED_AGENT_LLM_MARKUP_BPS / BILLING_BASIS_POINTS\nexport const SCHEDULED_RUN_DEFAULT_MAX_CREDITS = 5_000\n\nexport const CONNECTED_USAGE_RATE_POLICY_VERSION = '2026-08-03.connected-usage-v3'\nexport const CONNECTED_ACTIVE_CONNECTION_MONTHLY_CREDITS = 15_000\nexport const CONNECTED_ACTIVE_CONNECTION_MONTHLY_MC = CONNECTED_ACTIVE_CONNECTION_MONTHLY_CREDITS * MC_PER_CREDIT\nexport const CONNECTED_FUNCTION_RUN_CREDITS = 2\nexport const CONNECTED_PROXY_REQUEST_CREDITS = 2\nexport const CONNECTED_COMPUTE_CREDITS_PER_SECOND = 5\nexport const CONNECTED_FUNCTION_RUN_MC = CONNECTED_FUNCTION_RUN_CREDITS * MC_PER_CREDIT\nexport const CONNECTED_PROXY_REQUEST_MC = CONNECTED_PROXY_REQUEST_CREDITS * MC_PER_CREDIT\nexport const CONNECTED_COMPUTE_MC_PER_SECOND = CONNECTED_COMPUTE_CREDITS_PER_SECOND * MC_PER_CREDIT\n\n/**\n * Versioned commercial contract for tenant-owned Nango connections.\n *\n * The recurring connection line item is denominated in USD and is deliberately\n * separate from usage debits in the Credit wallet. Usage receipts are reported\n * in aggregate milliseconds and rounded once to the smallest ledger unit (mc),\n * never up to a whole compute second.\n */\nexport const CONNECTED_USAGE_RATE_POLICY = {\n schemaVersion: 2,\n ratePolicyVersion: CONNECTED_USAGE_RATE_POLICY_VERSION,\n effectiveAt: '2026-08-03T00:00:00.000Z',\n provider: 'nango',\n entitlement: 'paid_plan_add_on',\n connection: {\n billingMode: 'flat_recurring_credits',\n amountCredits: CONNECTED_ACTIVE_CONNECTION_MONTHLY_CREDITS,\n interval: 'month',\n unit: 'active_connection',\n proration: 'none',\n },\n usage: {\n billingMode: 'credits',\n settlementMode: 'authoritative_receipt',\n rounding: 'aggregate_then_ceil_to_mc',\n functionRun: {\n credits: CONNECTED_FUNCTION_RUN_CREDITS,\n mc: CONNECTED_FUNCTION_RUN_MC,\n unit: 'per_function_run',\n },\n proxyRequest: {\n credits: CONNECTED_PROXY_REQUEST_CREDITS,\n mc: CONNECTED_PROXY_REQUEST_MC,\n unit: 'per_proxy_request',\n },\n compute: {\n creditsPerSecond: CONNECTED_COMPUTE_CREDITS_PER_SECOND,\n mcPerSecond: CONNECTED_COMPUTE_MC_PER_SECOND,\n sourceUnit: 'millisecond',\n unit: 'per_compute_second',\n formula: 'ceil(computeMilliseconds * mcPerSecond / 1000)',\n },\n },\n} as const\n\nexport interface ConnectedUsageQuantities {\n functionRuns: number\n proxyRequests: number\n computeMilliseconds: number\n}\n\nexport interface ConnectedUsageCharge {\n functionRunMc: number\n proxyRequestMc: number\n computeMc: number\n amountMc: number\n credits: number\n}\n\nfunction nonNegativeSafeInteger(value: number, field: string): bigint {\n if (!Number.isSafeInteger(value) || value < 0) {\n throw new Error(`${field} must be a non-negative safe integer`)\n }\n return BigInt(value)\n}\n\nfunction safeMc(value: bigint): number {\n if (value > BigInt(Number.MAX_SAFE_INTEGER)) throw new Error('connected usage charge exceeds the safe integer range')\n return Number(value)\n}\n\n/** Calculate one receipt after aggregating its raw Nango usage counters. */\nexport function calculateConnectedUsageCharge(usage: ConnectedUsageQuantities): ConnectedUsageCharge {\n const functionRuns = nonNegativeSafeInteger(usage.functionRuns, 'functionRuns')\n const proxyRequests = nonNegativeSafeInteger(usage.proxyRequests, 'proxyRequests')\n const computeMilliseconds = nonNegativeSafeInteger(usage.computeMilliseconds, 'computeMilliseconds')\n const functionRunMc = functionRuns * BigInt(CONNECTED_FUNCTION_RUN_MC)\n const proxyRequestMc = proxyRequests * BigInt(CONNECTED_PROXY_REQUEST_MC)\n const computeNumerator = computeMilliseconds * BigInt(CONNECTED_COMPUTE_MC_PER_SECOND)\n const computeMc = computeNumerator === 0n ? 0n : (computeNumerator + 999n) / 1_000n\n const amountMc = functionRunMc + proxyRequestMc + computeMc\n\n return {\n functionRunMc: safeMc(functionRunMc),\n proxyRequestMc: safeMc(proxyRequestMc),\n computeMc: safeMc(computeMc),\n amountMc: safeMc(amountMc),\n credits: safeMc(amountMc) / MC_PER_CREDIT,\n }\n}\n\n/**\n * Public, machine-readable Scheduled Actions billing contract.\n *\n * Keep every API/UI surface on this object instead of restating the policy.\n * The primitive constants above remain the execution-time source of truth;\n * this object gives clients stable semantic fields for displaying and applying\n * those rates without having to infer behavior from prose.\n */\nexport const SCHEDULED_ACTIONS_RATE_POLICY = {\n billingMode: 'credits',\n entitlement: 'paid_plan_included',\n separateSubscriptionRequired: false,\n chargeEvent: 'started_occurrence',\n runBaseCredits: SCHEDULED_RUN_BASE_CREDITS,\n runBaseMc: SCHEDULED_RUN_BASE_MC,\n llmCostMultiplier: SCHEDULED_AGENT_LLM_MARKUP,\n llmCostMultiplierBps: SCHEDULED_AGENT_LLM_MARKUP_BPS,\n modes: {\n connection_sync: {\n runBaseCredits: SCHEDULED_RUN_BASE_CREDITS,\n modelCostBilling: 'none',\n modelCostMultiplier: 0,\n },\n agent: {\n runBaseCredits: SCHEDULED_RUN_BASE_CREDITS,\n modelCostBilling: 'actual_reported_cost',\n modelCostProvider: 'openrouter',\n modelCostMultiplier: SCHEDULED_AGENT_LLM_MARKUP,\n modelCostMultiplierBps: SCHEDULED_AGENT_LLM_MARKUP_BPS,\n },\n },\n} as const\n\nexport function vendorCostUsdToMc(costUsd: number, markupBps: number): number {\n if (!Number.isFinite(costUsd) || costUsd < 0) throw new Error('costUsd must be a finite non-negative number')\n if (!Number.isInteger(markupBps) || markupBps < 0) throw new Error('markupBps must be a non-negative integer')\n\n const rawCostNanos = BigInt(Math.round(costUsd * USD_NANOS))\n const numerator =\n rawCostNanos *\n BigInt(markupBps) *\n BigInt(BILLING_MC_PER_USD_NUMERATOR)\n const denominator =\n BigInt(USD_NANOS) *\n BigInt(BILLING_BASIS_POINTS) *\n BigInt(BILLING_MC_PER_USD_DENOMINATOR)\n const mc = numerator === 0n ? 0n : (numerator + denominator - 1n) / denominator\n if (mc > BigInt(Number.MAX_SAFE_INTEGER)) throw new Error('calculated mc exceeds the safe integer range')\n return Number(mc)\n}\n\nexport const CREDIT_COST_CATALOG: Array<{\n key: McCostKey\n label: string\n aliases: string[]\n credits: number\n unit: string\n notes?: string\n}> = [\n {\n key: 'serp',\n label: 'SERP search',\n aliases: ['search_serp', 'serp', 'google search', 'organic results'],\n credits: mcToCredits(MC_COSTS.serp_headful),\n unit: 'per search',\n 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 ${mcToCredits(MC_COSTS.serp_headful)} credits per search. Optional SERP Intelligence page snapshots add ${mcToCredits(MC_COSTS.page_scrape)} credit per attempted URL.`,\n },\n {\n key: 'paa',\n label: 'PAA harvest',\n aliases: ['harvest_paa', 'paa', 'people also ask', 'questions'],\n credits: mcToCredits(MC_COSTS.paa),\n unit: `per question (+${mcToCredits(MC_COSTS.paa_base)} credit base)`,\n 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 ${mcToCredits(MC_COSTS.paa_base)} credit base + ${mcToCredits(MC_COSTS.paa)} per question actually returned (unused estimate refunded).`,\n },\n {\n key: 'page_scrape',\n label: 'Page crawl / extract',\n aliases: ['extract_url', 'extract_site', 'page scrape', 'url scrape', 'single page', 'site crawl'],\n credits: mcToCredits(MC_COSTS.page_scrape),\n unit: 'per page',\n notes: 'Applies to both single-URL extraction and per-page site crawls.',\n },\n {\n key: 'listing_create',\n label: 'Directory or wiki listing creation',\n aliases: ['local-sourcebook-capture', 'commons_submit_entity', 'directory listing', 'wiki listing'],\n credits: mcToCredits(MC_COSTS.listing_create),\n unit: 'per new listing',\n notes: 'Fixed total price for a new Local Sourcebook directory listing or Transparent Commons wiki entity. Sourcebook acquisition is included.',\n },\n {\n key: 'listing_edit',\n label: 'Directory or wiki listing edit',\n aliases: ['local_sourcebook_refresh', 'commons_submit_entity', 'listing refresh', 'wiki edit'],\n credits: mcToCredits(MC_COSTS.listing_edit),\n unit: 'per existing listing revision',\n notes: 'Fixed total price for refreshing an existing Local Sourcebook listing or revising an existing Transparent Commons entity.',\n },\n {\n key: 'url_map',\n label: 'Site URL mapping',\n aliases: ['map_site_urls', 'url map', 'site map', 'crawl urls'],\n credits: mcToCredits(MC_COSTS.url_map),\n unit: 'per mapping operation',\n notes: 'Flat rate for the full /map-urls call regardless of URL count discovered.',\n },\n {\n key: 'yt_channel',\n label: 'YouTube search / channel harvest',\n aliases: ['youtube_harvest', 'youtube search', 'youtube channel', 'yt_channel'],\n credits: mcToCredits(MC_COSTS.yt_channel),\n unit: 'per call',\n },\n {\n key: 'yt_transcription',\n label: 'YouTube transcription',\n aliases: ['youtube_transcribe', 'youtube transcript', 'transcription', 'yt_transcription'],\n credits: mcToCredits(20_000),\n unit: 'base + 2/min of video',\n 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).',\n },\n {\n key: 'fb_ad',\n label: 'Facebook search / ad lookup',\n aliases: ['facebook_page_intel', 'facebook_ad_search', 'facebook_ad', 'facebook ads', 'fb ads'],\n credits: mcToCredits(MC_COSTS.fb_ad),\n unit: 'per call',\n },\n {\n key: 'maps_search',\n label: 'Maps business search',\n aliases: ['maps_search', 'google maps search', 'gmb search', 'gbp search', 'business profiles'],\n credits: mcToCredits(MC_COSTS.maps_search),\n unit: 'per search',\n notes: 'Returns up to 50 Google Maps business/profile candidates. Use maps_place_intel to hydrate selected businesses.',\n },\n {\n key: 'maps_place',\n label: 'Maps business lookup',\n aliases: ['maps_place_intel', 'google maps', 'maps place', 'place intel'],\n credits: mcToCredits(MC_COSTS.maps_place),\n unit: 'per business',\n notes: 'Base lookup. Reviews billed separately per card at maps_review rate.',\n },\n {\n key: 'maps_review',\n label: 'Maps review',\n aliases: ['maps_reviews', 'google reviews', 'review cards', 'reviews'],\n credits: mcToCredits(MC_COSTS.maps_review),\n unit: 'per review card',\n notes: 'Charged after extraction when includeReviews is true.',\n },\n {\n key: 'fb_search',\n label: 'Facebook ad library search',\n aliases: ['facebook_search', 'fb_search', 'fb ad search'],\n credits: mcToCredits(MC_COSTS.fb_search),\n unit: 'per search',\n notes: 'Browser automation to search Facebook Ads Library by keyword.',\n },\n {\n key: 'google_ads_search',\n label: 'Google Ads Transparency search',\n aliases: ['google_ads_search', 'google ads search', 'ads transparency search'],\n credits: mcToCredits(MC_COSTS.google_ads_search),\n unit: 'per search',\n notes: 'Browser automation to find advertisers in Google Ads Transparency Center by domain or name.',\n },\n {\n key: 'google_ads_intel',\n label: 'Google Ads Transparency advertiser intel',\n aliases: ['google_ads_page_intel', 'google ads intel', 'ads transparency intel'],\n credits: mcToCredits(MC_COSTS.google_ads_intel),\n unit: 'per call',\n notes: 'Lists and hydrates an advertiser\\'s creatives with image URLs and video references.',\n },\n {\n key: 'google_ads_transcribe',\n label: 'Google ad video transcription',\n aliases: ['google_ads_transcribe', 'google ad transcript'],\n credits: mcToCredits(20_000),\n unit: 'base + 2/min of video',\n 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).',\n },\n {\n key: 'fb_transcribe',\n label: 'Facebook video / ad transcription',\n aliases: ['facebook_transcribe', 'facebook_video_transcribe', 'fb_transcribe', 'fb ad transcript'],\n credits: mcToCredits(20_000),\n unit: 'base + 2/min of video',\n 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).',\n },\n {\n key: 'instagram_profile',\n label: 'Instagram profile content discovery',\n aliases: ['instagram_profile_content', 'instagram profile', 'instagram content list', 'ig profile'],\n credits: mcToCredits(MC_COSTS.instagram_profile),\n unit: 'per profile scan',\n notes: 'Browser extraction of public Instagram profile grid links. Complete history may require a logged-in profile.',\n },\n {\n key: 'instagram_media',\n label: 'Instagram media download',\n aliases: ['instagram_media_download', 'instagram reel download', 'instagram post download', 'ig media'],\n credits: mcToCredits(MC_COSTS.instagram_media),\n unit: 'per post or reel',\n notes: 'Extracts post text, image URLs, and reel audio/video tracks, with local downloads when the server can write files.',\n },\n {\n key: 'instagram_transcribe',\n label: 'Instagram media transcription',\n aliases: ['instagram transcript', 'instagram reel transcript', 'ig transcribe'],\n credits: mcToCredits(20_000),\n unit: 'base + 2/min of video',\n 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).',\n },\n {\n key: 'browser_minute',\n label: 'Interactive browser session',\n aliases: ['browser_open', 'browser agent', 'browser_agent', 'live browser', 'browse', 'browser control', 'interactive browser'],\n credits: mcToCredits(MC_COSTS.browser_minute),\n unit: 'per minute of use',\n 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.',\n },\n {\n key: 'reddit_thread',\n label: 'Reddit thread base lookup',\n aliases: ['reddit', 'reddit_thread', 'reddit comments', 'subreddit', 'reddit post'],\n credits: mcToCredits(MC_COSTS.reddit_thread),\n unit: 'per thread',\n notes: 'Base lookup for the post itself. Comments billed separately per comment at reddit_comment rate. Refunded if the thread cannot be retrieved.',\n },\n {\n key: 'reddit_comment',\n label: 'Reddit comment',\n aliases: ['reddit_comment', 'reddit comments'],\n credits: mcToCredits(MC_COSTS.reddit_comment),\n unit: 'per comment',\n notes: 'Charged per comment actually extracted, billed down automatically if the balance runs out mid-thread.',\n },\n {\n key: 'video_analysis',\n label: 'Video breakdown (frame-by-frame + transcript)',\n aliases: ['video_frame_analysis', 'video breakdown', 'video analysis', 'analyze video'],\n credits: mcToCredits(MC_COSTS.video_analysis),\n unit: 'per 120 frames (max 480)',\n 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.',\n },\n {\n key: 'trustpilot_reviews',\n label: 'Trustpilot review harvest',\n aliases: ['trustpilot_reviews', 'trustpilot', 'trustpilot reviews'],\n credits: mcToCredits(MC_COSTS.trustpilot_reviews),\n unit: 'per call',\n notes: 'Base lookup. Reviews billed separately per card at trustpilot_review rate. Refunded if no reviews are found.',\n },\n {\n key: 'trustpilot_review',\n label: 'Trustpilot review card',\n aliases: ['trustpilot_review', 'trustpilot card'],\n credits: mcToCredits(MC_COSTS.trustpilot_review),\n unit: 'per review card',\n notes: 'Charged per review actually extracted, billed down automatically if the balance runs out mid-page.',\n },\n {\n key: 'g2_reviews',\n label: 'G2 review harvest',\n aliases: ['g2_reviews', 'g2', 'g2 reviews'],\n credits: mcToCredits(MC_COSTS.g2_reviews),\n unit: 'per call',\n notes: 'Base lookup. Reviews billed separately per card at g2_review rate. Refunded if no reviews are found.',\n },\n {\n key: 'g2_review',\n label: 'G2 review card',\n aliases: ['g2_review', 'g2 card'],\n credits: mcToCredits(MC_COSTS.g2_review),\n unit: 'per review card',\n 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.',\n },\n {\n key: 'diff_page',\n label: 'Page change check',\n aliases: ['diff_page', 'page diff', 'change detection'],\n credits: mcToCredits(MC_COSTS.diff_page),\n unit: 'per check',\n notes: 'Same cost as a single page extract — one scrape is performed per check, then compared against your last stored snapshot for that URL.',\n },\n]\n\nexport const CONCURRENCY_PRICE_ID = 'price_1Ta1NRS8aAcsk3TGwsRnYbix'\n\nexport interface SubscriptionTier {\n tier: string\n label: string\n price_id: string\n monthly_usd: number\n billed_usd?: number\n credits_mc: number\n concurrency: number\n intro_coupon: string | null\n billing_interval?: 'month' | 'year'\n credits_never_expire?: boolean\n includes_memory?: boolean\n private_offer?: boolean\n}\n\nexport function tierBillingInterval(tier: SubscriptionTier): 'month' | 'year' {\n return tier.billing_interval ?? 'month'\n}\n\nexport function tierAmountChargedUsd(tier: SubscriptionTier): number {\n return tier.billed_usd ?? tier.monthly_usd\n}\n\nexport function tierCreditsPerInterval(tier: SubscriptionTier): number {\n return tier.credits_mc / MC_PER_CREDIT\n}\n\nexport const SUBSCRIPTION_TIERS: Record<string, SubscriptionTier> = {\n 'price_1TmiHRS8aAcsk3TGwmSNfNIa': { tier: 'starter', label: 'Starter', price_id: 'price_1TmiHRS8aAcsk3TGwmSNfNIa', monthly_usd: 12, credits_mc: 8_000_000, concurrency: 3, intro_coupon: 'mcp-starter-1dollar-intro-12' },\n 'price_1TrgihS8aAcsk3TG5cglrq4D': { tier: 'growth', label: 'Growth', price_id: 'price_1TrgihS8aAcsk3TG5cglrq4D', monthly_usd: 40, credits_mc: 26_666_700, concurrency: 10, intro_coupon: null },\n 'price_1TrgihS8aAcsk3TG4HnG4gbY': { tier: 'scale', label: 'Scale', price_id: 'price_1TrgihS8aAcsk3TG4HnG4gbY', monthly_usd: 100, credits_mc: 80_000_000, concurrency: 20, intro_coupon: null },\n 'price_1TwqIVS8aAcsk3TG0FE3ddDM': { tier: 'sonic', label: 'Sonic Annual', price_id: 'price_1TwqIVS8aAcsk3TG0FE3ddDM', monthly_usd: 25, billed_usd: 300, credits_mc: 250_000_000, concurrency: 3, intro_coupon: null, billing_interval: 'year', credits_never_expire: true, private_offer: true },\n 'price_1TwqIWS8aAcsk3TGbGbtlLak': { tier: 'sonic-memory', label: 'Sonic Annual + Memory Pro', price_id: 'price_1TwqIWS8aAcsk3TGbGbtlLak', monthly_usd: 34.5, billed_usd: 414, credits_mc: 250_000_000, concurrency: 3, intro_coupon: null, billing_interval: 'year', credits_never_expire: true, includes_memory: true, private_offer: true },\n}\n\nexport const SUBSCRIPTION_TIER_BY_KEY: Record<string, SubscriptionTier> = Object.fromEntries(\n Object.values(SUBSCRIPTION_TIERS).map(t => [t.tier, t]),\n)\n\nexport interface PrivateOffer {\n slug: string\n label: string\n headline: string\n tier_keys: string[]\n}\n\nexport const PRIVATE_OFFERS: Record<string, PrivateOffer> = {\n sonic: {\n slug: 'sonic',\n label: 'Sonic annual partner offer',\n headline: 'A full year of MCP Scraper, with Credits that never expire.',\n tier_keys: ['sonic', 'sonic-memory'],\n },\n}\n\nexport function offerClaimPathForTier(tierKey: string): string | null {\n const offer = Object.values(PRIVATE_OFFERS).find(o => o.tier_keys.includes(tierKey))\n return offer ? `/${offer.slug}/claim` : null\n}\n\nexport function offerForTier(tierKey: string | null | undefined): PrivateOffer | null {\n if (!tierKey) return null\n return Object.values(PRIVATE_OFFERS).find(o => o.tier_keys.includes(tierKey)) ?? null\n}\n\nexport function tierChangeLeavesPrivateOffer(\n fromTier: string | null | undefined,\n toTier: string,\n): boolean {\n const from = offerForTier(fromTier)\n if (!from) return false\n return !from.tier_keys.includes(toTier)\n}\n\nexport interface SubscriptionPlanView {\n tier: string\n label: string\n amount_usd: number\n interval: 'month' | 'year'\n monthly_equivalent_usd: number\n credits_per_interval: number\n concurrency: number\n credits_never_expire: boolean\n includes_memory: boolean\n private_offer: boolean\n offer_claim_path: string | null\n}\n\nexport function getSubscriptionPlanView(tierKey: string | null | undefined): SubscriptionPlanView | null {\n if (!tierKey) return null\n const tier = SUBSCRIPTION_TIER_BY_KEY[tierKey]\n if (!tier) return null\n return {\n tier: tier.tier,\n label: tier.label,\n amount_usd: tierAmountChargedUsd(tier),\n interval: tierBillingInterval(tier),\n monthly_equivalent_usd: tier.monthly_usd,\n credits_per_interval: tierCreditsPerInterval(tier),\n concurrency: tier.concurrency,\n credits_never_expire: !!tier.credits_never_expire,\n includes_memory: !!tier.includes_memory,\n private_offer: !!tier.private_offer,\n offer_claim_path: offerClaimPathForTier(tier.tier),\n }\n}\n\nexport function getPrivateOfferPayload(slug: string) {\n const offer = PRIVATE_OFFERS[slug]\n if (!offer) return null\n const options = offer.tier_keys\n .map(key => SUBSCRIPTION_TIER_BY_KEY[key])\n .filter((t): t is SubscriptionTier => !!t)\n .map(t => ({\n tier: t.tier,\n label: t.label,\n amount_usd: tierAmountChargedUsd(t),\n interval: tierBillingInterval(t),\n monthly_equivalent_usd: t.monthly_usd,\n credits: tierCreditsPerInterval(t),\n credits_never_expire: !!t.credits_never_expire,\n includes_memory: !!t.includes_memory,\n concurrency: t.concurrency,\n }))\n if (!options.length) return null\n return { slug: offer.slug, label: offer.label, headline: offer.headline, options }\n}\n\nexport function getPublicRatesPayload() {\n const starter = SUBSCRIPTION_TIER_BY_KEY.starter\n const costs = CREDIT_COST_CATALOG.map(({ aliases, ...cost }) => ({\n ...cost,\n ...(cost.notes ? { notes: cost.notes.replace(/ via fal\\.ai/g, '') } : {}),\n }))\n\n const operationCosts = Object.fromEntries(costs.map((cost) => [cost.key, {\n credits: cost.credits,\n unit: cost.unit,\n label: cost.label,\n ...(cost.notes ? { notes: cost.notes } : {}),\n }]))\n const publicTiers = Object.values(SUBSCRIPTION_TIERS).filter((tier) => !tier.private_offer).map((tier) => ({\n tier: tier.tier,\n label: tier.label,\n monthlyUsd: tier.monthly_usd,\n credits: tier.credits_mc / MC_PER_CREDIT,\n concurrency: tier.concurrency,\n }))\n\n return {\n ...PUBLIC_PRODUCT_CONTRACT,\n operationCosts,\n publicTiers,\n concurrencyPack: {\n ratePolicyVersion: CONCURRENCY_PACK_RATE_POLICY_VERSION,\n monthlyUsd: CONCURRENCY_PACK_PRICE_USD,\n currency: CONCURRENCY_PACK_PRICE_CURRENCY,\n interval: CONCURRENCY_PACK_PRICE_INTERVAL,\n billingUnit: 'pack' as const,\n slotsPerPack: CONCURRENCY_SLOTS_PER_PACK,\n },\n creditsPerDollarStarter: Math.round(mcToCredits(starter.credits_mc) / starter.monthly_usd),\n costs,\n scheduling: PUBLIC_PRODUCT_CONTRACT.addons.scheduling,\n connectedAccounts: PUBLIC_PRODUCT_CONTRACT.addons.connectedAccounts,\n listingWrites: LISTING_WRITE_RATE_POLICY,\n }\n}\n\nexport const CONCURRENCY_PACK_PRICE_USD = 5\nexport const CONCURRENCY_PACK_PRICE_CURRENCY = 'usd'\nexport const CONCURRENCY_PACK_PRICE_INTERVAL = 'month'\nexport const CONCURRENCY_SLOTS_PER_PACK = 2\nexport const CONCURRENCY_PACK_RATE_POLICY_VERSION = '2026-08-14.concurrency-pack-v1'\nexport const CONCURRENCY_PACK_PRICE_LABEL = '$5/month for 2 extra browsers'\nexport const CONCURRENCY_PACK_INVOICE_DESCRIPTION = 'MCP Scraper browser concurrency pack — each $5 monthly pack adds 2 browsers.'\nexport const CONCURRENCY_PACK_INVOICE_FOOTER = 'Billed monthly until canceled. A receipt is emailed after each successful payment.'\nexport const CONCURRENCY_PACK_TERMINAL_COMMAND = 'npx -y -p mcp-scraper@latest mcp-scraper-cli billing concurrency checkout'\n\n// Compatibility aliases keep existing SDK consumers compiling while the\n// commercial unit changes from one slot to one two-browser pack.\nexport const CONCURRENCY_SLOT_PRICE_USD = CONCURRENCY_PACK_PRICE_USD\nexport const CONCURRENCY_SLOT_PRICE_CURRENCY = CONCURRENCY_PACK_PRICE_CURRENCY\nexport const CONCURRENCY_SLOT_PRICE_INTERVAL = CONCURRENCY_PACK_PRICE_INTERVAL\nexport const CONCURRENCY_SLOT_PRICE_LABEL = CONCURRENCY_PACK_PRICE_LABEL\nexport const CONCURRENCY_SLOT_TERMINAL_COMMAND = CONCURRENCY_PACK_TERMINAL_COMMAND\n\nexport function concurrencyPackBillingInfo() {\n const billingUrl = process.env.CONCURRENCY_BILLING_URL ?? 'https://mcpscraper.dev/billing'\n return {\n product: 'Extra browser concurrency pack',\n rate_policy_version: CONCURRENCY_PACK_RATE_POLICY_VERSION,\n price_label: CONCURRENCY_PACK_PRICE_LABEL,\n unit_amount_usd: CONCURRENCY_PACK_PRICE_USD,\n currency: CONCURRENCY_PACK_PRICE_CURRENCY,\n interval: CONCURRENCY_PACK_PRICE_INTERVAL,\n billing_unit: 'pack',\n pack_quantity: 1,\n slots_per_pack: CONCURRENCY_SLOTS_PER_PACK,\n extra_slots: CONCURRENCY_SLOTS_PER_PACK,\n billing_url: billingUrl,\n terminal_command: CONCURRENCY_PACK_TERMINAL_COMMAND,\n terminal_command_with_api_key_env: `MCP_SCRAPER_API_KEY=sk_live_your_key ${CONCURRENCY_PACK_TERMINAL_COMMAND}`,\n }\n}\n\n/** @deprecated Use concurrencyPackBillingInfo. */\nexport const concurrencySlotBillingInfo = concurrencyPackBillingInfo\n\n// The free tier is retired. Keep these exported compatibility constants at zero\n// so older consumers do not advertise or grant credits that no longer exist.\nexport const FREE_SIGNUP_MC = 0\nexport const FREE_MONTHLY_REFRESH_MC = 0\n\nexport const BALANCE_PRICE_IDS: Record<string, number> = {\n 'price_1TZx6rS8aAcsk3TGNMc1Vgpo': 11_000_000,\n 'price_1TZx6sS8aAcsk3TGxgqB7khO': 27_500_000,\n 'price_1TZx6tS8aAcsk3TG8PnJqHlG': 60_500_000,\n 'price_1TZx6tS8aAcsk3TGNgRMpy0e': 121_000_000,\n}\n\nexport const BALANCE_PACK_LABELS: Record<string, string> = {\n 'price_1TZx6rS8aAcsk3TGNMc1Vgpo': '$10',\n 'price_1TZx6sS8aAcsk3TGxgqB7khO': '$25',\n 'price_1TZx6tS8aAcsk3TG8PnJqHlG': '$50',\n 'price_1TZx6tS8aAcsk3TGNgRMpy0e': '$100',\n}\n\nexport function mcToCredits(mc: number): number {\n return mc / MC_PER_CREDIT\n}\n\nexport function insufficientBalanceResponse(balanceMc: number, requiredMc: number) {\n const topupUrl = process.env.TOPUP_URL ?? 'https://mcpscraper.dev/billing'\n const balanceCredits = mcToCredits(balanceMc)\n const requiredCredits = mcToCredits(requiredMc)\n return {\n error: 'insufficient_balance',\n error_code: 'insufficient_balance' as const,\n message: `Insufficient credits. Balance: ${balanceCredits} credits. This call requires ${requiredCredits} credits. Top up at ${topupUrl}`,\n balance_credits: balanceCredits,\n required_credits: requiredCredits,\n topup_url: topupUrl,\n }\n}\n\nexport interface MemoryPlan {\n plan: 'pro' | 'team'\n label: string\n price_id: string\n interval: 'month' | 'year'\n monthly_usd: number\n quota_bytes: number\n}\n\nexport const MEMORY_FREE_QUOTA_BYTES = 0.01e9 * 1\n\nexport const MEMORY_PLANS: Record<string, MemoryPlan> = {\n 'price_1TnMSTS8aAcsk3TGBgiwuvqL': { plan: 'pro', label: 'Pro', price_id: 'price_1TnMSTS8aAcsk3TGBgiwuvqL', interval: 'month', monthly_usd: 19, quota_bytes: 5e9 },\n 'price_1TnMSTS8aAcsk3TGWBVU2agY': { plan: 'pro', label: 'Pro', price_id: 'price_1TnMSTS8aAcsk3TGWBVU2agY', interval: 'year', monthly_usd: 19, quota_bytes: 5e9 },\n}\n\nexport const MEMORY_PLAN_QUOTA: Record<string, number> = { free: MEMORY_FREE_QUOTA_BYTES, pro: 5e9, team: 50e9 }\n\nexport const MEMORY_MARGIN_MULTIPLE = 3\nexport const MEMORY_FREE_COST_CAP_USD = 1.0\nexport const MEMORY_PRO_COST_BUDGET_USD = 19 / MEMORY_MARGIN_MULTIPLE\n\nexport const LedgerOperation = {\n TOPUP: 'topup',\n SUBSCRIPTION: 'subscription',\n SIGNUP_GRANT: 'signup_grant',\n MONTHLY_REFRESH: 'monthly_free_refresh',\n PAA: 'paa',\n PAA_REFUND: 'paa_refund',\n SERP: 'serp',\n SERP_REFUND: 'serp_refund',\n REFUND: 'refund',\n TRANSCRIPTION: 'transcription',\n TRANSCRIPTION_HOLD: 'transcription_hold',\n TRANSCRIPTION_REFUND: 'transcription_refund',\n YT_CHANNEL: 'yt_channel',\n FB_AD: 'fb_ad',\n MAPS_SEARCH: 'maps_search',\n DIRECTORY_WORKFLOW_HOLD: 'directory_workflow_hold',\n DIRECTORY_WORKFLOW_REFUND: 'directory_workflow_refund',\n MAPS_PLACE: 'maps_place',\n MAPS_REVIEW: 'maps_review',\n MAPS_REVIEW_REFUND: 'maps_review_refund',\n EXTRACT_SITE: 'extract_site',\n EXTRACT_SITE_REFUND: 'extract_site_refund',\n EXTRACT_URL: 'page_scrape',\n URL_MAP: 'url_map',\n EXTRACT_SITE_HOLD: 'extract_site_hold',\n YT_CHANNEL_REFUND: 'yt_channel_refund',\n FB_AD_REFUND: 'fb_ad_refund',\n URL_MAP_REFUND: 'url_map_refund',\n FB_SEARCH: 'fb_search',\n FB_TRANSCRIBE: 'fb_transcribe',\n FB_SEARCH_REFUND: 'fb_search_refund',\n FB_SEARCH_RESULT: 'fb_search_result',\n FB_SEARCH_RESULT_REFUND: 'fb_search_result_refund',\n FB_PAGE_INTEL: 'fb_page_intel',\n FB_PAGE_INTEL_REFUND: 'fb_page_intel_refund',\n FB_PAGE_INTEL_AD: 'fb_page_intel_ad',\n FB_PAGE_INTEL_AD_REFUND: 'fb_page_intel_ad_refund',\n FB_TRANSCRIBE_REFUND: 'fb_transcribe_refund',\n GOOGLE_ADS_SEARCH: 'google_ads_search',\n GOOGLE_ADS_SEARCH_REFUND: 'google_ads_search_refund',\n GOOGLE_ADS_INTEL: 'google_ads_intel',\n GOOGLE_ADS_INTEL_REFUND: 'google_ads_intel_refund',\n GOOGLE_ADS_TRANSCRIBE: 'google_ads_transcribe',\n GOOGLE_ADS_TRANSCRIBE_REFUND: 'google_ads_transcribe_refund',\n INSTAGRAM_PROFILE: 'instagram_profile',\n INSTAGRAM_PROFILE_REFUND: 'instagram_profile_refund',\n INSTAGRAM_MEDIA: 'instagram_media',\n INSTAGRAM_MEDIA_REFUND:'instagram_media_refund',\n INSTAGRAM_TRANSCRIBE: 'instagram_transcribe',\n INSTAGRAM_TRANSCRIBE_REFUND: 'instagram_transcribe_refund',\n BROWSER_SESSION: 'browser_session',\n REDDIT_THREAD: 'reddit_thread',\n REDDIT_THREAD_REFUND: 'reddit_thread_refund',\n REDDIT_COMMENT: 'reddit_comment',\n REDDIT_COMMENT_REFUND: 'reddit_comment_refund',\n VIDEO_ANALYSIS: 'video_analysis',\n VIDEO_ANALYSIS_REFUND: 'video_analysis_refund',\n VIDEO_ANALYSIS_ADJUST: 'video_analysis_adjust',\n VIDEO_ANALYSIS_LLM: 'video_analysis_llm',\n MEMORY_AI: 'memory_ai',\n MEMORY_AI_REFUND: 'memory_ai_refund',\n TRUSTPILOT_REVIEWS: 'trustpilot_reviews',\n TRUSTPILOT_REVIEWS_REFUND: 'trustpilot_reviews_refund',\n TRUSTPILOT_REVIEW: 'trustpilot_review',\n TRUSTPILOT_REVIEW_REFUND: 'trustpilot_review_refund',\n G2_REVIEWS: 'g2_reviews',\n G2_REVIEWS_REFUND: 'g2_reviews_refund',\n G2_REVIEW: 'g2_review',\n G2_REVIEW_REFUND: 'g2_review_refund',\n DIFF_PAGE: 'diff_page',\n DIFF_PAGE_REFUND: 'diff_page_refund',\n LOCAL_SOURCEBOOK_CREATE: 'local_sourcebook_create',\n LOCAL_SOURCEBOOK_CREATE_REFUND: 'local_sourcebook_create_refund',\n LOCAL_SOURCEBOOK_EDIT: 'local_sourcebook_edit',\n LOCAL_SOURCEBOOK_EDIT_REFUND: 'local_sourcebook_edit_refund',\n COMMONS_CREATE: 'commons_create',\n COMMONS_CREATE_REFUND: 'commons_create_refund',\n COMMONS_EDIT: 'commons_edit',\n COMMONS_EDIT_REFUND: 'commons_edit_refund',\n SITE_AUDIT_LLM: 'site_audit_llm',\n SCHEDULED_RUN: 'scheduled_run',\n CONNECTED_USAGE: 'connected_usage',\n CONNECTED_ACCOUNT_FEE: 'connected_account_fee',\n ADMIN_GRANT: 'admin_grant',\n ADMIN_REVOKE: 'admin_revoke',\n} as const\n\nexport type LedgerOperation = typeof LedgerOperation[keyof typeof LedgerOperation]\n\nexport const MEMORY_AI_MARGIN_MULTIPLE = 3\nexport const SITE_AUDIT_LLM_MARGIN_MULTIPLE = 1.5\nexport const VIDEO_ANALYSIS_LLM_MARGIN_MULTIPLE = 1.5\nexport const MEDIA_TRANSCRIBE_FLAT_MC = 20_000\nexport const MEDIA_TRANSCRIBE_PER_MIN_MC = 200\n\nexport function mediaTranscribeChargeMc(durationSecs: number): number {\n const mins = Math.max(1, Math.ceil((durationSecs || 60) / 60))\n return MEDIA_TRANSCRIBE_FLAT_MC + MEDIA_TRANSCRIBE_PER_MIN_MC * mins\n}\n\nexport const MEDIA_TRANSCRIBE_MARGIN_MULTIPLE = 3\nexport const MEDIA_TRANSCRIBE_HOLD_MC = MEDIA_TRANSCRIBE_FLAT_MC + MEDIA_TRANSCRIBE_PER_MIN_MC * 30\n\nexport const MC_PER_USD =\n SUBSCRIPTION_TIERS['price_1TmiHRS8aAcsk3TGwmSNfNIa'].credits_mc /\n SUBSCRIP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;AAIO,IAAM,4BAA4B;AAClC,IAAM,iCAAiC;AACvC,IAAM,qCAAqC;AAC3C,IAAM,2BAA2B;AACjC,IAAM,8BAA8B;AAEpC,SAAS,wBAAwB,cAA8B;AACpE,QAAM,OAAO,KAAK,IAAI,GAAG,KAAK,MAAM,gBAAgB,MAAM,EAAE,CAAC;AAC7D,SAAO,2BAA2B,8BAA8B;AAClE;AAGO,IAAM,2BAA2B,2BAA2B,8BAA8B;AAE1F,IAAM,aACX,mBAAmB,gCAAgC,EAAE,aACrD,mBAAmB,gCAAgC,EAAE;","names":[]}
@@ -21,14 +21,14 @@ import {
21
21
  } from "./chunk-AK2NNIYA.js";
22
22
  import {
23
23
  PACKAGE_VERSION
24
- } from "./chunk-LHH3GX3W.js";
24
+ } from "./chunk-AQA2ZL4X.js";
25
25
  import {
26
26
  MC_PER_CREDIT,
27
27
  PAA_BASE_CREDITS,
28
28
  PAA_QUESTION_CREDITS,
29
29
  PAGE_SCRAPE_CREDITS,
30
30
  SERP_SEARCH_CREDITS
31
- } from "./chunk-R6CO77BN.js";
31
+ } from "./chunk-2U2ZDDSI.js";
32
32
  import {
33
33
  buildPublicErrorEnvelope,
34
34
  normalizePublicErrorCode,
@@ -6194,6 +6194,7 @@ var LocationMarketsInputSchema = {
6194
6194
  includeZipGroups: z5.boolean().default(true).describe("Include ZIP and county groups from the active hosted ZIP dataset.")
6195
6195
  };
6196
6196
  var CommonsSearchEntitiesInputSchema = {
6197
+ mode: z5.enum(["lexical", "semantic", "hybrid"]).optional().describe("Retrieval mode. hybrid (default) fuses meaning-based candidates with exact term matching; lexical matches terms only, which is what you want when the caller quoted an exact name or phrase; semantic ignores term matching entirely."),
6197
6198
  query: z5.string().trim().max(300).optional().describe("Search text matched against title, description, tags, keywords, JSON-LD, source metadata, citations, media, and article body."),
6198
6199
  entityType: z5.string().trim().max(120).optional().describe('Optional entity type filter. "Public Article", "PublicArticle", "Article", and "item" normalize to PublicArticle.'),
6199
6200
  tag: z5.string().trim().max(80).optional().describe("Single canonical tag filter. Use tags for multiple tags."),
@@ -6608,7 +6609,21 @@ var CommonsPublishEditorialInputSchema = {
6608
6609
  baseRevision: z5.number().int().positive().optional().describe("Required when revising an existing edition; use the current revision from commons_get_publication."),
6609
6610
  ...CreateEditorialReadingRoomInputSchema
6610
6611
  };
6612
+ var CommonsUpdateEditorialArticleInputSchema = {
6613
+ publicationSubdomain: CommonsPublicationSubdomainSchema.describe("Publication owned by the authenticated account."),
6614
+ editionSlug: z5.string().trim().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).max(80).optional().describe("Edition holding the article. Defaults to the publication\u2019s latest edition."),
6615
+ articleSlug: z5.string().trim().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).max(80).describe("Slug of the one article to replace, from commons_get_publication with includeArticles."),
6616
+ idempotencyKey: z5.string().trim().min(8).max(200).describe("Unique key for this intended edit. Reuse it only when retrying the same edit."),
6617
+ baseRevision: z5.number().int().positive().describe("Current edition revision from commons_get_publication. The edit is refused if the edition moved on."),
6618
+ markdown: z5.string().trim().min(1).max(4e5).optional().describe("Replacement Markdown body for this article. Omit to change only the metadata fields below."),
6619
+ title: z5.string().trim().min(1).max(180).optional().describe("Replacement article title."),
6620
+ summary: z5.string().trim().min(1).max(500).optional().describe("Replacement one or two sentence summary."),
6621
+ category: z5.string().trim().min(1).max(80).optional().describe("Replacement section label."),
6622
+ kicker: z5.string().trim().min(1).max(140).optional().describe("Replacement framing line above the title."),
6623
+ order: z5.number().int().min(1).max(1e3).optional().describe("Replacement reading-order position.")
6624
+ };
6611
6625
  var CommonsGetPublicationInputSchema = {
6626
+ includeArticles: z5.boolean().optional().describe("Return every stored article\u2019s Markdown source alongside each edition. Large payload; request it only when you intend to edit an article. Owner-only: a publication read by name never returns sources."),
6612
6627
  subdomain: CommonsPublicationSubdomainSchema.optional().describe("Public publication name to inspect. Omit to return the publication owned by the authenticated account."),
6613
6628
  includeEditions: z5.boolean().default(true).describe("Include the latest revision of every published edition.")
6614
6629
  };
@@ -9768,7 +9783,7 @@ function registerPaaExtractorMcpTools(server, executor, options = {}) {
9768
9783
  }, async (input) => formatG2Reviews(await executor.g2Reviews(input), input));
9769
9784
  server.registerTool("commons_search_entities", {
9770
9785
  title: "Transparent Commons Entity Search",
9771
- description: "Search the Transparent Commons public wiki graph using the same fields the public /wiki/ frontend uses: title, description, tags, keywords, JSON-LD, article body, citations, media, source metadata, related entities, trails, and saved account filters. This reads published Commons entities only.",
9786
+ description: "Search the Transparent Commons public wiki graph. Hybrid by default: meaning-based candidates fused with exact matching over title, description, tags, keywords, JSON-LD, body, citations, media, source metadata, related entities, trails, and saved filters, ranked title-first. Set mode:lexical for a quoted exact name or phrase. Reads published Commons entities only; never a personal Memory vault.",
9772
9787
  inputSchema: CommonsSearchEntitiesInputSchema,
9773
9788
  outputSchema: recordOutputSchema("commons_search_entities", CommonsGenericOutputSchema),
9774
9789
  annotations: {
@@ -9846,7 +9861,7 @@ function registerPaaExtractorMcpTools(server, executor, options = {}) {
9846
9861
  }, async (input) => executor.commonsValidateEntity(input));
9847
9862
  server.registerTool("commons_submit_entity", {
9848
9863
  title: "Transparent Commons Governed Entity Write",
9849
- description: "Create or propose an edit to a Transparent Commons public wiki entity through the governed MCP Scraper write plane. A new entity costs 10 Credits; an edit to an existing entity costs 2 Credits. Preparation and validation are free, and idempotent retries are not charged twice. This never edits rendered HTML directly. Normal workflow is commons_prepare_entity, compose, commons_validate_entity, then submit. Choose a precise entityType and write a neutral encyclopedia projection with the matching entity structure, not a blog article or raw scrape dump. Use H2 sections and H3/H4/H5 subitems; every heading appears in the public page menu. Omit unsupported sections instead of publishing empty/filler headings. Transparent Commons is an open wiki: any account may edit any entity, and every edit publishes and is recorded on the public contribution ledger. Publishing requires a featured image and body/source evidence. Pass baseRevision when editing so the ledger can show whether the edit was written on top of a newer revision. Requires idempotencyKey.",
9864
+ description: "Create or propose an edit to a Transparent Commons public wiki entity through the governed MCP Scraper write plane. A new entity costs 10 Credits; an edit to an existing entity costs 2 Credits. Preparation and validation are free, and idempotent retries are not charged twice. This never edits rendered HTML directly. Normal workflow is commons_prepare_entity, compose, commons_validate_entity, then submit. commons_prepare_entity returns the entity profile contract and section guidance to compose against. Transparent Commons is an open wiki: any account may edit any entity, and every edit publishes and is recorded on the public contribution ledger. Publishing requires a featured image and body/source evidence. Pass baseRevision when editing so the ledger can show whether the edit was written on top of a newer revision. Requires idempotencyKey.",
9850
9865
  inputSchema: CommonsSubmitEntityInputSchema,
9851
9866
  outputSchema: recordOutputSchema("commons_submit_entity", CommonsGenericOutputSchema),
9852
9867
  annotations: {
@@ -9872,7 +9887,7 @@ function registerPaaExtractorMcpTools(server, executor, options = {}) {
9872
9887
  }, async (input) => executor.commonsGetEntityLedger(input));
9873
9888
  server.registerTool("commons_host_image", {
9874
9889
  title: "Host a Transparent Commons Image",
9875
- description: "Download an image from a public https URL, or accept base64 bytes, and store it as a permanent Commons-hosted image. Returns the hosted URL to use on an entity. Commons never serves a third-party image URL: submitting an entity with an external image hosts it automatically, and this tool exists for hosting an image before or independently of a write. JPEG, PNG, GIF, and WebP up to 10 MB; SVG is rejected because the wiki serves images to the public web. Identical bytes are stored once and reused.",
9890
+ description: "Host an image from a public https URL or base64 bytes, returning a permanent Commons URL. Commons never serves a third-party image URL \u2014 commons_submit_entity hosts external images automatically, so use this only to host one before or independently of a write. JPEG, PNG, GIF, WebP up to 10 MB; SVG rejected. Identical bytes are stored once.",
9876
9891
  inputSchema: CommonsHostImageInputSchema,
9877
9892
  outputSchema: recordOutputSchema("commons_host_image", CommonsGenericOutputSchema),
9878
9893
  annotations: {
@@ -9950,9 +9965,16 @@ function registerPaaExtractorMcpTools(server, executor, options = {}) {
9950
9965
  outputSchema: recordOutputSchema("commons_publish_editorial", CommonsGenericOutputSchema),
9951
9966
  annotations: { title: "Publish Transparent Commons Editorial Edition", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true }
9952
9967
  }, async (input) => executor.commonsPublishEditorial(input));
9968
+ server.registerTool("commons_update_editorial_article", {
9969
+ title: "Edit One Transparent Commons Article",
9970
+ description: "Replace the Markdown of one article in a published edition without resupplying the others: it reads the stored sources, swaps the article you name, and publishes the next revision with the rest byte-identical. Read commons_get_publication with includeArticles first for the current source and revision. commons_publish_editorial is the full-replace path. Requires baseRevision and idempotencyKey.",
9971
+ inputSchema: CommonsUpdateEditorialArticleInputSchema,
9972
+ outputSchema: recordOutputSchema("commons_update_editorial_article", CommonsGenericOutputSchema),
9973
+ annotations: { title: "Edit One Transparent Commons Article", readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true }
9974
+ }, async (input) => executor.commonsUpdateEditorialArticle(input));
9953
9975
  server.registerTool("commons_get_publication", {
9954
9976
  title: "Get Transparent Commons Publication",
9955
- description: "Read a Transparent Commons publication and its latest edition revisions. Omit subdomain to inspect the caller-owned publication; pass a name to inspect a public publication. Returns the permanent public and archive URLs needed for sharing or later edits.",
9977
+ description: "Read a Transparent Commons publication and its latest edition revisions. Omit subdomain to inspect the caller-owned publication; pass a name to inspect a public publication. Returns the permanent public and archive URLs needed for sharing or later edits. Set includeArticles to also return every stored article\u2019s Markdown source and slug, which is what commons_update_editorial_article edits \u2014 the payload is large, so request it only when you intend to edit.",
9956
9978
  inputSchema: CommonsGetPublicationInputSchema,
9957
9979
  outputSchema: recordOutputSchema("commons_get_publication", CommonsGenericOutputSchema),
9958
9980
  annotations: { title: "Get Transparent Commons Publication", readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }
@@ -10019,7 +10041,7 @@ function registerPaaExtractorMcpTools(server, executor, options = {}) {
10019
10041
  }, async (input) => executor.localSourcebookCapture(input));
10020
10042
  server.registerTool("local_sourcebook_submission_status", {
10021
10043
  title: "Local Sourcebook Submission Status",
10022
- description: "Read the authenticated caller\u2019s listing draft, enrichment coverage, immutable revision number, publication state, and exact live LocalSourcebook.com profile and reviews URLs. When status is failed, acquisitionError states why in plain language \u2014 read it before retrying, because a refresh repeats the same acquisition and will fail the same way until the cause is fixed. Coverage counters are written only when acquisition succeeds, so a failed listing still shows the pre-run crawl block; zeroed counters do not mean the crawl never ran.",
10044
+ description: "Read the caller\u2019s listing draft, enrichment coverage, revision number, publication state, and live LocalSourcebook.com profile and reviews URLs. When status is failed, acquisitionError says why \u2014 read it before retrying, since a refresh repeats the same acquisition. Coverage counters are written only on success, so zeroed counters on a failed listing do not mean the crawl never ran.",
10023
10045
  inputSchema: LocalSourcebookSubmissionStatusInputSchema,
10024
10046
  outputSchema: recordOutputSchema("local_sourcebook_submission_status", LocalSourcebookOutputSchema),
10025
10047
  annotations: localPlanningToolAnnotations("Local Sourcebook Submission Status")
@@ -10913,6 +10935,12 @@ var HttpMcpToolExecutor = class {
10913
10935
  commonsHostImage(input) {
10914
10936
  return this.call("/commons/images", input);
10915
10937
  }
10938
+ commonsUpdateEditorialArticle(input) {
10939
+ const { idempotencyKey, ...body } = input;
10940
+ return this.call("/commons/publications/articles", { ...body, idempotencyKey }, this.timeoutMs, "POST", {
10941
+ "Idempotency-Key": `commons-article-${createHash4("sha256").update(idempotencyKey).digest("hex")}`
10942
+ });
10943
+ }
10916
10944
  commonsSaveFilter(input) {
10917
10945
  return this.call("/commons/filters", input);
10918
10946
  }
@@ -10941,7 +10969,7 @@ var HttpMcpToolExecutor = class {
10941
10969
  });
10942
10970
  }
10943
10971
  commonsGetPublication(input) {
10944
- const query = new URLSearchParams({ includeEditions: String(input.includeEditions ?? true) });
10972
+ const query = new URLSearchParams({ includeEditions: String(input.includeEditions ?? true), includeArticles: String(input.includeArticles ?? false) });
10945
10973
  return this.getJson(input.subdomain ? `/commons/publications/${encodeURIComponent(input.subdomain)}?${query}` : `/commons/publications/me?${query}`);
10946
10974
  }
10947
10975
  async captureSerpSnapshot(input) {
@@ -15956,6 +15984,7 @@ export {
15956
15984
  CommonsValidatePublicationInputSchema,
15957
15985
  CommonsClaimPublicationInputSchema,
15958
15986
  CommonsPublishEditorialInputSchema,
15987
+ CommonsUpdateEditorialArticleInputSchema,
15959
15988
  resolveDeploymentProfile,
15960
15989
  isLoopbackBaseUrl,
15961
15990
  permitsLocalNetworkAccess,
@@ -15972,4 +16001,4 @@ export {
15972
16001
  ScheduledResultsMcpExecutor,
15973
16002
  registerScheduledResultsMcpTools
15974
16003
  };
15975
- //# sourceMappingURL=chunk-QSUSTYB3.js.map
16004
+ //# sourceMappingURL=chunk-AIA3MFT2.js.map