socialcrawl-mcp 2.2.0 → 2.5.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 (75) hide show
  1. package/README.md +49 -21
  2. package/dist/app.d.ts +3 -3
  3. package/dist/app.js +75 -12
  4. package/dist/chatgpt-text.d.ts +23 -0
  5. package/dist/chatgpt-text.js +310 -0
  6. package/dist/client-tag.d.ts +13 -0
  7. package/dist/client-tag.js +17 -0
  8. package/dist/client.d.ts +5 -0
  9. package/dist/client.js +14 -4
  10. package/dist/constants.d.ts +1 -1
  11. package/dist/constants.js +1 -1
  12. package/dist/context.d.ts +13 -0
  13. package/dist/context.js +1 -0
  14. package/dist/cost-guard.d.ts +15 -3
  15. package/dist/cost-guard.js +39 -3
  16. package/dist/data/docs-async.d.ts +2 -2
  17. package/dist/data/docs-async.js +24 -3
  18. package/dist/data/docs-handwritten.js +968 -906
  19. package/dist/data/docs.js +7 -1
  20. package/dist/data/endpoints.js +11153 -7559
  21. package/dist/data/examples.js +2 -2
  22. package/dist/data/guide.d.ts +2 -2
  23. package/dist/data/guide.js +2 -2
  24. package/dist/data/outputs.js +425 -290
  25. package/dist/data/platforms.js +214 -55
  26. package/dist/data/recipes.js +1 -1
  27. package/dist/data/registry-meta.d.ts +10 -10
  28. package/dist/data/registry-meta.js +10 -10
  29. package/dist/endpoint-resolve.d.ts +1 -0
  30. package/dist/endpoint-resolve.js +10 -1
  31. package/dist/endpoint-surface.d.ts +64 -0
  32. package/dist/endpoint-surface.js +472 -0
  33. package/dist/hydration.js +28 -3
  34. package/dist/instructions.md +18 -18
  35. package/dist/listings.d.ts +24 -0
  36. package/dist/listings.js +55 -0
  37. package/dist/oauth/config.d.ts +39 -4
  38. package/dist/oauth/config.js +50 -6
  39. package/dist/oauth/resource-server.d.ts +12 -2
  40. package/dist/oauth/resource-server.js +5 -20
  41. package/dist/oauth/scopes.d.ts +2 -2
  42. package/dist/oauth/scopes.js +4 -4
  43. package/dist/param-aliases.d.ts +7 -0
  44. package/dist/param-aliases.js +15 -0
  45. package/dist/pricing.js +5 -1
  46. package/dist/resources/sample-gate.js +34 -1
  47. package/dist/resources/supplier-tokens.d.ts +1 -1
  48. package/dist/resources/supplier-tokens.js +2 -0
  49. package/dist/result.js +8 -0
  50. package/dist/schemas/async.d.ts +41 -31
  51. package/dist/schemas/async.js +28 -9
  52. package/dist/schemas/outputs.d.ts +4 -4
  53. package/dist/schemas/tools.d.ts +18 -6
  54. package/dist/schemas/tools.js +24 -4
  55. package/dist/server.js +6 -5
  56. package/dist/timeouts.d.ts +24 -1
  57. package/dist/timeouts.js +32 -0
  58. package/dist/tools/account.d.ts +4 -1
  59. package/dist/tools/account.js +1 -1
  60. package/dist/tools/async-common.js +3 -1
  61. package/dist/tools/check-balance.d.ts +4 -2
  62. package/dist/tools/check-balance.js +9 -0
  63. package/dist/tools/discover-runs.js +117 -11
  64. package/dist/tools/discover.js +3 -0
  65. package/dist/tools/estimate.js +10 -1
  66. package/dist/tools/list-endpoints.js +5 -3
  67. package/dist/tools/manage.js +2 -0
  68. package/dist/tools/monitors.d.ts +7 -1
  69. package/dist/tools/monitors.js +26 -2
  70. package/dist/tools/pricing.js +11 -1
  71. package/dist/tools/request.js +10 -2
  72. package/dist/types.d.ts +9 -1
  73. package/dist/value-prices.d.ts +18 -0
  74. package/dist/value-prices.js +79 -0
  75. package/package.json +75 -75
