refactor: centralize typing mode signals

This commit is contained in:
Peter Steinberger
2026-01-07 22:18:11 +00:00
parent bac1608933
commit 434c25331e
13 changed files with 192 additions and 73 deletions

View File

@@ -9,7 +9,7 @@ import type { TypingMode } from "../../config/types.js";
import type { TemplateContext } from "../templating.js";
import type { GetReplyOptions } from "../types.js";
import type { FollowupRun, QueueSettings } from "./queue.js";
import type { TypingController } from "./typing.js";
import { createMockTypingController } from "./test-helpers.js";
const runEmbeddedPiAgentMock = vi.fn();
@@ -46,18 +46,6 @@ vi.mock("./queue.js", async () => {
import { runReplyAgent } from "./agent-runner.js";
function createTyping(): TypingController {
return {
onReplyStart: vi.fn(async () => {}),
startTypingLoop: vi.fn(async () => {}),
startTypingOnText: vi.fn(async () => {}),
refreshTypingTtl: vi.fn(),
markRunComplete: vi.fn(),
markDispatchIdle: vi.fn(),
cleanup: vi.fn(),
};
}
type EmbeddedPiAgentParams = {
onPartialReply?: (payload: { text?: string }) => Promise<void> | void;
};
@@ -71,7 +59,7 @@ function createMinimalRun(params?: {
storePath?: string;
typingMode?: TypingMode;
}) {
const typing = createTyping();
const typing = createMockTypingController();
const opts = params?.opts;
const sessionCtx = {
Provider: "whatsapp",