feat: 状态栏支持 refreshInterval 定时刷新

- Zod schema 补齐 refreshInterval 字段
- 通过 scheduleUpdate 复用 300ms debounce,event/settings/time 三路触发单飞
- 新增 docs/features/status-line.mdx 调研文档
This commit is contained in:
zny
2026-05-06 22:50:11 +08:00
parent 68c7ebb242
commit 2f150d3ecd
3 changed files with 285 additions and 0 deletions

View File

@@ -288,6 +288,15 @@ function StatusLineInner({ messagesRef, lastAssistantMessageId, vimMode }: Props
}
}, [lastAssistantMessageId, permissionMode, vimMode, mainLoopModel, scheduleUpdate]);
// Time-driven refresh: tick setInterval(refreshInterval seconds) through the
// existing debounced scheduleUpdate so interval + message-change don't double-fire.
const refreshIntervalMs = (settings?.statusLine?.refreshInterval ?? 0) * 1000;
useEffect(() => {
if (refreshIntervalMs <= 0) return;
const id = setInterval(() => scheduleUpdate(), refreshIntervalMs);
return () => clearInterval(id);
}, [refreshIntervalMs, scheduleUpdate]);
// When the statusLine command changes (hot reload), log the next result
const statusLineCommand = settings?.statusLine?.command;
const isFirstSettingsRender = useRef(true);

View File

@@ -552,6 +552,7 @@ export const SettingsSchema = lazySchema(() =>
type: z.literal('command'),
command: z.string(),
padding: z.number().optional(),
refreshInterval: z.number().optional(),
})
.optional()
.describe('Custom status line display configuration'),