feat: add typing mode controls

This commit is contained in:
Peter Steinberger
2026-01-07 21:58:54 +00:00
parent 430662f6ef
commit bac1608933
14 changed files with 307 additions and 20 deletions

View File

@@ -65,6 +65,10 @@ import {
prependSystemEvents,
} from "./reply/session-updates.js";
import { createTypingController } from "./reply/typing.js";
import {
resolveTypingMode,
shouldStartTypingImmediately,
} from "./reply/typing-mode.js";
import type { MsgContext, TemplateContext } from "./templating.js";
import {
type ElevatedLevel,
@@ -594,7 +598,13 @@ export async function getReplyFromConfig(
const isGroupChat = sessionCtx.ChatType === "group";
const wasMentioned = ctx.WasMentioned === true;
const isHeartbeat = opts?.isHeartbeat === true;
const shouldEagerType = (!isGroupChat || wasMentioned) && !isHeartbeat;
const typingMode = resolveTypingMode({
configured: agentCfg?.typingMode,
isGroupChat,
wasMentioned,
isHeartbeat,
});
const shouldEagerType = shouldStartTypingImmediately(typingMode);
const shouldInjectGroupIntro = Boolean(
isGroupChat &&
(isFirstTurnInSession || sessionEntry?.groupActivationNeedsSystemIntro),
@@ -816,6 +826,7 @@ export async function getReplyFromConfig(
resolvedBlockStreamingBreak,
sessionCtx,
shouldInjectGroupIntro,
typingMode,
});
}