Heartbeat: resolve main session key for session store
This commit is contained in:
@@ -12,6 +12,7 @@ import type { ClawdbotConfig } from "../config/config.js";
|
|||||||
import { loadConfig } from "../config/config.js";
|
import { loadConfig } from "../config/config.js";
|
||||||
import {
|
import {
|
||||||
loadSessionStore,
|
loadSessionStore,
|
||||||
|
resolveMainSessionKey,
|
||||||
resolveStorePath,
|
resolveStorePath,
|
||||||
type SessionEntry,
|
type SessionEntry,
|
||||||
saveSessionStore,
|
saveSessionStore,
|
||||||
@@ -113,8 +114,8 @@ function resolveHeartbeatAckMaxChars(cfg: ClawdbotConfig) {
|
|||||||
function resolveHeartbeatSession(cfg: ClawdbotConfig) {
|
function resolveHeartbeatSession(cfg: ClawdbotConfig) {
|
||||||
const sessionCfg = cfg.session;
|
const sessionCfg = cfg.session;
|
||||||
const scope = sessionCfg?.scope ?? "per-sender";
|
const scope = sessionCfg?.scope ?? "per-sender";
|
||||||
const mainKey = (sessionCfg?.mainKey ?? "main").trim() || "main";
|
const sessionKey =
|
||||||
const sessionKey = scope === "global" ? "global" : mainKey;
|
scope === "global" ? "global" : resolveMainSessionKey(cfg);
|
||||||
const storePath = resolveStorePath(sessionCfg?.store);
|
const storePath = resolveStorePath(sessionCfg?.store);
|
||||||
const store = loadSessionStore(storePath);
|
const store = loadSessionStore(storePath);
|
||||||
const entry = store[sessionKey];
|
const entry = store[sessionKey];
|
||||||
|
|||||||
Reference in New Issue
Block a user