Skip to content

Conversation

@dingyi222666
Copy link
Member

This PR switches the default preset from ChatGPT to Sydney and removes the code sandbox feature that required external API dependencies.

New Features

  • Sydney Preset: New Sydney preset with advanced conversational capabilities and tool-aware instructions
    • Supports web search prioritization when available
    • Includes comprehensive task planning with todos tool integration
    • Uses plain text output format optimized for chat interfaces
    • Features footnote-style link references
  • Group Management Whitelist: Added group ID whitelist feature for fine-grained access control
    • New groupWhitelist configuration option
    • When empty, available in all groups; when specified, only works in whitelisted groups

Removals

  • Code Sandbox Plugin: Removed Python code execution feature
    • Eliminated external dependency on E2B API
    • Removed code_sandbox.ts plugin file
    • Cleaned up related configuration options (codeSandboxAPIKey, codeSandboxSelector)
  • ChatGPT Preset: Removed in favor of Sydney preset

Other Changes

  • Changed default chat mode from chat to agent for better tool utilization
  • Changed default preset reference from chatgpt to sydney
  • Updated configuration schema to remove code sandbox settings
  • Improved log file timestamp format for better cross-platform compatibility
  • Fixed typo in zh-CN locale (用户 -> 用途)
  • Updated cron tool description to remove outdated dependency mentions

…iltering

- Add fsIgnores config option with default ignore patterns for common folders (node_modules, .git, dist, build, etc.)
- Implement ignore pattern matching using micromatch in FileStore
- Skip ignored files during search and list operations
- Update config schema to include fsIgnores with default patterns
- Add localization for new fsIgnores config option

This improves fs tool performance by skipping irrelevant folders and prevents unnecessary file operations on build artifacts and dependencies.
…d batch updates

- Add batch_set action for updating multiple todos at once
- Implement sequential task validation (tasks must be completed in order)
- Inject task progress tracking into chat context via before-chat hook
- Improve status display with checkbox format ([ ] / [x])
- Add minimum task requirement (at least 3 subtasks)
- Simplify user-facing messages and improve progress feedback
- Auto-cleanup completed task lists

This ensures better task tracking discipline and provides clearer progress visibility to users during multi-step operations.
…m compatibility

- Replace locale-specific date format with ISO 8601 format
- Use consistent YYYY-MM-DD-HH-mm-ss format for log filenames
- Remove locale-dependent characters that cause issues on different systems
- Ensure valid filenames across all operating systems

This fixes log file naming issues on systems with different locale settings.
…nd comprehensive task management

This commit introduces a complete rewrite of the cron task system:

- Replace command-based scheduling with database-backed task persistence
- Add database model `chatluna_cron_task` with comprehensive field support
- Implement CRUD operations: create, get (list), and cancel tasks
- Support two task types: notification (reminders) and command (bot commands)
- Add flexible time parsing: delays (Xs/Xm/Xh/Xd), specific times (HH:MM), and repeating tasks (time/interval)
- Implement permission system with `cronScopeSelector` for command-type tasks
- Add task restoration on bot restart via ctx.on('ready') and bot-status-updated events
- Extract Config interface and Schema to separate config.ts file for better modularity
- Update locale files with new cronScopeSelector configuration descriptions
- Remove dependency on legacy command validation and element utilities

The new implementation provides better reliability, persistence across restarts, and more intuitive task management for end users.
… management

- Change default chat mode from 'chat' to 'agent'
- Change default preset from 'chatgpt' to 'sydney'
- Remove chatgpt preset in favor of sydney
- Add group whitelist feature for fine-grained access control
- Remove code_sandbox plugin
- Add sydney.yml preset configuration
…ales

- Remove code sandbox API key and selector configuration sections
- Update cron description to remove dependency mentions
- Fix typo in zh-CN command description (用户 -> 用途)
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 6, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

