feat: implement /loop command with fixed and dynamic scheduling (#621)
* feat: implement /loop command with fixed and dynamic scheduling modes Enable cron tools and /loop skill without the AGENT_TRIGGERS build flag by removing feature guards from tools.ts, REPL.tsx, and skill registration. The isKairosCronEnabled() runtime gate now enables cron unconditionally for open builds while preserving the GrowthBook kill switch for ant builds. The /loop skill supports four modes: fixed-interval with prompt, fixed-interval maintenance, dynamic-prompt (self-pacing), and dynamic maintenance (bare /loop). * chore: remove unused DEFAULT_INTERVAL constant from loop skill * revert: drop infra changes, scope PR to /loop skill rewrite only The cron activation layer (AGENT_TRIGGERS guard removal, isKairosCronEnabled hardcode) is covered by an in-flight stack (#633, #639). Scope this PR to just the loop.ts rewrite and its tests so it can land cleanly on top. * fix: restore infra changes needed for /loop in open build Bun's constant folder evaluates feature('AGENT_TRIGGERS') at bundle time through the bun:bundle shim — even when the flag is flipped to true in build.ts, the folded value is cached from the previous build and stays false. This means the feature-gated require() blocks for cron tools, useScheduledTasks, and loop skill registration all compile to dead code regardless of the flag. Fix by removing the AGENT_TRIGGERS guards from the specific paths /loop needs: - tools.ts: cron tools always registered (isEnabled gates visibility) - REPL.tsx: useScheduledTasks always mounted - index.ts: registerLoopSkill via static import, called unconditionally - prompt.ts: isKairosCronEnabled() bypasses feature flag for non-ant builds * fix: replace backslash line continuations with explicit delimiters in loop prompts The backslash-newline sequences inside template literals were acting as line continuations, collapsing newlines and merging prompt content with surrounding instruction text. Replace with --- BEGIN/END --- markers for unambiguous delimiting. Also add tests for trailing "every" clause parsing, human-readable unit normalization, and the non-interval "check every PR" case. * fix: remove remaining AGENT_TRIGGERS guards from print.ts and constants/tools.ts Completes the cron guard removal started in the previous commit. The cron scheduler in non-interactive (-p) mode was dead because print.ts still gated cronSchedulerModule/cronGate requires behind feature('AGENT_TRIGGERS'), which Bun constant-folds to false in open builds. Similarly, cron tool names were absent from IN_PROCESS_TEAMMATE_ALLOWED_TOOLS. Remove all three guards so the scheduler initialises (gated at runtime by isKairosCronEnabled) and cron tools are allowed for in-process teammates in all builds.
This commit is contained in:
12
src/tools.ts
12
src/tools.ts
@@ -26,13 +26,11 @@ const SleepTool =
|
||||
feature('PROACTIVE') || feature('KAIROS')
|
||||
? require('./tools/SleepTool/SleepTool.js').SleepTool
|
||||
: null
|
||||
const cronTools = feature('AGENT_TRIGGERS')
|
||||
? [
|
||||
require('./tools/ScheduleCronTool/CronCreateTool.js').CronCreateTool,
|
||||
require('./tools/ScheduleCronTool/CronDeleteTool.js').CronDeleteTool,
|
||||
require('./tools/ScheduleCronTool/CronListTool.js').CronListTool,
|
||||
]
|
||||
: []
|
||||
const cronTools = [
|
||||
require('./tools/ScheduleCronTool/CronCreateTool.js').CronCreateTool,
|
||||
require('./tools/ScheduleCronTool/CronDeleteTool.js').CronDeleteTool,
|
||||
require('./tools/ScheduleCronTool/CronListTool.js').CronListTool,
|
||||
]
|
||||
const RemoteTriggerTool = feature('AGENT_TRIGGERS_REMOTE')
|
||||
? require('./tools/RemoteTriggerTool/RemoteTriggerTool.js').RemoteTriggerTool
|
||||
: null
|
||||
|
||||
Reference in New Issue
Block a user