refactor(acp): consolidate AGENT_SKILLS_DIRS into ACP_BACKENDS_ALL#1913
refactor(acp): consolidate AGENT_SKILLS_DIRS into ACP_BACKENDS_ALL#1913
Conversation
…illsDirs field Move native skill directory mapping from the standalone AGENT_SKILLS_DIRS constant in initAgent.ts into the AcpBackendConfig.skillsDirs field within ACP_BACKENDS_ALL. This eliminates data duplication — adding a new agent backend now only requires editing one configuration table. - Add skillsDirs field to AcpBackendConfig interface - Add hasNativeSkillSupport() and getSkillsDirsForBackend() to acpTypes.ts - Update setupAssistantWorkspace to read from ACP_BACKENDS_ALL - Re-export hasNativeSkillSupport from initAgent.ts for backward compat - Add unit tests for new utility functions (acpTypesSkillsDirs.test.ts)
Code Review:refactor(acp): consolidate AGENT_SKILLS_DIRS into ACP_BACKENDS_ALL (#1913)变更概述本 PR 将 方案评估结论:✅ 方案合理 重构方向正确——skill 目录配置理应与 backend 配置放在一起,避免两处维护同步。新的 问题清单🔵 LOW — initAgent.ts 中 export 语句插入在 import 块之间文件: 问题代码: import { uuid } from '@/common/utils';
// Re-export for backward compatibility (tests mock this path)
export { hasNativeSkillSupport };
import { existsSync } from 'fs'; // ← import 出现在 export 之后
import fs from 'fs/promises';问题说明: 修复建议:将 re-export 移到所有 import 语句之后: import type { ICreateConversationParams } from '@/common/adapter/ipcBridge';
import type { TChatConversation, TProviderWithModel } from '@/common/config/storage';
import type { PresetAgentType } from '@/common/types/acpTypes';
import { getSkillsDirsForBackend, hasNativeSkillSupport } from '@/common/types/acpTypes';
import { uuid } from '@/common/utils';
import { existsSync } from 'fs';
import fs from 'fs/promises';
import path from 'path';
import { getSkillsDir, getBuiltinSkillsCopyDir, getAutoSkillsDir, getSystemDir } from './initStorage';
import { computeOpenClawIdentityHash } from './openclawUtils';
// Re-export for backward compatibility (tests mock this path)
export { hasNativeSkillSupport };汇总
结论✅ 批准合并 — 无阻塞性问题,仅一处代码排列风格问题(LOW),不影响功能和正确性。 本报告由本地 CONCLUSION: APPROVED |
|
✅ 已自动 review,无阻塞性问题,正在触发自动合并。 |
* 'main' of github.com:wuhao1477/AionUi: (40 commits) fix(agents): prevent unhandled promise rejection in bootstrap initialization (iOfficeAI#1933) fix(gemini): restore context after stopping a reply (iOfficeAI#1932) fix(codex): reject start promise immediately on process exit during startup (iOfficeAI#1929) fix(conversation): sync renamed titles with detail view (iOfficeAI#1927) fix(paste): deduplicate filenames when pasting multiple images simultaneously fix(mobile): add SafeArea support and update app icon (iOfficeAI#1926) fix(database): guard against undefined params in databaseBridge providers (iOfficeAI#1924) fix(conversation): validate type field before creating conversation (iOfficeAI#1921) fix(docs): restore wechat_group_5.png reference to wx-5.png in readme fix(snapshot): add maxBuffer to git add/commit exec calls (iOfficeAI#1914) refactor(acp): consolidate AGENT_SKILLS_DIRS into ACP_BACKENDS_ALL (iOfficeAI#1913) fix(gemini): guard against EACCES in workspace realpath during init (ELECTRON-BM) (iOfficeAI#1912) fix(channels): send raw QR ticket instead of page URL in WeChat WebUI login SSE (iOfficeAI#1910) .md format chore(pr-automation): fix missed sleep 5 in comment to sleep 10 chore(pr-automation): increase auto-merge retry delay to 10s chore(pr-automation): add 5s retry for transient GitHub mergeStateStatus UNKNOWN fix(docs): remove trailing whitespace in OfficeCLI readmes chore(pr-automation): verify auto-merge success before labeling bot:done fix(snapshot): guard against non-existent workspace in WorkspaceSnapshotService.init (iOfficeAI#1906) ...
Summary
skillsDirsfield toAcpBackendConfiginterface inacpTypes.tsAGENT_SKILLS_DIRSintoACP_BACKENDS_ALLhasNativeSkillSupport()andgetSkillsDirsForBackend()utility functions toacpTypes.tssetupAssistantWorkspaceandAcpAgentManagerto use centralized confighasNativeSkillSupportfrominitAgent.tsfor backward compatibilityCloses #1911
Test plan
tests/unit/acpTypesSkillsDirs.test.ts— 11 tests forhasNativeSkillSupportandgetSkillsDirsForBackendtests/unit/initAgent.skills.test.ts— 19 existing tests pass (re-export compatibility)tests/unit/AcpAgentManagerSkillInjection.test.ts— 4 existing tests passtests/unit/acpAgentManagerCronGuard.test.ts— 9 existing tests passbunx tsc --noEmit— no type errors