|
|
|
|
@ -12,18 +12,17 @@ import { resolveChannelModelOverride } from "../../channels/model-overrides.js";
|
|
|
|
|
import { type OpenClawConfig, loadConfig } from "../../config/config.js";
|
|
|
|
|
import { defaultRuntime } from "../../runtime.js";
|
|
|
|
|
import { normalizeStringEntries } from "../../shared/string-normalization.js";
|
|
|
|
|
import { resolveCommandAuthorization } from "../command-auth.js";
|
|
|
|
|
import { shouldHandleTextCommands } from "../commands-text-routing.js";
|
|
|
|
|
import type { MsgContext } from "../templating.js";
|
|
|
|
|
import { normalizeVerboseLevel } from "../thinking.js";
|
|
|
|
|
import { SILENT_REPLY_TOKEN } from "../tokens.js";
|
|
|
|
|
import type { GetReplyOptions, ReplyPayload } from "../types.js";
|
|
|
|
|
import { buildCommandContext } from "./commands-context.js";
|
|
|
|
|
import { resolveDefaultModel } from "./directive-handling.defaults.js";
|
|
|
|
|
import { clearInlineDirectives } from "./get-reply-directives-utils.js";
|
|
|
|
|
import { resolveReplyDirectives } from "./get-reply-directives.js";
|
|
|
|
|
import {
|
|
|
|
|
initFastReplySessionState,
|
|
|
|
|
buildFastReplyCommandContext,
|
|
|
|
|
shouldHandleFastReplyTextCommands,
|
|
|
|
|
shouldUseReplyFastDirectiveExecution,
|
|
|
|
|
resolveGetReplyConfig,
|
|
|
|
|
shouldUseReplyFastTestBootstrap,
|
|
|
|
|
@ -240,11 +239,6 @@ export async function getReplyFromConfig(
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const commandAuthorized = finalized.CommandAuthorized;
|
|
|
|
|
resolveCommandAuthorization({
|
|
|
|
|
ctx: finalized,
|
|
|
|
|
cfg,
|
|
|
|
|
commandAuthorized,
|
|
|
|
|
});
|
|
|
|
|
const sessionState = useFastTestBootstrap
|
|
|
|
|
? initFastReplySessionState({
|
|
|
|
|
ctx: finalized,
|
|
|
|
|
@ -336,6 +330,15 @@ export async function getReplyFromConfig(
|
|
|
|
|
triggerBodyNormalized,
|
|
|
|
|
})
|
|
|
|
|
) {
|
|
|
|
|
const fastCommand = buildFastReplyCommandContext({
|
|
|
|
|
ctx,
|
|
|
|
|
cfg,
|
|
|
|
|
agentId,
|
|
|
|
|
sessionKey,
|
|
|
|
|
isGroup,
|
|
|
|
|
triggerBodyNormalized,
|
|
|
|
|
commandAuthorized,
|
|
|
|
|
});
|
|
|
|
|
return runPreparedReply({
|
|
|
|
|
ctx,
|
|
|
|
|
sessionCtx,
|
|
|
|
|
@ -345,19 +348,10 @@ export async function getReplyFromConfig(
|
|
|
|
|
agentCfg,
|
|
|
|
|
sessionCfg,
|
|
|
|
|
commandAuthorized,
|
|
|
|
|
command: buildCommandContext({
|
|
|
|
|
ctx,
|
|
|
|
|
cfg,
|
|
|
|
|
agentId,
|
|
|
|
|
sessionKey,
|
|
|
|
|
isGroup,
|
|
|
|
|
triggerBodyNormalized,
|
|
|
|
|
commandAuthorized,
|
|
|
|
|
}),
|
|
|
|
|
command: fastCommand,
|
|
|
|
|
commandSource: finalized.BodyForCommands ?? finalized.CommandBody ?? finalized.RawBody ?? "",
|
|
|
|
|
allowTextCommands: shouldHandleTextCommands({
|
|
|
|
|
allowTextCommands: shouldHandleFastReplyTextCommands({
|
|
|
|
|
cfg,
|
|
|
|
|
surface: finalized.Surface ?? finalized.Provider ?? "",
|
|
|
|
|
commandSource: finalized.CommandSource,
|
|
|
|
|
}),
|
|
|
|
|
directives: clearInlineDirectives(
|
|
|
|
|
|