feat(timezone): make all user/LLM-facing timestamps timezone-configurable (#129)

Add top-level `timezone` config option (default: "system") supporting
IANA names and UTC offset strings (ECMA-402 2024).

- Introduce unified `src/utils/time.ts` module with formatForLLM,
  formatLocalDate, formatLocalDateTime, startOfLocalDay, nowInstantISO
- Converge 4 scattered time helpers into the single module
- L1 extraction / auto-recall / scene-extraction / persona-generation
  prompts now emit ISO 8601 with explicit UTC offset
- Add timezone declaration to LLM system prompts
- Local-day shard boundaries and cleaner cutoff follow configured tz
- Storage instants (SQLite/TCVDB) remain UTC — no data migration needed
- 38 unit tests covering IANA, offset, DST, half-hour zones, fallback
This commit is contained in:
Ruida Xu
2026-06-04 11:44:01 +08:00
committed by GitHub
parent c6ed755835
commit 32ba4d303d
15 changed files with 702 additions and 48 deletions
+5
View File
@@ -13,6 +13,11 @@
"type": "object",
"additionalProperties": true,
"properties": {
"timezone": {
"type": "string",
"default": "system",
"description": "时区配置:影响所有暴露给用户/LLM 的时间戳和本地日切片。可选值:\"system\"(跟随进程系统时区)、IANA 时区名(如 \"Asia/Shanghai\"、\"Europe/Berlin\")、UTC 偏移串(如 \"+08:00\"、\"-05:30\")。存储时间戳始终为 UTC,此配置仅影响展示层。"
},
"storeBackend": {
"type": "string",
"enum": ["sqlite", "tcvdb"],