@klarkxy/dsh-zhihu 0.2.2 → 0.2.4

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/README.md CHANGED
@@ -1,108 +1,69 @@
1
- # @klarkxy/dsh-zhihu
1
+ # Zhihu
2
2
 
3
3
  <!-- release-state-note -->
4
4
 
5
-
6
-
7
- Hand Zhihu to the agent as a research source: in-site search, global web search, the hot list, 直答 AI answers and public knowledge bases, plus question discovery, creator statistics and usage tracking. Every call uses your own Zhihu Access Secret, and what comes back is reference material for the agent, not a settled verdict.
8
-
9
5
  [简体中文](docs/README.zh-CN.md)
10
6
 
11
- Requires Node.js ≥22 (26 verified) and DSH `0.1.7-rc.2` or later. No repository build is needed.
7
+ Use Zhihu as a research source for the model: site search, web search, the hot list, Zhida answers, knowledge bases, question discovery, and creator statistics. Every request uses your own Zhihu Access Secret. Results are reference material, not conclusions.
12
8
 
13
9
  ## Install
14
10
 
15
- Install the published package into the target profile:
16
-
17
11
  ```sh
18
12
  dsh plugin --profile web add @klarkxy/dsh-zhihu
19
13
  ```
20
14
 
21
- Replace `web` with your profile name. Restart DSH Web, open **Plugins → @klarkxy/dsh-zhihu**, and enter your Access Secret (DSH credential `ZHIHU_ACCESS_TOKEN`). Use the full scoped name; the unscoped `dsh-zhihu` package belongs to another maintainer. To uninstall, run `dsh plugin --profile web remove @klarkxy/dsh-zhihu`.
15
+ Replace `web` with your profile name and restart DSH Web. Use the full scoped name; the unscoped `dsh-zhihu` belongs to someone else.
22
16
 
23
17
  ## Use
24
18
 
25
- **Plugins → @klarkxy/dsh-zhihu** holds the settings, **Statistics**, **Official usage**, the knowledge bases and **Test**. **Test** uses one function selector and shows the parameters and the result of whichever function you pick, covering search and question/creator queries: question recommendations, answer excerpts, your published content and comments, and account or per-content statistics. **Statistics** shows the daily calls, failures and returned results recorded on this machine. The separate **Official usage** tab fetches every official quota category when it opens and when you refresh it, drawing metric charts and values rather than showing raw JSON. Totals or used amounts that Zhihu does not return are never inferred, and separate API categories are not summed. **Test** holds business queries only, each of which needs an explicit click. No request is automatically retried or paginated. Existing agent tools and RPC endpoints remain available.
19
+ Open **Plugins → Zhihu** and enter your Access Secret under **Settings**. The other tabs are:
26
20
 
27
- ## Agent tools
21
+ - **Stats**: local daily calls, failures, and results;
22
+ - **Official quota**: your remaining free allowance as reported by Zhihu;
23
+ - **Knowledge base**: upload and search reference files;
24
+ - **Test**: run any search or query by hand.
28
25
 
29
- To enable the agent tools, add this entry to the plugin list in the `agent.cordis.yml` you use:
26
+ With the Web Search plugin installed, Zhihu web search also appears in its provider list.
27
+
28
+ ## Give the tools to the model
29
+
30
+ Add this to the plugin list of the `agent.cordis.yml` you use:
30
31
 
31
32
  ```yaml
32
33
  - name: '@klarkxy/dsh-zhihu/tools'
33
34
  ```
34
35
 
