google-trends-for-agent 0.2.41 → 0.2.43

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/AGENTS.md CHANGED
@@ -19,19 +19,21 @@ Prefer **Apify on-demand execution** for cloud/hosted clients (`meka.im/google-t
19
19
 
20
20
  Local CLI/stdio is an explicit direct-access or development option. An Apify route can still be blocked or rate-limited; stop that path and report the result rather than switching deployments to get around it.
21
21
 
22
- ## Install from GitHub
22
+ ## Install from npm
23
23
 
24
- The CLI/MCP require Node.js 20+. Nothing is published to npm; `npx` builds the package from the git checkout on first run.
24
+ The CLI and MCP server are published on npm as `google-trends-for-agent` and require Node.js 20+.
25
25
 
26
26
  ```sh
27
- npx -y -p github:meka-im/google-trends-for-agent gtfa --help
27
+ npx -y -p google-trends-for-agent gtfa --help
28
28
  ```
29
29
 
30
- The GitHub dependency build was verified with npm 11.19.1. npm 10.9.4 can build it and then fail while packaging it with a `GitFetcher` error about a missing Arborist dependency. If you hit that error, use the clone → `npm ci` → pack flow below or upgrade npm. The CLI and installed package still require Node.js 20+.
30
+ The package installs two commands: `gtfa` (CLI) and `gtfa-mcp` (MCP server; stdio by default, or local Streamable HTTP with `--http --port 4321`). For frequent use, install globally from npm:
31
31
 
32
- The package installs two commands: `gtfa` (CLI) and `gtfa-mcp` (MCP server; stdio by default, or local Streamable HTTP with `--http --port 4321`). The zero-install `npx` path builds from git on first use; build time depends on the network and machine. For frequent use, prefer a persistent install or the MCP server.
32
+ ```sh
33
+ npm install -g google-trends-for-agent
34
+ ```
33
35
 
34
- Persistent install (clone first because npm global git installs can omit build devDependencies during `prepare`). Pack and install the tarball so the clone can be deleted afterwards:
36
+ Or build from source if installing from a local git checkout:
35
37
 
36
38
  ```sh
37
39
  git clone https://github.com/meka-im/google-trends-for-agent.git
@@ -40,14 +42,13 @@ npm ci
40
42
  npm install -g "$(npm pack | tail -1)"
41
43
  ```
42
44
 
43
- The clone tracks the repository's default `main` branch. Add your own immutable commit pin only when a review process requires one.
45
+ Pin a published npm version or git commit when a review process requires an immutable revision.
44
46
 
45
- The packed tarball bundles the audited `apify` dependency subtree from the root lock. Scoped npm `overrides` are not inherited when this package is installed as a dependency, so the bundle—not the root override alone—protects consumer installs from re-resolving older Apify transitives. The root pins `@crawlee/core` → `minimatch` to `11.0.8`, outside Crawlee's declared `^9` range; the exact override keeps clean installs aligned with the audited lock when newer releases appear. Consumer `npm ls` may show a range warning even though the override is intentional. Audits cover both the root tree and a clean consumer install of the packed artifact. The bundled tree materially increases package size.
47
+ The published tarball bundles the audited `apify` dependency subtree from the root lock. Scoped npm `overrides` are not inherited when this package is installed as a dependency, so the bundle—not the root override alone—protects consumer installs from re-resolving older Apify transitives. The root pins `@crawlee/core` → `minimatch` to `11.0.8`, outside Crawlee's declared `^9` range; the exact override keeps clean installs aligned with the audited lock when newer releases appear. Consumer `npm ls` may show a range warning even though the override is intentional. Audits cover both the root tree and a clean consumer install of the packed artifact. The bundled tree materially increases package size.
46
48
 
47
49
  ## MCP client config
48
50
 
49
- For explicitly selected local access, use this generic stdio configuration,
50
- which follows the repository's `main` branch. Muse, GrokBot and Dots should start
51
+ For explicitly selected local access, use this generic stdio configuration. Muse, GrokBot and Dots should start
51
52
  with the [Apify setup](docs/clients.md).
52
53
 
53
54
  ```json
@@ -55,13 +56,13 @@ with the [Apify setup](docs/clients.md).
55
56
  "mcpServers": {
56
57
  "google-trends": {
57
58
  "command": "npx",
58
- "args": ["-y", "-p", "github:meka-im/google-trends-for-agent", "gtfa-mcp"]
59
+ "args": ["-y", "-p", "google-trends-for-agent", "gtfa-mcp"]
59
60
  }
60
61
  }
61
62
  }
62
63
  ```
63
64
 
64
- After the persistent install, use this config (or an absolute path to `gtfa-mcp`) to avoid resolving the GitHub package through npx on every start:
65
+ After a global install (`npm install -g google-trends-for-agent`), use this config (or an absolute path to `gtfa-mcp`) directly without invoking `npx` on every start:
65
66
 
66
67
  ```json
