Skip to content

feat(cindy-web-search): add AnySearch search provider - #197

Closed
HpIahtcthocw wants to merge 4 commits into
makecindy:mainfrom
HpIahtcthocw:feat/anysearch-provider
Closed

HpIahtcthocw wants to merge 4 commits into
makecindy:mainfrom
HpIahtcthocw:feat/anysearch-provider

Conversation

@HpIahtcthocw

Copy link
Copy Markdown

What changed

Add AnySearch as a new search provider for the cindy-web-search plugin:

  • ghost.json: version 1.4.0 → 1.5.0; declare api.anysearch.com host and an optional anysearch_api_key secret (Bearer injection, host-scoped); extend the search_web provider enum with anysearch; update the tool description.
  • main.js: new searchAnySearch() — POST https://api.anysearch.com/v1/search with { query, max_results }; maps data.results (snippet falls back to content); classifies HTTP errors (400/401/402/403/415/429/5xx) into actionable messages; never relays upstream bodies (a 402 body may contain auto-generated credentials); no retry or provider fallback, consistent with the other providers.
  • settings.html / settings.js: AnySearch option in the BYO provider dropdown plus an optional key row. Keyless (anonymous) usage is supported and called out in the UI.
  • locales/*: zh-CN / en / ja / ko updated for AnySearch.
  • .tests/cindy-web-search.test.mjs: updated manifest assertions plus 28 new tests (request shape, BYO default, shared 1–10 limit contract, HTTP error mapping including 402 credential non-leakage, structured host error codes, malformed/truncated/non-zero-code responses, settings persistence).

Why

Closes #2401 (Web Search 插件支持自定义/更多搜索 provider). AnySearch provides a free search source that works anonymously without an API key and is accessible from mainland China — exactly the "免费源" requested in the issue. The AnySearch open-source bounty programme confirmed that plugin-form integration into the official plugin repo is an acceptable integration.

Checklist

  • Reviewed the complete diff — no credentials, tokens, authorization codes, real user data, unrelated generated files, or node_modules.
  • ghost.json declares only capabilities actually used: one new network host (api.anysearch.com) and one optional secret (Bearer, host-scoped); justified in this description.
  • Tools with irreversible external side effects — n/a (search-only tool).
  • Every changed tool description matches actual behavior; settings copy stays consistent with it.
  • Bumped ghost.json version to 1.5.0 (greater than main's 1.4.0).
  • Cindy device verification — pending: requires installing the packaged .cindy on a real device running a stable production or Beta Cindy build (dev/local builds do not qualify). Will verify once the PR test package is available and record the verified version/channel here.
  • No minCindyVersion change.
  • For a new plugin — n/a (existing plugin).
  • Ran node --test .tests/localization.test.mjs — 2 of 3 pass; the failing test (plugins never infer language from the browser or operating system) fails on my-browser/extension/vendor/tesseract/*.wasm.js and is pre-existing on main, unrelated to this PR.
  • No src/ change (no node/worker.cjs rebuild needed).
  • No bundled dependency added or upgraded.
  • Every commit is signed off (git commit -s).

Verification

  • node scripts/validate-plugin-manifest.mjs ./cindy-web-search → cindy-web-search\ghost.json: valid Cindy plugin manifest.
  • node --test .tests/cindy-web-search.test.mjs → 68/68 pass (40 existing + 28 new).
  • node --test .tests/localization.test.mjs → 2/3 pass; the 1 failure is pre-existing on main (my-browser tesseract vendor binary), unrelated to this PR.
  • Device verification pending (see checklist).

Sensitive changes

  • New network host and optional secret in ghost.json (documented above). No OAuth/API scope change, no dependency/vendor/binary resources, no provisioning audience change, no minCindyVersion reduction. Diff scanned for credentials/tokens — none found (the only password/api_key strings are test fixtures asserting 402 credential non-leakage and a standard password input element).

Signed-off-by: HpIahtcthocw <3154200873@qq.com>
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

🤖 Contributor checklist / 贡献检查清单

Hi @HpIahtcthocw, the following items are still open / 以下事项尚待处理:

  • Cindy device verification / Cindy 实机验证 is unchecked. Download the package from the Verify pull request run → Artifacts, install on a stable/Beta Cindy device, record version/channel/SHA-256 under Verification, then check the box. / 实机验证未勾选:从 Verify pull request 的 Artifacts 下载测试包,在正式稳定版/Beta 实机安装验证,在「验证」一节记录版本/渠道/SHA-256 后勾选。

Version bump (ghost.json version > main), tests and packaging are checked by Verify pull request; open its failed step for the exact message. / 版本号 bump、测试与打包由 Verify pull request 检查,失败时点开对应步骤查看具体原因。

Updated automatically for 6bad15d (author association: NONE). See CONTRIBUTING.md / CONTRIBUTING.zh-CN.md. 本评论自动更新。

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-23T07:05:36.715111Z
We couldn’t complete this review. Comment @codex review to try again.
99f73f3 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

zqchris commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Thanks for the thorough PR — the code itself is clean. Since this adds a new third-party network host to a built-in plugin, a maintainer will decide whether to accept AnySearch as a provider. One concrete safety question in the meantime:

Unlike Brave / Tavily / DeepSeek, AnySearch works with no key, so the model can pass provider: "anysearch" and send the user's query to api.anysearch.com even if the user never chose AnySearch in settings. Could anonymous AnySearch calls be allowed only when the user has explicitly selected AnySearch as their BYO provider (or saved a key), and otherwise return NOT_CONFIGURED like the other providers? Also, could you share AnySearch's privacy / data-retention policy for queries sent anonymously?

@greptile-apps

greptile-apps Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] No code findings remain, but maintainer review and the acknowledged device check are still required before release.

Summary

敏感变更,需要维护者人工 review — High risk because this PR adds a network host and a host-managed secret.

Adds AnySearch with anonymous or API-key searches, saved provider preferences, and guidance in four languages.

  • Web Search can query AnySearch and return its results.
  • AnySearch searches only after a person opts in.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Search selects AnySearch] --> B{Saved provider choice or key?}
  B -->|No| C[Return NOT_CONFIGURED]
  B -->|Yes| D[Host sends search request]
  D --> E{Valid successful response?}
  E -->|No| F[Return safe error without response body]
  E -->|Yes| G[Return bounded results with string snippets]
Loading

Reviews (4) · Last reviewed commit: "fix(cindy-web-search): coerce non-string..." · Reviewed by Greptile

Comment thread cindy-web-search/locales/en.json Outdated
Comment thread cindy-web-search/ghost.json Outdated
Comment thread cindy-web-search/main.js Outdated
Signed-off-by: HpIahtcthocw <3154200873@qq.com>
@HpIahtcthocw

Copy link
Copy Markdown
Author

@zqchris thanks for the review — both points are valid. I've pushed a fix.

1. Anonymous calls now fail closed unless the user explicitly opted in

searchAnySearch() first calls a new anySearchConfigured() gate. An anonymous call to api.anysearch.com is only allowed when the user has explicitly opted in, otherwise it returns NOT_CONFIGURED without sending any network request:

  • the user selected AnySearch as their BYO default provider in settings (byoDefaultProvider === "anysearch" in /kv), or
  • the user saved an AnySearch API Key (anysearch_api_key present in /secrets).

This applies to both the default route and an explicit provider: "anysearch" from the model — the gate runs before any request, matching the other providers' fail-closed behavior. Covered by 5 new test cases (no opt-in → NOT_CONFIGURED + zero network calls; explicit provider still gated; saved key opts in; unrelated key does not; preference-read failure fails closed). Full suite: 69/69 pass, manifest validation passes.

2. AnySearch privacy / data-retention policy (anonymous queries)

From AnySearch's official FAQ (https://anysearch.com/faq):

  • Search queries are not stored. They collect only the minimal usage data needed to improve the product — "no personal or query data is stored."
  • Queries are never used for training and never shared with anyone.
  • Everything is encrypted in transit; credentials are transformed irreversibly, so sensitive data cannot be recovered or leaked at transport, processing, or storage layers.

This is corroborated by third-party reporting on the service (MIT Technology Review China, ITHome): zero-retention execution — query data is discarded immediately after processing, no tracking, no telemetry, no logging. Queries sent anonymously are subject to the daily free quota and IP rate limits described in the API docs (a 402 carries auto-generated credentials, which this plugin never relays).

Note the practical posture stays conservative regardless: anonymous usage is now opt-in only, and users can always configure their own key or stick to Cindy AI.

Comment thread cindy-web-search/main.js
…tions and settings

Signed-off-by: HpIahtcthocw <3154200873@qq.com>
…illing note

Signed-off-by: HpIahtcthocw <3154200873@qq.com>

zqchris commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Thanks for the contribution. We're not going to add AnySearch to the official built-in search plugin: it would let the model route user queries anonymously to a third-party service the user never chose, and we'd rather keep the built-in provider list small. Closing for now.

@zqchris zqchris closed this Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants