feat: prepare DB for shared access (WAL, service partitioning)

Phase 0-2 of data unification:
- Enable WAL mode + busy_timeout for safe concurrent access
- router_state: keys prefixed with SERVICE_ID (lazy migration)
- sessions: composite PK (group_folder, agent_type)
- registered_groups: filtered by SERVICE_AGENT_TYPE on load
- Logger: service name tag for unified log streams

All changes are backward-compatible with the current split setup.
Actual directory merge (Phase 3-4) is a separate step.
This commit is contained in:
Eyejoker
2026-03-15 18:45:56 +09:00
parent 26783e520e
commit 6f4b6f8df7
5 changed files with 115 additions and 26 deletions

View File

@@ -7,6 +7,7 @@ import {
ASSISTANT_NAME,
IDLE_TIMEOUT,
POLL_INTERVAL,
SERVICE_AGENT_TYPE,
STATUS_CHANNEL_ID,
STATUS_UPDATE_INTERVAL,
TIMEZONE,
@@ -82,7 +83,7 @@ function loadState(): void {
lastAgentTimestamp = {};
}
sessions = getAllSessions();
registeredGroups = getAllRegisteredGroups();
registeredGroups = getAllRegisteredGroups(SERVICE_AGENT_TYPE);
logger.info(
{ groupCount: Object.keys(registeredGroups).length },
'State loaded',