diff --git a/src/agents/pi-embedded-subscribe.test.ts b/src/agents/pi-embedded-subscribe.test.ts index 066e8d124..61bfd0445 100644 --- a/src/agents/pi-embedded-subscribe.test.ts +++ b/src/agents/pi-embedded-subscribe.test.ts @@ -164,7 +164,7 @@ describe("subscribeEmbeddedPiSession", () => { expect(onBlockReply).toHaveBeenCalledTimes(2); expect(onBlockReply.mock.calls[0][0].text).toBe( - "Reasoning:\nBecause it helps", + "Reasoning:\n_Because it helps_", ); expect(onBlockReply.mock.calls[1][0].text).toBe("Final answer"); }); @@ -209,7 +209,7 @@ describe("subscribeEmbeddedPiSession", () => { expect(onBlockReply).toHaveBeenCalledTimes(2); expect(onBlockReply.mock.calls[0][0].text).toBe( - "Reasoning:\nBecause it helps", + "Reasoning:\n_Because it helps_", ); expect(onBlockReply.mock.calls[1][0].text).toBe("Final answer"); @@ -283,7 +283,7 @@ describe("subscribeEmbeddedPiSession", () => { const streamTexts = onReasoningStream.mock.calls .map((call) => call[0]?.text) .filter((value): value is string => typeof value === "string"); - expect(streamTexts.at(-1)).toBe("Reasoning:\nBecause it helps"); + expect(streamTexts.at(-1)).toBe("Reasoning:\n_Because it helps_"); expect(assistantMessage.content).toEqual([ { type: "thinking", thinking: "Because it helps" }, diff --git a/src/agents/pi-embedded-utils.ts b/src/agents/pi-embedded-utils.ts index f52ccbe40..40c3ec1ce 100644 --- a/src/agents/pi-embedded-utils.ts +++ b/src/agents/pi-embedded-utils.ts @@ -37,7 +37,9 @@ export function extractAssistantThinking(msg: AssistantMessage): string { export function formatReasoningMessage(text: string): string { const trimmed = text.trim(); if (!trimmed) return ""; - return `Reasoning:\n${trimmed}`; + // Show reasoning in italics (cursive) for markdown-friendly surfaces (Discord, etc.). + // Keep the plain "Reasoning:" prefix so existing parsing/detection keeps working. + return `Reasoning:\n_${trimmed}_`; } type ThinkTaggedSplitBlock = diff --git a/src/auto-reply/reply/agent-runner.heartbeat-typing.test.ts b/src/auto-reply/reply/agent-runner.heartbeat-typing.test.ts index 556e223c6..26d0f2dce 100644 --- a/src/auto-reply/reply/agent-runner.heartbeat-typing.test.ts +++ b/src/auto-reply/reply/agent-runner.heartbeat-typing.test.ts @@ -206,7 +206,7 @@ describe("runReplyAgent typing (heartbeat)", () => { text?: string; }) => Promise | void; }) => { - await params.onReasoningStream?.({ text: "Reasoning:\nstep" }); + await params.onReasoningStream?.({ text: "Reasoning:\n_step_" }); await params.onPartialReply?.({ text: "hi" }); return { payloads: [{ text: "final" }], meta: {} }; }, diff --git a/src/infra/heartbeat-runner.test.ts b/src/infra/heartbeat-runner.test.ts index 49b975a49..df8bf7776 100644 --- a/src/infra/heartbeat-runner.test.ts +++ b/src/infra/heartbeat-runner.test.ts @@ -286,7 +286,7 @@ describe("runHeartbeatOnce", () => { }; replySpy.mockResolvedValue([ - { text: "Reasoning:\nBecause it helps" }, + { text: "Reasoning:\n_Because it helps_" }, { text: "Final alert" }, ]); const sendWhatsApp = vi.fn().mockResolvedValue({ @@ -309,7 +309,7 @@ describe("runHeartbeatOnce", () => { expect(sendWhatsApp).toHaveBeenNthCalledWith( 1, "+1555", - "Reasoning:\nBecause it helps", + "Reasoning:\n_Because it helps_", expect.any(Object), ); expect(sendWhatsApp).toHaveBeenNthCalledWith( @@ -361,7 +361,7 @@ describe("runHeartbeatOnce", () => { }; replySpy.mockResolvedValue([ - { text: "Reasoning:\nBecause it helps" }, + { text: "Reasoning:\n_Because it helps_" }, { text: "HEARTBEAT_OK" }, ]); const sendWhatsApp = vi.fn().mockResolvedValue({ @@ -384,7 +384,7 @@ describe("runHeartbeatOnce", () => { expect(sendWhatsApp).toHaveBeenNthCalledWith( 1, "+1555", - "Reasoning:\nBecause it helps", + "Reasoning:\n_Because it helps_", expect.any(Object), ); } finally {