desearch-mcp-server 0.11.1 → 0.13.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,53 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.13.0
4
+
5
+ Balance: one new tool (52 in total) for `GET /desearch/balance` (desearch-public-api `docs/balance.md`).
6
+
7
+ | Tool | Route | Billed |
8
+ | --- | --- | --- |
9
+ | `balance` | `GET /desearch/balance` | Free. |
10
+
11
+ - `balance` takes no arguments (unknown ones are refused) and returns `{ balance_usd, currency }` as the API sent it: what the account behind the key can still spend, with charges from about the last minute already subtracted and top-ups (card, TAO, Gamma) shown as soon as they are credited. It is a read-only lookup (`readOnlyHint: true`, `destructiveHint: false`).
12
+ - The route is not in `desearch-js` 1.5, so the tool calls it directly through `desearch-api.ts`, like Monitors. API errors read `Get Balance error: HTTP <status>: <detail>` (503 when the API cannot read the balance).
13
+ - Every version (package, `server.json`, the Gemini extension, the plugin manifests, and `SERVER_VERSION`) is 0.13.0, and the docs and manifest descriptions say the server exposes 52 tools.
14
+ - Publish after `GET /desearch/balance` is live on `api.desearch.ai`.
15
+
16
+ ## 0.12.0
17
+
18
+ Monitors: twelve new tools (51 in total) for the `/desearch/monitors` routes (desearch-public-api `docs/monitors.md`). A monitor reruns a search over `web`, `x`, `reddit`, `youtube`, and `threads` on a schedule (`1h` to `7d`), drops everything it has already seen, screens the new items (relevant, new information, and one question per criterion; kept at `min_score`), and keeps the ones that pass, readable through the API and sent to a signed webhook. Monitors are not in `desearch-js` 1.5, so `monitors.ts` calls the routes directly through `desearch-api.ts`, which now also sends `PATCH` and `DELETE`.
19
+
20
+ | Tool | Route | Billed |
21
+ | --- | --- | --- |
22
+ | `monitor-create` | `POST /desearch/monitors` | Free; with `run_now` (the API default) its first run is queued, and billed when it ends. |
23
+ | `monitor-estimate` | `POST /desearch/monitors/estimate` | Free. |
24
+ | `monitor-list` | `GET /desearch/monitors` | Free. |
25
+ | `monitor-get` | `GET /desearch/monitors/{monitor_id}` | Free. |
26
+ | `monitor-update` | `PATCH /desearch/monitors/{monitor_id}` | Free. |
27
+ | `monitor-delete` | `DELETE /desearch/monitors/{monitor_id}` | Free. |
28
+ | `monitor-trigger` | `POST /desearch/monitors/{monitor_id}/trigger` | One run, billed when it ends. |
29
+ | `monitor-runs` | `GET /desearch/monitors/{monitor_id}/runs` | Free. |
30
+ | `monitor-run` | `GET /desearch/monitors/{monitor_id}/runs/{run_id}` | Free. |
31
+ | `monitor-items` | `GET /desearch/monitors/{monitor_id}/items` | Free. |
32
+ | `monitor-webhook-test` | `POST /desearch/monitors/{monitor_id}/webhook/test` | Free. |
33
+ | `monitor-webhook-rotate-secret` | `POST /desearch/monitors/{monitor_id}/webhook/rotate-secret` | Free. |
34
+
35
+ - A run is billed for its searches at their list price, AI screening at $0.05 per 1,000 items screened, and the summary's LLM usage plus 50%; its `max_run_cost_usd` is held while it runs. The create, estimate, and trigger descriptions say so.
36
+ - `monitor-create` and `monitor-update` take the per-source options flat (`web_count`, `x_count`, `x_lang`, `x_min_likes`) and the webhook as `webhook_url` and `webhook_events`, and send them as the API's nested `options` and `webhook`. `monitor-update` removes a webhook with `remove_webhook: true`, because a null argument means "omitted" on this server. Only the arguments the caller set are sent.
37
+ - `webhook_secret` is passed through on create, on an update that changes the webhook URL, and on rotate-secret, with a `next` hint to store it and how to verify `Desearch-Signature`.
38
+ - Lists return `{ monitors | runs | items, next_cursor }` with `next_cursor` `null` on the last page. Items keep their fields, with `text` cut to 1000 characters.
39
+ - Annotations: `monitor-estimate`, `monitor-list`, `monitor-get`, `monitor-runs`, `monitor-run`, and `monitor-items` are lookups. `monitor-create` and `monitor-trigger` are `destructiveHint: false`, `idempotentHint: false`. `monitor-update` and `monitor-delete` are `destructiveHint: true`, `idempotentHint: true`. `monitor-webhook-rotate-secret` is `destructiveHint: true`, `idempotentHint: false`. `monitor-webhook-test` is `readOnlyHint: false`, `destructiveHint: false`, `idempotentHint: false`.
40
+ - TikTok and watched accounts (desearch-public-api #635): `sources` and the `monitor-items` source filter take `tiktok`. `monitor-create`, `monitor-update`, and `monitor-estimate` take `x_accounts`, `reddit_subreddits`, `youtube_channels`, and `tiktok_accounts` (up to 10 each) and `tiktok_count` (10, 20, or 30), sent as `options.x.accounts`, `options.reddit.subreddits`, `options.youtube.channels`, and `options.tiktok`. Names go out as given (the API cleans them, or answers 422); an empty list is sent too, so an update can stop watching accounts. The descriptions say the query and criteria still decide what is kept (`min_score: 0` keeps every new post), that items from a watched account have `data.account`, what TikTok item `data` holds, `stats.sources.<source>.accounts_failed`, and the prices (a TikTok post $0.00207, a watched X account about $0.003, a subreddit or channel $0.00207).
41
+ - The `monitor-create` description and the Monitors docs say TikTok search has no working date filter and ranks by relevance, so a TikTok keyword monitor finds a new video only when it reaches TikTok's top results; to follow creators, watch their accounts (`tiktok_accounts`).
42
+ - Instagram, Facebook, Meta ads, and Threads accounts (desearch-public-api #644): `sources` and the `monitor-items` source filter take `instagram`, `facebook`, and `meta_ads`. `monitor-create`, `monitor-update`, and `monitor-estimate` take `instagram_accounts`, `facebook_pages`, `threads_accounts` (up to 10 each) and `meta_ads_count` (10, 20, or 30), sent as `options.instagram.accounts`, `options.facebook.pages`, `options.threads.accounts`, and `options.meta_ads.count`. The descriptions say `instagram` and `facebook` read only watched accounts and need them (the API answers 422 on create, and on an update that leaves either without accounts; the tool sends the request and reports the 422, since the update rule depends on the monitor as patched), that a `meta_ads` query is keywords (a brand, product, or short phrase; a sentence finds nothing), that Threads keyword search is loose so `threads_accounts` works better, and the per-run prices (a Threads account $0.00207; Instagram, Facebook, and Meta ads per read, see below). `x_accounts` says an X username has 1–15 characters.
43
+ - `monitor-get` and `monitor-list` describe `webhook.last_delivery`, the newest delivery (`null` before the first; `status` `pending`, `delivered`, or `failed`, with `attempts`, `status_code`, `error`, and `next_attempt_at`), passed through as the API sends it; `monitor-webhook-test` says its `monitor.test` event leaves it unchanged. `monitor-run` and `monitor-items` list item `data` per source (Threads `likes`; Instagram `likes`, `comments`, `views`, `media_type`, `thumbnail`; Facebook `reactions`, `comments`, `shares`; Meta ads `page`, `active`, `cta`, `link`, `platforms`, `thumbnail`, with the ad headline as `title` and the Ad Library record as `url`) and `signals.criteria`.
44
+ - Watched hashtags on TikTok and Instagram: `monitor-create`, `monitor-update`, and `monitor-estimate` take `tiktok_hashtags` and `instagram_hashtags` (up to 10 each, any script: `skincare`, `#სილამაზე`, or a tag URL), sent as `options.tiktok.hashtags` and `options.instagram.hashtags`. A hashtag feed lists posts from any account, so a monitor finds posts outside the accounts it watches; `instagram` needs accounts or hashtags. The descriptions give the price (one read per hashtag), `stats.sources.<source>.hashtags_failed`, `data.hashtag`, the TikTok, Instagram, and Facebook post fields (`post_id`, `type`, `hashtags`, `mentions`, `media`, TikTok `saves`, Facebook `views`), and `stats.screen` `ai` or `keyword`.
45
+ - Monitors billing as documented: TikTok, Instagram, Facebook, and Meta ads reads are billed per read ($3.00 per 1,000 reads), whatever the number of posts a read returns: one per watched account, hashtag, Facebook page, TikTok keyword search, or Ad Library search; an empty or private TikTok account takes two reads. X timelines, subreddits, YouTube channels, and Threads keep their list prices. The tool descriptions, README, and parity doc say so.
46
+ - `facebook` `search` takes `sort`: `impressions` (the API default, most seen first) or `recent` (recently started ads first). Other Facebook actions refuse it before the request.
47
+ - `scripts/e2e-monitors.mjs` drives every free monitor tool over stdio against a live API (`--base-url`, `--key-env`) and deletes the monitors it creates. It never triggers a run. `--with-accounts` also checks the #644 sources: the estimate breakdown for Instagram, Facebook, Meta ads, and Threads accounts, the 422 for `instagram` or `facebook` without accounts on create and update, a monitor with all four (names cleaned, `meta_ads.count`, `webhook.last_delivery` null), items by source `meta_ads`, the 15-character X username limit, and one billed `facebook` search with `sort: "recent"` and `count: 2` (at most $0.00414).
48
+ - The Monitors routes are live on `api.desearch.ai` (desearch-public-api #635, #644, and the hashtag 7-day window #666, with their console migrations).
49
+ - Every version (package, `server.json`, the Gemini extension, the plugin manifests, and `SERVER_VERSION`) is 0.12.0, and the docs and manifest descriptions say the server exposes 51 tools.
50
+
3
51
  ## 0.11.1
4
52
 
5
53
  `search-api` results have `meta` with only `notices`. Tool names are unchanged (39 tools).
package/README.md CHANGED
@@ -52,13 +52,13 @@ Example output:
52
52
 
53
53
  The tool returns that JSON as pretty-printed text: `{ "content": [{ "type": "text", "text": "<json above>" }] }`.
54
54
 
55
- AI search, X search and web search for AI agents, plus the Search API (ranked pages with the best-matching passage), page extraction, X data tools, public TikTok, Facebook, Instagram, YouTube (videos, transcripts, comments, channels), Reddit, and Threads data, People Search (find people and creators on X, YouTube, LinkedIn, and TikTok), and Company Search (find companies on the web, or enrich domains you have, with their public contacts and leaders). Bring your own Desearch API key. Version 0.11.1 exposes 39 tools.
55
+ AI search, X search and web search for AI agents, plus the Search API (ranked pages with the best-matching passage), page extraction, X data tools, public TikTok, Facebook, Instagram, YouTube (videos, transcripts, comments, channels), Reddit, and Threads data, People Search (find people and creators on X, YouTube, LinkedIn, and TikTok), Company Search (find companies on the web, or enrich domains you have, with their public contacts and leaders), Monitors (searches that rerun on a schedule over web, X, Reddit, YouTube, Threads, and TikTok, or watch chosen accounts there, and keep only new, relevant items, with a signed webhook), and your account balance. Bring your own Desearch API key. Version 0.13.0 exposes 52 tools.
56
56
 
57
57
  ## Tools
58
58
 
59
59
  The Desearch MCP server includes the following tools.
60
60
 
61
- Lookup tools, including `search` and `fetch`, set `readOnlyHint: true`, `destructiveHint: false`, and `openWorldHint: true`. `search-api`, `tiktok`, `facebook`, `instagram`, `youtube`, `reddit`, `threads`, `people-search-status`, `people-search-tasks`, `people-profiles`, and `people-search-export` are lookups too. `people-search` starts a paid job billed to the user's Desearch balance, so `readOnlyHint` is false; it creates a new task and does not delete or overwrite anything, so `destructiveHint` is false. `people-search-pause` and `people-search-resume` change a task's state and undo each other, so `readOnlyHint` and `destructiveHint` are false and `idempotentHint` is true. Pausing loses no data (people found so far stay readable and the search keeps its progress) and changes no billing (nothing is charged or refunded; the reservation stays until the search ends), and resume continues from where the search stopped with no new charge. The caveat: the API cancels a search paused for more than 7 days, and a cancelled search cannot be resumed, so a pause is reversible only within those 7 days. `people-search-cancel` cannot be undone, so `readOnlyHint` is false and `destructiveHint` and `idempotentHint` are true. The Company Search tools follow the same rules: `company-search` and `company-enrich` start paid jobs (`readOnlyHint: false`, `destructiveHint: false`, `idempotentHint: false`), `company-search-status` and `company-search-tasks` are lookups, `company-search-pause` and `company-search-resume` set `destructiveHint: false` and `idempotentHint: true` (with the same 7-day caveat), and `company-search-cancel` sets `destructiveHint: true` and `idempotentHint: true`. `openWorldHint` is true on every tool because the call reaches a live external source.
61
+ Lookup tools, including `search` and `fetch`, set `readOnlyHint: true`, `destructiveHint: false`, and `openWorldHint: true`. `search-api`, `tiktok`, `facebook`, `instagram`, `youtube`, `reddit`, `threads`, `people-search-status`, `people-search-tasks`, `people-profiles`, `people-search-export`, and `balance` are lookups too. `people-search` starts a paid job billed to the user's Desearch balance, so `readOnlyHint` is false; it creates a new task and does not delete or overwrite anything, so `destructiveHint` is false. `people-search-pause` and `people-search-resume` change a task's state and undo each other, so `readOnlyHint` and `destructiveHint` are false and `idempotentHint` is true. Pausing loses no data (people found so far stay readable and the search keeps its progress) and changes no billing (nothing is charged or refunded; the reservation stays until the search ends), and resume continues from where the search stopped with no new charge. The caveat: the API cancels a search paused for more than 7 days, and a cancelled search cannot be resumed, so a pause is reversible only within those 7 days. `people-search-cancel` cannot be undone, so `readOnlyHint` is false and `destructiveHint` and `idempotentHint` are true. The Company Search tools follow the same rules: `company-search` and `company-enrich` start paid jobs (`readOnlyHint: false`, `destructiveHint: false`, `idempotentHint: false`), `company-search-status` and `company-search-tasks` are lookups, `company-search-pause` and `company-search-resume` set `destructiveHint: false` and `idempotentHint: true` (with the same 7-day caveat), and `company-search-cancel` sets `destructiveHint: true` and `idempotentHint: true`. Among the Monitors tools, `monitor-estimate`, `monitor-list`, `monitor-get`, `monitor-runs`, `monitor-run`, and `monitor-items` are lookups. `monitor-create` and `monitor-trigger` queue billed runs and delete nothing (`readOnlyHint: false`, `destructiveHint: false`, `idempotentHint: false`). `monitor-update` overwrites settings and `monitor-delete` removes a monitor for good, so both set `destructiveHint: true` and `idempotentHint: true`. `monitor-webhook-rotate-secret` replaces the signing secret (`destructiveHint: true`, `idempotentHint: false`), and `monitor-webhook-test` sends one more delivery to your endpoint (`readOnlyHint: false`, `destructiveHint: false`, `idempotentHint: false`). `openWorldHint` is true on every tool because the call reaches a live external source.
62
62
 
63
63
  - **AI Search** (`ai-search`): X (Twitter) posts and web (from the Desearch index) with relevant links and an optional AI summary. Web results are capped at 20 per request; for web only, use `search-api`. `tools` uses short source ids (`web`, `twitter`, `arxiv`, `wikipedia`, `hackernews`, `reddit`). Older labels such as `Web Search`, `ArXiv Search`, `Wikipedia Search`, `Hacker News Search`, and `Reddit Search` are still accepted and sent as the short id. `youtube` is not accepted. Default is `["web", "twitter"]`.
64
64
  - **X Search** (`x-search`): Tweet search on X. Arguments: `query` (required), `count` (optional, default 20). Sort stays Top. Optional filters: `user`, `start_date`, `end_date` (YYYY-MM-DD), `lang`, `verified`, `blue_verified`, `is_quote`, `is_video`, `is_image`, `min_retweets`, `min_replies`, `min_likes`.
@@ -79,7 +79,7 @@ Lookup tools, including `search` and `fetch`, set `readOnlyHint: true`, `destruc
79
79
  - **X Post Replies** (`x-post-replies`): Replies to a post. Arguments: `post_id` (required), `count` (optional, 1–100), `query` (optional).
80
80
  - **X Trends** (`x-trends`): Trending topics for a location. Arguments: `woeid` (required), `count` (optional, 30–100).
81
81
  - **TikTok** (`tiktok`): Public TikTok data. `action` (required) picks the route: `search` (`query`; optional `count`, `sort`, `cursor`), `post` (`id`), `profile` (`username`), `profile_posts` (`username`; optional `count`, `cursor`), `comments` (`video_id`; optional `count`, `cursor`), `hashtag` (`tag`; optional `count`, `cursor`), `trending` (optional `region`, `count`). See [TikTok, Facebook, and Instagram](#tiktok-facebook-and-instagram).
82
- - **Facebook** (`facebook`): Public Facebook data. `action` (required): `search` (`query`; optional `count`, `cursor`) and `hashtag` (`tag`; optional `count`, `cursor`) return Meta Ad Library ads, not organic posts; `post` (`id`), `profile` (`profile_id`, a page or profile ID or public handle), `profile_posts` (`profile_id`; optional `count`, `cursor`), `comments` (`post_id`; optional `count`, `cursor`).
82
+ - **Facebook** (`facebook`): Public Facebook data. `action` (required): `search` (`query`; optional `count`, `sort`: `impressions`, the API default, or `recent`; `cursor`) and `hashtag` (`tag`; optional `count`, `cursor`) return Meta Ad Library ads, not organic posts; `post` (`id`), `profile` (`profile_id`, a page or profile ID or public handle), `profile_posts` (`profile_id`; optional `count`, `cursor`), `comments` (`post_id`; optional `count`, `cursor`).
83
83
  - **Instagram** (`instagram`): Public Instagram data. `action` (required): `search` (`query`; optional `count`; profiles, one page, no cursor), `media` (`id`: shortcode, numeric ID, or URL), `profile` (`username`), `profile_posts` (`username`; optional `count`, `cursor`), `comments` (`shortcode`, the code in the post URL; optional `count`, `cursor`), `hashtag` (`tag`; optional `count`, `cursor`).
84
84
  - **YouTube** (`youtube`): Public YouTube data. `action` (required): `search` (`query`; optional `type`, `upload_date`, `sort_by`, `duration`, `cursor`; videos, Shorts, live streams, channels, and playlists, each with a `type`), `video` (`id`: video or Short ID or URL), `transcript` (`video_id`; optional `language`), `comments` (`video_id`; optional `order`, `cursor`), `channel` (`handle`, with or without `@`, or a `UC...` channel ID), `channel_videos` (`handle`; optional `sort`, `cursor`). See [YouTube, Reddit, and Threads](#youtube-reddit-and-threads).
85
85
  - **Reddit** (`reddit`): Public Reddit data. `action` (required): `search` (`query`; optional `sort`, `timeframe`, `cursor`), `subreddit` (`name`, case-sensitive), `subreddit_posts` (`name`; optional `sort`, `timeframe`, `cursor`), `post` (`id`: post ID or URL), `comments` (`post_id`; optional `cursor`).
@@ -99,6 +99,19 @@ Lookup tools, including `search` and `fetch`, set `readOnlyHint: true`, `destruc
99
99
  - **Resume Company Search** (`company-search-resume`): Resume a paused task from where it stopped, with no new charge (409 when it is not paused). Argument: `task_id` (required). Free.
100
100
  - **Cancel Company Search** (`company-search-cancel`): Stop a task for good. You pay only for the companies it already delivered (a search with `max_cost_usd`: its search effort so far when that is more, up to the budget); the rest of the reservation is returned. Cannot be undone. Argument: `task_id` (required). Free.
101
101
  - **List Company Search Tasks** (`company-search-tasks`): Your Company Search and Company Enrich tasks, newest first. Arguments: `type` (optional, `search` or `enrich`), `status` (optional list), `limit` (optional, 1–100), `cursor` (optional), `metadata` (optional, up to 3 labels, exact match). Free; People Search tasks are not listed here.
102
+ - **Create Monitor** (`monitor-create`): Create a monitor that reruns a search on a schedule and keeps only new, relevant items. Arguments: `query` (required, 3–500 characters), `name` (optional, up to 120), `criteria` (optional, up to 5 conditions of up to 300 characters), `sources` (optional: `web`, `x`, `reddit`, `youtube`, `threads`, `tiktok`, `instagram`, `facebook`, `meta_ads`; API default `["web", "x"]`), `interval` (optional: `1h`, `3h`, `6h`, `12h`, `1d`, `7d`; API default `1d`), `web_count` (optional: 10, 15, or 20), `x_count` (optional, 1–100), `x_lang` (optional), `x_min_likes` (optional), `x_accounts`, `reddit_subreddits`, `youtube_channels`, `tiktok_accounts`, `threads_accounts` (optional watched accounts, up to 10 each), `tiktok_hashtags` and `instagram_hashtags` (optional watched hashtags, up to 10 each), `instagram_accounts` (up to 10; `instagram` needs accounts or hashtags) and `facebook_pages` (1–10, required with the `facebook` source), `tiktok_count` (optional: 10, 20, or 30), `meta_ads_count` (optional: 10, 20, or 30), `min_score` (optional, 0–100, API default 60), `summary` (optional), `webhook_url` and `webhook_events` (optional), `metadata` (optional, up to 20 labels), `run_now` (optional, API default `true`). The per-source options are sent as the API's `options`. Free; with `run_now` the first run is queued and billed when it ends. Returns `webhook_secret` once when `webhook_url` is set.
103
+ - **Estimate Monitor Cost** (`monitor-estimate`): The most one run can cost (`max_run_cost_usd`), runs per month, the most a month can cost, and a breakdown. Arguments: `sources`, `web_count`, `x_count`, `x_accounts`, `reddit_subreddits`, `youtube_channels`, `tiktok_count`, `tiktok_accounts`, `tiktok_hashtags`, `threads_accounts`, `instagram_accounts`, `instagram_hashtags`, `facebook_pages`, `meta_ads_count`, `summary`, `interval` (all optional). The breakdown is per source plus screening and summary. Free.
104
+ - **List Monitors** (`monitor-list`): Your monitors, newest first. Arguments: `status` (optional list: `active`, `paused`), `limit` (optional, 1–100), `cursor` (optional). Returns `{ monitors, next_cursor }`. Free.
105
+ - **Get Monitor** (`monitor-get`): One monitor's settings, status and `paused_reason`, webhook (`url`, `events`, `consecutive_failures`, and `last_delivery`; never the secret), `next_run_at`, `last_run`, and totals. Argument: `monitor_id` (required). Free.
106
+ - **Update Monitor** (`monitor-update`): Change any setting of `monitor-create` except `run_now`, plus `status` (`active` or `paused`) and `remove_webhook`. Arguments: `monitor_id` (required) and the settings to change. The per-source options replace the monitor's options as a whole; an update that leaves `instagram` without accounts or hashtags, or `facebook` without pages, is a 422. A new `webhook_url` returns a new `webhook_secret` once. Free.
107
+ - **Delete Monitor** (`monitor-delete`): Delete a monitor for good; a queued run is cancelled and its hold released. Argument: `monitor_id` (required). Free.
108
+ - **Run Monitor Now** (`monitor-trigger`): Queue one billed run now, also on a paused monitor (409 while a run is queued or running). Argument: `monitor_id` (required).
109
+ - **List Monitor Runs** (`monitor-runs`): A monitor's runs, newest first, with per-source stats (including `accounts_failed` and `hashtags_failed`, watched accounts and hashtags it could not read), how items were screened (`stats.screen`: `ai` or `keyword`), and cost. Arguments: `monitor_id` (required), `limit` (optional, 1–100), `cursor` (optional). Returns `{ runs, next_cursor }`. Free.
110
+ - **Get Monitor Run** (`monitor-run`): One run with the items it kept, most relevant first. Arguments: `monitor_id`, `run_id` (both required). Free.
111
+ - **List Monitor Items** (`monitor-items`): Everything a monitor kept, newest first. Arguments: `monitor_id` (required), `source` (optional, including `tiktok`, `instagram`, `facebook`, and `meta_ads`), `limit` (optional, 1–200), `cursor` (optional). Returns `{ items, next_cursor }`. Free.
112
+ - **Test Monitor Webhook** (`monitor-webhook-test`): Send a signed `monitor.test` event to the monitor's webhook and report what it answered (`delivered`, `status_code`, `error`, `duration_ms`); it does not change `webhook.last_delivery`. Argument: `monitor_id` (required). Free.
113
+ - **Rotate Monitor Webhook Secret** (`monitor-webhook-rotate-secret`): Replace the signing secret and return the new `webhook_secret` once. Argument: `monitor_id` (required). Free.
114
+ - **Get Balance** (`balance`): What the Desearch account behind your API key can still spend: `{ balance_usd, currency }`. No arguments. Free, and not counted as usage. It already subtracts charges from the last minute and shows top-ups (card, TAO, Gamma) as soon as they are credited. A paid tool the balance cannot cover fails with `HTTP 402: Insufficient balance`. To keep an account funded automatically, read it on a schedule and top up below a threshold.
102
115
 
103
116
  ### Cost of each call
104
117
 
@@ -111,7 +124,7 @@ Every tool result from a billed Desearch API call carries that call's cost in th
111
124
  }
112
125
  ```
113
126
 
114
- The full SDK method → endpoint → MCP tool map is in [docs/API_MCP_PARITY.md](docs/API_MCP_PARITY.md). Every public `desearch-js` 1.5 method is a tool. `latestTweets` was removed from the SDK (`GET /twitter/latest` in 1.0.1) and is not exposed. People Search, Company Search, the TikTok, Facebook, Instagram, YouTube, Reddit, and Threads routes, and `POST /search` are not in `desearch-js` 1.5; those tools call the routes directly (`/desearch/people/*`, `/desearch/companies/*`, and the rest), and the parity doc lists them too. The network stats routes (`/network/stats`) are not MCP tools.
127
+ The full SDK method → endpoint → MCP tool map is in [docs/API_MCP_PARITY.md](docs/API_MCP_PARITY.md). Every public `desearch-js` 1.5 method is a tool. `latestTweets` was removed from the SDK (`GET /twitter/latest` in 1.0.1) and is not exposed. People Search, Company Search, Monitors, the TikTok, Facebook, Instagram, YouTube, Reddit, and Threads routes, and `POST /search` are not in `desearch-js` 1.5; those tools call the routes directly (`/desearch/people/*`, `/desearch/companies/*`, `/desearch/monitors/*`, and the rest), and the parity doc lists them too. The network stats routes (`/network/stats`) are not MCP tools.
115
128
 
116
129
  ### TikTok, Facebook, and Instagram
117
130
 
@@ -143,7 +156,7 @@ Prompt: show me the latest TikTok videos tagged #ai, then the next page.
143
156
  { "name": "tiktok", "arguments": { "action": "hashtag", "tag": "ai", "count": 2, "cursor": "eyJ2IjoxLCJyb3V0ZSI6..." } }
144
157
  ```
145
158
 
146
- The cursor is opaque: send it back unchanged, on the same action with the same target (`query`, `username`, `profile_id`, `video_id`, `post_id`, `shortcode`, or `tag`), within 24 hours. Any other value returns HTTP 422 and is not charged. TikTok `trending` and Instagram `search` return one page and take no cursor. Facebook `search` and `hashtag` read the Meta Ad Library (ads), not organic posts. Instagram `comments` takes the post shortcode (`DeuOR-CjKE9` in `https://www.instagram.com/p/DeuOR-CjKE9/`); a numeric media ID returns 404. A leading `@` on a username and `#` on a tag are removed.
159
+ The cursor is opaque: send it back unchanged, on the same action with the same target (`query`, `username`, `profile_id`, `video_id`, `post_id`, `shortcode`, or `tag`), within 24 hours. Any other value returns HTTP 422 and is not charged. TikTok `trending` and Instagram `search` return one page and take no cursor. Facebook `search` and `hashtag` read the Meta Ad Library (ads), not organic posts; `search` takes `sort`: `impressions` (the API default, most seen first) or `recent` (Meta's monthly relevance grouping, which puts recently started ads first). Instagram `comments` takes the post shortcode (`DeuOR-CjKE9` in `https://www.instagram.com/p/DeuOR-CjKE9/`); a numeric media ID returns 404. A leading `@` on a username and `#` on a tag are removed.
147
160
 
148
161
  ### YouTube, Reddit, and Threads
149
162
 
@@ -445,6 +458,46 @@ The output above is shortened to one company.
445
458
 
446
459
  CSV and JSON Lines downloads (`GET /desearch/companies/tasks/{task_id}/export`) are not MCP tools; call the API directly for a file.
447
460
 
461
+ ### Monitors
462
+
463
+ A monitor is a search that reruns on a schedule and returns only what is new since its last run. Each run searches its `sources` (`web`, `x`, `reddit`, `youtube`, `threads`, `tiktok`, `instagram`, `facebook`, `meta_ads`) inside a window that starts where the previous run ended, drops every item the monitor has already seen, and screens the new ones with an AI classifier: `relevant` (the item is about what the monitor watches), `new_info` (it reports something new rather than an evergreen page), and one yes/no question per `criteria` entry. `score` is the lowest of `relevant` and the criteria, times 100; an item is kept at `min_score` (default 60). Kept items are readable with `monitor-items` and `monitor-run`, and, with a webhook, POSTed to it.
464
+
465
+ **Watched accounts.** Instead of searching by keyword, a source can watch up to 10 accounts: `x_accounts` (X usernames: `OpenAI`, `@OpenAI`, or an x.com URL), `reddit_subreddits` (`LocalLLaMA`, `r/LocalLLaMA`, or a URL), `youtube_channels` (an `@handle`, a `UC...` channel ID, or a channel URL), `tiktok_accounts` (TikTok usernames), `threads_accounts` (`zuck`, `@zuck`, or a profile URL), `instagram_accounts` (`openai`, `@openai`, or a profile URL), and `facebook_pages` (a page name, a numeric page ID, or a page URL; `profile.php?id=…` and `/pages/Name/123…` URLs are read as the ID). Each run then reads every account's newest posts, and the query and criteria still decide what is kept; `min_score: 0` keeps every new post. With `x_accounts`, `x_count` is not used (a timeline page is 20 posts) and `x_lang` and `x_min_likes` still filter. `tiktok_count` (10, 20, or 30) is per account with `tiktok_accounts`. Names are sent as given; the API returns them cleaned (`OpenAI`, `LocalLLaMA`, `@OpenAI` or `UC...`, `openai`, `NASA` or `100044561550831`) and answers 422 for a name it cannot read (an X username has 1–15 characters). An item read from a watched account has `data.account`, the name it was watched as. A run lists accounts it could not read (unknown or private) in `stats.sources.<source>.accounts_failed`; the source fails only when all of its accounts do.
466
+
467
+ **Watched hashtags.** TikTok and Instagram can also watch up to 10 hashtags each: `tiktok_hashtags` and `instagram_hashtags`, in any script (`skincare`, `#სილამაზე`, or a tag URL such as `https://www.tiktok.com/tag/skincare` or `https://www.instagram.com/explore/tags/skincare/`), sent as `options.tiktok.hashtags` and `options.instagram.hashtags`. A hashtag feed lists popular posts before recent ones from any account, so a monitor finds posts outside the accounts it watches, and since a new post can reach it days late, a run keeps the hashtag posts from the last 7 days that the monitor has not seen; with accounts or hashtags, a source reads those feeds instead of searching by keyword. Each run reads `tiktok_count` posts per TikTok hashtag and up to 12 per Instagram hashtag. The API returns hashtags without `#` (a tag URL becomes its tag) and answers 422 for one it cannot read. An item read from a hashtag has `data.hashtag`, and a run lists hashtags it could not read in `stats.sources.<source>.hashtags_failed`. Facebook has no organic hashtag feed; for ads by keyword use `meta_ads`.
468
+
469
+ **Item data by source.** `data` holds X `likes`, `reposts`, `replies`, `views`; Reddit `subreddit`, `score`, `comments`; YouTube `channel`, `views`, `thumbnail`; TikTok `views`, `likes`, `comments`, `shares`, `saves`, `duration_s`; Threads `likes`; Instagram `likes`, `comments`, `views`, `media_type`; Facebook `reactions`, `comments`, `shares`, `views`; Meta ads `page`, `active`, `cta`, `link` (the ad's landing page), `platforms`, `thumbnail`, with the ad headline as the item's `title` and `url` the Ad Library record; web `highlights`, `domain`. TikTok, Instagram, and Facebook items also have `post_id` (the ID the API's `GET /desearch/social/post` gives the same post; an Instagram shortcode), `type` (`video`, `image`, `carousel`, `reel`, …), `hashtags`, `mentions` (TikTok and Instagram), `media` (links to the post's videos and pictures), and `thumbnail`; media and thumbnail links expire after a few days. The metrics are the post's when the run found it; `GET /desearch/social/post?url=<link>` reads them again (`author=true` adds the author's followers). `signals` has `relevant` and `new_info`, plus `criteria` (the lowest answer across the criteria) when the monitor has criteria; Meta ads have no `new_info`.
470
+
471
+ TikTok search has no working date filter and ranks by relevance, so a TikTok keyword monitor finds a new video only when it reaches TikTok's top results; to follow creators or a tag, watch their accounts (`tiktok_accounts`) or the hashtag (`tiktok_hashtags`). Threads keyword search returns loosely matched posts, so `threads_accounts` works better there too.
472
+
473
+ **Instagram, Facebook, and Meta ads.** `instagram` and `facebook` have no keyword search: they read only watched feeds, so a monitor with `instagram` needs `instagram_accounts` or `instagram_hashtags` and one with `facebook` needs `facebook_pages`. The API answers 422 without them, on `monitor-create` and on a `monitor-update` that would leave either source without them (new `sources` with the current options, or new options with the current sources); `monitor-estimate` does not check. `meta_ads` searches the Meta Ad Library with the query, so the query should be keywords (a brand, product, or short phrase such as `ChatGPT`); a sentence finds nothing. `meta_ads_count` (10, 20, or 30) is how many ads a run reads. An ad counts as new the first time a run sees it if it started within the last 30 days, and ads are screened with their own relevance question and no `new_info`. For ads by keyword use `meta_ads`; for a page's own posts use `facebook_pages`.
474
+
475
+ Creating, reading, changing, and deleting monitors is free. Each run is billed when it ends: its searches at their list price, AI screening at $0.05 per 1,000 new items screened, and, with `summary`, the summary's LLM usage plus 50%. TikTok, Instagram, Facebook, and Meta ads are billed per read, $3.00 per 1,000 reads ($0.003 a read), whatever the number of posts a read returns: one read per watched account, hashtag, or Facebook page, one per TikTok keyword search, and one per Ad Library search (`meta_ads`, whatever `meta_ads_count`). A read that returns nothing is free, except an empty or private TikTok account, which takes two reads, so a run's hold counts two reads per TikTok account. The other sources pay their feed's list price: an X timeline (20 posts) about $0.003, and a subreddit, YouTube channel, or Threads account $0.00207. Ten watched accounts cost about ten searches. A run with no new items still pays for its searches. While a run is queued or running, its most (`max_run_cost_usd`, also on `monitor-estimate`) is held on the balance; it is billed what it used and the rest is released. A run that cannot be held fails with `insufficient_credits` and pauses the monitor (`paused_reason: "insufficient_credits"`) until you set `status: "active"` again. An account has at most 25 monitors.
476
+
477
+ 1. `monitor-estimate` prices a configuration; `monitor-create` sets one up. With `run_now` (the default) its first run is queued at once.
478
+ 2. `monitor-runs` lists runs with what each source returned (`fetched`, `in_window`, `new`, `passed`) and the cost; `monitor-run` reads one run with the items it kept; `monitor-items` pages through everything kept, newest first, optionally by `source`.
479
+ 3. `monitor-update` changes settings, pauses (`status: "paused"`) or resumes it; `monitor-trigger` runs it once now; `monitor-delete` removes it.
480
+
481
+ Prompt: watch X, Reddit, and the web for new Bittensor subnet launches every 6 hours, and send them to my webhook.
482
+
483
+ ```json
484
+ {
485
+ "name": "monitor-create",
486
+ "arguments": {
487
+ "query": "Bittensor subnet launches and updates",
488
+ "criteria": ["Announces a new subnet, release or partnership"],
489
+ "sources": ["web", "x", "reddit"],
490
+ "interval": "6h",
491
+ "x_count": 50,
492
+ "webhook_url": "https://example.com/hooks/desearch"
493
+ }
494
+ }
495
+ ```
496
+
497
+ The reply is the monitor with its `monitor_id`, `max_run_cost_usd`, `next_run_at`, and, because `webhook_url` is set, `webhook_secret` (shown only on create, when the webhook URL changes, and by `monitor-webhook-rotate-secret`).
498
+
499
+ **Webhooks.** Events are `monitor.items.found` (a run kept at least one item; default), `monitor.run.completed` (every completed run), and `monitor.run.failed` (default). Each delivery is a JSON POST with `Desearch-Event`, `Desearch-Delivery`, and `Desearch-Signature: t=<unix>,v1=<hex>` headers, where `v1` is the HMAC-SHA256 of `"<t>.<raw body>"` keyed with `webhook_secret`. Reject a timestamp older than 5 minutes and compare in constant time. The URL must be HTTPS on a public address and redirects are not followed. A delivery without a 2xx within 10 seconds is retried after 1, 5, 30, 120, and 360 minutes; after 5 deliveries in a row fail, the monitor pauses with `paused_reason: "webhook_failing"`. `monitor-get` and `monitor-list` show the newest delivery as `webhook.last_delivery` (`null` before the first): `event`, `status` (`pending` while it waits for its first or next attempt at `next_attempt_at`, with the last answer in `status_code` and `error`; `delivered`; or `failed` after every retry), `attempts`, `status_code`, `error`, `created_at`, `next_attempt_at`, and `delivered_at`. `monitor-webhook-test` sends a signed `monitor.test` event at any time; it does not change `last_delivery`.
500
+
448
501
  ## Prerequisites 📋
449
502
 
450
503
  - An [Desearch API Key](https://console.desearch.ai/api-keys)
@@ -715,6 +768,8 @@ Allowed callback URLs:
715
768
  - `https://claude.com/api/mcp/auth_callback`
716
769
  - `https://chatgpt.com/connector_platform_oauth_redirect`
717
770
  - `https://chatgpt.com/connector/oauth/{callback_id}`
771
+ - `https://script.google.com/macros/d/1q3nQZY0VanjPTREexH3qUWIKQd4Ghd7_yFb5ElZ8YXiWolagOSlk2j-1/usercallback` (Desearch Google Workspace add-on; this script ID only)
772
+ - `https://api.mcpbundles.com/oauth/callback/desearch-60432bc8` (MCPBundles Studio Connect; this callback id only)
718
773
  - Loopback `http://localhost`, `http://127.0.0.1`, and `http://[::1]` on any port (host and path must match the registered callback)
719
774
 
720
775
  The connector URL is `https://mcp.desearch.ai/mcp`. On the sign-in page, paste a key from [console.desearch.ai/api-keys](https://console.desearch.ai/api-keys). Leave a client id blank when the client can register itself.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Direct calls to the Desearch API for routes desearch-js 1.5 does not cover
3
- * (People Search, the TikTok, Facebook, Instagram, YouTube, Reddit and Threads routes,
4
- * `POST /search`).
3
+ * (People Search, Company Search, Monitors, the TikTok, Facebook, Instagram, YouTube,
4
+ * Reddit and Threads routes, `POST /search`, `GET /desearch/balance`).
5
5
  *
6
6
  * Same base URL, `Authorization: <key>` header, and `HTTP <status>: <detail>`
7
7
  * error text that desearch-js uses, so every tool reports API errors the same way.
@@ -27,7 +27,7 @@ export interface ApiRequestOptions {
27
27
  body?: Record<string, unknown>;
28
28
  headers?: Record<string, string>;
29
29
  }
30
- export type DesearchApi = (method: "GET" | "POST", path: string, options?: ApiRequestOptions) => Promise<ApiResponse>;
30
+ export type DesearchApi = (method: "GET" | "POST" | "PATCH" | "DELETE", path: string, options?: ApiRequestOptions) => Promise<ApiResponse>;
31
31
  /** The API's `detail` (plus the task status People Search adds on a 409), or the start of the body. */
32
32
  export declare function errorDetail(data: unknown, text: string): string;
33
33
  /** `path?key=value`, leaving out undefined values. */
@@ -1 +1 @@
1
- {"version":3,"file":"desearch-api.d.ts","sourceRoot":"","sources":["../desearch-api.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAGjC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAE/D,MAAM,WAAW,WAAW;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,IAAI,EAAE,OAAO,CAAC;IACd,kEAAkE;IAClE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QAAE,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;CACjD;AAED,MAAM,WAAW,iBAAiB;IAC9B,KAAK,CAAC,EAAE,MAAM,CAA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AC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpC;AAED,MAAM,MAAM,WAAW,GAAG,CACtB,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,EAC3C,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,iBAAiB,KAC1B,OAAO,CAAC,WAAW,CAAC,CAAC;AAM1B,uGAAuG;AACvG,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAO/D;AAED,sDAAsD;AACtD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,MAAM,CASlF;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,MAA8B,GAAG,WAAW,CAiCtG"}
@@ -2,8 +2,8 @@ import { fetch } from "undici";
2
2
  import { recordCostHeaders } from "./cost-meta.js";
3
3
  /**
4
4
  * Direct calls to the Desearch API for routes desearch-js 1.5 does not cover
5
- * (People Search, the TikTok, Facebook, Instagram, YouTube, Reddit and Threads routes,
6
- * `POST /search`).
5
+ * (People Search, Company Search, Monitors, the TikTok, Facebook, Instagram, YouTube,
6
+ * Reddit and Threads routes, `POST /search`, `GET /desearch/balance`).
7
7
  *
8
8
  * Same base URL, `Authorization: <key>` header, and `HTTP <status>: <detail>`
9
9
  * error text that desearch-js uses, so every tool reports API errors the same way.
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../http.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAoBjC,MAAM,WAAW,iBAAiB;IAC9B,IAAI,CAAC,EAAE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DD,wBAAgB,eAAe,CAAC,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAiD3F"}
package/build/http.js CHANGED
@@ -104,20 +104,36 @@ const LOGIN_CHALLENGE = {
104
104
  /** Public docs page that browsers and crawlers land on when they open /mcp without a key. */
105
105
  export const MCP_DOCS_URL = "https://www.desearch.ai/docs/guide/sdk/mcp";
106
106
  /**
107
- * A plain page view of /mcp: GET or HEAD, Accept asks for HTML, and nothing
108
- * marks it as an MCP client (no SSE Accept, no MCP session or protocol header).
109
- * MCP clients send `Accept: text/event-stream` on GET, so they keep the 401
107
+ * A plain page view of /mcp: GET or HEAD from a browser or a crawler, with
108
+ * nothing that marks it as an MCP client. Accept either asks for HTML, or is
109
+ * missing, or is only the wildcard `*\/*` (link checkers and SEO crawlers).
110
+ * MCP clients send `Accept: text/event-stream` on GET (and `application/json`
111
+ * on POST), plus MCP session or protocol headers, so they keep the 401
110
112
  * challenge that drives their OAuth or key prompt.
111
113
  */
112
114
  function isBrowserPageView(request) {
113
115
  if (request.method !== "GET" && request.method !== "HEAD") {
114
116
  return false;
115
117
  }
118
+ // Any credential header, even an empty, unsupported or malformed one, keeps the 401 challenge.
119
+ if (request.headers.has("authorization") || request.headers.has("x-api-key")) {
120
+ return false;
121
+ }
122
+ if (request.headers.has("mcp-session-id") || request.headers.has("mcp-protocol-version")) {
123
+ return false;
124
+ }
116
125
  const accept = (request.headers.get("accept") ?? "").toLowerCase();
117
- if (!accept.includes("text/html") || accept.includes("text/event-stream")) {
126
+ if (accept.includes("text/event-stream") || accept.includes("application/json")) {
118
127
  return false;
119
128
  }
120
- return !request.headers.has("mcp-session-id") && !request.headers.has("mcp-protocol-version");
129
+ if (accept.includes("text/html")) {
130
+ return true;
131
+ }
132
+ const types = accept
133
+ .split(",")
134
+ .map((part) => part.split(";")[0].trim())
135
+ .filter(Boolean);
136
+ return types.every((type) => type === "*/*");
121
137
  }
122
138
  function docsRedirect() {
123
139
  return new Response(null, {
@@ -0,0 +1,189 @@
1
+ import { type DesearchApi, type QueryValue } from "./desearch-api.js";
2
+ /**
3
+ * Monitors on the Desearch API (`/desearch/monitors/*`, desearch-public-api docs/monitors.md).
4
+ *
5
+ * desearch-js 1.5 has no Monitors methods, so this module calls the routes directly through
6
+ * `desearch-api.ts`, with the same base URL, `Authorization: <key>` header, and
7
+ * `HTTP <status>: <detail>` error text as Company Search (companies.ts).
8
+ *
9
+ * A monitor reruns a search over its `sources` on a schedule (`interval`), or reads the newest
10
+ * posts of up to 10 watched accounts per source (X users, subreddits, YouTube channels, TikTok,
11
+ * Threads, and Instagram users, Facebook pages) and up to 10 watched TikTok and Instagram
12
+ * hashtags, drops everything it has already seen, screens the new items with an AI classifier
13
+ * (relevant, new_info, and one question per criterion; `score` is the lowest, kept at
14
+ * `min_score`), and keeps the ones that pass. Kept items are readable with the items route and
15
+ * are sent to the monitor's signed webhook. `instagram` and `facebook` only read watched accounts
16
+ * or hashtags (the API answers 422 without any); `meta_ads` searches the Meta Ad Library.
17
+ *
18
+ * - Creating, reading, changing, and deleting monitors is free, and so are the run, item, and
19
+ * webhook routes.
20
+ * - Each run is billed when it ends: its searches at their list price, AI screening per item
21
+ * screened (the `/desearch/monitors` price), and the summary's LLM usage plus 50%. Its most
22
+ * (`max_run_cost_usd`) is held on the balance while it runs. `run_now` on create (the API
23
+ * default) and the trigger route each queue a billed run.
24
+ * - `webhook_secret` is returned only by create (with a webhook), by an update that changes the
25
+ * webhook URL, and by rotate-secret.
26
+ */
27
+ /** `sources` (model/monitors.py MonitorSource). */
28
+ export declare const MONITOR_SOURCES: readonly ["web", "x", "reddit", "youtube", "threads", "tiktok", "instagram", "facebook", "meta_ads"];
29
+ export type MonitorSource = (typeof MONITOR_SOURCES)[number];
30
+ /** `interval` (model/monitors.py MONITOR_INTERVALS). */
31
+ export declare const MONITOR_INTERVALS: readonly ["1h", "3h", "6h", "12h", "1d", "7d"];
32
+ export type MonitorInterval = (typeof MONITOR_INTERVALS)[number];
33
+ /** `webhook.events` (model/monitors.py MonitorEvent). */
34
+ export declare const MONITOR_EVENTS: readonly ["monitor.items.found", "monitor.run.completed", "monitor.run.failed"];
35
+ export type MonitorEvent = (typeof MONITOR_EVENTS)[number];
36
+ /** `status` on a monitor, its PATCH body, and the list filter. */
37
+ export declare const MONITOR_STATUSES: readonly ["active", "paused"];
38
+ export type MonitorStatus = (typeof MONITOR_STATUSES)[number];
39
+ /** `options.web.count` (model/monitors.py WebOptions). */
40
+ export declare const MONITOR_WEB_COUNTS: readonly [10, 15, 20];
41
+ /** `options.tiktok.count` (model/monitors.py TikTokOptions): posts per run, per account and per hashtag with them. */
42
+ export declare const MONITOR_TIKTOK_COUNTS: readonly [10, 20, 30];
43
+ /** `options.meta_ads.count` (model/monitors.py MetaAdsOptions): Ad Library records per run. */
44
+ export declare const MONITOR_META_ADS_COUNTS: readonly [10, 20, 30];
45
+ /** Request limits (model/monitors.py). */
46
+ export declare const MONITOR_QUERY_MIN = 3;
47
+ export declare const MONITOR_QUERY_MAX = 500;
48
+ export declare const MONITOR_NAME_MAX = 120;
49
+ export declare const MONITOR_CRITERIA_MAX = 5;
50
+ export declare const MONITOR_CRITERION_MAX = 300;
51
+ export declare const MONITOR_METADATA_MAX_KEYS = 20;
52
+ export declare const MONITOR_METADATA_KEY_MAX = 64;
53
+ export declare const MONITOR_METADATA_VALUE_MAX = 500;
54
+ export declare const MONITOR_X_COUNT_MAX = 100;
55
+ /** Watched accounts per source, and watched hashtags per source (model/monitors.py MAX_ACCOUNTS). */
56
+ export declare const MONITOR_ACCOUNTS_MAX = 10;
57
+ /** The per-source options as flat tool arguments; monitorOptions nests them. */
58
+ export interface MonitorSourceArgs {
59
+ web_count?: number;
60
+ x_count?: number;
61
+ x_lang?: string;
62
+ x_min_likes?: number;
63
+ x_accounts?: string[];
64
+ reddit_subreddits?: string[];
65
+ youtube_channels?: string[];
66
+ tiktok_count?: number;
67
+ tiktok_accounts?: string[];
68
+ tiktok_hashtags?: string[];
69
+ threads_accounts?: string[];
70
+ instagram_accounts?: string[];
71
+ instagram_hashtags?: string[];
72
+ facebook_pages?: string[];
73
+ meta_ads_count?: number;
74
+ }
75
+ /** Settings create and update share. Per-source options are flat here and nested in the body. */
76
+ export interface MonitorSettingsArgs extends MonitorSourceArgs {
77
+ name?: string;
78
+ criteria?: string[];
79
+ sources?: MonitorSource[];
80
+ interval?: MonitorInterval;
81
+ min_score?: number;
82
+ summary?: boolean;
83
+ webhook_url?: string;
84
+ webhook_events?: MonitorEvent[];
85
+ metadata?: Record<string, string>;
86
+ }
87
+ export interface MonitorCreateArgs extends MonitorSettingsArgs {
88
+ query: string;
89
+ run_now?: boolean;
90
+ }
91
+ export interface MonitorUpdateArgs extends MonitorSettingsArgs {
92
+ monitor_id: string;
93
+ query?: string;
94
+ status?: MonitorStatus;
95
+ remove_webhook?: boolean;
96
+ }
97
+ export interface MonitorEstimateArgs extends Pick<MonitorSourceArgs, "web_count" | "x_count" | "x_accounts" | "reddit_subreddits" | "youtube_channels" | "tiktok_count" | "tiktok_accounts" | "tiktok_hashtags" | "threads_accounts" | "instagram_accounts" | "instagram_hashtags" | "facebook_pages" | "meta_ads_count"> {
98
+ sources?: MonitorSource[];
99
+ summary?: boolean;
100
+ interval?: MonitorInterval;
101
+ }
102
+ export interface MonitorClient {
103
+ create(body: Record<string, unknown>): Promise<unknown>;
104
+ estimate(body: Record<string, unknown>): Promise<unknown>;
105
+ list(params: Record<string, QueryValue>): Promise<unknown>;
106
+ get(monitorId: string): Promise<unknown>;
107
+ update(monitorId: string, body: Record<string, unknown>): Promise<unknown>;
108
+ remove(monitorId: string): Promise<unknown>;
109
+ trigger(monitorId: string): Promise<unknown>;
110
+ listRuns(monitorId: string, params: Record<string, QueryValue>): Promise<unknown>;
111
+ getRun(monitorId: string, runId: string): Promise<unknown>;
112
+ listItems(monitorId: string, params: Record<string, QueryValue>): Promise<unknown>;
113
+ testWebhook(monitorId: string): Promise<unknown>;
114
+ rotateSecret(monitorId: string): Promise<unknown>;
115
+ }
116
+ export declare function createMonitorClient(apiKey: string, baseUrl?: string): MonitorClient;
117
+ /** A Monitors client on an existing API caller, so the server shares one per key. */
118
+ export declare function monitorClientFor(call: DesearchApi): MonitorClient;
119
+ /**
120
+ * `options` from the flat tool arguments: `web.count`; `x.count`, `x.lang`, `x.min_likes`,
121
+ * `x.accounts`; `reddit.subreddits`; `youtube.channels`; `tiktok.count`, `tiktok.accounts`,
122
+ * `tiktok.hashtags`; `threads.accounts`; `instagram.accounts`, `instagram.hashtags`;
123
+ * `facebook.pages`; `meta_ads.count`.
124
+ * Account names and hashtags are sent as given: the API cleans them (`@OpenAI` → `OpenAI`,
125
+ * `r/LocalLLaMA` → `LocalLLaMA`, a Facebook `profile.php?id=…` URL → its ID, `#სილამაზე` → `სილამაზე`,
126
+ * a tag URL → its tag) and answers 422 for a name or hashtag it cannot read, and for `instagram`
127
+ * in `sources` without accounts or hashtags or `facebook` without pages.
128
+ */
129
+ export declare function monitorOptions(args: MonitorSourceArgs): Record<string, unknown> | undefined;
130
+ /** Request body for `POST /desearch/monitors` (model/monitors.py MonitorCreateRequest). */
131
+ export declare function monitorCreateBody(args: MonitorCreateArgs): Record<string, unknown>;
132
+ /**
133
+ * Request body for `PATCH /desearch/monitors/{monitor_id}` (model/monitors.py
134
+ * MonitorUpdateRequest). `remove_webhook` sends `webhook: null`, which removes the webhook.
135
+ */
136
+ export declare function monitorUpdateBody(args: MonitorUpdateArgs): Record<string, unknown>;
137
+ /** Request body for `POST /desearch/monitors/estimate` (model/monitors.py MonitorEstimateRequest). */
138
+ export declare function monitorEstimateBody(args: MonitorEstimateArgs): Record<string, unknown>;
139
+ /**
140
+ * One kept item as an agent needs it: where it came from, what it says (`text` cut to 1000
141
+ * characters), who posted it, how it scored, and the source's own fields (`data`, with
142
+ * `account` when it was read from a watched account and `hashtag` when it was read from a
143
+ * watched hashtag).
144
+ */
145
+ export declare function compactMonitorItem(item: unknown): Record<string, unknown>;
146
+ /** What to do next after a create or an update, so an agent does not have to infer it. */
147
+ export declare function monitorNextStep(monitor: unknown, options?: {
148
+ created?: boolean;
149
+ runNow?: boolean;
150
+ }): string;
151
+ /** What to do next with one run, by its status. */
152
+ export declare function monitorRunNextStep(run: unknown): string;
153
+ /** `monitor-create`: create a monitor; with run_now (the default) its first billed run is queued. */
154
+ export declare function createMonitor(client: MonitorClient, args: MonitorCreateArgs): Promise<Record<string, unknown>>;
155
+ /** `monitor-update`: change settings, pause or resume, or remove the webhook. */
156
+ export declare function updateMonitor(client: MonitorClient, args: MonitorUpdateArgs): Promise<Record<string, unknown>>;
157
+ /** `monitor-list`: the caller's monitors, newest first. */
158
+ export declare function listMonitors(client: MonitorClient, args: {
159
+ status?: MonitorStatus[];
160
+ limit?: number;
161
+ cursor?: string;
162
+ }): Promise<Record<string, unknown>>;
163
+ /** `monitor-trigger`: queue one billed run now. */
164
+ export declare function triggerMonitor(client: MonitorClient, args: {
165
+ monitor_id: string;
166
+ }): Promise<Record<string, unknown>>;
167
+ /** `monitor-runs`: a monitor's runs, newest first. */
168
+ export declare function listMonitorRuns(client: MonitorClient, args: {
169
+ monitor_id: string;
170
+ limit?: number;
171
+ cursor?: string;
172
+ }): Promise<Record<string, unknown>>;
173
+ /** `monitor-run`: one run with the items it kept, most relevant first. */
174
+ export declare function readMonitorRun(client: MonitorClient, args: {
175
+ monitor_id: string;
176
+ run_id: string;
177
+ }): Promise<Record<string, unknown>>;
178
+ /** `monitor-items`: everything a monitor kept, newest first. */
179
+ export declare function listMonitorItems(client: MonitorClient, args: {
180
+ monitor_id: string;
181
+ source?: MonitorSource;
182
+ limit?: number;
183
+ cursor?: string;
184
+ }): Promise<Record<string, unknown>>;
185
+ /** `monitor-webhook-rotate-secret`: a new signing secret, returned once. */
186
+ export declare function rotateMonitorSecret(client: MonitorClient, args: {
187
+ monitor_id: string;
188
+ }): Promise<Record<string, unknown>>;
189
+ //# sourceMappingURL=monitors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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