Merge 597931e0fb into da71eaebd2
This commit is contained in:
commit
88be7481a7
@ -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 = {
|
||||
|
||||
@ -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 };
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user