Skip to content

feat(jm): 新增 jm_search 工具(info_agent 禁漫搜索 / 浏览 / 排行) - #107

Merged
69gg merged 2 commits into
mainfrom
feature/better-jm
Oct 1, 2026
Merged

69gg merged 2 commits into
mainfrom
feature/better-jm

Conversation

@69gg

@69gg 69gg commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

变更内容

  • 给 info_agent 新增 jm_search 工具(src/Undefined/skills/agents/info_agent/tools/jm_search/)与领域层 src/Undefined/jm/searcher.py:mode=search 关键词检索、mode=browse 分类浏览(不需要关键词)、mode=ranking 日/周/月排行;筛选维度 target(站内/作品/作者/标签/角色)、sort、time_range、genre、sub_genre,返回车号(JM<数字>)、标题、作者、分类与更新时间,n 默认 5、上限 20,只查列表、不下载也不发送。
  • 参数校验与失败语义:mode=search 必须给 msg(≥2 字,纯数字车号直达该本子),browse/ranking 带关键词会被拦下并提示改用 search;ranking 固定按观看数排序,显式传其它 sort 时提示改用 browse;sub_genre 必须与 genre 同给,且只有网页端接口支持,被反爬拦截时直接返回原因。
  • 结果表头写明模式与生效筛选(如 🏆 禁漫日榜(同人 / CG));分类页与排行榜不返回总数,这类结果只提示「需要更多结果时可用 page=N+1 继续」,只有确实知道总页数时才说「还有更多」。
  • 域层通过 skills/shared.py::jm_search_text 桥接,handler 只依赖 skills 内模块与第三方 jmcpy,tests/test_skills_import_boundary.py 棘轮基线零改动;工具仅 info_agent 可见,不受 [jm].auto_extract_enabled 影响。
  • 文档同步:docs/configuration.md、docs/usage.md、README.md、ARCHITECTURE.md、CLAUDE.md、docs/development.md 与 info_agent 的 prompt.md / intro.md / config.json。
  • v3.18.2 发布准备:CHANGELOG 条目 + 版本号同步(pyproject.toml、src/Undefined/__init__.py、两个 App 的 package/lock/Cargo/tauri.conf 与 uv.lock,lock 只改根包版本、无依赖漂移)。

验证

  • uv run pytest tests/test_jm_searcher.py tests/test_jm_search_tool.py tests/test_skills_import_boundary.py tests/test_jm_tool.py tests/test_skill_handler_loading.py tests/test_agent_tool_registry.py -q → 82 passed
  • uv run ruff check . / uv run ruff format --check . → 通过;uv run mypy . → Success(815 files)
  • uv run python scripts/release_notes.py validate --tag v3.18.2 → 通过(tag / 各版本文件 / CHANGELOG 最新版本一致)
  • pre-commit 全量钩子通过(Python ruff + mypy,两个 App 的 Biome + tsc + cargo fmt/check/test)
  • 无 WebUI / Tauri UI 改动,无需截图

关联 issue

无

Summary by CodeRabbit

  • New Features
    • Added JM listing search, category browsing, and daily, weekly, and monthly rankings.
    • Search supports filters such as author, tag, role, category, and time range. Results include available listing details and book IDs.
    • Choose the number of results per page, up to 20. The feature displays listings only; it does not download books or send content.
  • Documentation
    • Updated usage and configuration guides with JM search examples and options.
  • Release
    • Updated the app version to 3.18.2.

69gg added 2 commits October 1, 2026 11:45
- 新增 `src/Undefined/jm/searcher.py`:按 `mode` 分派 jmcpy 的 `search` /
  `browse` / `ranking`,统一渲染车号列表(车号、标题、作者、分类、更新时间)
  与模式感知表头;分类页与排行榜不返回总数时只提示「需要更多结果时翻页」。
- info_agent 新增 `jm_search`:`mode=search` 支持 `target` / `sort` /
  `time_range` / `genre` / `sub_genre`,`mode=browse` 按分类浏览(无需关键词),
  `mode=ranking` 取日/周/月榜;`sub_genre` 必须与 `genre` 同给且只有网页端支持,
  `ranking` 固定按观看数排序。只查列表,不下载、不发送消息。
- 域层通过 `skills/shared.py::jm_search_text` 桥接,handler 不越界导入
  `Undefined.jm.*`,导入边界棘轮基线保持不变。
- CHANGELOG.md 新增 v3.18.2 条目:info_agent 的 jm_search 禁漫列表查询工具
  (关键词检索 / 分类浏览 / 日周月排行);
- 版本号同步到 3.18.2:pyproject.toml、src/Undefined/__init__.py、两个 App 的
  package.json / package-lock.json / Cargo.toml / Cargo.lock / tauri.conf.json
  与 uv.lock(lock 只改根包版本,无依赖漂移)。
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: 69gg/Undefined/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: f113f00b-4075-47fe-966d-f2526e2a3ac1

📥 Commits

Reviewing files that changed from the base of the PR and between 022ff29 and dd99eea.

