This commit is contained in:
Travis Pew 2026-01-30 09:33:58 -05:00 committed by GitHub
commit 88be7481a7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 32 additions and 1 deletions

View File

@ -160,6 +160,35 @@ describe("trigger handling", () => {
expect(text).toBe("ok");
});
});
it("returns a single reply for envelope-prefixed /help", async () => {
await withTempHome(async (home) => {
const blockReplies: Array<{ text?: string }> = [];
const res = await getReplyFromConfig(
{
Body: "[Signal] T: /help",
RawBody: "/help",
CommandBody: "/help",
From: "+1002",
To: "+2000",
Provider: "signal",
Surface: "signal",
SenderName: "T",
SenderId: "signal:+1002",
CommandAuthorized: true,
},
{
onBlockReply: async (payload) => {
blockReplies.push(payload);
},
},
makeCfg(home),
);
const text = Array.isArray(res) ? res[0]?.text : res?.text;
expect(blockReplies.length).toBe(0);
expect(text).toContain("Help");
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
});
});
it("drops /status for unauthorized senders", async () => {
await withTempHome(async (home) => {
const cfg = {

View File

@ -11,6 +11,7 @@ import type { InlineDirectives } from "./directive-handling.js";
import { isDirectiveOnly } from "./directive-handling.js";
import type { createModelSelectionState } from "./model-selection.js";
import { extractInlineSimpleCommand } from "./reply-inline.js";
import { stripStructuralPrefixes } from "./mentions.js";
import type { TypingController } from "./typing.js";
import { listSkillCommandsForWorkspace, resolveSkillCommandInvocation } from "../skill-commands.js";
import { logVerbose } from "../../globals.js";
@ -297,7 +298,8 @@ export async function handleInlineActions(params: {
skillCommands,
});
if (inlineResult.reply) {
if (!inlineCommand.cleaned) {
const cleanedAfterStrip = stripStructuralPrefixes(inlineCommand.cleaned);
if (!cleanedAfterStrip) {
typing.cleanup();
return { kind: "reply", reply: inlineResult.reply };
}