feat(cron): add interactive E2E tests and fix cron trigger reactivity

- Add getScreenText() to TerminalCapture for reading rendered xterm.js screen
- Add E2E tests for in-session cron: inline firing, user priority, error resilience
- Fix cron prompts not processing by adding cronTrigger state dependency

This ensures cron-injected prompts are processed immediately when fired,
not just when streaming state changes, and provides comprehensive test
coverage for the in-session cron feature.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
tanzhenxin 2026-03-29 04:22:16 +00:00
parent f063e7cd22
commit a3623fd819
3 changed files with 343 additions and 1 deletions

View file

@ -1640,6 +1640,7 @@ export const useGeminiStream = (
// ─── Cron scheduler integration ─────────────────────────
const cronQueueRef = useRef<string[]>([]);
const [cronTrigger, setCronTrigger] = useState(0);
// Start the scheduler on mount, stop on unmount
useEffect(() => {
@ -1647,6 +1648,7 @@ export const useGeminiStream = (
const scheduler = config.getCronScheduler();
scheduler.start((job: { prompt: string }) => {
cronQueueRef.current.push(job.prompt);
setCronTrigger((n) => n + 1);
});
return () => {
scheduler.stop();
@ -1662,7 +1664,7 @@ export const useGeminiStream = (
const prompt = cronQueueRef.current.shift()!;
submitQuery(prompt, SendMessageType.UserQuery);
}
}, [streamingState, submitQuery]);
}, [streamingState, submitQuery, cronTrigger]);
return {
streamingState,