67
68
  {
@@ -75,21 +76,24 @@ For local MCP, restart the client, then call `trends_ask` with a single term. `t
75
76
 
76
77
  ## dsh plugin
77
78
 
78
- Prerequisites: dsh requires **Node >=24.9** and **pnpm >=10** on PATH (`allowBuilds` needs pnpm 10; tested with 10.34.6). Install dsh with `npm i -g @deepseek-ai/dsh` and pnpm with `npm i -g pnpm@10`. The gtfa CLI/MCP alone require Node 20+ (`engines.node: >=20`). Without pnpm on PATH, plugin installation fails with `spawn pnpm ENOENT` / `pnpm was not found`.
79
+ Prerequisites: dsh Desktop for macOS or `dsh` CLI (**Node >=24.9** and **pnpm >=10** on `PATH`; `npm i -g @deepseek-ai/dsh pnpm@10`). The gtfa CLI/MCP alone only require Node 20+ (`engines.node: >=20`).
80
+
81
+ Install from npm (no manual `allowBuilds` required):
82
+
83
+ - **DeepSeek Harness Desktop:** Plugins → `+ Install plugin` → enter `google-trends-for-agent` directly (do not paste a full `npmjs.com` web URL).
84
+ - **dsh CLI:**
79
85
 
80
86
  ```sh
81
- dsh plugin --profile web add github:meka-im/google-trends-for-agent
87
+ dsh plugin --profile web add google-trends-for-agent
82
88
  ```
83
89
 
84
- The first run usually prints a key and fails; a cached build in the pnpm store may pass immediately. Append the block below, using the exact key pnpm prints (ending in the commit hash), to the YAML dsh already generated at `$DSH_HOME/profiles/web/pnpm-workspace.yaml` (`DSH_HOME` defaults to `~/.dsh`). Keep all existing keys; do not overwrite the file. Then re-run the command. For another profile, replace `web` in both the command and the path:
90
+ If installing unreleased commits from GitHub `main` (`dsh plugin --profile web add github:meka-im/google-trends-for-agent`), the first run usually prints a key and fails; append the printed key as an `allowBuilds:` map with `: true` (not an `onlyBuiltDependencies:` list) to `$DSH_HOME/profiles/web/pnpm-workspace.yaml` (keeping existing keys) and re-run:
85
91
 
86
92
  ```yaml
87
93
  allowBuilds:
88
94
  "google-trends-for-agent@https://codeload.github.com/meka-im/google-trends-for-agent/tar.gz/<commit>": true
89
95
  ```
90
96
 
91
- pnpm suggests an `onlyBuiltDependencies:` list; dsh profiles require an `allowBuilds:` map with `: true` (a list under `allowBuilds` fails). The key changes whenever main moves; re-add it after updates.
92
-
93
97
  The plugin provides four native in-process tools (`trends_ask`, `trends_snapshot`, `trends_compare`, `trends_now`) and a `gtfa` skill. By default it does not start an MCP server, run the `gtfa` CLI, or call the Actor. The plugin is enabled by default after install. In dsh 0.2.2-rc.1, open **dsh web → Plugins → Google Trends** (the installed-plugin card), then under **Components** click the **Google Trends / gtfa** row to open the settings page. In the **Connection** section, use the three-way **Egress** control to pick **Local (this machine)**, **Public Actor**, or **My own Actor**. Click **Save** to apply egress changes; no restart is needed. Egress defaults to `local`; `actor-public` relays through the public `meka.im/google-trends-for-agent` Actor, and `actor-own` relays through a deployment in your own account (deploy or pick it on the same page). Both Actor routes run on demand with the residential proxy inside the Actor.
94
98
 
95
99
  When the dsh Host provides its credentials service, both Actor routes use Apify device OAuth first. Click **Sign in with Apify**; the page displays Apify's official authorization link and user code. The user confirms on Apify's official page, then the plugin stores the token through `ctx.credentials`; login needs no Save. Pending login checks Host status every 2 seconds, and the Host follows Apify's polling interval including `slow_down`. Closing the page pauses polling, reopening resumes, and expiry requires starting again. Apify's current device OAuth scope is only `full_api_access`: tell the user this grants full Apify API access, not access limited to this Actor or tool.
@@ -114,8 +118,8 @@ For explicitly selected local CLI/MCP access, run doctor after install or when
114
118
  a call fails unexpectedly. It checks that machine's route, not the Apify Actor:
115
119
 
116
120
  ```sh
117
- npx -y -p github:meka-im/google-trends-for-agent gtfa doctor
118
- npx -y -p github:meka-im/google-trends-for-agent gtfa doctor --json
121
+ npx -y -p google-trends-for-agent gtfa doctor
122
+ npx -y -p google-trends-for-agent gtfa doctor --json
119
123
  ```
120
124
 
121
125
  It prints PASS/FAIL for Node >= 20, Google Trends reachability, proxy mode, and one live `gpts` US 24h fetch. Exit code 0 means all checks passed.
@@ -129,7 +133,7 @@ Local CLI/MCP networking is direct by default. If this machine needs a proxy, se
129
133
  Choose the execution route before querying:
130
134
 
131
135
  1. **Apify Actor (recommended for Muse, GrokBot and Dots).** Choose the public Actor or the user's own deployment, with on-demand execution. Remote MCP connects to Apify's managed gateway; a connector/API, dsh, or `gtfa` / `gtfa-mcp --egress actor-public|actor-own` (with `APIFY_TOKEN`) starts the Actor through the platform API. Runs use the on-platform residential proxy and exit after completing the result. Successful local dsh snapshot-cache hits start no cloud run. Keep Server / Standby disabled. Compute, proxy and storage usage apply; there is no fixed per-call price. A call is capped at 300 seconds of Actor runtime. Caller cancellation should abort its owned run, with the platform timeout as a final bound.
132
- 2. **Your own machine IP (explicit direct access or development).** Run the stdio server locally, or run `npx -y -p github:meka-im/google-trends-for-agent gtfa-mcp --http --port 4321` and keep it bound to `127.0.0.1`.
136
+ 2. **Your own machine IP (explicit direct access or development).** Run the stdio server locally, or run `npx -y -p google-trends-for-agent gtfa-mcp --http --port 4321` and keep it bound to `127.0.0.1`.
133
137
  3. **The platform cloud VM (explicit direct access).** Run the client and server on that VM only when deliberately selected and outbound HTTPS is available. Installing `gtfa-mcp` with default `--egress local` does not route traffic through Apify; pass `--egress actor-public` (or `GTFA_EGRESS=actor-public`) with `APIFY_TOKEN` when routing through Apify from a local stdio/CLI process.
134
138
 
135
139
  | Client capability | Connection |
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.43 — 2026-11-26
4
+
5
+ ### dsh install walkthrough & docs alignment
6
+ - Add animated bilingual DeepSeek Harness (macOS) installation walkthrough SVGs (`docs/assets/demo-dsh-install-en.svg`, `docs/assets/demo-dsh-install-zh.svg`) embedded in `README.md`, `README.zh-CN.md`, and `docs/clients/dsh.md`.
7
+ - Simplify primary dsh install docs (`README.md`, `README.zh-CN.md`, `AGENTS.md`, `docs/reference.md`, `docs/clients/dsh.md`) to direct npm package installation (`google-trends-for-agent`), keeping GitHub `main` + `allowBuilds` as an optional development alternative.
8
+
9
+ ## 0.2.42 — 2026-11-26
10
+
11
+ ### npm release & documentation alignment
12
+ - Publish [`google-trends-for-agent`](https://www.npmjs.com/package/google-trends-for-agent) on npm with GitHub Actions provenance (`--provenance --access public` via `.github/workflows/publish-npm.yml`) and add the npm version badge to `README.md` / `README.zh-CN.md`.
13
+ - Update `README.md`, `README.zh-CN.md`, `AGENTS.md`, `docs/reference.md`, and client setup guides (`openclaw.md`, `codex.md`, `claude.md`, `cursor-vscode.md`, `dots.md`) to use `npm install -g google-trends-for-agent` and `npx -y -p google-trends-for-agent`, replacing stale pre-npm instructions.
14
+ - Document the standard `GitHub Release → npm publish → Apify Actor rebuild & health probe` release workflow in `docs/releasing.md`.
15
+
16
+ ### Apify Actor resilience (included since 0.2.41)
17
+ - Add automatic Apify proxy session fallback (`RESIDENTIAL` → default Apify Proxy → direct) and bounded transient retries on rotating proxy runs (`src/actor-proxy.ts`, `src/actor.ts`, `src/client.ts`).
18
+ - Add twice-daily and on-demand Apify Actor health check & `UNDER_MAINTENANCE` auto-recovery workflow (`scripts/apify-health.mjs`, `.github/workflows/apify-health.yml`).
19
+
3
20
  ## 0.2.41 — 2026-11-22
4
21
 
5
22
  ### Per-Actor-run billing ledger & dual-view history (dsh)
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  <p align="center">English | <a href="README.zh-CN.md">简体中文</a></p>
12
12
 
13
- <p align="center"><a href="https://apify.com/meka.im/google-trends-for-agent"><img src="https://img.shields.io/badge/Apify%20Store-google--trends--for--agent-97D700?style=flat-square" alt="Apify Store"></a> <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license"></a> <a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen?style=flat-square&logo=node.js&logoColor=white" alt="Node.js >= 20"></a> <img src="https://img.shields.io/badge/TypeScript-strict-3178C6?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript strict"> <img src="https://img.shields.io/badge/status-unofficial-orange?style=flat-square" alt="Unofficial"></p>
13
+ <p align="center"><a href="https://www.npmjs.com/package/google-trends-for-agent"><img src="https://img.shields.io/npm/v/google-trends-for-agent?style=flat-square&logo=npm&logoColor=white&color=CB3837" alt="npm version"></a> <a href="https://apify.com/meka.im/google-trends-for-agent"><img src="https://img.shields.io/badge/Apify%20Store-google--trends--for--agent-97D700?style=flat-square" alt="Apify Store"></a> <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license"></a> <a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen?style=flat-square&logo=node.js&logoColor=white" alt="Node.js >= 20"></a> <img src="https://img.shields.io/badge/TypeScript-strict-3178C6?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript strict"> <img src="https://img.shields.io/badge/status-unofficial-orange?style=flat-square" alt="Unofficial"></p>
14
14
 
15
15
  <p align="center"><a href="https://apify.com/meka.im/google-trends-for-agent"><picture><source media="(prefers-color-scheme: dark)" srcset="docs/assets/store-button-en-dark.png"><img src="docs/assets/store-button-en.png" alt="Open in Apify Store" width="231" height="44"></picture></a></p>
16
16
 
@@ -74,17 +74,19 @@ Apify's `full_api_access` OAuth scope grants account-wide API access. Clients wi
74
74
 
75
75
  ## Install & quick start
76
76
 
77
- The CLI/MCP require Node.js 20+. Nothing is published to npm; `npx` builds the package from the GitHub checkout on first run. The commands below follow the repository's `main` branch.
77
+ The CLI and MCP server are published on npm as [`google-trends-for-agent`](https://www.npmjs.com/package/google-trends-for-agent) and require Node.js 20+. Run immediately with `npx`:
78
78
 
79
79
  ```sh
80
- npx -y -p github:meka-im/google-trends-for-agent gtfa snapshot Sora --geo US --json --pretty
80
+ npx -y -p google-trends-for-agent gtfa snapshot Sora --geo US --json --pretty
81
81
  ```
82
82
 
83
- Building the GitHub dependency was verified with npm 11.19.1. npm 10.9.4 can build it and then fail while packaging it with a `GitFetcher` error about a missing Arborist dependency. If you hit that error, use the clone → `npm ci` → pack flow below or upgrade npm. The CLI and installed package still require Node.js 20+.
83
+ For frequent use, install globally from npm:
84
84
 
85
- The zero-install `npx` path builds from git on first use; build time depends on the network and machine. For frequent use, prefer a persistent install or the MCP server.
85
+ ```sh
86
+ npm install -g google-trends-for-agent
87
+ ```
86
88
 
87
- Persistent install (clone first because npm global git installs can omit build devDependencies during `prepare`). Pack and install the tarball so the clone can be deleted afterwards:
89
+ Or build from source if you prefer a local git checkout:
88
90
 
89
91
  ```sh
90
92
  git clone https://github.com/meka-im/google-trends-for-agent.git
@@ -93,9 +95,9 @@ npm ci
93
95
  npm install -g "$(npm pack | tail -1)"
94
96
  ```
95
97
 
96
- The clone tracks the repository's default `main` branch. If your review process requires an immutable source revision, add your own commit pin rather than relying on a moving branch.
98
+ The source checkout tracks the repository's default `main` branch. If your review process requires an immutable source revision, pin a published npm version or git commit rather than relying on a moving branch.
97
99
 
98
- The packed tarball bundles the audited `apify` dependency tree so a consumer install does not re-resolve older vulnerable Apify transitives. Root npm `overrides` do not propagate into consumers, so this bundle is part of the consumer protection. The root also applies an explicit `@crawlee/core` → `minimatch` `^11.0.1` security override (lock: `11.0.8`); Crawlee declares `^9`, so consumer `npm ls` may show a range warning even though the explicit override is intentional. Audits cover both the root tree and a clean install of the packed artifact. Bundling materially increases package size.
100
+ The published tarball bundles the audited `apify` dependency tree so a consumer install does not re-resolve older vulnerable Apify transitives. Root npm `overrides` do not propagate into consumers, so this bundle is part of the consumer protection. The root also applies an explicit `@crawlee/core` → `minimatch` `^11.0.1` security override (lock: `11.0.8`); Crawlee declares `^9`, so consumer `npm ls` may show a range warning even though the explicit override is intentional. Audits cover both the root tree and a clean install of the packed artifact. Bundling materially increases package size.
99
101
 
100
102
  The CLI is `gtfa`; `gtfa-mcp` runs the local MCP server. Both default to `local` egress (this machine's network) and also support Apify on-demand cloud egress (`--egress actor-public` or `--egress actor-own --actor <id>`, or `GTFA_EGRESS` / `GTFA_APIFY_ACTOR` with `APIFY_TOKEN`), giving direct access to the four `trends_*` tools through Apify's residential proxy. For managed remote MCP without a local Node process, Muse, GrokBot and Dots should start with the [Apify setup](docs/clients.md):
101
103
 
@@ -104,7 +106,7 @@ The CLI is `gtfa`; `gtfa-mcp` runs the local MCP server. Both default to `local`
104
106
  "mcpServers": {
105
107
  "google-trends": {
106
108
  "command": "npx",
107
- "args": ["-y", "-p", "github:meka-im/google-trends-for-agent", "gtfa-mcp"]
109
+ "args": ["-y", "-p", "google-trends-for-agent", "gtfa-mcp"]
108
110
  }
109
111
  }
110
112
  }
@@ -117,14 +119,14 @@ To route local stdio MCP or CLI calls through Apify's public Actor with `APIFY_T
117
119
  "mcpServers": {
118
120
  "google-trends": {
119
121
  "command": "npx",
120
- "args": ["-y", "-p", "github:meka-im/google-trends-for-agent", "gtfa-mcp", "--egress", "actor-public"],
122
+ "args": ["-y", "-p", "google-trends-for-agent", "gtfa-mcp", "--egress", "actor-public"],
121
123
  "env": { "APIFY_TOKEN": "<your-apify-token>" }
122
124
  }
123
125
  }
124
126
  }
