fix(channels): align command-body parsing sources

This commit is contained in:
Peter Steinberger
2026-03-01 23:11:20 +00:00
parent 4c43fccb3e
commit 8e48520d74
5 changed files with 16 additions and 6 deletions

View File

@@ -1098,14 +1098,15 @@ export async function processMessage(
});
}
}
const commandBody = messageText.trim();
const ctxPayload = core.channel.reply.finalizeInboundContext({
Body: body,
BodyForAgent: rawBody,
InboundHistory: inboundHistory,
RawBody: rawBody,
CommandBody: rawBody,
BodyForCommands: rawBody,
CommandBody: commandBody,
BodyForCommands: commandBody,
MediaUrl: mediaUrls[0],
MediaUrls: mediaUrls.length > 0 ? mediaUrls : undefined,
MediaPath: mediaPaths[0],

View File

@@ -638,6 +638,7 @@ export async function monitorMattermostProvider(opts: MonitorMattermostOpts = {}
const to = kind === "direct" ? `user:${senderId}` : `channel:${channelId}`;
const mediaPayload = buildAgentMediaPayload(mediaList);
const commandBody = rawText.trim();
const inboundHistory =
historyKey && historyLimit > 0
? (channelHistories.get(historyKey) ?? []).map((entry) => ({
@@ -651,7 +652,8 @@ export async function monitorMattermostProvider(opts: MonitorMattermostOpts = {}
BodyForAgent: bodyText,
InboundHistory: inboundHistory,
RawBody: bodyText,
CommandBody: bodyText,
CommandBody: commandBody,
BodyForCommands: commandBody,
From:
kind === "direct"
? `mattermost:${senderId}`

View File

@@ -495,13 +495,15 @@ export function createMSTeamsMessageHandler(deps: MSTeamsMessageHandlerDeps) {
timestamp: entry.timestamp,
}))
: undefined;
const commandBody = text.trim();
const ctxPayload = core.channel.reply.finalizeInboundContext({
Body: combinedBody,
BodyForAgent: rawBody,
InboundHistory: inboundHistory,
RawBody: rawBody,
CommandBody: rawBody,
CommandBody: commandBody,
BodyForCommands: commandBody,
From: teamsFrom,
To: teamsTo,
SessionKey: route.sessionKey,

View File

@@ -64,6 +64,7 @@ export function createSignalEventHandler(deps: SignalEventHandlerDeps) {
groupName?: string;
isGroup: boolean;
bodyText: string;
commandBody: string;
timestamp?: number;
messageId?: string;
mediaPath?: string;
@@ -147,7 +148,8 @@ export function createSignalEventHandler(deps: SignalEventHandlerDeps) {
BodyForAgent: entry.bodyText,
InboundHistory: inboundHistory,
RawBody: entry.bodyText,
CommandBody: entry.bodyText,
CommandBody: entry.commandBody,
BodyForCommands: entry.commandBody,
From: entry.isGroup
? `group:${entry.groupId ?? "unknown"}`
: `signal:${entry.senderRecipient}`,
@@ -691,6 +693,7 @@ export function createSignalEventHandler(deps: SignalEventHandlerDeps) {
groupName,
isGroup,
bodyText,
commandBody: messageText,
timestamp: envelope.timestamp ?? undefined,
messageId,
mediaPath,

View File

@@ -611,13 +611,15 @@ export async function prepareSlackMessage(params: {
timestamp: entry.timestamp,
}))
: undefined;
const commandBody = textForCommandDetection.trim();
const ctxPayload = finalizeInboundContext({
Body: combinedBody,
BodyForAgent: rawBody,
InboundHistory: inboundHistory,
RawBody: rawBody,
CommandBody: rawBody,
CommandBody: commandBody,
BodyForCommands: commandBody,
From: slackFrom,
To: slackTo,
SessionKey: sessionKey,