fix(reply): keep text command replies visible

This commit is contained in:
Vincent Koc
2026-05-06 01:47:54 -07:00
parent 5e218b402f
commit a2f1d1dfd8
2 changed files with 26 additions and 22 deletions

View File

@@ -87,13 +87,15 @@ describe("resolveSourceReplyDeliveryMode", () => {
).toBe("automatic");
});
it("treats native commands as explicit replies in groups", () => {
expect(
resolveSourceReplyDeliveryMode({
cfg: emptyConfig,
ctx: { ChatType: "group", CommandSource: "native" },
}),
).toBe("automatic");
it("treats native and text commands as explicit replies in groups", () => {
for (const CommandSource of ["native", "text"] as const) {
expect(
resolveSourceReplyDeliveryMode({
cfg: emptyConfig,
ctx: { ChatType: "group", CommandSource },
}),
).toBe("automatic");
}
});
it("falls back to automatic when message tool is unavailable", () => {
@@ -177,20 +179,22 @@ describe("resolveSourceReplyVisibilityPolicy", () => {
});
});
it("keeps native command replies visible in groups", () => {
expect(
resolveSourceReplyVisibilityPolicy({
cfg: emptyConfig,
ctx: { ChatType: "group", CommandSource: "native" },
sendPolicy: "allow",
}),
).toMatchObject({
sourceReplyDeliveryMode: "automatic",
suppressAutomaticSourceDelivery: false,
suppressDelivery: false,
suppressHookReplyLifecycle: false,
suppressTyping: false,
});
it("keeps native and text command replies visible in groups", () => {
for (const CommandSource of ["native", "text"] as const) {
expect(
resolveSourceReplyVisibilityPolicy({
cfg: emptyConfig,
ctx: { ChatType: "group", CommandSource },
sendPolicy: "allow",
}),
).toMatchObject({
sourceReplyDeliveryMode: "automatic",
suppressAutomaticSourceDelivery: false,
suppressDelivery: false,
suppressHookReplyLifecycle: false,
suppressTyping: false,
});
}
});
it("keeps configured automatic group delivery visible", () => {

View File

@@ -20,7 +20,7 @@ export function resolveSourceReplyDeliveryMode(params: {
? "automatic"
: params.requested;
}
if (params.ctx.CommandSource === "native") {
if (params.ctx.CommandSource === "native" || params.ctx.CommandSource === "text") {
return "automatic";
}
const chatType = normalizeChatType(params.ctx.ChatType);