refactor: split config module

This commit is contained in:
Peter Steinberger
2026-01-04 07:05:04 +01:00
parent 5e36e2c3f3
commit c9504a6f20
16 changed files with 2236 additions and 2082 deletions

View File

@@ -1,5 +1,9 @@
import type { ClawdisConfig } from "../../config/config.js";
import { type SessionEntry, saveSessionStore } from "../../config/sessions.js";
import {
type SessionEntry,
type SessionScope,
saveSessionStore,
} from "../../config/sessions.js";
import { logVerbose } from "../../globals.js";
import { triggerClawdisRestart } from "../../infra/restart.js";
import { resolveSendPolicy } from "../../sessions/send-policy.js";
@@ -101,7 +105,7 @@ export async function handleCommands(params: {
sessionStore?: Record<string, SessionEntry>;
sessionKey?: string;
storePath?: string;
sessionScope: string;
sessionScope?: SessionScope;
workspaceDir: string;
defaultGroupActivation: () => "always" | "mention";
resolvedThinkLevel?: ThinkLevel;

View File

@@ -11,6 +11,7 @@ import {
resolveSessionKey,
resolveStorePath,
type SessionEntry,
type SessionScope,
saveSessionStore,
} from "../../config/sessions.js";
import type { MsgContext, TemplateContext } from "../templating.js";
@@ -26,7 +27,7 @@ export type SessionInitResult = {
systemSent: boolean;
abortedLastRun: boolean;
storePath: string;
sessionScope: string;
sessionScope: SessionScope;
groupResolution?: GroupKeyResolution;
isGroup: boolean;
bodyStripped?: string;
@@ -66,7 +67,7 @@ export async function initSessionState(params: {
let persistedModelOverride: string | undefined;
let persistedProviderOverride: string | undefined;
const groupResolution = resolveGroupSessionKey(ctx);
const groupResolution = resolveGroupSessionKey(ctx) ?? undefined;
const isGroup =
ctx.ChatType?.trim().toLowerCase() === "group" || Boolean(groupResolution);
const triggerBodyNormalized = stripStructuralPrefixes(ctx.Body ?? "")