调整 core 默认配置与预设匹配,规范日志时间戳;在 extension-tools 中拆分配置导出并移除 code_sandbox;新增/扩展 cron 持久化调度、文件就地替换(updateFile)、群组白名单与 todos 批量更新等工具与接口。

Changes

Cohort / File(s) 摘要
Core 配置与预设
packages/core/src/config.ts, packages/core/src/preset.ts, packages/core/src/utils/logger.ts
将 auto-create room 默认值:defaultChatMode'chat' 改为 'agent'defaultPreset'chatgpt' 改为 'sydney';getDefaultPreset 优先匹配触发词包含 sydney;trackLogToLocal 改为基于 ISO 格式生成无毫秒、用连字符替换冒号的时间戳,其他逻辑不变。
Extension 配置模块化
packages/extension-tools/src/config.ts, packages/extension-tools/src/index.ts
新增独立配置模块 config.ts(导出 Config 接口与复杂 Schema<Config>injectname),并在 index.ts 中移除内联配置声明,改为 export * from './config'
移除 code_sandbox 插件
packages/extension-tools/src/plugin.ts, packages/extension-tools/src/plugins/code_sandbox.ts
删除 code_sandbox.ts 文件并从 plugin.ts 中移除其注册/中间件条目,相关工具类与执行逻辑移除。
Cron 任务系统
packages/extension-tools/src/plugins/cron.ts
新增持久化表 chatluna_cron_taskCronTask 接口、内存调度句柄管理、时间解析/格式化工具、任务创建/列举/取消/执行流程,支持 notification/command 两类任务、重复与一次性逻辑,并更新 CronTool 构造签名与工具注册。
文件工具增强(fs)
packages/extension-tools/src/plugins/fs.ts
FileStore 增加忽略规则与 _shouldIgnore 过滤,新增 updateFile 方法(按次数替换并返回上下文片段),新增 UpdateFileTool 并在插件中注册,FileStore 构造签名调整以接受 ignores
群组授权门控
packages/extension-tools/src/plugins/group.ts
在 group 工具注册中加入 groupWhitelist 检查:若配置存在且非空,则仅允许白名单群;否则按原先逻辑放行。
Todos 批量更新
packages/extension-tools/src/plugins/todos.ts
增加 action: 'batch_set'updates 字段(数组 { todoId, status }),新增按序校验并应用批量更新流程,返回可读错误字符串与进度提示。

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant User as 用户
  participant Bot as Bot/Plugin
  participant Cron as CronTool
  participant DB as chatluna_cron_task
  participant Scheduler as 调度器(内存)

  User->>Bot: 创建定时任务请求
  Bot->>Cron: create(action, payload)
  Cron->>Cron: 解析时间/间隔与类型
  Cron->>DB: 插入任务记录
  DB-->>Cron: 任务ID/记录
  Cron->>Scheduler: 计算下次触发并注册回调
  Scheduler-->>Cron: 返回注销句柄
  Cron-->>User: 返回创建结果与任务信息

  Note over Scheduler,Cron: 到期触发
  Scheduler->>Cron: 执行任务回调
  Cron->>Bot: 根据类型发送通知/执行命令
  Cron->>DB: 更新 lastCall/重复任务下一次时间
Loading
sequenceDiagram
  autonumber
  participant User as 用户
  participant Bot as Bot/Plugin
  participant FS as UpdateFileTool
  participant Store as FileStore

  User->>Bot: 请求更新文件(路径、查找、替换、次数)
  Bot->>FS: call(update params)
  FS->>Store: updateFile(scope, path, find, replace, count)
  Store->>Store: 读取/过滤忽略/替换并写回
  Store-->>FS: 成功标志、替换数、上下文片段
  FS-->>User: 文本结果(含上下文)
Loading
sequenceDiagram
  autonumber
  participant User as 用户
  participant Bot as Bot/Plugin
  participant Todos as TodosTool
  participant Store as TodoState

  User->>Bot: action=batch_set, updates=[{id,status}...]
  Bot->>Todos: _call(payload)
  Todos->>Todos: 校验顺序与状态合法性
  alt 有非法顺序/状态
    Todos-->>User: 返回可读错误信息
  else 全部合法
    Todos->>Store: 依序应用更新
    Todos-->>User: 返回进度清单与完成提示(若全部完成)
  end
