


























@@ -1531,6 +1531,58 @@ describe("runPreparedReply media-only handling", () => {
15311531);
15321532});
153315331534+it("runs bare mention replies when the reply target is the current-turn context", async () => {
1535+vi.mocked(buildInboundUserContextPrefix).mockReturnValueOnce(
1536+[
1537+"Reply target of current user message (untrusted, for context):",
1538+"```json",
1539+JSON.stringify({ sender_label: "Bot", body: "quoted status body" }, null, 2),
1540+"```",
1541+].join("\n"),
1542+);
1543+1544+const result = await runPreparedReply(
1545+baseParams({
1546+ctx: {
1547+Body: "",
1548+RawBody: "@bot",
1549+CommandBody: "@bot",
1550+Provider: "telegram",
1551+Surface: "telegram",
1552+ChatType: "group",
1553+ReplyToBody: "quoted status body",
1554+ReplyToSender: "Bot",
1555+},
1556+sessionCtx: {
1557+Body: "",
1558+BodyStripped: "",
1559+RawBody: "@bot",
1560+CommandBody: "@bot",
1561+Provider: "telegram",
1562+Surface: "telegram",
1563+ChatType: "group",
1564+ReplyToBody: "quoted status body",
1565+ReplyToSender: "Bot",
1566+},
1567+command: {
1568+ ...baseParams().command,
1569+rawBodyNormalized: "@bot",
1570+commandBodyNormalized: "",
1571+} as never,
1572+}),
1573+);
1574+1575+expect(result).toEqual({ text: "ok" });
1576+const call = requireLastRunReplyAgentCall();
1577+expect(call?.transcriptCommandBody).toBe("");
1578+expect(call?.followupRun.prompt).toBe("");
1579+expect(call?.followupRun.transcriptPrompt).toBe("");
1580+expect(call?.followupRun.currentInboundContext?.text).toContain(
1581+"Reply target of current user message",
1582+);
1583+expect(call?.followupRun.currentInboundContext?.text).toContain("quoted status body");
1584+});
1585+15341586it("runs room events as contextual events instead of direct user prompts", async () => {
15351587vi.mocked(buildInboundUserContextPrefix).mockReturnValueOnce(
15361588[
@@ -1871,7 +1923,7 @@ describe("runPreparedReply media-only handling", () => {
18711923["/new", "new"],
18721924["/reset", "reset"],
18731925] as const)(
1874-"keeps inbound sender context in the bare %s model prompt while hiding startup instructions from transcript prompt",
1926+"keeps inbound sender context in reply-targeted bare %s model prompt while hiding startup instructions from transcript prompt",
18751927async (commandText, startupAction) => {
18761928vi.mocked(buildInboundUserContextPrefix).mockReturnValueOnce(
18771929[
@@ -1891,6 +1943,8 @@ describe("runPreparedReply media-only handling", () => {
18911943Provider: "webchat",
18921944Surface: "webchat",
18931945ChatType: "direct",
1946+ReplyToBody: "quoted reset target",
1947+ReplyToSender: "Ada Lovelace",
18941948},
18951949sessionCtx: {
18961950Body: "",
@@ -1900,6 +1954,8 @@ describe("runPreparedReply media-only handling", () => {
19001954ChatType: "direct",
19011955SenderId: "telegram-user-1",
19021956SenderName: "Ada Lovelace",
1957+ReplyToBody: "quoted reset target",
1958+ReplyToSender: "Ada Lovelace",
19031959},
19041960command: {
19051961surface: "webchat",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。