auto-reply: enrich chat status

This commit is contained in:
Peter Steinberger
2025-12-07 16:53:19 +00:00
parent 1f0ee9837b
commit e2c6546b61
9 changed files with 283 additions and 1 deletions

View File

@@ -22,6 +22,9 @@ import {
type MsgContext,
type TemplateContext,
} from "./templating.js";
import { buildStatusMessage } from "./status.js";
import { resolveHeartbeatSeconds } from "../web/reconnect.js";
import { getWebAuthAgeMs, webAuthExists } from "../web/session.js";
import {
normalizeThinkLevel,
normalizeVerboseLevel,
@@ -503,6 +506,30 @@ export async function getReplyFromConfig(
};
}
if (
rawBodyNormalized === "/status" ||
rawBodyNormalized === "status" ||
rawBodyNormalized.startsWith("/status ")
) {
const webLinked = await webAuthExists();
const webAuthAgeMs = getWebAuthAgeMs();
const heartbeatSeconds = resolveHeartbeatSeconds(cfg, undefined);
const statusText = buildStatusMessage({
reply,
sessionEntry,
sessionKey,
sessionScope,
storePath,
resolvedThink: resolvedThinkLevel,
resolvedVerbose: resolvedVerboseLevel,
webLinked,
webAuthAgeMs,
heartbeatSeconds,
});
cleanupTyping();
return { text: statusText };
}
const abortRequested =
reply?.mode === "command" && isAbortTrigger(rawBodyNormalized);