Loading

Estimated code review effort

🎯 4 (复杂) | ⏱️ ~60 minutes

Possibly related PRs

Poem

我是跃草间的小兔子,耳尖点点新更意;
默认走向 agent 台,预设寻向 sydney 派。
Cron 钟微响任务起,文件替换留前后迹;
待办批量序列理,群门白名单守与弃。 🐇✨

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed 标题简明指出将默认预设切换至 sydney 并移除 code sandbox 功能,与变更集的主要目标完全一致。标题中未包含无关文件列表或模糊词汇,语义清晰且易读。使用 feat 前缀符合常见约定式提交规范,为扫视历史记录的同事提供了有用的上下文。
Description Check ✅ Passed PR 描述详细列举了切换默认预设、移除 code sandbox、添加组白名单、更新日志时间戳格式、修复本地化文案等主要改动,与原始变更集内容高度对齐且没有偏离主题。描述信息清晰地覆盖了各项新增功能和删除项,便于审阅者快速理解改动内容。整体描述与代码改动密切相关,因此通过检查。
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/tool-imp

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.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @dingyi222666, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a major shift in the core AI experience by migrating from the ChatGPT preset to a more advanced Sydney preset, while simultaneously streamlining the system by removing the external dependency of the code sandbox feature. Beyond these core changes, significant enhancements have been made to task management, file system interactions, and group access controls, aiming to provide a more robust, intelligent, and configurable platform.

Highlights

  • Preset Switch and Code Sandbox Removal: The default AI preset has been switched from ChatGPT to a new 'Sydney' preset, which includes advanced conversational capabilities, web search prioritization, and comprehensive task planning. Concurrently, the Python code execution (code sandbox) feature and its external API dependency have been entirely removed.
  • Enhanced Cron Task Management: The cron tool has been significantly refactored to support persistent, database-backed scheduled tasks. It now allows users to create, list, and cancel one-time or recurring notifications and command executions with flexible time parsing.
  • Improved File System (FS) Tooling: The file system tool now includes a new file_update function for replacing text within files and supports configurable ignore patterns (fsIgnores) to exclude specific directories from file operations, enhancing control and efficiency.
  • Advanced To-Do List Integration: The to-do list tool now actively injects task progress into the AI's prompt context, enabling the model to track and manage subtasks more effectively. It also introduces batch status updates and enforces sequential completion of tasks.
  • Group Management Whitelist: A new groupWhitelist configuration option has been added, allowing fine-grained access control for group management functions, making them available only in specified groups.
  • Default Chat Mode Change: The default chat mode has been updated from chat to agent, optimizing for better tool utilization and more proactive AI behavior.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
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 successfully switches the default preset to "Sydney" and removes the code sandbox feature. It also introduces significant improvements to the cron and todos tools, making them more robust and feature-rich. The refactoring of the extension tools configuration into its own file is a good move for maintainability. I've found a few issues, including a bug where the default preset was not updated in the configuration, some inconsistencies in error handling, and potential improvements in a few implementation details. Overall, this is a great set of changes that enhances the agent's capabilities.

dingyi222666 and others added 4 commits October 6, 2025 17:09
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…or handling

- Remove codeSandbox boolean from config schema (already removed from plugin)
- Change todos tool error throwing to return error messages for better tool chain stability
Copy link
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: 5

🧹 Nitpick comments (2)
packages/core/src/utils/logger.ts (1)

38-43: 改进跨平台兼容性的有效实现。

时间戳格式的更改解决了跨平台文件名兼容性问题(特别是 Windows 不允许文件名中包含冒号)。使用 UTC 时间戳确保了不同时区环境下的一致性。

可选的改进建议:可以添加注释说明生成的时间戳格式(YYYY-MM-DD-HH-mm-ss)以提高代码可读性。

