
























@@ -63,6 +63,7 @@ function createRuntimeStub(callId = "call-1"): VoiceCallRuntime {
6363endCall: vi.fn(async () => ({ success: true })),
6464getCall: vi.fn((id: string) => (id === callId ? { callId } : undefined)),
6565getCallByProviderCallId: vi.fn(() => undefined),
66+getActiveCalls: vi.fn(() => [{ callId }]),
6667} as unknown as VoiceCallRuntime["manager"],
6768webhookServer: {} as VoiceCallRuntime["webhookServer"],
6869webhookUrl: "http://127.0.0.1:3334/voice/webhook",
@@ -284,6 +285,26 @@ describe("voice-call plugin", () => {
284285expect(payload.callId).toBe("call-1");
285286});
286287288+it("preserves mode on legacy voicecall.start", async () => {
289+const { methods } = setup({ provider: "mock" });
290+const handler = methods.get("voicecall.start") as
291+| ((ctx: {
292+params: Record<string, unknown>;
293+respond: ReturnType<typeof vi.fn>;
294+}) => Promise<void>)
295+| undefined;
296+const respond = vi.fn();
297+await handler?.({
298+params: { message: "Hi", mode: "conversation", to: "+15550001234" },
299+ respond,
300+});
301+expect(runtimeStub.manager.initiateCall).toHaveBeenCalledWith("+15550001234", undefined, {
302+message: "Hi",
303+mode: "conversation",
304+});
305+expect(respond.mock.calls[0]?.[0]).toBe(true);
306+});
307+287308it("returns call status", async () => {
288309const { methods } = setup({ provider: "mock" });
289310const handler = methods.get("voicecall.status") as
@@ -490,6 +511,22 @@ describe("voice-call plugin", () => {
490511}
491512});
492513514+it("CLI status lists active calls without a call id", async () => {
515+const program = new Command();
516+const stdout = captureStdout();
517+await registerVoiceCallCli(program);
518+519+try {
520+await program.parseAsync(["voicecall", "status", "--json"], { from: "user" });
521+const parsed = JSON.parse(stdout.output()) as {
522+calls?: Array<{ callId?: string }>;
523+};
524+expect(parsed.calls).toEqual([expect.objectContaining({ callId: "call-1" })]);
525+} finally {
526+stdout.restore();
527+}
528+});
529+493530it("CLI smoke dry-runs a live call unless --yes is passed", async () => {
494531const program = new Command();
495532const stdout = captureStdout();
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。