mirror of
https://github.com/TencentCloud/TencentDB-Agent-Memory
synced 2026-07-10 12:34:27 +00:00
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:
@@ -23,6 +23,7 @@ import { createRequire } from "node:module";
|
||||
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core";
|
||||
import { parseConfig } from "./src/config.js";
|
||||
import type { MemoryTdaiConfig } from "./src/config.js";
|
||||
import { initTimeModule, getActiveTimeZone } from "./src/utils/time.js";
|
||||
import { registerOffload } from "./src/offload/index.js";
|
||||
import {
|
||||
setPreferredEmbeddedAgentRuntime,
|
||||
@@ -190,6 +191,9 @@ export default function register(api: OpenClawPluginApi) {
|
||||
throw err;
|
||||
}
|
||||
|
||||
// Initialize unified time module (must happen before any timestamp formatting)
|
||||
initTimeModule({ timezone: cfg.timezone }, api.logger);
|
||||
|
||||
// ============================
|
||||
// Hook policy auto-patch (v2026.4.24+ compat)
|
||||
// ============================
|
||||
|
||||
Reference in New Issue
Block a user