test(auto-reply): fix heartbeat typing block reply assertions

This commit is contained in:
Peter Steinberger
2026-01-12 23:01:53 +00:00
parent a55c880191
commit cf92099d40
2 changed files with 27 additions and 12 deletions

View File

@@ -47,9 +47,18 @@ vi.mock("./queue.js", async () => {
import { runReplyAgent } from "./agent-runner.js";
type EmbeddedPiAgentParams = {
onPartialReply?: (payload: { text?: string; mediaUrls?: string[] }) => Promise<void> | void;
onBlockReply?: (payload: { text?: string; mediaUrls?: string[] }) => Promise<void> | void;
onToolResult?: (payload: { text?: string; mediaUrls?: string[] }) => Promise<void> | void;
onPartialReply?: (payload: {
text?: string;
mediaUrls?: string[];
}) => Promise<void> | void;
onBlockReply?: (payload: {
text?: string;
mediaUrls?: string[];
}) => Promise<void> | void;
onToolResult?: (payload: {
text?: string;
mediaUrls?: string[];
}) => Promise<void> | void;
};
function createMinimalRun(params?: {
@@ -277,7 +286,13 @@ describe("runReplyAgent typing (heartbeat)", () => {
await run();
expect(typing.startTypingOnText).toHaveBeenCalledWith("chunk");
expect(onBlockReply).toHaveBeenCalledWith({ text: "chunk", mediaUrls: [] });
expect(onBlockReply).toHaveBeenCalled();
const [blockPayload, blockOpts] = onBlockReply.mock.calls[0] ?? [];
expect(blockPayload).toMatchObject({ text: "chunk", audioAsVoice: false });
expect(blockOpts).toMatchObject({
abortSignal: expect.any(AbortSignal),
timeoutMs: expect.any(Number),
});
});
it("signals typing on tool results", async () => {

View File

@@ -629,14 +629,14 @@ export async function applyInlineDirectivesFastLane(params: {
provider: string;
model: string;
initialModelLabel: string;
formatModelSwitchEvent: (label: string, alias?: string) => string;
agentCfg?: NonNullable<ClawdbotConfig["agents"]>["defaults"];
modelState: {
resolveDefaultThinkingLevel: () => Promise<ThinkLevel | undefined>;
allowedModelKeys: Set<string>;
allowedModelCatalog: Awaited<
ReturnType<
typeof import("../../agents/model-catalog.js").loadModelCatalog
formatModelSwitchEvent: (label: string, alias?: string) => string;
agentCfg?: NonNullable<ClawdbotConfig["agents"]>["defaults"];
modelState: {
resolveDefaultThinkingLevel: () => Promise<ThinkLevel | undefined>;
allowedModelKeys: Set<string>;
allowedModelCatalog: Awaited<
ReturnType<
typeof import("../../agents/model-catalog.js").loadModelCatalog
>
>;
resetModelOverride: boolean;