From 1bad96aa2b040b3b5188fdecb417abb0f2615268 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Mon, 5 Jan 2026 01:46:07 +0100 Subject: [PATCH] style: tidy auto-reply imports and formatting --- src/auto-reply/reply.ts | 8 ++------ src/auto-reply/reply/commands.ts | 2 +- src/auto-reply/reply/directive-handling.ts | 6 ++---- src/imessage/monitor.ts | 2 +- src/slack/monitor.ts | 10 +++++++--- src/telegram/bot.ts | 3 +-- src/web/auto-reply.ts | 2 +- 7 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/auto-reply/reply.ts b/src/auto-reply/reply.ts index 78a5070e3..0580088ff 100644 --- a/src/auto-reply/reply.ts +++ b/src/auto-reply/reply.ts @@ -20,12 +20,12 @@ import { resolveSessionTranscriptPath } from "../config/sessions.js"; import { logVerbose } from "../globals.js"; import { clearCommandLane, getQueueSize } from "../process/command-queue.js"; import { defaultRuntime } from "../runtime.js"; +import { hasControlCommand } from "./command-detection.js"; import { getAbortMemory } from "./reply/abort.js"; import { runReplyAgent } from "./reply/agent-runner.js"; import { resolveBlockStreamingChunking } from "./reply/block-streaming.js"; import { applySessionHints } from "./reply/body.js"; import { buildCommandContext, handleCommands } from "./reply/commands.js"; -import { hasControlCommand } from "./command-detection.js"; import { handleDirectiveOnly, isDirectiveOnly, @@ -498,11 +498,7 @@ export async function getReplyFromConfig( const baseBody = sessionCtx.BodyStripped ?? sessionCtx.Body ?? ""; const rawBodyTrimmed = (ctx.Body ?? "").trim(); const baseBodyTrimmedRaw = baseBody.trim(); - if ( - !commandAuthorized && - !baseBodyTrimmedRaw && - hasControlCommand(rawBody) - ) { + if (!commandAuthorized && !baseBodyTrimmedRaw && hasControlCommand(rawBody)) { typing.cleanup(); return undefined; } diff --git a/src/auto-reply/reply/commands.ts b/src/auto-reply/reply/commands.ts index 68475ce9a..d76de7b2f 100644 --- a/src/auto-reply/reply/commands.ts +++ b/src/auto-reply/reply/commands.ts @@ -20,8 +20,8 @@ import type { MsgContext } from "../templating.js"; import type { ThinkLevel, VerboseLevel } from "../thinking.js"; import type { ReplyPayload } from "../types.js"; import { isAbortTrigger, setAbortMemory } from "./abort.js"; -import { stripMentions } from "./mentions.js"; import type { InlineDirectives } from "./directive-handling.js"; +import { stripMentions } from "./mentions.js"; export type CommandContext = { surface: string; diff --git a/src/auto-reply/reply/directive-handling.ts b/src/auto-reply/reply/directive-handling.ts index aa87de762..a12573da4 100644 --- a/src/auto-reply/reply/directive-handling.ts +++ b/src/auto-reply/reply/directive-handling.ts @@ -85,10 +85,8 @@ export function parseInlineDirectives(body: string): InlineDirectives { rawLevel: rawElevatedLevel, hasDirective: hasElevatedDirective, } = extractElevatedDirective(verboseCleaned); - const { - cleaned: statusCleaned, - hasDirective: hasStatusDirective, - } = extractStatusDirective(elevatedCleaned); + const { cleaned: statusCleaned, hasDirective: hasStatusDirective } = + extractStatusDirective(elevatedCleaned); const { cleaned: modelCleaned, rawModel, diff --git a/src/imessage/monitor.ts b/src/imessage/monitor.ts index 674ad7f72..cd47df9b0 100644 --- a/src/imessage/monitor.ts +++ b/src/imessage/monitor.ts @@ -1,5 +1,5 @@ -import { hasControlCommand } from "../auto-reply/command-detection.js"; import { chunkText, resolveTextChunkLimit } from "../auto-reply/chunk.js"; +import { hasControlCommand } from "../auto-reply/command-detection.js"; import { formatAgentEnvelope } from "../auto-reply/envelope.js"; import { getReplyFromConfig } from "../auto-reply/reply.js"; import type { ReplyPayload } from "../auto-reply/types.js"; diff --git a/src/slack/monitor.ts b/src/slack/monitor.ts index 74988e63c..ab8c03b48 100644 --- a/src/slack/monitor.ts +++ b/src/slack/monitor.ts @@ -3,9 +3,8 @@ import type { SlackEventMiddlewareArgs, } from "@slack/bolt"; import bolt from "@slack/bolt"; - -import { hasControlCommand } from "../auto-reply/command-detection.js"; import { chunkText, resolveTextChunkLimit } from "../auto-reply/chunk.js"; +import { hasControlCommand } from "../auto-reply/command-detection.js"; import { formatAgentEnvelope } from "../auto-reply/envelope.js"; import { getReplyFromConfig } from "../auto-reply/reply.js"; import { SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js"; @@ -600,7 +599,12 @@ export async function monitorSlackProvider(opts: MonitorSlackOpts = {}) { !hasAnyMention && commandAuthorized && hasControlCommand(message.text ?? ""); - if (isRoom && channelConfig?.requireMention && !wasMentioned && !shouldBypassMention) { + if ( + isRoom && + channelConfig?.requireMention && + !wasMentioned && + !shouldBypassMention + ) { logger.info( { channel: message.channel, reason: "no-mention" }, "skipping room message", diff --git a/src/telegram/bot.ts b/src/telegram/bot.ts index 7d3f71e58..cfe76d0bc 100644 --- a/src/telegram/bot.ts +++ b/src/telegram/bot.ts @@ -4,9 +4,8 @@ import { Buffer } from "node:buffer"; import { apiThrottler } from "@grammyjs/transformer-throttler"; import type { ApiClientOptions, Message } from "grammy"; import { Bot, InputFile, webhookCallback } from "grammy"; - -import { hasControlCommand } from "../auto-reply/command-detection.js"; import { chunkText, resolveTextChunkLimit } from "../auto-reply/chunk.js"; +import { hasControlCommand } from "../auto-reply/command-detection.js"; import { formatAgentEnvelope } from "../auto-reply/envelope.js"; import { getReplyFromConfig } from "../auto-reply/reply.js"; import type { ReplyPayload } from "../auto-reply/types.js"; diff --git a/src/web/auto-reply.ts b/src/web/auto-reply.ts index a565b0d95..4e657d24a 100644 --- a/src/web/auto-reply.ts +++ b/src/web/auto-reply.ts @@ -1,5 +1,5 @@ -import { hasControlCommand } from "../auto-reply/command-detection.js"; import { chunkText, resolveTextChunkLimit } from "../auto-reply/chunk.js"; +import { hasControlCommand } from "../auto-reply/command-detection.js"; import { formatAgentEnvelope } from "../auto-reply/envelope.js"; import { normalizeGroupActivation,