style: tidy auto-reply imports and formatting
This commit is contained in:
@@ -20,12 +20,12 @@ import { resolveSessionTranscriptPath } from "../config/sessions.js";
|
|||||||
import { logVerbose } from "../globals.js";
|
import { logVerbose } from "../globals.js";
|
||||||
import { clearCommandLane, getQueueSize } from "../process/command-queue.js";
|
import { clearCommandLane, getQueueSize } from "../process/command-queue.js";
|
||||||
import { defaultRuntime } from "../runtime.js";
|
import { defaultRuntime } from "../runtime.js";
|
||||||
|
import { hasControlCommand } from "./command-detection.js";
|
||||||
import { getAbortMemory } from "./reply/abort.js";
|
import { getAbortMemory } from "./reply/abort.js";
|
||||||
import { runReplyAgent } from "./reply/agent-runner.js";
|
import { runReplyAgent } from "./reply/agent-runner.js";
|
||||||
import { resolveBlockStreamingChunking } from "./reply/block-streaming.js";
|
import { resolveBlockStreamingChunking } from "./reply/block-streaming.js";
|
||||||
import { applySessionHints } from "./reply/body.js";
|
import { applySessionHints } from "./reply/body.js";
|
||||||
import { buildCommandContext, handleCommands } from "./reply/commands.js";
|
import { buildCommandContext, handleCommands } from "./reply/commands.js";
|
||||||
import { hasControlCommand } from "./command-detection.js";
|
|
||||||
import {
|
import {
|
||||||
handleDirectiveOnly,
|
handleDirectiveOnly,
|
||||||
isDirectiveOnly,
|
isDirectiveOnly,
|
||||||
@@ -498,11 +498,7 @@ export async function getReplyFromConfig(
|
|||||||
const baseBody = sessionCtx.BodyStripped ?? sessionCtx.Body ?? "";
|
const baseBody = sessionCtx.BodyStripped ?? sessionCtx.Body ?? "";
|
||||||
const rawBodyTrimmed = (ctx.Body ?? "").trim();
|
const rawBodyTrimmed = (ctx.Body ?? "").trim();
|
||||||
const baseBodyTrimmedRaw = baseBody.trim();
|
const baseBodyTrimmedRaw = baseBody.trim();
|
||||||
if (
|
if (!commandAuthorized && !baseBodyTrimmedRaw && hasControlCommand(rawBody)) {
|
||||||
!commandAuthorized &&
|
|
||||||
!baseBodyTrimmedRaw &&
|
|
||||||
hasControlCommand(rawBody)
|
|
||||||
) {
|
|
||||||
typing.cleanup();
|
typing.cleanup();
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@ import type { MsgContext } from "../templating.js";
|
|||||||
import type { ThinkLevel, VerboseLevel } from "../thinking.js";
|
import type { ThinkLevel, VerboseLevel } from "../thinking.js";
|
||||||
import type { ReplyPayload } from "../types.js";
|
import type { ReplyPayload } from "../types.js";
|
||||||
import { isAbortTrigger, setAbortMemory } from "./abort.js";
|
import { isAbortTrigger, setAbortMemory } from "./abort.js";
|
||||||
import { stripMentions } from "./mentions.js";
|
|
||||||
import type { InlineDirectives } from "./directive-handling.js";
|
import type { InlineDirectives } from "./directive-handling.js";
|
||||||
|
import { stripMentions } from "./mentions.js";
|
||||||
|
|
||||||
export type CommandContext = {
|
export type CommandContext = {
|
||||||
surface: string;
|
surface: string;
|
||||||
|
|||||||
@@ -85,10 +85,8 @@ export function parseInlineDirectives(body: string): InlineDirectives {
|
|||||||
rawLevel: rawElevatedLevel,
|
rawLevel: rawElevatedLevel,
|
||||||
hasDirective: hasElevatedDirective,
|
hasDirective: hasElevatedDirective,
|
||||||
} = extractElevatedDirective(verboseCleaned);
|
} = extractElevatedDirective(verboseCleaned);
|
||||||
const {
|
const { cleaned: statusCleaned, hasDirective: hasStatusDirective } =
|
||||||
cleaned: statusCleaned,
|
extractStatusDirective(elevatedCleaned);
|
||||||
hasDirective: hasStatusDirective,
|
|
||||||
} = extractStatusDirective(elevatedCleaned);
|
|
||||||
const {
|
const {
|
||||||
cleaned: modelCleaned,
|
cleaned: modelCleaned,
|
||||||
rawModel,
|
rawModel,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { hasControlCommand } from "../auto-reply/command-detection.js";
|
|
||||||
import { chunkText, resolveTextChunkLimit } from "../auto-reply/chunk.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 { formatAgentEnvelope } from "../auto-reply/envelope.js";
|
||||||
import { getReplyFromConfig } from "../auto-reply/reply.js";
|
import { getReplyFromConfig } from "../auto-reply/reply.js";
|
||||||
import type { ReplyPayload } from "../auto-reply/types.js";
|
import type { ReplyPayload } from "../auto-reply/types.js";
|
||||||
|
|||||||
@@ -3,9 +3,8 @@ import type {
|
|||||||
SlackEventMiddlewareArgs,
|
SlackEventMiddlewareArgs,
|
||||||
} from "@slack/bolt";
|
} from "@slack/bolt";
|
||||||
import bolt 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 { chunkText, resolveTextChunkLimit } from "../auto-reply/chunk.js";
|
||||||
|
import { hasControlCommand } from "../auto-reply/command-detection.js";
|
||||||
import { formatAgentEnvelope } from "../auto-reply/envelope.js";
|
import { formatAgentEnvelope } from "../auto-reply/envelope.js";
|
||||||
import { getReplyFromConfig } from "../auto-reply/reply.js";
|
import { getReplyFromConfig } from "../auto-reply/reply.js";
|
||||||
import { SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js";
|
import { SILENT_REPLY_TOKEN } from "../auto-reply/tokens.js";
|
||||||
@@ -600,7 +599,12 @@ export async function monitorSlackProvider(opts: MonitorSlackOpts = {}) {
|
|||||||
!hasAnyMention &&
|
!hasAnyMention &&
|
||||||
commandAuthorized &&
|
commandAuthorized &&
|
||||||
hasControlCommand(message.text ?? "");
|
hasControlCommand(message.text ?? "");
|
||||||
if (isRoom && channelConfig?.requireMention && !wasMentioned && !shouldBypassMention) {
|
if (
|
||||||
|
isRoom &&
|
||||||
|
channelConfig?.requireMention &&
|
||||||
|
!wasMentioned &&
|
||||||
|
!shouldBypassMention
|
||||||
|
) {
|
||||||
logger.info(
|
logger.info(
|
||||||
{ channel: message.channel, reason: "no-mention" },
|
{ channel: message.channel, reason: "no-mention" },
|
||||||
"skipping room message",
|
"skipping room message",
|
||||||
|
|||||||
@@ -4,9 +4,8 @@ import { Buffer } from "node:buffer";
|
|||||||
import { apiThrottler } from "@grammyjs/transformer-throttler";
|
import { apiThrottler } from "@grammyjs/transformer-throttler";
|
||||||
import type { ApiClientOptions, Message } from "grammy";
|
import type { ApiClientOptions, Message } from "grammy";
|
||||||
import { Bot, InputFile, webhookCallback } 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 { chunkText, resolveTextChunkLimit } from "../auto-reply/chunk.js";
|
||||||
|
import { hasControlCommand } from "../auto-reply/command-detection.js";
|
||||||
import { formatAgentEnvelope } from "../auto-reply/envelope.js";
|
import { formatAgentEnvelope } from "../auto-reply/envelope.js";
|
||||||
import { getReplyFromConfig } from "../auto-reply/reply.js";
|
import { getReplyFromConfig } from "../auto-reply/reply.js";
|
||||||
import type { ReplyPayload } from "../auto-reply/types.js";
|
import type { ReplyPayload } from "../auto-reply/types.js";
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { hasControlCommand } from "../auto-reply/command-detection.js";
|
|
||||||
import { chunkText, resolveTextChunkLimit } from "../auto-reply/chunk.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 { formatAgentEnvelope } from "../auto-reply/envelope.js";
|
||||||
import {
|
import {
|
||||||
normalizeGroupActivation,
|
normalizeGroupActivation,
|
||||||
|
|||||||
Reference in New Issue
Block a user