如果需要,可以应用以下差异添加说明性注释:

+    // 生成文件名安全的 UTC 时间戳,格式:YYYY-MM-DD-HH-mm-ss
     const currentTime = new Date()
         .toISOString()
         .replace(/\..+/, '')
         .replaceAll(':', '-')
         .split('T')
         .join('-')
packages/extension-tools/src/config.ts (1)

65-70: 移除已废弃的 codeSandbox 配置项
Line 68 仍保留 codeSandbox 开关,但该功能在本次改动中已经移除,继续暴露此项会让用户误以为功能仍然可用,也与 PR 目标不符。建议从 Schema 中删除这一字段,以免产生无效配置项。修改示例:

-        fs: Schema.boolean().default(false),
-        command: Schema.boolean().default(false),
-        codeSandbox: Schema.boolean().default(false),
-        cron: Schema.boolean().default(true)
+        fs: Schema.boolean().default(false),
+        command: Schema.boolean().default(false),
+        cron: Schema.boolean().default(true)
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a1e0d09 and 0da8df9.

⛔ Files ignored due to path filters (4)
  • packages/core/resources/presets/chatgpt.yml is excluded by !**/*.yml
  • packages/core/resources/presets/sydney.yml is excluded by !**/*.yml
  • packages/extension-tools/src/locales/en-US.schema.yml is excluded by !**/*.yml
  • packages/extension-tools/src/locales/zh-CN.schema.yml is excluded by !**/*.yml
📒 Files selected for processing (11)
  • packages/core/src/config.ts (1 hunks)
  • packages/core/src/preset.ts (1 hunks)
  • packages/core/src/utils/logger.ts (1 hunks)
  • packages/extension-tools/src/config.ts (1 hunks)
  • packages/extension-tools/src/index.ts (2 hunks)
  • packages/extension-tools/src/plugin.ts (0 hunks)
  • packages/extension-tools/src/plugins/code_sandbox.ts (0 hunks)
  • packages/extension-tools/src/plugins/cron.ts (3 hunks)
  • packages/extension-tools/src/plugins/fs.ts (10 hunks)
  • packages/extension-tools/src/plugins/group.ts (1 hunks)
  • packages/extension-tools/src/plugins/todos.ts (11 hunks)
💤 Files with no reviewable changes (2)
  • packages/extension-tools/src/plugins/code_sandbox.ts
  • packages/extension-tools/src/plugin.ts
🧰 Additional context used
🧬 Code graph analysis (5)
packages/core/src/preset.ts (2)
packages/core/src/llm-core/chat/app.ts (1)
  • preset (344-346)
packages/core/src/services/chat.ts (1)
  • preset (323-325)
packages/extension-tools/src/config.ts (1)
packages/core/src/services/chat.ts (1)
  • ChatLunaPlugin (594-781)
packages/extension-tools/src/plugins/fs.ts (1)
packages/extension-tools/src/plugin.ts (1)
  • plugin (17-47)
packages/extension-tools/src/plugins/cron.ts (2)
packages/extension-tools/src/config.ts (2)
  • Config (4-48)
  • Config (50-248)
packages/core/src/llm-core/platform/types.ts (1)
  • ChatLunaToolRunnable (107-115)
packages/extension-tools/src/plugins/group.ts (1)
packages/core/src/llm-core/platform/client.ts (1)
  • config (91-93)
🪛 GitHub Check: CodeFactor
packages/extension-tools/src/config.ts

[notice] 178-178: packages/extension-tools/src/config.ts#L178
This line has a length of 410. Maximum allowed is 160. (max-len)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: lint
🔇 Additional comments (2)
packages/core/src/preset.ts (1)

215-215: 变更符合PR目标!

将默认预设从 'chatgpt' 切换到 'sydney' 的更改正确实现了PR的目标。逻辑清晰,保持了原有的回退机制。

packages/core/src/config.ts (1)