⛔ Files ignored due to path filters (5)
  • apps/undefined-chat/package-lock.json is excluded by !**/package-lock.json
  • apps/undefined-chat/src-tauri/Cargo.lock is excluded by !**/*.lock
  • apps/undefined-console/package-lock.json is excluded by !**/package-lock.json
  • apps/undefined-console/src-tauri/Cargo.lock is excluded by !**/*.lock
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (25)
  • ARCHITECTURE.md
  • CHANGELOG.md
  • CLAUDE.md
  • README.md
  • apps/undefined-chat/package.json
  • apps/undefined-chat/src-tauri/Cargo.toml
  • apps/undefined-chat/src-tauri/tauri.conf.json
  • apps/undefined-console/package.json
  • apps/undefined-console/src-tauri/Cargo.toml
  • apps/undefined-console/src-tauri/tauri.conf.json
  • docs/configuration.md
  • docs/development.md
  • docs/usage.md
  • pyproject.toml
  • src/Undefined/__init__.py
  • src/Undefined/jm/searcher.py
  • src/Undefined/skills/agents/README.md
  • src/Undefined/skills/agents/info_agent/config.json
  • src/Undefined/skills/agents/info_agent/intro.md
  • src/Undefined/skills/agents/info_agent/prompt.md
  • src/Undefined/skills/agents/info_agent/tools/jm_search/config.json
  • src/Undefined/skills/agents/info_agent/tools/jm_search/handler.py
  • src/Undefined/skills/shared.py
  • tests/test_jm_search_tool.py
  • tests/test_jm_searcher.py

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.


📝 Walkthrough

Walkthrough

The info_agent gains a jm_search tool for JM keyword searches, category browsing, and rankings. The change adds listing retrieval and formatting, validates tool inputs, updates agent documentation, and changes project versions to 3.18.2.

Changes

JM listing search

Layer / File(s) Summary
JM listing retrieval and formatting
src/Undefined/jm/searcher.py, src/Undefined/skills/shared.py, tests/test_jm_searcher.py
Adds JM client calls for search, browse, and ranking. Formats query headings, book details, and pagination information. Tests cover retrieval, formatting, and defaults.
Tool contract and execution
src/Undefined/skills/agents/info_agent/tools/jm_search/config.json, src/Undefined/skills/agents/info_agent/tools/jm_search/handler.py, tests/test_jm_search_tool.py
Adds the tool schema and handler. The handler validates modes, keywords, filters, and paging inputs before calling the shared listing helper. Tests cover valid requests, validation errors, defaults, and query failures.
Agent exposure and release updates
src/Undefined/skills/agents/README.md, src/Undefined/skills/agents/info_agent/*, README.md, docs/*, ARCHITECTURE.md, CHANGELOG.md, CLAUDE.md, apps/undefined-{chat,console}/..., pyproject.toml, src/Undefined/__init__.py
Updates information-agent descriptions, examples, and JM configuration documentation. Removes whois from the architecture tool list. Changes project and application versions to 3.18.2. The JM entries in CLAUDE.md and docs/development.md remain unchanged.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant InfoAgent
  participant JmSearchHandler
  participant SharedJmSearchText
  participant JmSearcher
  participant JmcpyClient
  InfoAgent->>JmSearchHandler: Submit mode and search filters
  JmSearchHandler->>SharedJmSearchText: Pass validated query and runtime configuration
  SharedJmSearchText->>JmSearcher: Fetch and format listing
  JmSearcher->>JmcpyClient: Call search, browse, or ranking
  JmcpyClient-->>JmSearcher: Return listing page
  JmSearcher-->>SharedJmSearchText: Return formatted listing
  SharedJmSearchText-->>JmSearchHandler: Return result text
  JmSearchHandler-->>InfoAgent: Return result or error text
Loading

Merge Risk: ⚪ Minimal · up to dd99e

The JM listing flow is compatible with its dependency and has validation and error handling. The change is ready to merge after normal checks; live remote-service behavior was not verified.

Security Architecture Review

Security architecture risk: 🔵 Low · up to dd99e

The new capability retrieves catalog metadata without directly downloading files, sending messages, or accepting user-selected network destinations. Risk is low, but shared-session safety and access isolation are not fully established.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The supported exposure is the new listing caller, external JM service access, and any session storage selected by runtime configuration. There is no tool parameter for an arbitrary endpoint, proxy, credential, filesystem destination, or tenant. Deployment-wide and cross-tenant exposure cannot be determined from this evidence.

Security Findings and Attack Paths

  • observed — The inspected listing call graph contains no direct download or send operation. Its declaration permits later handoff of identifiers to the separate jm_book capability, but that is not automatic chaining in this implementation. No privileged attack path through that handoff was verified.

Trust Boundaries and Controls

  • observed — Argument validation precedes the network call, and runtime configuration owns network/session settings. Placement and guidance scope the capability to the information agent; these facts do not establish end-user authorization or isolation between users sharing that configuration.

Resilience and Maintainability Implications

  • inferred — Cancelling the awaiting coroutine does not necessarily stop its synchronous worker. That pattern predates this PR in JM detail retrieval, but another caller can increase overlapping activity. Session-write atomicity, concurrency isolation, and interruption recovery remain dependency proof gaps, not established corruption or credential-exposure findings.

Hardening Proposals

  • proposed — Preserve catalog metadata as untrusted data throughout model-facing result handling and subsequent handoffs; do not let listing content authorize unrelated tool actions.
  • proposed — Verify the locked dependency's session persistence and cleanup contract under concurrent calls, cancellation, and interruption before relying on a shared session directory for isolated access. Add serialization or separate session ownership only if that verification demonstrates a need.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.77% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 52 functions across 6 files. (19 skipped:… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely identifies the new jm_search tool and its search, browse, and ranking capabilities for info_agent.
Description check ✅ Passed The description explains the feature, affected modules and behavior, validation results, related issue status, and the absence of UI changes. It uses different headings from the template and does not …
Full details: Docstring Coverage

Explanation

Docstring coverage is 30.77% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 52 functions across 6 files. (19 skipped: 19 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@69gg 69gg changed the title feat(jm): 新增 jm_search 工具(info_agent 禁漫搜索 / 浏览 / 排行)与 v3.18.2 发布准备 feat(jm): 新增 jm_search 工具(info_agent 禁漫搜索 / 浏览 / 排行) Oct 1, 2026
@69gg
69gg merged commit 3a96355 into main Oct 1, 2026
6 checks passed
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.

1 participant