fix: 彻底移除 /loop 及 cron 工具的 feature('AGENT_TRIGGERS') gate

上次提交仅移除了 isKairosCronEnabled 中的 gate,但 /loop 整条链路
仍被 feature('AGENT_TRIGGERS') 拦截导致无法使用:
- skills/bundled/index.ts: registerLoopSkill() 未被调用
- tools.ts: CronCreate/Delete/List 工具未加载
- constants/tools.ts: cron 工具名未加入 teammate 工具列表
- screens/REPL.tsx: useScheduledTasks hook 被跳过
- cli/print.ts: pipe 模式 cron 调度器未初始化

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
claude-code-best
2026-04-01 11:57:16 +08:00
parent 33fe4940e1
commit 2934f30084
5 changed files with 15 additions and 41 deletions

View File

@@ -197,7 +197,7 @@ const PROACTIVE_NO_OP_SUBSCRIBE = (_cb: () => void) => () => {};
const PROACTIVE_FALSE = () => false;
const SUGGEST_BG_PR_NOOP = (_p: string, _n: string): boolean => false;
const useProactive = feature('PROACTIVE') || feature('KAIROS') ? require('../proactive/useProactive.js').useProactive : null;
const useScheduledTasks = feature('AGENT_TRIGGERS') ? require('../hooks/useScheduledTasks.js').useScheduledTasks : null;
const useScheduledTasks = require('../hooks/useScheduledTasks.js').useScheduledTasks;
/* eslint-enable @typescript-eslint/no-require-imports */
import { isAgentSwarmsEnabled } from '../utils/agentSwarmsEnabled.js';
import { useTaskListWatcher } from '../hooks/useTaskListWatcher.js';
@@ -4047,16 +4047,9 @@ export function REPL({
});
// Scheduled tasks from .claude/scheduled_tasks.json (CronCreate/Delete/List)
if (feature('AGENT_TRIGGERS')) {
// Assistant mode bypasses the isLoading gate (the proactive tick →
// Sleep → tick loop would otherwise starve the scheduler).
// kairosEnabled is set once in initialState (main.tsx) and never mutated — no
// subscription needed. The tengu_kairos_cron runtime gate is checked inside
// useScheduledTasks's effect (not here) since wrapping a hook call in a dynamic
// condition would break rules-of-hooks.
{
const assistantMode = store.getState().kairosEnabled;
// biome-ignore lint/correctness/useHookAtTopLevel: feature() is a compile-time constant
useScheduledTasks!({
useScheduledTasks({
isLoading,
assistantMode,
setMessages