125-125: 变更符合PR目标!

将默认聊天模式从 'chat' 改为 'agent' 正确实现了PR的目标。

…isplay

- Format logger timestamp code for better readability
- Fix todos tool to show correct status markers based on actual todo status
  - [ ] for pending
  - [→] for in_progress
  - [-] for cancelled
  - [x] for completed
Copy link
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: 4

♻️ Duplicate comments (1)
packages/extension-tools/src/plugins/todos.ts (1)

283-283: 状态标记仍然不准确(与先前审查重复)

283 行始终发送 - [x] ${todo.title},无论实际状态如何。这与先前审查中标记的问题相同,会在状态为 pending、in_progress 或 cancelled 时误导用户。

建议根据实际状态选择标记:

  • [ ] 用于 pending
  • [→] 用于 in_progress
  • [-] 用于 cancelled
  • [x] 仅用于 completed

应用此差异修复:

-        await session.send(`- [x] ${todo.title}`)
+        const statusMark =
+            todo.status === 'completed'
+                ? '[x]'
+                : todo.status === 'in_progress'
+                  ? '[→]'
+                  : todo.status === 'cancelled'
+                    ? '[-]'
+                    : '[ ]'
+        await session.send(`- ${statusMark} ${todo.title}`)
🧹 Nitpick comments (1)
packages/extension-tools/src/config.ts (1)

174-178: 考虑提取超长的默认提示词。

第 178 行包含一个长度为 410 字符的 drawPrompt 默认值,超过了代码风格的 160 字符限制。虽然这是一个合理的默认值,但考虑提取到单独的常量以提高可读性:

const DEFAULT_DRAW_PROMPT = `1girl, solo, female only, full body, masterpiece, highly detailed, game CG, spring, cherry blossoms, floating sakura, beautiful sky, park, extremely delicate and beautiful girl, high school girl, black blazer jacket, plaid skirt
short_hair, blunt_bangs, white_hair/pink_eyes, two-tone hair, gradient hair, by Masaaki Sasamoto, best quality, masterpiece, highres, red-eyeshadow, lipstick.`

然后在 Schema 中引用:

-            drawPrompt: Schema.string()
-                .role('textarea')
-                .default(
-                    `1girl, solo, female only, full body, masterpiece, highly detailed, game CG, spring, cherry blossoms, floating sakura, beautiful sky, park, extremely delicate and beautiful girl, high school girl, black blazer jacket, plaid skirt\nshort_hair, blunt_bangs, white_hair/pink_eyes, two-tone hair, gradient hair, by Masaaki Sasamoto, best quality, masterpiece, highres, red-eyeshadow, lipstick.`
-                ),
+            drawPrompt: Schema.string()
+                .role('textarea')
+                .default(DEFAULT_DRAW_PROMPT),
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0da8df9 and 4ee77c5.