@@ -0,0 +1,310 @@
1
+ export const TOOL_TEXT = {
2
+ // ── Reads whose text promised background work or stored state ──
3
+ get_prism_discover: {
4
+ summary: "Search many platforms for posts on a topic or brand, keep a date window, judge each row for relevance and return the posts.",
5
+ useWhen: "Use it to collect what people say about a topic or a brand across platforms in one call.",
6
+ params: {
7
+ keywords: "Comma-separated searches, up to 6 in one call. Each runs once on each platform.",
8
+ depth: "quick (at most 3 fast platforms, about 15 s) or standard (the default).",
9
+ pages_per_platform: "Pages per search, 1 (the default) to 3.",
10
+ continue: "The token in data.next.continue_url: fetches the next platform pages of the searches that reported more.",
11
+ },
12
+ },
13
+ get_prism_creators: {
14
+ summary: "Find creators (influencers) who post about a niche on TikTok, Instagram, YouTube, X and LinkedIn, or measure and rank creators you already have.",
15
+ useWhen: "Use it to search for or rank creators in one call.",
16
+ params: {
17
+ limit: "Creators to deliver, up to 100 (default 20).",
18
+ depth: "quick (profile-level creators, no posts read, at most three platforms) or standard (the default, which reads each creator's recent posts).",
19
+ deadline_s: "Seconds this call may wait, 10 to 96 (default 40, quick 15).",
20
+ },
21
+ },
22
+ get_prism_profile_comments: {
23
+ useWhen: "Use it to check an account's own recent posts for new comments, passing a recent since date.",
24
+ },
25
+ get_prism_jobs_by_job_id: {
26
+ useWhen: "Use it to check a background job's progress and read its rows page by page.",
27
+ params: { job_id: "The job id (bj_…) from the job's data.job_id." },
28
+ },
29
+ get_twitter_ai_search: {
30
+ title: "Ask a question about posts on X",
31
+ summary: "Answer an open question about posts on X, using a model that searches X and cites the posts it used.",
32
+ useWhen: "Use it for open questions such as what an account said this week. A thin answer means few posts were found, so confirm with search_twitter_tweets.",
33
+ },
34
+ search_telegram: {
35
+ params: { date_posted: "Only pages the search index dates within this window: last-hour, last-day, last-week, last-month or last-year." },
36
+ },
37
+ search_linkedin_hashtag: { useWhen: "Use it to find posts that carry a hashtag. Keyword search across posts is search/posts." },
38
+ search_linkedin_posts: {
39
+ useWhen: "Use it to find public LinkedIn posts that match a keyword; it reads LinkedIn's own post search at request time, newest first with sort_by=date_posted or by relevance.",
40
+ },
41
+ get_linkedin_company_job_count: { useWhen: "Use it to read a company's current open job count without paging through company/jobs." },
42
+ get_naver_place_reviews: {
43
+ useWhen: "Use it to read recent visitor reviews; send since to keep only reviews from that date on, and read the sentiment labels on each review.",
44
+ },
45
+ get_naver_blog_posts: {
46
+ title: "List a Naver blog's posts, newest first (블로그 글 목록)",
47
+ summary: "List the posts of a Naver blog, newest first, page by page (블로그 글 목록).",
48
+ useWhen: "Use it to read a blog's posts with the cursor. To find posts by keyword, use blog/search.",
49
+ },
50
+ // ── Comparisons with other products or ways of working ──
51
+ get_reddit_profile_comments: {
52
+ summary: "Read a Reddit account's own comments, newest first.",
53
+ useWhen: "Use it when you need the account's actual comment history. It costs 2 credits per comment returned; search/comments with query=author:<name> costs 1 credit a page but returns fewer rows.",
54
+ },
55
+ get_naver_search_trend: {
56
+ useWhen: "Use it to see how Korean search demand for a term changes over time. To compare terms, put them in one call as groups; separate calls are not on the same scale.",
57
+ },
58
+ get_linkedin_profile_posts_archive: {
59
+ title: "A LinkedIn member's post history, 100 per page",
60
+ summary: "Read a LinkedIn member's posts 100 a page, further back than profile/posts goes, with exact publish times and share counts.",
61
+ useWhen: "It costs 5 credits per post returned, so check profile/posts first: it covers up to 100 posts at a lower price.",
62
+ },
63
+ get_douyin_profile: {
64
+ summary: "Get a Douyin creator profile, without its videos.",
65
+ useWhen: "Use it to read a creator's follower count; call it again later to see how the count changes.",
66
+ },
67
+ get_youtube_playlist: { useWhen: "Use it when you have a playlist id; playlist/items returns the same rows." },
68
+ get_youtube_playlist_items: { useWhen: "Use it when you have a playlist id; add include=engagement for counts and durations." },
69
+ get_prism_ai_visibility: {
70
+ title: "Measure a brand's mentions in AI answers",
71
+ summary: "Ask a set of prompts to AI engines several times and report how often each brand appears, with a ranking of the domains the answers cite.",
72
+ useWhen: "Use it to track a brand's visibility in AI answers and see which sites those answers cite.",
73
+ },
74
+ get_prism_korea_gap: {
75
+ summary: "Compare what is said about a brand or topic worldwide with what is said on Naver in Korea, both ways.",
76
+ useWhen: "Use it to see whether a brand's Korean conversation matches its global one.",
77
+ },
78
+ get_prism_audience_overlap: {
79
+ summary: "Measure how much two TikTok creators' commenter audiences overlap, with the shared-fan count and a confidence label.",
80
+ useWhen: "Use it to check for duplicate reach before booking both creators.",
81
+ },
82
+ get_prism_share_of_voice: {
83
+ summary: "Compare 2 to 5 brands by engagement-weighted share of voice, split between web and social, with an emotion breakdown.",
84
+ useWhen: "Use it to compare brands against each other in one call; brand-mentions covers a single keyword.",
85
+ },
86
+ get_prism_review_integrity: {
87
+ summary: "Check a product's or business's reviews across sources for signs of inflated or paid ratings, using fixed statistical rules.",
88
+ useWhen: "Use it when you suspect inflated or paid reviews; product-reviews tells you what buyers said.",
89
+ },
90
+ get_utility_llms: {
91
+ title: "Get an overview of the API for AI agents",
92
+ summary: "Return an overview of the SocialCrawl API for an AI agent to read.",
93
+ useWhen: "Use it when an agent should learn the API in one call.",
94
+ cost: "Costs 0 credits per call.",
95
+ },
96
+ get_youtube_profile_full: {
97
+ useWhen: "Use it when you want the channel and its recent videos together; if the videos cannot be fetched you still get the profile with those metrics empty.",
98
+ },
99
+ get_twitter_profile_full: {
100
+ useWhen: "Use it when you want the profile and recent posts together. The metrics are computed from one fetch of the account's posts, so check _warnings before reading cadence as a true rate.",
101
+ },
102
+ get_facebook_profile_full: {
103
+ useWhen: "Use it when you want the profile and recent posts together; the profile still comes back even if the posts part fails.",
104
+ },
105
+ get_search_multi: {
106
+ useWhen: "Use it to see each platform's own results for one query; for a ranked, summarised answer, use get_search_everywhere.",
107
+ },
108
+ // ── API paths with no tool behind them ──
109
+ create_prism_discover_inputs: {
110
+ useWhen: "Use it when a list of authors to keep, or of posts you hold, is too long for a URL; pass its id to get_prism_discover.",
111
+ },
112
+ run_google_business_reviews_history: {
113
+ useWhen: "Use it when a place has more reviews than the 1,000 one business reviews call returns.",
114
+ params: { depth: "How many reviews to collect, 1 to 10,000. The job's results are read page by page with offset and limit." },
115
+ },
116
+ run_trustpilot_reviews_history: {
117
+ params: { depth: "How many reviews to collect, 1 to 10,000. The job's results are read page by page with offset and limit." },
118
+ },
119
+ // ── Titles that promised every, any or everything ──
120
+ get_google_business_contributor_reviews: {
121
+ title: "Get a Google Maps reviewer's reviews",
122
+ summary: "Get the reviews one Google Maps reviewer has written, up to the limit you set.",
123
+ useWhen: "Use it when a review looks suspicious or influential and you want to see what else that reviewer has posted, or to profile a Local Guide.",
124
+ },
125
+ get_prism_comments: {
126
+ title: "Get a post's comments with replies nested",
127
+ summary: "Get a post's comments with replies nested, paging through them up to the max you set (default 1,000 top-level comments).",
128
+ useWhen: "Use it to collect a comment thread in one request, without paging the platform's own comments tool.",
129
+ },
130
+ get_prism_video_intel: {
131
+ title: "Get a video's details, stats and top comments",
132
+ summary: "Get one video's details, stats and top comments from a YouTube, TikTok, Rumble or Instagram URL, with an optional transcript and commenter sample.",
133
+ useWhen: "Use it to read one video in one call rather than separate detail, comments and transcript calls.",
134
+ },
135
+ get_prism_lookup: {
136
+ title: "Look up a post, video, product or repo URL",
137
+ summary: "Take the URL of one post, video, product or repository and return its details from the matching platform.",
138
+ useWhen: "Use it when you have such a URL and do not know which platform tool fits. Profile, channel and storefront URLs are not accepted.",
139
+ },
140
+ get_search_everywhere: {
141
+ title: "Search a topic across 18 platforms",
142
+ summary: "Search one topic across up to 18 social platforms and return ranked results.",
143
+ useWhen: "Use it when you want a topic's coverage across platforms in one call.",
144
+ cost: "Costs 20 credits per search; each keyword and each language you add is its own search.",
145
+ params: {
146
+ sort: "relevance, recent or engagement.",
147
+ max_per_platform: "1 to 100 rows per platform.",
148
+ deadline_s: "Time limit in seconds, 8 to 96.",
149
+ },
150
+ },
151
+ run_search_everywhere: {
152
+ summary: "Run a list of searches across platforms as one background run, or turn a search into a watch that repeats on a schedule and delivers only new rows.",
153
+ cost: "Costs 20 credits per search; dry_run is free.",
154
+ },
155
+ get_twitter_tweet_thread: { title: "Get an X thread in order from one of its posts" },
156
+ get_linkedin_profile_complete: { title: "LinkedIn profile with experience, education and skills" },
157
+ get_g2_categories: { title: "List G2 category URLs" },
158
+ get_walmart_offers: { title: "Get the sellers offering a Walmart product" },
159
+ get_utility_endpoints: { title: "List the available endpoints" },
160
+ get_utility_endpoint: { title: "How to use one endpoint" },
161
+ get_producthunt_leaderboard: { title: "Product Hunt leaderboard for a period" },
162
+ get_goodreads_book_editions: {
163
+ title: "List editions of a Goodreads book",
164
+ summary: "List the editions of a Goodreads book, up to the limit you set.",
165
+ },
166
+ get_github_repo_dossier: {
167
+ title: "Get a GitHub repository overview",
168
+ summary: "Get an overview of a GitHub repository in one call: its details, README, releases and issues.",
169
+ useWhen: "Use it when a single call should give you enough to summarise a project.",
170
+ },
171
+ get_github_user_profile_velocity: {
172
+ title: "Get a GitHub user's activity summary",
173
+ summary: "Get a summary of how active a GitHub developer is and where they contribute.",
174
+ },
175
+ get_us_congress_trades_ticker_trades: { useWhen: "Use it after stats/tickers to list the filings on that symbol, paged with limit and offset." },
176
+ get_us_congress_trades_stats: { title: "US Congress trades dataset summary", useWhen: "Use it first to see how many trades the dataset holds before paging through them." },
177
+ search_redfin: { useWhen: "Use it to list an area's homes for sale or recent sales; narrow the area when a search reaches its limit." },
178
+ // ── One price and one behaviour per tool ──
179
+ search_instagram_hashtag: {
180
+ title: "Get posts for an Instagram hashtag",
181
+ summary: "Get posts for one Instagram hashtag, ranked top, recent or clips, paged with a cursor.",
182
+ useWhen: "Use it when you already have the hashtag. For keyword or topic discovery, use search/reels.",
183
+ },
184
+ search_instagram_reels: {
185
+ title: "Search Instagram reels by keyword",
186
+ summary: "Search Instagram for reels about a brand, phrase or subject, with view counts.",
187
+ useWhen: "Use it for keyword and topic discovery on Instagram. For a hashtag you already have, use search/hashtag; for share counts, post/stats.",
188
+ },
189
+ get_youtube_channel_about: {
190
+ summary: "Get a YouTube channel's public contact email and country.",
191
+ useWhen: "Use it for outreach when get_youtube_channel returned no email. A first read can take up to 5 minutes.",
192
+ cost: "Costs 25 credits when an address comes back; you are charged only when an address is returned.",
193
+ },
194
+ get_yelp_business_info: {
195
+ title: "Get a Yelp business by its id",
196
+ summary: "Get one Yelp business by its Yelp id (encid).",
197
+ useWhen: "Use it when you already have the business id; to find businesses by term and location, use search_yelp.",
198
+ },
199
+ get_linkedin_profile_all: {
200
+ title: "A LinkedIn member's profile, counts and interests",
201
+ summary: "Get a LinkedIn member's profile, counts, interests and similar profiles in one call.",
202
+ useWhen: "Use it when you want those parts together rather than calling get_linkedin_profile, profile/complete, profile/stats and the interests tools one by one.",
203
+ },
204
+ // ── Text a reader could not follow ──
205
+ get_instagram_media_screen_text: {
206
+ summary: "Read the text shown in an Instagram post's images or video, such as carousel headlines or text on a reel's cover.",
207
+ useWhen: "Use it for text designed into the post itself. The caption comes from get_instagram_post and the spoken words from media/transcript. On a reel it reads the cover unless frames is all.",
208
+ },
209
+ get_tiktok_video_screen_text: {
210
+ summary: "Read the text shown on screen in a TikTok video, such as overlay captions.",
211
+ useWhen: "Use it for text designed into the video itself. The caption comes from get_tiktok_post and the spoken words from post/transcript.",
212
+ },
213
+ get_youtube_transcripts: { summary: "Get transcripts for up to 100 YouTube videos, one row per video id. Failed ids are refunded." },
214
+ get_reddit_omni_search: {
215
+ summary: "Search Reddit for one keyword and return matching threads with their subreddit and top comments.",
216
+ useWhen: "Use it to read what people say about a topic on Reddit in one call. It is slow, and some threads may be only loosely related.",
217
+ },
218
+ get_prism_answers: {
219
+ summary: "Ask one question to Perplexity, Grok and Tavily and return each answer as written, with merged citations and a table of where the answers agree.",
220
+ useWhen: "Use it when you want several AI answers to one question and the sources they cite.",
221
+ },
222
+ get_prism_post_stats: { summary: "Take up to 100 post URLs from different platforms and return each post's current engagement. Failed URLs are refunded." },
223
+ get_prism_profiles: { summary: "Take up to 50 platform and handle pairs and return one profile per row. Failed handles are refunded." },
224
+ get_prism_post_comments: {
225
+ summary: "Take up to 25 post URLs from different platforms and return each post's comments in one call, priced per page like the comment tools.",
226
+ },
227
+ get_prism_demand_signals: {
228
+ title: "Get a consumer demand index for a product",
229
+ summary: "Combine app-review velocity, web mention trend, Reddit velocity and commerce review levels into one demand index for a product.",
230
+ useWhen: "Use it to gauge whether interest in a product is rising.",
231
+ },
232
+ get_prism_crisis_radar: {
233
+ summary: "Check whether a brand's daily mention volume and negative share are unusually high against recent days, and grade the severity if so.",
234
+ useWhen: "Use it to check for a sudden spike in negative chatter; when it triggers, crisis-postmortem gives the full timeline.",
235
+ },
236
+ get_prism_devtool_pulse: {
237
+ summary: "Report on a developer tool from its GitHub repository, Hacker News reaction, Reddit posts and developer-blog mentions, in one call.",
238
+ useWhen: "Use it to judge a developer tool's momentum in one request.",
239
+ },
240
+ get_prism_earned_media: {
241
+ summary: "List news, tech-press and recent web coverage of a brand, with duplicates removed and ranked, and a count by outlet.",
242
+ useWhen: "Use it to track press coverage in one call, and add a competitor to see which outlets covered them.",
243
+ },
244
+ get_prism_truthsocial_pulse: {
245
+ summary: "Get a Truth Social account's profile, recent posts, post details and related news in one call.",
246
+ useWhen: "Use it to follow one Truth Social account in a single request; the platform has no search.",
247
+ },
248
+ get_prism_creator_card: {
249
+ summary: "Return the profiles for one handle on TikTok, Instagram, YouTube, X and more platforms.",
250
+ useWhen: "Use it to look up the same handle on several platforms at once; handle-audit adds scoring and estimates.",
251
+ },
252
+ get_prism_format_lift: {
253
+ summary: "Compare a creator's posts by the kind of opening hook, with each post's result divided by that creator's own median.",
254
+ useWhen: "Use it to see which kind of hook performs best for one creator.",
255
+ },
256
+ get_prism_earliness: {
257
+ summary: "Show when a term first appeared on each platform, and whether that came before it showed in search trends or in ads.",
258
+ useWhen: "Use it to see how early a term surfaced. A different subject that shares the words does not count as a first sighting.",
259
+ },
260
+ get_prism_handle_audit: {
261
+ summary: "Score a handle on several platforms, rank the best matches, and estimate the data volume and credit cost of collecting it.",
262
+ useWhen: "Use it to vet a creator or brand name across platforms in one call.",
263
+ },
264
+ get_prism_apps_lookup: {
265
+ summary: "Find one app on Google Play and the App Store, check that the titles match, and compare ratings and listings across both stores.",
266
+ },
267
+ get_prism_launch_echo: {
268
+ useWhen: "Use it right after a launch to gather the reaction in one call; devtool-pulse covers a tool's ongoing health.",
269
+ },
270
+ get_search_forums: {
271
+ summary: "Search Reddit, Hacker News and Naver 지식iN and 카페 in one call, with top comments included on the leading threads.",
272
+ useWhen: "Use it when you want what people are asking and answering in forums; get_search_everywhere also covers video, code and social posts.",
273
+ },
274
+ get_search_creators: {
275
+ summary: "Find creators on TikTok, Threads and Instagram for a topic, ranked by relevance, followers and verification. Add YouTube, X or Facebook with sources.",
276
+ useWhen: "Use it to find creators about a topic in one call; add country for one Latin American, Spanish or Brazilian market.",
277
+ },
278
+ get_search_news: {
279
+ title: "Search news in several countries",
280
+ summary: "Search news for one query across several countries in one call, from two news indexes, and merge the articles.",
281
+ useWhen: "Use it for news coverage across several countries at once; for one topic across social platforms, use get_search_everywhere.",
282
+ },
283
+ get_polymarket_research: {
284
+ title: "Research Polymarket markets on a topic",
285
+ summary: "Find Polymarket markets on a topic by running several searches and dropping results that are not about it.",
286
+ useWhen: "Use it to get a focused list of markets on a subject.",
287
+ },
288
+ get_pinterest_board: {
289
+ summary: "Get the pins on a Pinterest board from its URL, about 15 pins a page.",
290
+ useWhen: "Use it when you have a board URL; pass the cursor for the next page, and add include=engagement for pin dates at 1 credit a row. user/boards finds a user's boards.",
291
+ },
292
+ get_tiktok_trending: {
293
+ summary: "Get TikTok's trending feed, worldwide by default or for one country with feed=local.",
294
+ useWhen: "Use feed=local for videos mostly from one country. The default feed is largely worldwide whatever region you pass, so filter on post.ext.region.",
295
+ },
296
+ get_instagram_story_download: {
297
+ title: "Get one Instagram story's media",
298
+ summary: "Get the media of one Instagram story.",
299
+ useWhen: "Use it after get_instagram_stories: pass the author's user_id and the story_id it returned.",
300
+ },
301
+ get_finance_news: {
302
+ useWhen: "Use it to find news that may explain a price move. Pass a bare ticker such as AAPL, or quote's AAPL:NASDAQ form; the suffix is ignored. The news is delayed.",
303
+ },
304
+ run_web_sessions_by_session_id_execute: {
305
+ title: "Run code in an open web session",
306
+ summary: "Run a snippet of node, python or bash code in a web session you already opened, to click, type or read the live page.",
307
+ useWhen: "Use it to work a page step by step. With node the value comes back as the result; bash and python return what they print.",
308
+ },
309
+ };
310
+ //# sourceMappingURL=chatgpt-text.js.map
@@ -0,0 +1,13 @@
1
+ /**
2
+ * `x-client-tag` (UPGRADE-LOG API-210): an optional label stored on every
3
+ * charge a request writes, so spend can be read per tag
4
+ * (`GET /v1/credits/usage?group_by=tag`, `GET /v1/credits/transactions?tag=`).
5
+ *
6
+ * The rule is the API's own (social-api `credits/client-tag.ts`): trimmed,
7
+ * 1-64 characters of letters, digits, `.`, `_`, `:` or `-`. The API ignores a
8
+ * tag that breaks it (answering `X-Client-Tag-Ignored: invalid`); this server
9
+ * does not send one at all, so a typo in config never reaches the wire.
10
+ */
11
+ export declare const CLIENT_TAG_RE: RegExp;
12
+ /** The tag to send, or undefined for a blank or invalid one. */
13
+ export declare function clientTagOf(raw: string | undefined | null): string | undefined;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * `x-client-tag` (UPGRADE-LOG API-210): an optional label stored on every
3
+ * charge a request writes, so spend can be read per tag
4
+ * (`GET /v1/credits/usage?group_by=tag`, `GET /v1/credits/transactions?tag=`).
5
+ *
6
+ * The rule is the API's own (social-api `credits/client-tag.ts`): trimmed,
7
+ * 1-64 characters of letters, digits, `.`, `_`, `:` or `-`. The API ignores a
8
+ * tag that breaks it (answering `X-Client-Tag-Ignored: invalid`); this server
9
+ * does not send one at all, so a typo in config never reaches the wire.
10
+ */
11
+ export const CLIENT_TAG_RE = /^[A-Za-z0-9._:-]{1,64}$/;
12
+ /** The tag to send, or undefined for a blank or invalid one. */
13
+ export function clientTagOf(raw) {
14
+ const tag = raw?.trim();
15
+ return tag && CLIENT_TAG_RE.test(tag) ? tag : undefined;
16
+ }
17
+ //# sourceMappingURL=client-tag.js.map
package/dist/client.d.ts CHANGED
@@ -15,6 +15,11 @@ interface LongCallOptions {
15
15
  timeoutMs?: number;
16
16
  /** Send `Accept: text/event-stream`. A stream is assembled whether or not this is set. */
17
17
  stream?: boolean;
18
+ /**
19
+ * Send `Accept: application/json`: an `sse-default` endpoint streams unless
20
+ * the request asks for one JSON envelope. Ignored when `stream` is set.
21
+ */
22
+ json?: boolean;
18
23
  /** Called once per streamed chunk. */
19
24
  onProgress?: (tick: ProgressTick) => void;
20
25
  /** Filled in with response facts (Retry-After). */
package/dist/client.js CHANGED
@@ -1,11 +1,17 @@
1
1
  import { TIMEOUT_MS, CHARACTER_LIMIT, SERVER_NAME, SERVER_VERSION } from "./constants.js";
2
+ import { clientTagOf } from "./client-tag.js";
2
3
  import { assembleSse, describeChunk, readSse } from "./sse.js";
3
4
  /**
4
5
  * Sent on every call so the API can tell MCP traffic from other clients in its
5
6
  * usage analytics (it is otherwise counted as plain `node`).
6
7
  */
7
- function clientHeaders() {
8
- return { "User-Agent": `${SERVER_NAME}/${SERVER_VERSION}` };
8
+ function clientHeaders(ctx) {
9
+ const tag = clientTagOf(ctx.clientTag);
10
+ return {
11
+ "User-Agent": `${SERVER_NAME}/${SERVER_VERSION}`,
12
+ ...(tag ? { "x-client-tag": tag } : {}),
13
+ ...(ctx.clientSurface ? { "X-SocialCrawl-Client": ctx.clientSurface } : {}),
14
+ };
9
15
  }
10
16
  /** `Retry-After` as whole seconds (delta-seconds or an HTTP date), capped at an hour. */
11
17
  export function parseRetryAfter(value, now = Date.now()) {
@@ -76,9 +82,11 @@ export async function makeRequest(ctx, options) {
76
82
  const controller = new AbortController();
77
83
  const timeoutId = setTimeout(() => controller.abort(), options.timeoutMs ?? TIMEOUT_MS);
78
84
  const state = { events: [] };
79
- const headers = { ...clientHeaders(), "x-api-key": ctx.apiKey };
85
+ const headers = { ...clientHeaders(ctx), "x-api-key": ctx.apiKey };
80
86
  if (options.stream)
81
87
  headers.Accept = "text/event-stream";
88
+ else if (options.json)
89
+ headers.Accept = "application/json";
82
90
  if (options.idempotencyKey) {
83
91
  headers["Idempotency-Key"] = options.idempotencyKey;
84
92
  }
@@ -136,11 +144,13 @@ export async function apiRequest(ctx, options) {
136
144
  const controller = new AbortController();
137
145
  const timeoutId = setTimeout(() => controller.abort(), options.timeoutMs ?? TIMEOUT_MS);
138
146
  const state = { events: [] };
139
- const headers = clientHeaders();
147
+ const headers = clientHeaders(ctx);
140
148
  if (ctx.apiKey)
141
149
  headers["x-api-key"] = ctx.apiKey;
142
150
  if (options.stream)
143
151
  headers.Accept = "text/event-stream";
152
+ else if (options.json)
153
+ headers.Accept = "application/json";
144
154
  if (options.idempotencyKey) {
145
155
  headers["Idempotency-Key"] = options.idempotencyKey;
146
156
  }
@@ -9,7 +9,7 @@ export declare const TIMEOUT_MS = 60000;
9
9
  export declare const INLINE_MAX_ROWS = 200;
10
10
  export declare const INLINE_MAX_BYTES = 60000;
11
11
  export declare const SERVER_NAME = "socialcrawl-mcp";
12
- export declare const SERVER_VERSION = "2.2.0";
12
+ export declare const SERVER_VERSION = "2.5.0";
13
13
  /**
14
14
  * Inside a normalised `socialcrawl_request` params object: the names of the
15
15
  * endpoint params that arrived as top-level arguments and were moved into
package/dist/constants.js CHANGED
@@ -13,7 +13,7 @@ export const INLINE_MAX_BYTES = 60_000;
13
13
  // (CREDIT_LADDER) alongside the cache TTLs, so a ladder change cannot leave a
14
14
  // stale copy behind. Import it from there.
15
15
  export const SERVER_NAME = "socialcrawl-mcp";
16
- export const SERVER_VERSION = "2.2.0";
16
+ export const SERVER_VERSION = "2.5.0";
17
17
  /**
18
18
  * Inside a normalised `socialcrawl_request` params object: the names of the
19
19
  * endpoint params that arrived as top-level arguments and were moved into
package/dist/context.d.ts CHANGED
@@ -10,6 +10,19 @@ export interface ApiContext {
10
10
  * the `confirm: true` round trip.
11
11
  */
12
12
  confirm?: (message: string) => Promise<"accepted" | "declined" | "unsupported">;
13
+ /**
14
+ * Sent as `x-client-tag` on every API call, so this server's charges can be
15
+ * read per tag. stdio: `SOCIALCRAWL_CLIENT_TAG`; HTTP: the caller's own
16
+ * `x-client-tag` header. Invalid values are never sent (client-tag.ts).
17
+ */
18
+ clientTag?: string;
19
+ /**
20
+ * Sent as `X-SocialCrawl-Client` on every API call: the surface this
21
+ * request came through (`mcp:<listing>` for a store listing address,
22
+ * `mcp:chatgpt` for /chatgpt). Set by the HTTP app only, from its own route,
23
+ * never from a caller's header.
24
+ */
25
+ clientSurface?: string;
13
26
  }
14
27
  /**
15
28
  * Build the context for the stdio entrypoint from process env.
package/dist/context.js CHANGED
@@ -10,6 +10,7 @@ export function contextFromEnv() {
10
10
  apiKey: process.env.SOCIALCRAWL_API_KEY ?? "",
11
11
  // Normalize away trailing slashes so URL building never yields `//v1/...`.
12
12
  baseUrl: (process.env.SOCIALCRAWL_BASE_URL ?? DEFAULT_BASE_URL).replace(/\/+$/, ""),
13
+ ...(process.env.SOCIALCRAWL_CLIENT_TAG ? { clientTag: process.env.SOCIALCRAWL_CLIENT_TAG } : {}),
13
14
  };
14
15
  }
15
16
  //# sourceMappingURL=context.js.map
@@ -35,9 +35,21 @@ export interface GuardStop {
35
35
  structured: Record<string, unknown>;
36
36
  }
37
37
  /**
38
- * Whether a metered band is fully explained by the page, its `include=` joins
39
- * and its metered judgments — then local arithmetic is exact. Any other meter
40
- * (per-row `limit`, page walks the rule describes) is not.
38
+ * The `pages` lever (API-280, API-281): `{platform}/profile/full` and
39
+ * `prism/format-lift` read up to `max` pages in one call, the first at the flat
40
+ * price and each further page at `step` credits (the posts endpoint's own page
41
+ * price), refunding pages not read. The step is the band's spread over the
42
+ * further pages; undefined when the band does not split into whole credits.
43
+ */
44
+ export declare function pagesLever(e: Endpoint): {
45
+ max: number;
46
+ step: number;
47
+ } | undefined;
48
+ /**
49
+ * Whether a metered band is fully explained by the page, its `include=` joins,
50
+ * its metered judgments, its `pages` lever, and the value prices and include
51
+ * add-ons its text states (`value-prices.ts`) — then local arithmetic is exact.
52
+ * Any other meter (per-row `limit`, page walks the rule describes) is not.
41
53
  */
42
54
  export declare function bandExplained(e: Endpoint): boolean;
43
55
  /** Credits of the band's ceiling that belong to joins this call does not send. */
@@ -4,18 +4,50 @@ import { priceDrivingParams } from "./pricing.js";
4
4
  import { joinsCeiling, laneMaxCredits, quoteHydration } from "./hydration.js";
5
5
  import { judgmentHoldMax, quoteJudgments } from "./judgments.js";
6
6
  import { confirmThreshold } from "./session-spend.js";
7
+ import { valueAndAddOnCeiling, valueAndAddOnCredits } from "./value-prices.js";
7
8
  const present = (v) => v !== undefined && v !== null && v !== "";
8
9
  /**
9
- * Whether a metered band is fully explained by the page, its `include=` joins
10
- * and its metered judgments — then local arithmetic is exact. Any other meter
11
- * (per-row `limit`, page walks the rule describes) is not.
10
+ * The `pages` lever (API-280, API-281): `{platform}/profile/full` and
11
+ * `prism/format-lift` read up to `max` pages in one call, the first at the flat
12
+ * price and each further page at `step` credits (the posts endpoint's own page
13
+ * price), refunding pages not read. The step is the band's spread over the
14
+ * further pages; undefined when the band does not split into whole credits.
15
+ */
16
+ export function pagesLever(e) {
17
+ const param = e.optionalParams.find((o) => o.name === "pages");
18
+ if (!param || e.pricing.model !== "metered" || e.pricing.maxCost === undefined)
19
+ return undefined;
20
+ const fromText = /\b1-(\d+)\b/.exec(param.description ?? "");
21
+ const max = param.maximum ?? (fromText ? Number(fromText[1]) : undefined);
22
+ if (!max || max < 2)
23
+ return undefined;
24
+ const spread = e.pricing.maxCost - e.pricing.cost - joinsCeiling(e);
25
+ const step = spread / (max - 1);
26
+ return Number.isInteger(step) && step > 0 ? { max, step } : undefined;
27
+ }
28
+ /** Credits the further pages asked with `pages` add to the first page's price. */
29
+ function pagesCredits(e, params) {
30
+ const lever = pagesLever(e);
31
+ const pages = Number(params.pages);
32
+ if (!lever || !Number.isFinite(pages) || pages <= 1)
33
+ return 0;
34
+ return (Math.min(Math.floor(pages), lever.max) - 1) * lever.step;
35
+ }
36
+ /**
37
+ * Whether a metered band is fully explained by the page, its `include=` joins,
38
+ * its metered judgments, its `pages` lever, and the value prices and include
39
+ * add-ons its text states (`value-prices.ts`) — then local arithmetic is exact.
40
+ * Any other meter (per-row `limit`, page walks the rule describes) is not.
12
41
  */
13
42
  export function bandExplained(e) {
14
43
  if (e.pricing.model !== "metered" || e.pricing.maxCost === undefined)
15
44
  return true;
16
45
  const labels = e.judgments?.labels;
46
+ const lever = pagesLever(e);
17
47
  const explained = e.pricing.cost +
48
+ (lever ? (lever.max - 1) * lever.step : 0) +
18
49
  joinsCeiling(e) +
50
+ valueAndAddOnCeiling(e) +
19
51
  (labels && (labels.metered.length > 0 || labels.free.includes("intent")) ? judgmentHoldMax(e) : 0) +
20
52
  (e.judgments?.relevance ? judgmentHoldMax(e) : 0);
21
53
  return e.pricing.maxCost <= explained;
@@ -41,6 +73,10 @@ export function localQuote(endpoint, params) {
41
73
  }
42
74
  if (endpoint.judgments)
43
75
  hold += quoteJudgments(endpoint, params).held;
76
+ hold += pagesCredits(endpoint, params);
77
+ // A value that sets the page price (sort=likes) and a fixed include add-on
78
+ // (include=segments, description, stats), as the rule states them.
79
+ hold += valueAndAddOnCredits(endpoint, params);
44
80
  // A band that is nothing but the page, its joins and its judgments is
45
81
  // quoted exactly above; only a band that meters on something else is
46
82
  // budgeted at its ceiling — less the joins this call does not turn on.
@@ -6,7 +6,7 @@
6
6
  * {routes,resume,more,schedule-routes}.ts, platforms/review-history/
7
7
  * {http,engine}.ts, events/{feed,routes}.ts, webhooks/{http,limits}.ts.
8
8
  */
9
- export declare const DISCOVER_RUNS_DOC = "# SocialCrawl API \u2014 Discover runs, schedules and review history\n\nWork that keeps running after the call that started it. Start it with `socialcrawl_request`; read, export, steer and stop it with `socialcrawl_manage` (areas `discover` and `review_history`). Every read here is free; only the searches a run goes on to make are billed.\n\n## Discover runs (`/v1/prism/discover/runs`)\n\nStart a run with `socialcrawl_request` on `prism/discover` (`max_credits` is required; `async` runs it in the background). Manage it with `socialcrawl_manage` `area: \"discover\"`; `id` is the run id (`run_\u2026`, `data.run.run_id`).\n\n| Action | Route | Cost |\n|--------|-------|------|\n| `run_list` | `GET /runs` (status, kind, created_after, cursor, page_size \u2264100; `id` = a schedule id lists that schedule's runs) | 0 |\n| `run_get` | `GET /runs/{run_id}` | 0 |\n| `run_export` | `GET /runs/{run_id}/results.jsonl` | 0 |\n| `run_legs` | `GET /runs/{run_id}/legs` (page_size \u2264500) | 0 |\n| `run_cancel` | `DELETE /runs/{run_id}` | 0 \u2014 rows kept, resume continues |\n| `run_resume` | `POST /runs/{run_id}/resume` `{ max_credits?, retry_failed? }` | 0 itself; continued searches bill as they run |\n| `run_more` | `POST /runs/{run_id}/more` `{ new_searches?, feedback?, max_credits?, pages? }` | each new search bills at its lane price |\n\n- **Long-poll:** `run_get` with `wait_s` (0-25) answers early on a status change, a finished stage or 10% more rows. At most 5 long-polls per key; a sixth answers at once.\n- **Filters** (run_get and run_export): view, order (arrival | rank; rank on a running run is a free 400), include_pending, changes_since, group, platform, keyword, sort, state (kept | dropped | all), include=dropped, and `tags` sent as `tag.<key>=<value>`. Any parameter the route does not take is a free 400. A cursor is signed with the filters it was issued for: send the SAME filters with it.\n- **run_export** streams every matching row; the last line is `{\"complete\":true}` or `{\"next_cursor\":\"\u2026\"}` (stopped after about 45 s; send it back with the same filters).\n- **run_resume** works on paused, partial, failed or cancelled runs. A run paused at its cap needs a HIGHER `max_credits`. Searches already paid for are never paid twice.\n- **run_more** works on completed runs only: `pages` 1-10, `feedback.accept`/`feedback.reject` up to 100 ids each (`accept` needs `new_searches: true`). Read only the new rows with `changes_since` = `data.more.since_version`. `data.more.nothing_more` (200) charged nothing. The route takes no Idempotency-Key, so check the run before repeating a more.\n- **No dry_run** on any run or schedule route (resume and more refuse any query parameter).\n- **Errors:** 404 RUN_NOT_FOUND (not your run), 409 RUN_STATE_CONFLICT, 410 RUN_EXPIRED (retention passed), 503 store_unavailable (retryable, nothing charged).\n\n## Discover schedules (`/v1/prism/discover/schedules`)\n\nCreated by `prism/discover` with a `schedule` field. All free; each scheduled run bills like a run within `max_credits_per_run` and `max_credits_per_month`. `id` is the schedule id (`dsch_\u2026`).\n\n`schedule_list` (status active | paused | stopped, cursor, page_size \u2264100), `schedule_get` (its recent runs, this month's spend, next fire), `schedule_pause`, `schedule_resume` (`{ max_credits_per_run?, max_credits_per_month? }`, null clears the month cap), `schedule_delete` (runs keep their rows). `run_list` with the schedule id lists one schedule's runs.\n\n## Review history (`/v1/{platform}/reviews/history/{job_id}`)\n\nStart with `socialcrawl_request` on `POST trustpilot/reviews/history` (it holds the price and answers 202 with `job_id`). Poll with `socialcrawl_manage` `area: \"review_history\"`, `action: \"get\"`, `id` = the job id (`job_\u2026`), free: status queued \u2192 running \u2192 polling \u2192 succeeded | failed, `credits_hold` and the settled `credits_charged`. Once succeeded, page the reviews with `offset` and `limit` (1-100). `platform` is `trustpilot` (default) or `tripadvisor`.\n\n## follow\n\nAnswers carry ready next-step URLs in `data.next.*`. `socialcrawl_manage` `area: \"discover\"`, `action: \"follow\"`, `input: { url }` GETs one only when it is on the configured SocialCrawl API AND one of the free read routes above (batch jobs, discover runs and schedules, review history, the events feed, webhook endpoints). `status_url`, `results_url`, `changes_url` and `poll_url` are free reads. `continue_url` STARTS a billable continuation and is never followed (call `socialcrawl_request` after checking `continue_estimate`); `resume_url`/`more_url` are POSTs: use `run_resume`/`run_more`.\n";
9
+ export declare const DISCOVER_RUNS_DOC = "# SocialCrawl API \u2014 Discover runs, schedules and review history\n\nWork that keeps running after the call that started it. Start it with `socialcrawl_request`; read, export, steer and stop it with `socialcrawl_manage` (areas `discover` and `review_history`). Every read here is free; only the searches a run goes on to make are billed.\n\n## Discover runs (`/v1/prism/discover/runs`)\n\nStart a run with `socialcrawl_request` on `prism/discover` (`max_credits` is required; `async` runs it in the background). Manage it with `socialcrawl_manage` `area: \"discover\"`; `id` is the run id (`run_\u2026`, `data.run.run_id`). Runs created since 14/11/2026 are kept 30 days by default (was 7); `retention_days` is 1 to 30.\n\n| Action | Route | Cost |\n|--------|-------|------|\n| `run_list` | `GET /runs` (status, kind, created_after, cursor, page_size \u2264100; `id` = a schedule id lists that schedule's runs) | 0 |\n| `run_get` | `GET /runs/{run_id}` | 0 |\n| `run_export` | `GET /runs/{run_id}/results.jsonl` | 0 |\n| `run_legs` | `GET /runs/{run_id}/legs` (page_size \u2264500) | 0 |\n| `run_cancel` | `DELETE /runs/{run_id}` | 0 \u2014 rows kept, resume continues |\n| `run_resume` | `POST /runs/{run_id}/resume` `{ max_credits?, retry_failed? }` | 0 itself; continued searches bill as they run |\n| `run_more` | `POST /runs/{run_id}/more` `{ new_searches?, feedback?, max_credits?, pages? }` | each new search bills at its lane price |\n\n- **Long-poll:** `run_get` with `wait_s` (0-25) answers early on a status change, a finished stage or 10% more rows. At most 5 long-polls per key; a sixth answers at once.\n- **Filters** (run_get and run_export): view, order (arrival | rank; rank on a running run is a free 400), include_pending, changes_since, group, platform, keyword, sort, state (kept | dropped | all), include=dropped, and `tags` sent as `tag.<key>=<value>`. Any parameter the route does not take is a free 400. A cursor is signed with the filters it was issued for: send the SAME filters with it.\n- **run_export** streams every matching row; the last line is `{\"complete\":true}` or `{\"next_cursor\":\"\u2026\"}` (stopped after about 45 s; send it back with the same filters).\n- **run_resume** works on paused, partial, failed or cancelled runs. A run paused at its cap needs a HIGHER `max_credits`. Searches already paid for are never paid twice.\n- **run_more** works on completed runs only: `pages` 1-10, `feedback.accept`/`feedback.reject` up to 100 ids each (`accept` needs `new_searches: true`). Read only the new rows with `changes_since` = `data.more.since_version`. `data.more.nothing_more` (200) charged nothing. The route takes no Idempotency-Key, so check the run before repeating a more.\n- **No dry_run** on any run or schedule route (resume and more refuse any query parameter).\n- **Errors:** 404 RUN_NOT_FOUND (not your run), 409 RUN_STATE_CONFLICT, 410 RUN_EXPIRED (retention passed), 503 store_unavailable (retryable, nothing charged).\n\n## Discover schedules (`/v1/prism/discover/schedules`)\n\nCreated by `prism/discover` with a `schedule` field. All free; each scheduled run bills like a run within `max_credits_per_run` and `max_credits_per_month`. `id` is the schedule id (`dsch_\u2026`).\n\n`schedule_list` (status active | paused | stopped, cursor, page_size \u2264100), `schedule_get` (its recent runs, this month's spend, next fire), `schedule_pause`, `schedule_resume` (`{ max_credits_per_run?, max_credits_per_month? }`, null clears the month cap), `schedule_delete` (runs keep their rows). `run_list` with the schedule id lists one schedule's runs.\n\n## Stored lists (`/v1/prism/discover/inputs`)\n\nMake one with `socialcrawl_request` on `POST prism/discover/inputs` (`{ kind: \"authors\", authors: [...] }` up to 10,000 handles, or `{ kind: \"exclude\", exclude: [...] }` up to 50,000 entries); the answer's `author_list_id` / `exclude_list_id` (`din_\u2026`) goes into a discover call. Then, free: `input_list` (every live list with `item_count` and `expires_at`, plus `live` of `limit` 500 per account), `input_append` (`id` + `{ exclude: [...] }`, 1 to 50,000 entries; duplicates skipped, the expiry moves to 31 days; past 50,000 in all it is a free 400 `exclude_list_full`), `input_delete`. An unknown, expired or foreign id, or an author list sent to append, is a 404 `input_not_found`. Lists live 30 days.\n\n## Review history (`/v1/{platform}/reviews/history/{job_id}`)\n\nStart a job with `socialcrawl_request` on the POST for the platform \u2014 it holds the price and answers 202 with `job_id` (`job_\u2026`):\n\n| Start (POST) | Poll with `platform` | Price |\n|---|---|---|\n| `trustpilot/reviews/history` | `trustpilot` (default) | holds `depth` + 5 |\n| `tripadvisor/reviews/history` | `tripadvisor` | holds `depth` |\n| `google/business/reviews/history` (exactly one of `place_id` or `cid`, `depth` 1-10,000) | `google` | 5 per started 100 reviews collected; none collected is refunded in full |\n| `yelp/business/reviews/history` | `yelp` | 1 per started 4 pages (held at 52 a language; `languages=all` holds 154); honours `Idempotency-Key` |\n\nPoll with `socialcrawl_manage` `area: \"review_history\"`, `action: \"get\"`, `id` = the job id, free. Trustpilot, Tripadvisor and Google: status queued \u2192 running \u2192 polling \u2192 succeeded | failed; once settled each page carries `data.items` and `data.job` (`credits_hold`, the settled `credits_charged`, `expires_at`); page with `offset` and `limit` (1-100) until a page is shorter than `limit`. Yelp: rows are readable while the job runs, each page carries `data.job` (`pages_read`, `reviews_collected`, per-language progress), `total` and `next_offset` (null on the last page). Jobs live 7 days.\n\n## Bulk review history (`POST /v1/prism/reviews/bulk`)\n\nOne background job over up to 20,000 businesses or apps: `platform` (`yelp`, `tripadvisor`, `app_store`, `google_play`), `items`, optional `since` / `until`, `languages` (not Tripadvisor or App Store), `max_reviews_per_item`, `format` (`jsonl` | `csv`), `include` (`business`, `business_full` on Yelp, `none`), `country` (App Store, Google Play), `webhook_url` (https; the 202 shows its `webhook_secret` once) and `refresh_of` (an earlier job of this key: reuses its items and starts from the day it settled). Start it with `socialcrawl_request`. It bills 1 credit per started 4 pages over the whole job, reserved 25 credits at a time; a business that cannot be read costs nothing. When the next block cannot be held the job pauses as `paused_insufficient_credits` and resumes after a top-up (webhook events `reviews_bulk.paused`, `resumed`, `completed`, signed `x-socialcrawl-signature`). `Idempotency-Key` replays the job at 0 credits.\n\nThen, free: `action: \"bulk_get\"` (progress, each item's `status` pending | walking | waiting | done | unavailable, and signed links to the combined file, the manifest and each item's file, valid 1 hour; page items with `offset`/`limit`) and `action: \"bulk_cancel\"` (keeps and bills what was read; the job can still read `running` until it settles as `cancelled`). There is no list route: keep the job id.\n\n## follow\n\nAnswers carry ready next-step URLs in `data.next.*`. `socialcrawl_manage` `area: \"discover\"`, `action: \"follow\"`, `input: { url }` GETs one only when it is on the configured SocialCrawl API AND one of the free read routes above (batch jobs, discover runs and schedules, review history, the events feed, webhook endpoints). `status_url`, `results_url`, `changes_url` and `poll_url` are free reads. `continue_url` STARTS a billable continuation and is never followed (call `socialcrawl_request` after checking `continue_estimate`); `resume_url`/`more_url` are POSTs: use `run_resume`/`run_more`.\n";
10
10
  export declare const EVENTS_DOC = "# SocialCrawl API \u2014 Account events feed and webhook endpoints\n\nThe account event log records what happens to this key's background work: discover runs (`discover.completed`, `discover.partial`, `discover.paused`, `discover.failed`, `discover.progress`, `discover.accounts_ready`, `discover.new_rows`, `discover.new_accounts`, `discover.new_items`), schedules (`discover.run_skipped`, `discover.run_failed`) and webhook endpoint health (`endpoint.disabled`). Pull it with the feed or have it pushed to a webhook endpoint. Use `socialcrawl_manage` `area: \"events\"`. Everything here costs **0 credits**, and no route here takes `dry_run`.\n\n## Feed (`GET /v1/events`)\n\n- **Your own cursor:** `cursor` = `oldest` (start of the 30-day retention), `now` (only new events), an event id (`evt_\u2026`) or `pagination.next_cursor` exactly as returned. Save `next_cursor` after each page.\n- **Named consumer:** `id` = a consumer name (a-z, 0-9, _ and -, up to 64). The server keeps its position; `start` (now | oldest) sets where a new consumer begins; its `types`/`subject_ids` filters bind at first use. A read commits nothing: process the page, then `ack` its `pagination.next_cursor` (`POST /v1/events/consumers/{name}/ack`, same `id`, `input: { cursor }`). Until you ack, the read returns the same page.\n- Not both `cursor` and a consumer (a free 400).\n- **Filters:** `types` (up to 50 types or patterns: `discover.completed`, `discover.*`, `*`) and `subject_ids` (up to 100 run_\u2026 or dsch_\u2026 ids). `limit` 1-500 (default 100).\n- **Long-poll:** `wait_s` (0-25) holds an empty read until an event arrives. At most 5 long-polls per key; a sixth answers at once.\n- **410 CURSOR_EXPIRED:** the position is older than the 30-day retention, so events were missed. Restart from `oldest` (a consumer restarts there on its next read and says `restarted_from` once) and tell the user which window was missed.\n- `data.next.poll_url` is a free read: `area: \"discover\"` action `follow` can GET it.\n\n## Webhook endpoints (`/v1/webhook-endpoints`)\n\nAt most **20 per API key**; an endpoint answers only to the key that created it. `id` is the endpoint id (`we_\u2026`, `data.endpoint.id`).\n\n| Action | Route |\n|--------|-------|\n| `endpoint_create` | `POST /` `{ url, types?, description?, subject_ids? }` (201) |\n| `endpoint_list` | `GET /` (limit \u2264100, cursor, status) |\n| `endpoint_get` | `GET /{id}` |\n| `endpoint_update` | `PATCH /{id}` (url, types, description, subject_ids, status enabled/disabled) |\n| `endpoint_delete` | `DELETE /{id}` |\n| `endpoint_rotate_secret` | `POST /{id}/rotate-secret` |\n| `endpoint_test` | `POST /{id}/test` `{ type? }` |\n| `endpoint_attempts` | `GET /{id}/attempts` (limit \u2264100, cursor) |\n\n- **The secret is shown ONCE.** `endpoint_create` and `endpoint_rotate_secret` return a `whsec_` secret in `data.secret`; store it immediately. Both send an Idempotency-Key (generated when you omit it, and echoed): a replay never creates a second endpoint and never shows the secret again. If it is lost, rotate with a NEW key.\n- **Rotation:** for 24 hours every delivery is signed with both the old and the new secret, so deploy the new one before then.\n- **URL rules:** a public HTTPS receiver. Private hosts and chat-app incoming webhooks are refused (400 invalid_webhook_url).\n- **Types** default to `[\"*\"]`. `endpoint_test` sends one signed sample of a subscribed type; the receiver has 15 s to answer 2xx. Answering 410 to a real delivery disables the endpoint.\n- **Retries:** a failing delivery gets 8 attempts in all, backing off over roughly 41 hours; `endpoint_attempts` shows the log. Setting `status: \"enabled\"` on a disabled endpoint resumes its parked deliveries at once.\n- **Links are full URLs.** An event's `links` (`run`, `results`, `changes`) start with the API's https origin; pass any of them to action `follow` (areas `discover`, `search_runs`, `creator_runs`).\n";
11
11
  /**
12
12
  * Universal search runs, lists and watches (UPGRADE-LOG API-073, API-077,
@@ -15,4 +15,4 @@ export declare const EVENTS_DOC = "# SocialCrawl API \u2014 Account events feed
15
15
  * meta-search/{list-http,list-start,list-actions,list-more,list-followups,
16
16
  * list-watch,list-watch-routes,stored-runs}.ts and prism/creators/follow.ts.
17
17
  */
18
- export declare const SEARCH_RUNS_DOC = "# SocialCrawl API \u2014 Universal search runs, lists, watches and creator runs\n\n`GET /v1/search/everywhere` answers one search in the call (20 credits, flat). Everything that keeps working after the call \u2014 a list of searches, a scheduled watch, the next page, follow-up reads \u2014 is a **run**, read and steered with `socialcrawl_manage` area `search_runs`. Every read is free.\n\n## Start one (socialcrawl_request, `POST /v1/search/everywhere`)\n\nThe JSON body takes every search field of the GET (`query` or `keywords`, `context`, `platforms`, `exclude_platforms`, `period`/`since`/`until`, `languages`, `country`, `depth`, `label`, \u2026) plus exactly one of:\n\n- **`queries`** \u2014 up to 100 search strings (\u2264512 chars each). One background run; each search is a job that reserves its own **20 credits**.\n- **`groups`** \u2014 1-100 `{id, query | keywords, context?, platforms?, exclude_platforms?, period?, since?, until?, tags?}`. A group's rows keep their own order; one de-duplication runs across the list, and a row several groups found lists them in `also_in_groups`.\n- **`schedule`** \u2014 `{every: 1h|6h|12h|1d|7d|30d, max_credits_per_run, max_credits_per_month?, name, start_at?}` turns the search (or list) into a **watch**: each fire returns only rows that watch never delivered (the first fire marks its rows `baseline: true`).\n\n**Price:** 20 credits per search plus any extras' ceilings (`comments.*`, `authors.*`). A list needs `max_credits` at or above that estimate; nothing is held at submit, each search charges as it runs, and the run **pauses** at `max_credits`, the key budget or the balance with `data.next.resume_url` \u2014 nothing is paid twice. A watch needs `max_credits_per_run` at least one fire's estimate; each fire bills like the list (no surcharge, no refund when nothing is new). `dry_run: true` answers the plan and estimate for free \u2014 on a watch, the price of a fire (`credits_per_fire`) and of 30 days (`credits_per_30_days`). The answer is **202** with `data.run` and `data.next.status_url` (a watch adds `data.watch`). `Idempotency-Key` replays the first answer; the same request sent again while its run is live returns that run (`run.deduplicated`).\n\n## Runs (area `search_runs`)\n\n| Action | Route | Cost |\n|---|---|---|\n| `run_list` | `GET /v1/search/everywhere/runs` \u2014 status, created_after, cursor, page_size 1-100; a watch id as `id` lists its fires | 0 |\n| `run_get` | `GET \u2026/runs/{run_id}` \u2014 `wait_s` 0-25 long-polls; format evidence\\|compact\\|text, fields, sort relevance\\|recent\\|engagement, max_per_platform, platform, group, state kept\\|dropped\\|all, changes_since, cursor, page_size | 0 |\n| `run_export` | `GET \u2026/runs/{run_id}/results.jsonl` \u2014 the same filters, no paging; ends with `{\"complete\":true,\"changes_url\":\u2026}` | 0 |\n| `run_legs` | `GET \u2026/runs/{run_id}/legs` \u2014 every search with its outcome and credits | 0 |\n| `run_cancel` | `DELETE \u2026/runs/{run_id}` \u2014 a list only (409 `run_not_a_list` on a one-off) | 0 |\n| `run_resume` | `POST \u2026/runs/{run_id}/resume` \u2014 `max_credits` (higher, if it paused at its cap), `retry_failed` | 0 + the searches it runs |\n| `run_more` | `POST \u2026/runs/{run_id}/more` \u2014 the next page of every search that has one; `max_credits` is the run's new total cap | **20 credits per search** with another page; `nothing_more` is free; dry_run quotes it |\n| `run_include` | `POST \u2026/runs/{run_id}/include` \u2014 `include` comments\\|authors\\|body, `ids` (1-200 rows), `comments.per_post` 5-50, `comments.replies`, `authors.top` 1-100, `max_credits` | metered per read, capped by max_credits (default: the quote); dry_run answers `estimate.credits {min, expected, max}` |\n\n`run_more` and `run_include` take `Idempotency-Key` and `dry_run`. Read only what a step added with `run_get` + `changes_since`, or follow `data.next.changes_url` \u2014 the page that serves a run's last row names it.\n\n## Watches (area `search_runs`)\n\n`watch_list` (status active\\|paused\\|stopped), `watch_get` (with its 10 latest fires), `watch_delete` \u2014 all free on `/v1/search/everywhere/watches`. `watch_pause` / `watch_resume` (new `max_credits_per_run` / `max_credits_per_month`) use the discover schedule routes a watch is built on. A watch view carries `caps`, `spend.month`, `next_fire_at`, `last_fire {run_id, new_rows, results_url}`.\n\n## Creator runs (area `creator_runs`)\n\n`prism/creators` (GET or POST, socialcrawl_request) works toward `limit` until it has the creators, runs dry or reaches `max_credits`, and says which (`stopped_because`, `short_reason`). Its run is read like a search run on `/v1/prism/creators/runs` (`run_list`, `run_get` with country / account_kind / platform / sort / order filters, `run_export`, `run_legs`, `run_cancel`, `run_resume`, `run_more`) \u2014 reads free.\n\n`run_save` (`POST \u2026/runs/{run_id}/save`, `keys` optional, Idempotency-Key) stores the creators as author lists \u2014 **free**, kept 30 days, at most 20 lists per account and 10,000 handles each \u2014 and answers `data.next.follow`: a ready `POST prism/discover` schedule body (daily, event `discover.new_rows`) that watches those creators for new posts. It costs what its runs cost, with no premium.\n\n## follow\n\nAny `data.next.*` read URL (status_url, results_url, legs_url, changes_url, a watch's links) goes to action `follow` \u2014 absolute or relative, on the configured API only. POST links are refused with the action to use: more_url \u2192 `run_more`, include_url \u2192 `run_include`, resume_url \u2192 `run_resume`, a creator save \u2192 `run_save`.\n";
18
+ export declare const SEARCH_RUNS_DOC = "# SocialCrawl API \u2014 Universal search runs, lists, watches and creator runs\n\n`GET /v1/search/everywhere` answers one search in the call (20 credits, flat). Everything that keeps working after the call \u2014 a list of searches, a scheduled watch, the next page, follow-up reads \u2014 is a **run**, read and steered with `socialcrawl_manage` area `search_runs`. Every read is free.\n\n## Start one (socialcrawl_request, `POST /v1/search/everywhere`)\n\nThe JSON body takes every search field of the GET (`query` or `keywords`, `context`, `platforms`, `exclude_platforms`, `period`/`since`/`until`, `languages`, `country`, `depth`, `label`, \u2026) plus exactly one of:\n\n- **`queries`** \u2014 up to 100 search strings (\u2264512 chars each). One background run; each search is a job that reserves its own **20 credits**.\n- **`groups`** \u2014 1-100 `{id, query | keywords, context?, platforms?, exclude_platforms?, period?, since?, until?, tags?}`. A group's rows keep their own order; one de-duplication runs across the list, and a row several groups found lists them in `also_in_groups`.\n- **`schedule`** \u2014 `{every: 1h|6h|12h|1d|7d|30d, max_credits_per_run, max_credits_per_month?, name, start_at?}` turns the search (or list) into a **watch**: each fire returns only rows that watch never delivered (the first fire marks its rows `baseline: true`).\n\n**Price:** 20 credits per search plus any extras' ceilings (`comments.*`, `authors.*`). A list needs `max_credits` at or above that estimate; nothing is held at submit, each search charges as it runs, and the run **pauses** at `max_credits`, the key budget or the balance with `data.next.resume_url` \u2014 nothing is paid twice. A watch needs `max_credits_per_run` at least one fire's estimate; each fire bills like the list (no surcharge, no refund when nothing is new). `dry_run: true` answers the plan and estimate for free \u2014 on a watch, the price of a fire (`credits_per_fire`) and of 30 days (`credits_per_30_days`). The answer is **202** with `data.run` and `data.next.status_url` (a watch adds `data.watch`). `Idempotency-Key` replays the first answer; the same request sent again while its run is live returns that run (`run.deduplicated`).\n\n## Runs (area `search_runs`)\n\nUniversal-search runs created since 14/11/2026 are kept 30 days by default (was 7); `retention_days` is 1 to 30.\n\n| Action | Route | Cost |\n|---|---|---|\n| `run_list` | `GET /v1/search/everywhere/runs` \u2014 status, created_after, cursor, page_size 1-100; a watch id as `id` lists its fires | 0 |\n| `run_get` | `GET \u2026/runs/{run_id}` \u2014 `wait_s` 0-25 long-polls; format evidence\\|compact\\|text, fields, sort relevance\\|recent\\|engagement, max_per_platform, platform, group, state kept\\|dropped\\|all, changes_since, cursor, page_size | 0 |\n| `run_export` | `GET \u2026/runs/{run_id}/results.jsonl` \u2014 the same filters, no paging; ends with `{\"complete\":true,\"changes_url\":\u2026}` | 0 |\n| `run_legs` | `GET \u2026/runs/{run_id}/legs` \u2014 every search with its outcome and credits | 0 |\n| `run_cancel` | `DELETE \u2026/runs/{run_id}` \u2014 a list only (409 `run_not_a_list` on a one-off) | 0 |\n| `run_resume` | `POST \u2026/runs/{run_id}/resume` \u2014 `max_credits` (higher, if it paused at its cap), `retry_failed` | 0 + the searches it runs |\n| `run_more` | `POST \u2026/runs/{run_id}/more` \u2014 the next page of every search that has one; `max_credits` is the run's new total cap | **20 credits per search** with another page; `nothing_more` is free; dry_run quotes it |\n| `run_include` | `POST \u2026/runs/{run_id}/include` \u2014 `include` comments\\|authors\\|body, `ids` (1-200 rows), `comments.per_post` 5-50, `comments.replies`, `authors.top` 1-100, `max_credits` | metered per read, capped by max_credits (default: the quote); dry_run answers `estimate.credits {min, expected, max}` |\n\n`run_more` and `run_include` take `Idempotency-Key` and `dry_run`. Read only what a step added with `run_get` + `changes_since`, or follow `data.next.changes_url` \u2014 the page that serves a run's last row names it.\n\n## Watches (area `search_runs`)\n\n`watch_list` (status active\\|paused\\|stopped), `watch_get` (with its 10 latest fires), `watch_delete` \u2014 all free on `/v1/search/everywhere/watches`. `watch_pause` / `watch_resume` (new `max_credits_per_run` / `max_credits_per_month`) use the discover schedule routes a watch is built on. A watch view carries `caps`, `spend.month`, `next_fire_at`, `last_fire {run_id, new_rows, results_url}`.\n\n## Creator runs (area `creator_runs`)\n\n`prism/creators` (GET or POST, socialcrawl_request) works toward `limit` until it has the creators, runs dry or reaches `max_credits`, and says which (`stopped_because`, `short_reason`). Its run is read like a search run on `/v1/prism/creators/runs` (`run_list`, `run_get` with country / account_kind / platform / sort / order filters, `run_export`, `run_legs`, `run_cancel`, `run_resume`, `run_more`) \u2014 reads free.\n\n`run_save` (`POST \u2026/runs/{run_id}/save`, `keys` optional, Idempotency-Key) stores the creators as author lists \u2014 **free**, kept 30 days, counted in the 500 live stored lists per account (see Stored lists in the `discover-runs` topic), 10,000 handles each \u2014 and answers `data.next.follow`: a ready `POST prism/discover` schedule body (daily, event `discover.new_rows`) that watches those creators for new posts. It costs what its runs cost, with no premium.\n\n## follow\n\nAny `data.next.*` read URL (status_url, results_url, legs_url, changes_url, a watch's links) goes to action `follow` \u2014 absolute or relative, on the configured API only. POST links are refused with the action to use: more_url \u2192 `run_more`, include_url \u2192 `run_include`, resume_url \u2192 `run_resume`, a creator save \u2192 `run_save`.\n";