Skip to content

chore: bump alpha.4 and scope agent tool masks#827

Merged
dingyi222666 merged 2 commits intov1-devfrom
fix/agent-permission
Apr 13, 2026
Merged

chore: bump alpha.4 and scope agent tool masks#827
dingyi222666 merged 2 commits intov1-devfrom
fix/agent-permission

Conversation

@dingyi222666
Copy link
Copy Markdown
Member

Summary

  • bump koishi-plugin-chatluna to 1.4.0-alpha.4 and update workspace peer dependency references to match
  • scope tool-mask filtering to globally registered tools so direct agent-local tools are not blocked by global allow lists
  • include the current hi 数据库! workspace snapshot file in this branch

Update workspace package peers to 1.4.0-alpha.4 and keep global tool masks scoped to registered tools so direct agent-local tools remain callable.
@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
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 13, 2026

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (2)
  • packages/extension-agent/package.json is excluded by !**/*.json
  • packages/extension-tools/package.json is excluded by !**/*.json

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1ea3dd19-ef40-4981-99ef-759f5c29aa49

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

概览

该变更向 ToolMask 接口添加了可选的 tools 字段,用于显式列出允许的工具,并更新多个位置的过滤逻辑以在应用基于模式的规则之前优先使用该列表。

变更

组件 / 文件 摘要
参考列表更新
packages/...worktree-references (推论)
添加了四个新的 worktree-agent-* 条目,调整了现有分支/工作树引用列表。
工具掩码类型定义
packages/core/src/llm-core/agent/types.ts
ToolMask 接口添加了可选的 tools?: string[] 字段;更新了 applyToolMask() 函数,使其在 mask.tools 存在且不包含指定工具名称时直接返回 true
服务过滤逻辑
packages/core/src/llm-core/platform/service.ts, packages/extension-agent/src/service/permissions.ts
PlatformService.getFilteredTools 现在根据 mask.tools 预先过滤工具列表;buildToolMask 已更新为在所有模式下('all'、'allow'、'deny')的返回对象中包含完整的 tools 列表。

预计代码审查工作量

🎯 2 (简单) | ⏱️ ~10 分钟

可能相关的拉取请求

诗歌

🐰 工具的清单已列明,
tools 字段闪闪发光,
过滤先行,规则在后,
掩码更聪慧,权限更透彻,
代理的舞蹈变得优雅!✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed 标题清晰准确地反映了变更的两个主要目的:版本号升级(alpha.4)和工具掩码范围限定(scope agent tool masks)。
Description check ✅ Passed 描述与变更集高度相关,详细列出了三个主要改动:版本升级、工具掩码范围限定和工作区快照文件更新。

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/agent-permission

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 and usage tips.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the version of koishi-plugin-chatluna to 1.4.0-alpha.4 across multiple packages and introduces a tools property to the ToolMask interface to refine tool filtering logic. Feedback highlights a logic inconsistency in getFilteredTools where tools not explicitly listed in mask.tools are incorrectly excluded, which contradicts the logic implemented in applyToolMask. Additionally, a debug file containing git branch information and ANSI escape codes was accidentally committed and should be removed.

Comment thread packages/core/src/llm-core/platform/service.ts
Comment thread hi 数据库! Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/core/src/llm-core/agent/types.ts (1)

206-212: 建议给 tools 增加语义注释,降低误用概率。

当前 tools 更像“mask 作用域”而不是“最终 allowlist”。建议在字段处补一行注释,明确未命中 tools 的名称应走“放行/不受该 mask 约束”的语义。