📒 Files selected for processing (5)
  • packages/core/src/config.ts (1 hunks)
  • packages/core/src/utils/logger.ts (1 hunks)
  • packages/extension-tools/src/config.ts (1 hunks)
  • packages/extension-tools/src/plugins/fs.ts (10 hunks)
  • packages/extension-tools/src/plugins/todos.ts (10 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/extension-tools/src/plugins/fs.ts
  • packages/core/src/config.ts
🧰 Additional context used
🧬 Code graph analysis (1)
packages/extension-tools/src/config.ts (1)
packages/core/src/services/chat.ts (1)
  • ChatLunaPlugin (594-781)
🪛 GitHub Check: CodeFactor
packages/extension-tools/src/config.ts

[notice] 178-178: packages/extension-tools/src/config.ts#L178
This line has a length of 410. Maximum allowed is 160. (max-len)

packages/core/src/utils/logger.ts

[warning] 38-38: packages/core/src/utils/logger.ts#L38
Replace .toISOString().slice(0,·19).replace('T',·'-') with ⏎········.toISOString()⏎········.slice(0,·19)⏎········.replace('T',·'-')⏎········ (prettier/prettier)

🪛 GitHub Check: lint
packages/core/src/utils/logger.ts

[failure] 38-38:
Replace .toISOString().slice(0,·19).replace('T',·'-') with ⏎········.toISOString()⏎········.slice(0,·19)⏎········.replace('T',·'-')⏎········

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (12)
packages/extension-tools/src/plugins/todos.ts (6)

51-99: 任务进度注入实现良好

聊天前注入任务进度的实现很好:

  • 将活跃任务状态清晰地嵌入提示上下文
  • 使用直观的状态标记([✓]、[→]、[ ])
  • 为 LLM 提供了明确的更新指令
  • 正确使用 Document API 进行上下文增强

107-107: 批量更新功能架构合理

batch_set 操作的 schema 扩展设计良好:

  • action 枚举正确添加了 'batch_set'
  • updates 字段定义清晰,类型安全
  • 与现有代码集成流畅

Also applies to: 135-150, 164-164, 179-184


198-199: 错误处理改进正确

将错误从抛出异常改为返回描述性字符串是正确的做法:

  • 允许语言模型接收详细的错误信息
  • 使 LLM 能够理解问题并重试
  • 避免工具执行崩溃并返回通用错误

这解决了先前审查中对 310-312 行的关切。

Also applies to: 202-203, 247-247, 252-252, 257-258, 402-402, 407-407


263-273: 顺序验证逻辑实现正确

强制顺序更新的验证逻辑设计良好:

  • 正确验证前序任务必须完成或取消
  • 适用于 'in_progress' 和 'completed' 状态变更
  • 错误消息清晰,有助于 LLM 理解约束

319-359: 批量更新验证逻辑严谨

批量更新的验证实现非常完善:

  • 预先验证所有更新,避免部分应用
  • 按索引排序确保顺序处理
  • 正确应用顺序约束验证
  • 返回清晰的错误消息

这确保了批量操作的原子性和一致性。


285-293: 任务完成检查和清理实现良好

单个和批量更新中的完成检查逻辑一致且正确:

  • 准确识别所有子任务完成或取消的情况
  • 向用户发送完成通知
  • 从存储中清理已完成任务数据

这确保了资源的正确管理和良好的用户体验。

Also applies to: 380-388

packages/extension-tools/src/config.ts (6)

1-3: 导入声明正确。

导入的类型和模块都已正确使用。


4-48: 接口定义完整且类型正确。

Config 接口正确扩展了 ChatLunaPlugin.Config,并包含了所有必要的功能特性配置。groupWhitelist 的添加符合 PR 目标。


50-75: Schema 基础结构合理。

使用 Schema.intersect 组合多个配置对象,结构清晰,默认值设置合理。


244-247: i18n 配置正确。

正确配置了中英文本地化支持,从 YAML 文件加载翻译是良好实践。


249-254: 依赖注入和插件元数据配置正确。

inject 对象正确声明了必需和可选的依赖项,name 导出符合 Koishi 插件命名规范。


4-243: 确认 code sandbox 配置已正确移除。

针对之前审查中提到的 codeSandbox 属性问题,我确认该配置已从此文件中完全移除,符合 PR 目标。配置接口和 Schema 中均未包含任何 code sandbox 相关的属性。

Copy link
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: 0

♻️ Duplicate comments (3)
packages/core/src/utils/logger.ts (1)

38-42: 逻辑正确,但需要修复格式问题。

使用 toISOString() 替代本地化格式化确实提高了跨平台兼容性,符合 PR 目标。时间戳格式 YYYY-MM-DD-HH-mm-ss 生成逻辑正确。

然而,之前的审查评论已经指出格式问题——链式调用应拆分为多行以符合 prettier 规范。请应用之前建议的修复。

packages/extension-tools/src/plugins/todos.ts (2)

381-382: 批量更新中的状态标记不完整

批量更新的复选框逻辑仅区分 completed 和非 completed 状态,未反映 in_progress 和 cancelled:

const checkbox = updateInfo.status === 'completed' ? '[x]' : '[ ]'

这与第 283-291 行使用的全面状态标记映射不一致。

应用此差异以保持一致:

-            const checkbox = updateInfo.status === 'completed' ? '[x]' : '[ ]'
+            const checkbox =
+                updateInfo.status === 'completed'
+                    ? '[x]'
+                    : updateInfo.status === 'in_progress'
+                      ? '[→]'
+                      : updateInfo.status === 'cancelled'
+                        ? '[-]'
+                        : '[ ]'
             results.push(`- ${checkbox} ${todo.title}`)

419-423: get 操作中的状态标记不完整

get 操作的复选框逻辑与其他地方存在相同问题,仅区分 completed 和非 completed:

const checkbox = todo.status === 'completed' ? '[x]' : '[ ]'

为保持一致性并提供准确的状态信息,应使用与第 283-291 行相同的标记映射。

应用此差异:

             .map((todo) => {
-                const checkbox = todo.status === 'completed' ? '[x]' : '[ ]'
+                const checkbox =
+                    todo.status === 'completed'
+                        ? '[x]'
+                        : todo.status === 'in_progress'
+                          ? '[→]'
+                          : todo.status === 'cancelled'
+                            ? '[-]'
+                            : '[ ]'
                 return `- ${checkbox} ${todo.title}${todo.description ? ` - ${todo.description}` : ''}`
             })
🧹 Nitpick comments (1)
packages/extension-tools/src/plugins/todos.ts (1)

75-80: 标记符号轻微不一致

此处使用 [✓] 表示已完成状态,而在其他位置(如第 283-290 行)使用 [x] 表示相同状态。建议统一使用相同的标记符号以保持一致性。

应用此差异以统一标记符号:

         const status =
             todo.status === 'completed'
-                ? '[✓]'
+                ? '[x]'
                 : todo.status === 'in_progress'
                   ? '[→]'
                   : '[ ]'
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4ee77c5 and 6f1831b.

📒 Files selected for processing (2)
  • packages/core/src/utils/logger.ts (1 hunks)
  • packages/extension-tools/src/plugins/todos.ts (10 hunks)
🔇 Additional comments (10)
packages/extension-tools/src/plugins/todos.ts (10)

107-107: LGTM!

batch_set 操作的 schema 扩展正确,updates 字段结构清晰且文档完善。

Also applies to: 135-150


197-203: LGTM - 错误处理已改进

将错误处理从抛出异常改为返回描述性字符串,这为 LLM 提供了更好的反馈。最少 3 个子任务的验证是合理的约束。

如果将来需要,可以考虑将此阈值设为可配置项。


263-273: LGTM - 顺序验证逻辑正确

顺序验证确保任务按序更新,逻辑实现正确且错误消息清晰。


283-291: LGTM - 状态标记已修正

状态标记映射现已全面实现,正确区分了所有四种状态(completed、in_progress、cancelled、pending)。这解决了之前审查中标记的问题。


293-301: LGTM!

任务完成检查和存储清理逻辑正确,为用户提供了清晰的完成通知。


318-320: LGTM - 错误处理已改进

现在返回描述性错误字符串而不是抛出异常,这解决了之前的审查意见,为 LLM 提供了更有用的反馈。


327-347: LGTM!

批量更新验证逻辑正确,先验证所有更新,然后统一报告错误。这避免了部分更新的不一致状态。


354-367: LGTM!

批量更新中的顺序验证逻辑正确,在排序后验证确保任务按序更新。


389-396: LGTM!

批量更新的完成检查逻辑与单个更新一致,正确实现。


410-416: LGTM!

错误处理已改进为返回描述性字符串,与其他方法保持一致。

@dingyi222666 dingyi222666 merged commit 90481a5 into v1-dev Oct 6, 2025
3 of 5 checks passed
@dingyi222666 dingyi222666 deleted the fix/tool-imp branch October 6, 2025 09:59
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