refactor: normalize main session key handling
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
resolveStorePath,
|
||||
} from "../config/sessions.js";
|
||||
import { callGateway, randomIdempotencyKey } from "../gateway/call.js";
|
||||
import { normalizeMainKey } from "../routing/session-key.js";
|
||||
import type { RuntimeEnv } from "../runtime.js";
|
||||
import { normalizeMessageProvider } from "../utils/message-provider.js";
|
||||
import { agentCommand } from "./agent.js";
|
||||
@@ -51,7 +52,7 @@ function resolveGatewaySessionKey(opts: {
|
||||
}): string | undefined {
|
||||
const sessionCfg = opts.cfg.session;
|
||||
const scope = sessionCfg?.scope ?? "per-sender";
|
||||
const mainKey = sessionCfg?.mainKey ?? "main";
|
||||
const mainKey = normalizeMainKey(sessionCfg?.mainKey);
|
||||
const storePath = resolveStorePath(sessionCfg?.store);
|
||||
const store = loadSessionStore(storePath);
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@ import {
|
||||
normalizeOutboundPayloadsForJson,
|
||||
} from "../infra/outbound/payloads.js";
|
||||
import { resolveOutboundTarget } from "../infra/outbound/targets.js";
|
||||
import { normalizeMainKey } from "../routing/session-key.js";
|
||||
import { defaultRuntime, type RuntimeEnv } from "../runtime.js";
|
||||
import { resolveSendPolicy } from "../sessions/send-policy.js";
|
||||
import {
|
||||
@@ -104,7 +105,7 @@ function resolveSession(opts: {
|
||||
}): SessionResolution {
|
||||
const sessionCfg = opts.cfg.session;
|
||||
const scope = sessionCfg?.scope ?? "per-sender";
|
||||
const mainKey = sessionCfg?.mainKey ?? "main";
|
||||
const mainKey = normalizeMainKey(sessionCfg?.mainKey);
|
||||
const idleMinutes = Math.max(
|
||||
sessionCfg?.idleMinutes ?? DEFAULT_IDLE_MINUTES,
|
||||
1,
|
||||
|
||||
Reference in New Issue
Block a user