125
127
  ```
126
128
 
127
- After the persistent install, use this config (or an absolute path to `gtfa-mcp`) to avoid resolving the GitHub package through npx on every start:
129
+ After a global install (`npm install -g google-trends-for-agent`), use this config (or an absolute path to `gtfa-mcp`) directly without invoking `npx` on every start:
128
130
 
129
131
  ```json
130
132
  {
@@ -135,38 +137,53 @@ After the persistent install, use this config (or an absolute path to `gtfa-mcp`
135
137
  For a local **Streamable HTTP** endpoint (bound to `127.0.0.1`):
136
138
 
137
139
  ```sh
138
- npx -y -p github:meka-im/google-trends-for-agent gtfa-mcp --http --port 4321 # http://127.0.0.1:4321/mcp
140
+ npx -y -p google-trends-for-agent gtfa-mcp --http --port 4321 # http://127.0.0.1:4321/mcp
139
141
  ```
140
142
 
141
143
  Check both package-download and data-fetch connectivity:
142
144
 
143
145
  ```sh
144
- curl -I https://github.com
146
+ curl -I https://registry.npmjs.org
145
147
  curl -I https://trends.google.com
146
148
  ```
147
149
 
148
- If `npx …` exits 128 with empty stdout/stderr, the GitHub package fetch failed before gtfa started; inspect the npm debug log (typically `~/.npm/_logs/`). **MCP fails to start** means npx/git errors or EOF before the handshake. **MCP started but a tool fetch failed** means the handshake and `tools/list` succeed, but the tool returns `NETWORK_ERROR`, `RATE_LIMITED`, or another upstream error. Use `gtfa doctor --json` for the latter.
150
+ If `npx …` exits non-zero with empty stdout/stderr, the npm package fetch failed before gtfa started; inspect the npm debug log (typically `~/.npm/_logs/`). **MCP fails to start** means npx/npm errors or EOF before the handshake. **MCP started but a tool fetch failed** means the handshake and `tools/list` succeed, but the tool returns `NETWORK_ERROR`, `RATE_LIMITED`, or another upstream error. Use `gtfa doctor --json` for the latter.
149
151
 
150
152
  ## dsh plugin
151
153
 
152
- Prerequisites: dsh requires **Node >=24.9** and **pnpm >=10** on PATH (`allowBuilds` needs pnpm 10; tested with 10.34.6). Install dsh with `npm i -g @deepseek-ai/dsh` and pnpm with `npm i -g pnpm@10`. The gtfa CLI/MCP alone require Node 20+ (`engines.node: >=20`). Without pnpm on PATH, plugin installation fails with `spawn pnpm ENOENT` / `pnpm was not found`.
154
+ <p align="center">
155
+ <img src="docs/assets/demo-dsh-install-en.svg" alt="Animated walkthrough of installing google-trends-for-agent in DeepSeek Harness for macOS" width="800">
156
+ </p>
157
+ <p align="center"><sub>DeepSeek Harness (macOS): open <b>Plugins → + Install plugin</b>, enter <code>google-trends-for-agent</code> directly (no npmjs.com URL), then restart to load the backend.</sub></p>
158
+
159
+ - **DeepSeek Harness Desktop (macOS):** open **Plugins → + Install plugin**, enter the npm package name **`google-trends-for-agent`** directly (do not paste a full `npmjs.com` web URL), and install with one click—no manual `allowBuilds` editing required.
160
+ - **dsh CLI (`dsh web`):** requires **Node >=24.9** and **pnpm >=10** on `PATH` (install dsh with `npm i -g @deepseek-ai/dsh` and pnpm with `npm i -g pnpm@10`; CLI/MCP alone only require Node 20+):
153
161
 
154
162
  ```sh
155
- dsh plugin --profile web add github:meka-im/google-trends-for-agent
163
+ dsh plugin --profile web add google-trends-for-agent
156
164
  ```
157
165
 
158
166
  After installing or upgrading the plugin, fully quit and reopen dsh to load its backend. Saving plugin settings applies them immediately.
159
167
 
160
- The first run usually prints a key and fails; a cached build in the pnpm store may pass immediately. Append the block below, using the exact key pnpm prints (ending in the commit hash), to the YAML dsh already generated at `$DSH_HOME/profiles/web/pnpm-workspace.yaml` (`DSH_HOME` defaults to `~/.dsh`). Keep all existing keys; do not overwrite the file. Then re-run the command. For another profile, replace `web` in both the command and the path:
168
+ <details>
169
+ <summary>Alternative: installing unreleased commits from GitHub <code>main</code></summary>
170
+
171
+ To test unreleased commits from `main` instead of the published npm package, install from GitHub:
172
+
173
+ ```sh
174
+ dsh plugin --profile web add github:meka-im/google-trends-for-agent
175
+ ```
176
+
177
+ The first run usually prints a build-approval key and fails (unless cached in the pnpm store). Append the printed key (ending in the commit hash) as an `allowBuilds:` map entry to `$DSH_HOME/profiles/web/pnpm-workspace.yaml` (`DSH_HOME` defaults to `~/.dsh`), keeping all existing keys, then re-run:
161
178
 
162
179
  ```yaml
163
180
  allowBuilds:
164
181
  "google-trends-for-agent@https://codeload.github.com/meka-im/google-trends-for-agent/tar.gz/<commit>": true
165
182
  ```
166
183
 
167
- pnpm's box may wrap the key across lines — copy it from this template, only the commit hash changes.
184
+ Use `: true` under `allowBuilds:` rather than an `onlyBuiltDependencies:` list; the key changes whenever `main` advances.
168
185
 
169
- pnpm suggests an `onlyBuiltDependencies:` list; dsh profiles require an `allowBuilds:` map with `: true` (a list under `allowBuilds` fails). The key changes whenever main moves; re-add it after updates.
186
+ </details>
170
187
 
171
188
  The plugin is enabled by default after install and provides four native tools plus a `gtfa` skill. In dsh 0.2.2-rc.1, open **dsh web → Plugins → Google Trends** (the installed-plugin card), then under **Components** click the **Google Trends / gtfa** row to open the settings page. Choose **Local (this machine)**, **Public Actor**, or **My own Actor** under **Egress**, then click **Save**; login itself needs no Save. When the Host provides its credentials service, both Actor routes offer **Sign in with Apify**: the page shows Apify's official authorization link and user code, checks pending status every 2 seconds while honoring Apify's polling interval (including `slow_down`), pauses when closed, resumes when reopened, and restarts an expired attempt. Apify's only current device OAuth scope is `full_api_access`—full Apify API access, not access limited to this Actor or tool.
172
189
 
package/README.zh-CN.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  <p align="center"><a href="README.md">English</a> | 简体中文</p>
12
12
 
13
- <p align="center"><a href="https://apify.com/meka.im/google-trends-for-agent"><img src="https://img.shields.io/badge/Apify%20Store-google--trends--for--agent-97D700?style=flat-square" alt="Apify Store"></a> <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license"></a> <a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen?style=flat-square&logo=node.js&logoColor=white" alt="Node.js >= 20"></a> <img src="https://img.shields.io/badge/TypeScript-strict-3178C6?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript strict"> <img src="https://img.shields.io/badge/status-unofficial-orange?style=flat-square" alt="Unofficial"></p>
13
+ <p align="center"><a href="https://www.npmjs.com/package/google-trends-for-agent"><img src="https://img.shields.io/npm/v/google-trends-for-agent?style=flat-square&logo=npm&logoColor=white&color=CB3837" alt="npm version"></a> <a href="https://apify.com/meka.im/google-trends-for-agent"><img src="https://img.shields.io/badge/Apify%20Store-google--trends--for--agent-97D700?style=flat-square" alt="Apify Store"></a> <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square" alt="MIT license"></a> <a href="https://nodejs.org"><img src="https://img.shields.io/badge/node-%3E%3D20-brightgreen?style=flat-square&logo=node.js&logoColor=white" alt="Node.js >= 20"></a> <img src="https://img.shields.io/badge/TypeScript-strict-3178C6?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript strict"> <img src="https://img.shields.io/badge/status-unofficial-orange?style=flat-square" alt="Unofficial"></p>
14
14
 
15
15
  <p align="center"><a href="https://apify.com/meka.im/google-trends-for-agent"><picture><source media="(prefers-color-scheme: dark)" srcset="docs/assets/store-button-zh-dark.png"><img src="docs/assets/store-button-zh.png" alt="在 Apify Store 打开" width="224" height="44"></picture></a></p>
16
16
 
@@ -72,17 +72,19 @@ Apify OAuth 的 `full_api_access` 是完整账号 API 权限。没有 MCP OAuth
72
72
 
73
73
  ## 安装与快速开始
74
74
 
75
- CLI/MCP 需要 Node.js 20+。项目不发布到 npm;首次运行时 `npx` 会从 GitHub 检出并构建。下方命令跟随仓库的 `main` 分支。
75
+ CLI 与 MCP 服务器已发布至 npm(包名 [`google-trends-for-agent`](https://www.npmjs.com/package/google-trends-for-agent)),需要 Node.js 20+。可直接通过 `npx` 运行:
76
76
 
77
77
  ```sh
78
- npx -y -p github:meka-im/google-trends-for-agent gtfa snapshot Sora --geo US --json --pretty
78
+ npx -y -p google-trends-for-agent gtfa snapshot Sora --geo US --json --pretty
79
79
  ```
80
80
 
81
- GitHub 依赖的构建已用 npm 11.19.1 验证。npm 10.9.4 可能先成功构建该依赖,随后在 npm 打包阶段因 `GitFetcher` 缺少 Arborist 依赖而报错。遇到该报错时,请使用下方的 clone → `npm ci` → pack 持久安装流程,或升级 npm。CLI 和安装后的包仍要求 Node.js 20+。
81
+ 频繁使用建议直接从 npm 全局安装:
82
82
 
83
- 零安装的 `npx` 路径会在首次使用时从 git 构建,耗时取决于网络和机器。频繁使用建议持久安装或运行 MCP 服务器。
83
+ ```sh
84
+ npm install -g google-trends-for-agent
85
+ ```
84
86
 
85
- 持久安装(先克隆,因为 npm 全局安装 git 依赖时,`prepare` 阶段可能缺少构建所需的 devDependencies)。用打包后的 tarball 安装,之后可以删除 clone 目录:
87
+ 也可以从源码仓库自行构建安装:
86
88
 
87
89
  ```sh
88
90
  git clone https://github.com/meka-im/google-trends-for-agent.git
@@ -91,9 +93,9 @@ npm ci
91
93
  npm install -g "$(npm pack | tail -1)"
92
94
  ```
93
95
 
94
- clone 默认跟随仓库的 `main` 分支。如果审查流程需要不可变源码版本,请自行加上 commit pin,不要依赖移动的分支。
96
+ 源码 clone 默认跟随仓库的 `main` 分支。如果审查流程需要不可变源码版本,请固定 npm 版本号或 git commit,不要依赖移动的分支。
95
97
 
96
- 打包后的 tarball 会内置经审计的 `apify` 依赖树,避免 consumer 重新解析较旧的 Apify 漏洞传递依赖。根 npm `overrides` 不会传播给 consumer,因此内置依赖树是 consumer 防护的一部分。根包还显式将 `@crawlee/core` 的 `minimatch` 覆盖为 `^11.0.1`(lock 为 `11.0.8`);Crawlee 声明的是 `^9`,因此 consumer 的 `npm ls` 可能显示范围警告,但这是有意设置的安全 override。审计同时覆盖根依赖树和打包产物在干净 consumer 中的安装;内置依赖会使包体积明显增大。
98
+ 发布的 tarball 会内置经审计的 `apify` 依赖树,避免 consumer 重新解析较旧的 Apify 漏洞传递依赖。根 npm `overrides` 不会传播给 consumer,因此内置依赖树是 consumer 防护的一部分。根包还显式将 `@crawlee/core` 的 `minimatch` 覆盖为 `^11.0.1`(lock 为 `11.0.8`);Crawlee 声明的是 `^9`,因此 consumer 的 `npm ls` 可能显示范围警告,但这是有意设置的安全 override。审计同时覆盖根依赖树和打包产物在干净 consumer 中的安装;内置依赖会使包体积明显增大。
97
99
 
98
100
  CLI 命令是 `gtfa`,本地 MCP 服务器由 `gtfa-mcp` 启动。两者默认走 `local` 本机网络,也支持 Apify 按需云端出口(`--egress actor-public` 或 `--egress actor-own --actor <id>`,或通过环境变量 `GTFA_EGRESS` / `GTFA_APIFY_ACTOR` 配合 `APIFY_TOKEN`),可在直接暴露四个 `trends_*` 工具的同时走 Apify 住宅代理。若客户端支持免本地进程的远程托管 MCP,Muse、GrokBot、Dots 优先按[Apify 接入指南](docs/clients.md)配置:
99
101
 
@@ -102,7 +104,7 @@ CLI 命令是 `gtfa`,本地 MCP 服务器由 `gtfa-mcp` 启动。两者默认
102
104
  "mcpServers": {
103
105
  "google-trends": {
104
106
  "command": "npx",
105
- "args": ["-y", "-p", "github:meka-im/google-trends-for-agent", "gtfa-mcp"]
107
+ "args": ["-y", "-p", "google-trends-for-agent", "gtfa-mcp"]
106
108
  }
107
109
  }
108
110
  }
@@ -115,14 +117,14 @@ CLI 命令是 `gtfa`,本地 MCP 服务器由 `gtfa-mcp` 启动。两者默认
115
117
  "mcpServers": {
116
118
  "google-trends": {
117
119
  "command": "npx",
118
- "args": ["-y", "-p", "github:meka-im/google-trends-for-agent", "gtfa-mcp", "--egress", "actor-public"],
120
+ "args": ["-y", "-p", "google-trends-for-agent", "gtfa-mcp", "--egress", "actor-public"],
119
121
  "env": { "APIFY_TOKEN": "<your-apify-token>" }
120
122
  }
121
123
  }
122
124
  }
123
125
  ```
124
126
 
125
- 持久安装后可直接使用下面的配置(或 `gtfa-mcp` 的绝对路径),避免每次启动都由 npx 解析 GitHub 包:
127
+ 全局安装(`npm install -g google-trends-for-agent`)后可直接使用下面的配置(或 `gtfa-mcp` 的绝对路径),无需每次启动都由 `npx` 解析:
126
128
 
127
129
  ```json
128
130
  {
@@ -133,38 +135,53 @@ CLI 命令是 `gtfa`,本地 MCP 服务器由 `gtfa-mcp` 启动。两者默认
133
135
  本地 **Streamable HTTP** 端点(仅绑定 `127.0.0.1`):
134
136
 
135
137
  ```sh
136
- npx -y -p github:meka-im/google-trends-for-agent gtfa-mcp --http --port 4321 # http://127.0.0.1:4321/mcp
138
+ npx -y -p google-trends-for-agent gtfa-mcp --http --port 4321 # http://127.0.0.1:4321/mcp
137
139
  ```
138
140
 
139
141
  检查包下载和数据抓取两段连通性:
140
142
 
141
143
  ```sh
142
- curl -I https://github.com
144
+ curl -I https://registry.npmjs.org
143
145
  curl -I https://trends.google.com
144
146
  ```
145
147
 
146
- 若 `npx …` 退出 128 且 stdout/stderr 为空,说明 gtfa 启动前 GitHub 包获取失败;查看 npm debug 日志(通常在 `~/.npm/_logs/`)。**MCP 无法启动**表现为 npx/git 错误、握手前 EOF;**MCP 已启动但工具取数失败**则握手和 `tools/list` 成功,工具返回 `NETWORK_ERROR`、`RATE_LIMITED` 等上游错误。后者可用 `gtfa doctor --json` 排查。
148
+ 若 `npx …` 非零退出且 stdout/stderr 为空,说明 gtfa 启动前 npm 包获取失败;查看 npm debug 日志(通常在 `~/.npm/_logs/`)。**MCP 无法启动**表现为 npx/npm 错误、握手前 EOF;**MCP 已启动但工具取数失败**则握手和 `tools/list` 成功,工具返回 `NETWORK_ERROR`、`RATE_LIMITED` 等上游错误。后者可用 `gtfa doctor --json` 排查。
147
149
 
148
150
  ## dsh 插件
149
151
 
150
- 前置条件:dsh 需要 **Node >=24.9**,并确保 **pnpm >=10** 在 PATH 中(`allowBuilds` 需要 pnpm 10;测试版本为 10.34.6)。用 `npm i -g @deepseek-ai/dsh` 安装 dsh,用 `npm i -g pnpm@10` 安装 pnpm。仅使用 gtfa CLI/MCP 时仍只需 Node 20+(`engines.node: >=20`)。PATH 中没有 pnpm 时,插件安装会报 `spawn pnpm ENOENT` / `pnpm was not found`。
152
+ <p align="center">
153
+ <img src="docs/assets/demo-dsh-install-zh.svg" alt="DeepSeek Harness Mac 客户端安装 google-trends-for-agent 插件动画演示" width="800">
154
+ </p>
155
+ <p align="center"><sub>DeepSeek Harness (Mac):打开<b>插件 → + 安装插件</b>,直接输入 npm 包名 <code>google-trends-for-agent</code>(不要填 npmjs.com 网址),安装完成后重启客户端即可加载后端。</sub></p>
156
+
157
+ - **DeepSeek Harness Mac 桌面端**:打开**插件 → + 安装插件**,在输入框中直接填写 npm 包名 **`google-trends-for-agent`**(不要粘贴 `npmjs.com/package/...` 网页链接)一键安装,无需手动修改 `allowBuilds`。
158
+ - **dsh CLI(`dsh web`)**:需要 **Node >=24.9** 且 **pnpm >=10** 在 `PATH` 中(`npm i -g @deepseek-ai/dsh pnpm@10`;仅用 `gtfa` CLI/MCP 时只需 Node 20+):
151
159
 
152
160
  ```sh
153
- dsh plugin --profile web add github:meka-im/google-trends-for-agent
161
+ dsh plugin --profile web add google-trends-for-agent
154
162
  ```
155
163
 
156
164
  安装或升级插件后,请完全退出并重新打开 dsh,以加载插件后端。插件设置保存后立即生效。
157
165
 
158
- 首次运行通常会打印 key 并失败;pnpm store 已缓存构建时可能直接成功。将下方代码块以 pnpm 打印的完整 key(以 commit hash 结尾)**追加**到 dsh 已生成的 `$DSH_HOME/profiles/web/pnpm-workspace.yaml`(`DSH_HOME` 默认为 `~/.dsh`),保留已有键,不要覆盖文件,然后重跑。使用其他 profile 时,同时替换命令和路径中的 `web`:
166
+ <details>
167
+ <summary>备选:从 GitHub <code>main</code> 安装未发包源码</summary>
168
+
169
+ 如需直接测试 `main` 分支最新未发版提交,可改为从 GitHub 安装:
170
+
171
+ ```sh
172
+ dsh plugin --profile web add github:meka-im/google-trends-for-agent
173
+ ```
174
+
175
+ 首次运行通常会打印构建批准 key 并失败(若 pnpm store 已缓存可能直接成功)。将 pnpm 打印的完整 key(以 commit hash 结尾)以 `allowBuilds:` map 格式追加到 `$DSH_HOME/profiles/web/pnpm-workspace.yaml`(`DSH_HOME` 默认为 `~/.dsh`),保留已有键并重跑命令:
159
176
 
160
177
  ```yaml
161
178
  allowBuilds:
162
179
  "google-trends-for-agent@https://codeload.github.com/meka-im/google-trends-for-agent/tar.gz/<commit>": true
163
180
  ```
164
181
 
165
- pnpm 的提示框可能把 key 折成多行,请从本模板复制,只需改 commit hash。
182
+ 请使用带 `: true` 的 `allowBuilds:` map(不要写成列表);`main` 前进后 key 会变化,更新后需重新添加。
166
183
 
167
- pnpm 的报错建议使用 `onlyBuiltDependencies:` 列表;dsh profile 应使用带 `: true` 的 `allowBuilds:` map(在 `allowBuilds` 下写列表会失败)。main 更新后 key 会变化,需要重新添加。
184
+ </details>
168
185
 
169
186
  插件安装后默认启用,提供四个原生工具和 `gtfa` skill。在 dsh 0.2.2-rc.1 中,打开 **dsh web → Plugins → Google Trends** 已安装插件卡片,在详情页 **Components** 下点击 **Google Trends / gtfa** 行进入设置页。在 **Connection(连接方式)** 区块选择 **本机直连**、**公共 Actor** 或 **我自己的 Actor**,再点 **Save(保存)** 应用 egress;登录本身不需要 Save。Host 提供 credentials service 时,两条 Actor 路线都提供 **Sign in with Apify(登录 Apify)**:页面显示 Apify 官方授权链接和 user code;pending 时每 2 秒查询一次状态并遵守 Apify 的 polling interval(包括 `slow_down`),关闭页面暂停、重新打开继续,过期后重新发起。Apify 当前的 device OAuth scope 只有 `full_api_access`——这是完整 Apify API 访问权限,不是仅限本 Actor 或本工具的权限。
170
187
 
@@ -2141,7 +2141,7 @@ function parseVersionStatus(value) {
2141
2141
 
2142
2142
  // src/client/update-banner.tsx
2143
2143
  var import_jsx_runtime5 = require("react/jsx-runtime");
2144
- var CLIENT_VERSION = "0.2.41" ? "0.2.41" : null;
2144
+ var CLIENT_VERSION = "0.2.43" ? "0.2.43" : null;
2145
2145
  var VERSION_URL = "api/gtfa.version";
2146
2146
  var DISMISS_STORAGE_KEY = "gtfa.update.dismissed.1";
2147
2147
  function template2(text2, values) {