💡 可选补丁
 export interface ToolMask {
     mode: 'all' | 'allow' | 'deny'
+    // Scope of globally registered tools this mask applies to.
+    // Names outside this list are considered out-of-scope for this mask.
     tools?: string[]
     allow: string[]
     deny: string[]
     toolCallMask?: ToolMask
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/core/src/llm-core/agent/types.ts` around lines 206 - 212, Add a
clarifying comment on the ToolMask.tools field to state its semantic: tools is
the scope of the mask (i.e., which tool names the mask applies to), not the
final allowlist; tool names not listed in tools are exempt from this mask and
should be handled as "unconstrained" (i.e., allowed/ignored by this mask).
Update the ToolMask interface (referencing ToolMask and the tools property) to
include this single-line doc comment so callers don't mistake tools for the
definitive allowlist.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@hi` 数据库!:
- Around line 1-8: The file "hi 数据库!" is a local worktree snapshot that should
not be committed; remove this file from the commit (unstage/delete it from the
index and commit the removal), add an appropriate .gitignore entry to prevent
re-adding similar worktree snapshot files, and ensure no build/config/docs
reference the file; if the file was already pushed and must be purged,
coordinate to remove it from history (e.g., git filter-repo) with the team.

---

Nitpick comments:
In `@packages/core/src/llm-core/agent/types.ts`:
- Around line 206-212: Add a clarifying comment on the ToolMask.tools field to
state its semantic: tools is the scope of the mask (i.e., which tool names the
mask applies to), not the final allowlist; tool names not listed in tools are
exempt from this mask and should be handled as "unconstrained" (i.e.,
allowed/ignored by this mask). Update the ToolMask interface (referencing
ToolMask and the tools property) to include this single-line doc comment so
callers don't mistake tools for the definitive allowlist.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b847b5bf-70bc-4120-aed6-f088e104d7e7

📥 Commits

Reviewing files that changed from the base of the PR and between 6cd31a3 and 4b425e8.

⛔ Files ignored due to path filters (26)
  • packages/adapter-azure-openai/package.json is excluded by !**/*.json
  • packages/adapter-claude/package.json is excluded by !**/*.json
  • packages/adapter-deepseek/package.json is excluded by !**/*.json
  • packages/adapter-dify/package.json is excluded by !**/*.json
  • packages/adapter-doubao/package.json is excluded by !**/*.json
  • packages/adapter-gemini/package.json is excluded by !**/*.json
  • packages/adapter-hunyuan/package.json is excluded by !**/*.json
  • packages/adapter-ollama/package.json is excluded by !**/*.json
  • packages/adapter-openai-like/package.json is excluded by !**/*.json
  • packages/adapter-openai/package.json is excluded by !**/*.json
  • packages/adapter-qwen/package.json is excluded by !**/*.json
  • packages/adapter-rwkv/package.json is excluded by !**/*.json
  • packages/adapter-spark/package.json is excluded by !**/*.json
  • packages/adapter-wenxin/package.json is excluded by !**/*.json
  • packages/adapter-zhipu/package.json is excluded by !**/*.json
  • packages/core/package.json is excluded by !**/*.json
  • packages/extension-agent/package.json is excluded by !**/*.json
  • packages/extension-long-memory/package.json is excluded by !**/*.json
  • packages/extension-tools/package.json is excluded by !**/*.json
  • packages/extension-variable/package.json is excluded by !**/*.json
  • packages/renderer-image/package.json is excluded by !**/*.json
  • packages/service-embeddings/package.json is excluded by !**/*.json
  • packages/service-multimodal/package.json is excluded by !**/*.json
  • packages/service-search/package.json is excluded by !**/*.json
  • packages/service-vector-store/package.json is excluded by !**/*.json
  • packages/shared-adapter/package.json is excluded by !**/*.json
📒 Files selected for processing (4)
  • hi 数据库!
  • packages/core/src/llm-core/agent/types.ts
  • packages/core/src/llm-core/platform/service.ts
  • packages/extension-agent/src/service/permissions.ts

Comment thread hi 数据库! Outdated
Align the extension-tools peer dependency with the new agent release and drop the accidentally committed branch snapshot file.
@dingyi222666 dingyi222666 merged commit fe99839 into v1-dev Apr 13, 2026
3 checks passed
@dingyi222666 dingyi222666 deleted the fix/agent-permission branch April 13, 2026 16:10
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