35
- Twelve tools are available once that entry is enabled. The five existing tools are unchanged:
36
-
37
- - `zhihu_search`: search within Zhihu for community evidence; results are community/reader feedback only, never canon, and never written into project files.
38
- - `zhihu_global_search`: search the wider web beyond Zhihu through the open platform's global search; reference only.
39
- - `zhihu_hot_list`: pull the Zhihu hot list to see current community trends; reference for topics and hotspots only.
40
- - `zhihu_ask`: ask Zhihu 直答, an OpenAI-compatible AI answer service grounded in Zhihu community content; suited for research and background investigation.
41
- - `zhihu_knowledge_search`: retrieve RAG fragments from Zhihu knowledge bases — public bases by default, with personal and subscription recall scopes available after you upload material on Zhihu's web side.
42
-
43
- ### Question discovery and creator data
44
-
45
- Aligned with [zhihu-search PR #4](https://github.com/klarkxy/zhihu-search/pull/4) and upstream `main` at `62fd3ce5c5761dd217094280390b394e4eb77ed2` (2026-09-28). All seven additions use **only the current Access Secret**. They neither accept an OAuth identity switch nor expose credentials as tool parameters.
46
-
47
- | Agent tool | RPC endpoint on `/zhihu` | Parameters | Official quota |
48
- | --- | --- | --- | --- |
49
- | `zhihu_question_recommendations` | `question.recommendations` | Optional `query`; `count` 1–20, default 5 | `question_discovery` |
50
- | `zhihu_question_answers` | `question.answers` | `questionUrl`; `offset`, `limit` | `question_discovery` |
51
- | `zhihu_user_content_detail` | `content.detail` | `contentUrl` | `creator` |
52
- | `zhihu_user_content_comments` | `content.comments` | `contentUrl`; `offset`, `limit`; `order`: `score` (default), `reverse`, `ascending` | `creator` |
53
- | `zhihu_creator_account_stats` | `creator.account.stats` | `contentType`: `all` (default), `answer`, `article`, `pin`, `zvideo`; paired dates | `creator` |
54
- | `zhihu_creator_content_stats` | `creator.content.stats` | `contentUrl`; paired dates | `creator` |
55
- | `zhihu_quota` | `quota` | Optional `apiIds` array; omit or `[]` for all | None |
56
-
57
- The service also accepts upstream-style underscore aliases such as `question_recommendations`, `question_answers`, `content_detail`, `content_comments`, `creator_account_stats`, and `creator_content_stats` (plus `user_content_detail` / `user_content_comments`). Parameter names remain camelCase as shown above.
58
-
59
- Omit `query` to get profile-based recommendations. An explicitly empty or whitespace-only theme is rejected. Recommendations do not paginate. `questionUrl` must be an HTTPS `www.zhihu.com/question/{id}` link. `contentUrl` must be a Zhihu answer, column article, pin, or video link; creator endpoints apply only to content published by the current account. Video details contain associated text, not video files.
60
-
61
- Paged tools accept `offset` as a non-negative Int64 **decimal string**, default `"0"`; RPC also accepts safe JavaScript integers. `limit` is an integer from 1 to 50, default 20. Every call fetches one page. Only continue when `paging.canContinue` is true, using its `nextOffset` verbatim. A short or empty page is not the end; a missing, invalid, non-advancing, or unsafe numeric `NextOffset` stops pagination with a warning. Never derive the next offset from item counts. `Totals` may include filtered answers; `Summary` is an upstream excerpt, not full text or a newly generated AI summary. Attached comment `Children` may be incomplete.
62
-
63
- Both statistics tools require `startDate` and `endDate` together, as valid `YYYY-MM-DD` calendar dates with end ≥ start. Omit both for the upstream default range; no range is invented locally. Missing metrics stay missing and ratios are not converted to percentages. New results contain `version`, `operation`, `data`, optional `quotaId`, and optional safe `paging`. Structured `data` retains the original upstream fields and HTML; tool rendering strips HTML and displays inert fenced text. Empty/missing `Body` is not presented as full text.
36
+ The model then gets these tools:
64
37
 
65
- ### Official quota versus local usage
38
+ | Tool | Purpose |
39
+ | --- | --- |
40
+ | `zhihu_search`, `zhihu_global_search`, `zhihu_hot_list` | Zhihu search, web search, hot list |
41
+ | `zhihu_ask` | Zhida AI answers based on Zhihu content |
42
+ | `zhihu_knowledge_search` | Search knowledge bases |
43
+ | `zhihu_question_recommendations`, `zhihu_question_answers` | Find questions and read answer summaries |
44
+ | `zhihu_user_content_detail`, `zhihu_user_content_comments` | Read your own published content and its comments |
45
+ | `zhihu_creator_account_stats`, `zhihu_creator_content_stats` | Your creator statistics |
46
+ | `zhihu_quota` | Check official quota |
66
47
 
67
- `zhihu_quota` calls `GET /api/v1/quota`; it is the only source of official remaining quota. Its `apiIds` allowlist is `global_search`, `zhihu_search`, `hot_list`, `question_discovery`, `zhida_openai`, `tools`, `knowledge`, `user_data`, and `creator`. Duplicate IDs are removed in first-seen order. Quota reads do not emit business-usage events, even on failure. No remaining-quota prediction, reset countdown, or automatic retry is added.
48
+ ## Cost protection
68
49
 
69
- Local usage is still tracked as daily counters of calls, failures, and returned results; usage views default to the last 30 days and accept at most 90. New business operations emit one event per tool/RPC call, with their quota category; local counters are not a billing ledger or official balance. Existing storage identifiers are unchanged. Knowledge-base uploads remain limited to 20 MB per file.
70
-
71
- Business errors retain their upstream message and code, including on HTTP error responses. RPC `error.details` may contain `status`, `upstreamCode`, `retryAfter` (seconds), and `retryable`. `30001` / `30002` are rate/quota limits; **`30003` is risk-control rejection, not an ordinary rate limit** and tells callers not to retry immediately. No request is automatically retried. Timeouts and cancellation cover response-body reads as well as the initial request.
72
-
73
- ## Works with the web search manager
74
-
75
- When this profile provides `ctx.web`, the plugin registers **Zhihu global search** directly with the host, independently of the search manager. If [@klarkxy/dsh-web-search-manager](https://www.npmjs.com/package/@klarkxy/dsh-web-search-manager) is installed, it discovers the provider for enablement and ordering. Configure the Access Secret in Zhihu settings; the Zhihu plugin resolves it per request and refreshes local availability after credential changes. The dedicated Zhihu tools work independently.
76
-
77
- ## Boundaries and limits
78
-
79
- - Search covers Zhihu in-site search, the wider web, the hot list, Zhihu 直答 AI answers, and public knowledge bases.
80
- - Uploaded reference files are stored in Zhihu's cloud; do not upload unpublished manuscripts.
81
- - This sync does not cover all upstream CLI/MCP features, such as OAuth identity management or PDF/PPT tasks.
82
- - The client accepts structural host controls and has native HTML fallbacks. Building or using this package does not require application-private UI packages.
83
- - Existing agent tools, credentials, RPC contracts and storage identifiers are preserved; the additions above are additive.
84
-
85
- [License](https://github.com/klarkxy/dsh-plugins/blob/main/plugins/dsh-zhihu/LICENSE)
86
-
87
-
88
- ## Call and cost protection
89
-
90
- Free protection is the default. Every business request checks fresh official free allowance for its quota group. Missing/invalid allowance, failed checks, insufficient capacity or an unknown mapping block the business request. Quota reads bypass the guard and daily cap without recursive preflight. The old quota input `question_answers` maps to `question_discovery`; business names and paths stay unchanged.
91
-
92
- The local cap defaults to 100 reserved business requests per Beijing day and accepts 1–100000. Failed/cancelled/unknown dispatched requests still count; failed preflight does not. These counters are not official allowance, wallet balances or a bill. No prices or balances are estimated.
93
-
94
- Known quota groups allow unpriced fast/thinking Zhida, recommendations and PDF/PPT tasks in free mode. Explicit paid mode blocks capabilities without confirmed billing and suggests free mode instead. Generic resource-file upload has no reliable quota mapping and is blocked; knowledge upload has a confirmed mapping.
95
-
96
- Plugin row configuration accepts `allowPaid` (default false) and `dailyCallLimit` (default 100), overriding the server environment `ZHIHU_ALLOW_PAID` and `ZHIHU_DAILY_CALL_LIMIT`. Reload using the host's normal configuration workflow. The Settings tab shows the active policy; business RPC/tool arguments cannot opt into paid use. `policy.status` is local and does not query Zhihu.
50
+ By default the plugin only uses Zhihu's free allowance: before each request it checks the official quota and skips the request if none is left. It also stops after 100 requests per day (Beijing time). Both can be changed in the plugin configuration:
97
51
 
98
52
  ```yaml
99
53
  config:
100
54
  allowPaid: false
101
- dailyCallLimit: 50
55
+ dailyCallLimit: 100
102
56
  ```
103
57
 
104
- Both projects share `~/.config/zhihu-search/call-policy/daily.json` and `request.lock`. `ZHIHU_SEARCH_HOME` changes the root; `ZHIHU_CALL_POLICY_DIR` explicitly selects the shared directory. All accounts/processes using that directory share the cap. The mutex covers preflight and dispatch; reservations persist before sending. No quota cache or automatic retry is used. Unknown outcomes retain conservative quota reservations across day rollover. Crashed owners' locks are not reclaimed automatically: confirm both clients have no in-flight requests and check the official console before manually removing the lock. Damaged ledgers fail closed.
58
+ Paid use is allowed only when you set `allowPaid: true` yourself.
59
+
60
+ ## Limits
61
+
62
+ - Zero cost is not guaranteed: other clients on the same account can use up the free allowance first.
63
+ - Uploaded files are stored on Zhihu's servers; do not upload unpublished manuscripts. Each file is limited to 20 MB.
64
+ - Requests are never retried automatically.
65
+ - Not included: OAuth account switching, top-ups, or wallet queries.
105
66
 
106
- This local protection cannot guarantee zero charges: other clients on the same account may consume free allowance after a check. Existing local usage is not billing. No recharge, redemption or wallet API is added. Sources: [prices](https://developer.zhihu.com/docs?key=billing_price), [free quota](https://developer.zhihu.com/docs?key=quota), [order agreement](https://developer.zhihu.com/content/order-agreement) (V1.0, effective 2026-10-10). Paying for API calls does not expand content access or redistribution rights.
67
+ ## License
107
68
 
108
- Official quota updates may lag. Free mode still queries every time, and also keeps a monotone local reservation ceiling, using the more conservative value without replenishing it during the day. This internal ceiling is never displayed as official remaining allowance. It resets per Beijing day; uncertain reservations remain.
69
+ [SATA License 2.1](LICENSE)
@@ -1,115 +1,69 @@
1
- # @klarkxy/dsh-zhihu
1
+ # 知乎
2
2
 
3
3
  <!-- release-state-note -->
4
4
 
5
-
6
-
7
- 把知乎交给模型当调研信源:站内搜索、全网搜索、热榜、直答和公开知识库,外加问题发现、创作数据与用量统计。每次请求都只用你自己的知乎 Access Secret,取回的内容是给模型参考的资料,不是定论。
8
-
9
5
  [English](../README.md)
10
6
 
11
- 需要 Node.js ≥22(已验证 26)、DSH `0.1.7-rc.2` 或更高版本,无需构建本仓库。
7
+ 把知乎交给模型当调研信源:站内搜索、全网搜索、热榜、知乎直答、知识库、问题发现和创作数据。每次请求都只用你自己的知乎 Access Secret;取回的内容是参考资料,不是定论。
12
8
 
13
9
  ## 安装
14
10
 
15
- 把已发布包装进目标 profile:
16
-
17
11
  ```sh
18
12
  dsh plugin --profile web add @klarkxy/dsh-zhihu
19
13
  ```
20
14
 
21
- 把 `web` 换成你的 profile 名。重启 DSH Web,从「插件」打开「知乎(@klarkxy/dsh-zhihu)」填写 Access Secret(DSH 凭据 `ZHIHU_ACCESS_TOKEN`)。请使用完整 scoped 包名;无 scope 的 `dsh-zhihu` 属于其他维护者。卸载用 `dsh plugin --profile web remove @klarkxy/dsh-zhihu`。
15
+ 把 `web` 换成你的 profile 名,重启 DSH Web。请使用完整的 scoped 包名;无 scope 的 `dsh-zhihu` 属于其他维护者。
22
16
 
23
17
  ## 使用
24
18
 
25
- 「插件 → 知乎(@klarkxy/dsh-zhihu)」下有设置、统计、官方用量、知识库和「测试」分区。「测试」通过一个功能选择框统一选择搜索、问题与创作查询,按所选功能显示对应参数和结果,覆盖问题推荐、回答摘要、本人已发布内容及评论、账号和单篇创作统计。「统计」展示本机记录的每日调用、失败和结果条数;独立的「官方用量」页签在打开时和手动刷新时查询全部官方额度项,以图表和数值展示,不显示原始 JSON。知乎未返回的总量或已用量不自行推算,不同接口类别的数据也不相加。「测试」只保留业务查询,均需手动点击。所有请求都不会自动重试或翻页。原有模型工具和共享 RPC 仍可使用。
19
+ 打开「插件 → 知乎」,在「设置」中填写 Access Secret。其他页签:
20
+
21
+ - **统计**:本机记录的每日调用、失败和结果条数;
22
+ - **官方用量**:知乎返回的剩余免费额度;
23
+ - **知识库**:上传并检索参考文件;
24
+ - **测试**:手动执行各类搜索和查询。
26
25
 
27
- ## 模型工具
26
+ 安装了网页搜索插件时,「知乎全网搜索」也会出现在它的服务列表中。
28
27
 
29
- 模型需要使用知乎工具时,在所用 `agent.cordis.yml` 的插件列表加入:
28
+ ## 让模型使用
29
+
30
+ 在所用 `agent.cordis.yml` 的插件列表中加入:
30
31
 
31
32
  ```yaml
32
33
  - name: '@klarkxy/dsh-zhihu/tools'
33
34
  ```
34
35
 
35
- 加入后,模型可使用十二个工具。原有五个工具保持兼容:
36
-
37
- - `zhihu_search`:知乎站内搜索,拉取社区证据;结果仅作社区/读者反馈参考,不构成 canon,也不直接写入项目文件。
38
- - `zhihu_global_search`:知乎开放平台全网搜索,检索站外公开网页资料;仅作参考。
39
- - `zhihu_hot_list`:拉取知乎热榜,了解当前社区热点;仅作题材与热点参考。
40
- - `zhihu_ask`:调用知乎直答(OpenAI 兼容的 AI 问答),基于知乎社区内容生成综合回答;适合考据与背景调研。
41
- - `zhihu_knowledge_search`:检索知乎知识库(RAG 片段),默认只查公开库;在知乎网页端上传过个人资料后可加个人/订阅召回范围。
42
-
43
- ### 问题发现与创作能力
44
-
45
- 对齐 [zhihu-search PR #4](https://github.com/klarkxy/zhihu-search/pull/4) 和主库 `main` 的 `62fd3ce5c5761dd217094280390b394e4eb77ed2`(2026-09-28)。以下新增接口**只使用当前 Access Secret**,不接受 OAuth 身份切换,模型参数中不暴露密钥。
46
-
47
- | 模型工具 | `/zhihu` 上的 RPC 端点 | 参数 | 官方额度分类 |
48
- | --- | --- | --- | --- |
49
- | `zhihu_question_recommendations` | `question.recommendations` | 可选 `query`;`count` 1–20,默认 5 | `question_discovery` |
50
- | `zhihu_question_answers` | `question.answers` | `questionUrl`;`offset`、`limit` | `question_discovery` |
51
- | `zhihu_user_content_detail` | `content.detail` | `contentUrl` | `creator` |
52
- | `zhihu_user_content_comments` | `content.comments` | `contentUrl`;`offset`、`limit`;`order` 为 `score`(默认)、`reverse`、`ascending` | `creator` |
53
- | `zhihu_creator_account_stats` | `creator.account.stats` | `contentType` 为 `all`(默认)、`answer`、`article`、`pin`、`zvideo`;成对日期 | `creator` |
54
- | `zhihu_creator_content_stats` | `creator.content.stats` | `contentUrl`;成对日期 | `creator` |
55
- | `zhihu_quota` | `quota` | 可选 `apiIds` 数组,省略或 `[]` 查全部 | 不消耗业务额度 |
56
-
57
- RPC 还接受主库风格的下划线别名:`question_recommendations`、`question_answers`、`content_detail`、`content_comments`、`creator_account_stats`、`creator_content_stats`,以及 `user_content_detail` / `user_content_comments`。参数名仍使用表中的 camelCase。
58
-
59
- 省略 `query` 才按当前账号画像推荐;显式空字符串或纯空白主题会被拒绝。推荐不分页。`questionUrl` 必须是 HTTPS `www.zhihu.com/question/{id}` 问题链接。`contentUrl` 仅支持知乎回答、专栏文章、想法或视频链接;创作接口仅查询当前账号已发布的内容,视频仅返回关联正文,不返回视频文件。
60
-
61
- 分页工具的 `offset` 使用非负 Int64 **十进制字符串**,默认 `"0"`;RPC 也接受 JavaScript 安全整数。`limit` 为 1–50 的整数,默认 20。每次只取一页,只有 `paging.canContinue=true` 才原样使用其 `nextOffset` 继续。空页或条目不足不能视为结束;`NextOffset` 缺失、无效、未前进或为不安全的数值时,返回警告并停止翻页,不按条目数补偏移。`Totals` 可能包含被过滤的回答;`Summary` 是上游摘要/截取文本,不是全文,也不是额外生成的 AI 摘要。评论附带的 `Children` 不保证完整。
62
-
63
- 统计日期 `startDate` / `endDate` 必须同时提供或同时省略,格式为有效公历 `YYYY-MM-DD`,结束日期不得早于开始日期。省略时采用上游默认范围,不自行指定天数。缺失指标不补零,比例不换算百分比。新增结果包含 `version`、`operation`、`data`、可选 `quotaId` 与安全分页信息 `paging`。结构化 `data` 保留上游字段及原始 HTML;工具展示清洗 HTML 后放入不会执行的文本代码块。缺少或为空的 `Body` 不能视为全文。
64
-
65
- ### 官方额度与本地用量
66
-
67
- `zhihu_quota` 调用 `GET /api/v1/quota`,是官方剩余额度的唯一来源。`apiIds` 白名单为 `global_search`、`zhihu_search`、`hot_list`、`question_discovery`、`zhida_openai`、`tools`、`knowledge`、`user_data`、`creator`;重复项按首次出现顺序去重。额度查询本身不记录业务调用事件,失败时也不计入。不会用本地计数预测余额或推算额度重置时间,也不自动重试。
68
-
69
- 本地用量仍按日计数(调用次数、失败次数与成功调用返回的条目数),视图默认展示最近 30 天,最多可查 90 天。新增业务工具与 RPC 每次调用只记录一次事件,并带有额度分类;本地计数不是账单,也不是官方余额。存储标识保持不变。知识库上传单文件上限仍为 20 MB。
36
+ 模型会获得以下工具:
70
37
 
71
- 业务错误保留上游消息与错误码,即使 HTTP 状态为失败。RPC 的 `error.details` 可包含 `status`、`upstreamCode`、`retryAfter`(秒)和 `retryable`。`30001` / `30002` 为频率或额度限制;**`30003` 为风控拒绝,不是普通限流**,会提示不要立即重试。所有请求均不自动重试;超时和取消覆盖响应正文读取,而不只是等待响应头。
38
+ | 工具 | 用途 |
39
+ | --- | --- |
40
+ | `zhihu_search`、`zhihu_global_search`、`zhihu_hot_list` | 知乎站内搜索、全网搜索、热榜 |
41
+ | `zhihu_ask` | 基于知乎内容的直答 |
42
+ | `zhihu_knowledge_search` | 检索知识库 |
43
+ | `zhihu_question_recommendations`、`zhihu_question_answers` | 发现问题、读取回答摘要 |
44
+ | `zhihu_user_content_detail`、`zhihu_user_content_comments` | 读取自己已发布的内容及评论 |
45
+ | `zhihu_creator_account_stats`、`zhihu_creator_content_stats` | 自己的创作数据 |
46
+ | `zhihu_quota` | 查询官方额度 |
72
47
 
73
- ## 与网络搜索联动
48
+ ## 费用保护
74
49
 
75
- 同一 profile 提供 `ctx.web` 时,本插件直接向宿主注册「知乎全网搜索」,无需安装搜索管理器。安装 [@klarkxy/dsh-web-search-manager](https://www.npmjs.com/package/@klarkxy/dsh-web-search-manager) 后,管理器会自动发现它,可在那里启用并排序。Access Secret 仍在「知乎资料」中配置,每次请求由知乎插件读取,凭据变更会刷新本地可用状态。专用知乎工具仍可独立使用。
76
-
77
- ## 边界与限制
78
-
79
- - 可查询站内、全网、热榜、直答和公开知识库。
80
- - 上传的参考文件保存在知乎云端,请勿上传未发表手稿。
81
- - 此次同步不代表主库的全部 CLI/MCP 能力都已移植;OAuth 身份管理、PDF/PPT 任务等不在本次范围。
82
- - 客户端接收宿主提供的结构化控件,缺失时使用原生 HTML 控件。构建和使用本包不依赖应用私有 UI 包。
83
- - 原有 Agent 工具、凭据、RPC 合同和存储标识保持兼容,上述能力为增量扩展。
84
-
85
- [许可证](https://github.com/klarkxy/dsh-plugins/blob/main/plugins/dsh-zhihu/LICENSE)
86
-
87
-
88
- ## 调用与费用保护
89
-
90
- 默认是免费保护模式:每个业务请求先即时查询对应的官方免费额度;查询失败、缺少有效额度、额度不足或映射未确认时,不发送业务请求。额度查询本身不递归预查、不消耗本地上限。工具名及业务路径保持原样;旧额度输入 `question_answers` 映射为 `question_discovery`,问题推荐和回答摘要共用该组。
91
-
92
- 本地北京时间每日上限默认 **100 次**,可设为 1–100000。计数口径是已持久化预留的业务请求:包括已发送后失败、取消或结果未知的请求;预查失败不占用上限。它与官方免费次数、已有本地工具使用统计、钱包和账单分别处理,不估算费用或余额。
93
-
94
- 免费模式可使用有可靠额度映射的 fast/thinking 直答、问题推荐以及 PDF/PPT 任务;缺少单价不影响使用已确认的免费额度。显式付费模式对未确认计费的能力保守拒绝,并提示切换回免费保护模式。通用资源文件上传尚无可靠额度映射,暂时阻止;知识库上传的 `knowledge` 映射已确认。
95
-
96
- 两个客户端共用 `~/.config/zhihu-search/call-policy/daily.json` 和 `request.lock`;`ZHIHU_SEARCH_HOME` 可改变根目录,`ZHIHU_CALL_POLICY_DIR` 可显式指定共同保护目录。同目录内所有账号/进程共用一个本地上限,避免多 Secret 或多入口绕开计数;自定义目录时需让两项目使用同一路径。锁覆盖预查与请求,状态先原子预留,不缓存额度、不自动重试。网络失败或取消后的未知请求保守占用对应免费容量,跨日仍保留这些未知预留。
97
-
98
- 本地保护**不能承诺绝对零费用**:同账号其他客户端可能在预查后竞争免费额度,平台扣费时间也不由本机控制。结果未知时先在官方控制台核对,不盲目重试。进程崩溃留下的锁不会自动抢占;确认两个客户端均无在途请求、核对未知请求后才可手动移除 `request.lock`。损坏的计数文件会失败关闭,不自动清零。
99
-
100
- 鉴权和账号设置保持不变。不提供充值、权益兑换或钱包查询。官方依据:[服务价格](https://developer.zhihu.com/docs?key=billing_price)、[免费额度](https://developer.zhihu.com/docs?key=quota)、[线上订购协议](https://developer.zhihu.com/content/order-agreement)(V1.0,2026-10-10 生效)。API 计费不扩大内容访问或传播授权范围。
101
-
102
-
103
- ### DSH 配置
104
-
105
- 插件行配置支持 `allowPaid`(默认 false)和 `dailyCallLimit`(默认 100);也可在 DSH 服务端启动环境设置 `ZHIHU_ALLOW_PAID`、`ZHIHU_DAILY_CALL_LIMIT`。显式插件行配置优先。例:
50
+ 默认只使用知乎的免费额度:每次请求前先查询官方额度,额度不足就不发送。另外每天(北京时间)最多 100 次请求。两项都可以在插件配置中修改:
106
51
 
107
52
  ```yaml
108
53
  config:
109
54
  allowPaid: false
110
- dailyCallLimit: 50
55
+ dailyCallLimit: 100
111
56
  ```
112
57
 
113
- 只有用户显式把 `allowPaid` 改为 true 才允许付费续用,不能在业务 RPC/工具参数里打开。设置页展示当前保护模式及每日上限;更改插件行配置或启动环境后按宿主方式重载。共享请求层覆盖页面 RPC、可选模型工具、原生 web search、独立客户端和知识库上传;`policy.status` 仅报告本地保护配置,不发送官方请求。
58
+ 只有你自己把 `allowPaid` 设为 `true` 才允许付费调用。
59
+
60
+ ## 限制
61
+
62
+ - 不能保证绝对零费用:同一账号的其他客户端可能先用掉免费额度。
63
+ - 上传的文件保存在知乎云端,请勿上传未发表手稿;单个文件最大 20 MB。
64
+ - 所有请求都不会自动重试。
65
+ - 不提供 OAuth 账号切换、充值或钱包查询。
66
+
67
+ ## 许可证
114
68
 
115
- 官方额度更新也可能滞后:免费模式每次仍查询官方值,同时保留本机已消耗预留的容量上限,取更保守的值,不在当天自动补回;这个内部上限不会作为官方余额展示。次日按北京时间重置,结果未知的预留仍保留。
69
+ [SATA License 2.1](../LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@klarkxy/dsh-zhihu",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Zhihu search, agent tools, knowledge bases, and usage tracking for DeepSeek Harness.",
5
5
  "icon": "./icon.svg",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -96,7 +96,7 @@
96
96
  },
97
97
  "dependencies": {
98
98
  "zod": "^4.1.5",
99
- "@klarkxy/dsh-plugin-kit": "0.3.1"
99
+ "@klarkxy/dsh-plugin-kit": "0.3.3"
100
100
  },
101
101
  "peerDependencies": {
102
102
  "@deepseek-ai/cordis": ">=4.0.4",
@@ -153,6 +153,6 @@
153
153
  "registry": "https://registry.npmjs.org/"
154
154
  },
155
155
  "dshRelease": {
156
- "contentHash": "649152913b8fc651d985856a814a4d8afd8b06cba6d5e345de5cdea220a0badb"
156
+ "contentHash": "a199b3487864cc4abb4892192df0016d444c87be0a59319c29255b20e2ecc63c"
157
157
  }
158
158
  }