






















@@ -2,8 +2,6 @@
22import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
3344const state = vi.hoisted(() => ({
5-abortEmbeddedAgentRunMock: vi.fn(),
6-requestEmbeddedRunModelSwitchMock: vi.fn(),
75resolveDefaultModelForAgentMock: vi.fn(),
86resolvePersistedSelectedModelRefMock: vi.fn(),
97loadSessionStoreMock: vi.fn(),
@@ -17,12 +15,6 @@ vi.mock("./embedded-agent.js", () => {
1715return {};
1816});
191720-vi.mock("./embedded-agent-runner/runs.js", () => ({
21-abortEmbeddedAgentRun: (...args: unknown[]) => state.abortEmbeddedAgentRunMock(...args),
22-requestEmbeddedRunModelSwitch: (...args: unknown[]) =>
23-state.requestEmbeddedRunModelSwitchMock(...args),
24-}));
25-2618vi.mock("./model-selection.js", async () => {
2719const actual =
2820await vi.importActual<typeof import("./model-selection.js")>("./model-selection.js");
@@ -81,8 +73,6 @@ describe("live model switch", () => {
8173});
82748375beforeEach(() => {
84-state.abortEmbeddedAgentRunMock.mockReset().mockReturnValue(false);
85-state.requestEmbeddedRunModelSwitchMock.mockReset();
8676state.embeddedAgentModuleImported = false;
8777state.resolveDefaultModelForAgentMock
8878.mockReset()
@@ -339,27 +329,6 @@ describe("live model switch", () => {
339329});
340330});
341331342-it("queues a live switch only when an active run was aborted", async () => {
343-// Switching live runs is two-phase: abort the active run, then queue the
344-// selected provider/model for the restarted embedded run to consume.
345-state.abortEmbeddedAgentRunMock.mockReturnValue(true);
346-347-const { requestLiveSessionModelSwitch } = await loadModule();
348-349-expect(
350-requestLiveSessionModelSwitch({
351-sessionEntry: { sessionId: "session-1" },
352-selection: { provider: "openai", model: "gpt-5.4", authProfileId: "profile-gpt" },
353-}),
354-).toBe(true);
355-expect(state.abortEmbeddedAgentRunMock).toHaveBeenCalledWith("session-1");
356-expect(state.requestEmbeddedRunModelSwitchMock).toHaveBeenCalledWith("session-1", {
357-provider: "openai",
358-model: "gpt-5.4",
359-authProfileId: "profile-gpt",
360-});
361-});
362-363332it("does not import the broad embedded-agent barrel on module load", async () => {
364333await loadModule();
365334@@ -435,23 +404,6 @@ describe("live model switch", () => {
435404).toBe(false);
436405});
437406438-it("does not track persisted live selection when the run started on a transient model override", async () => {
439-const { shouldTrackPersistedLiveSessionModelSelection } = await loadModule();
440-441-expect(
442-shouldTrackPersistedLiveSessionModelSelection(
443-{
444-provider: "anthropic",
445-model: "claude-haiku-4-5",
446-},
447-{
448-provider: "anthropic",
449-model: "claude-sonnet-4-6",
450-},
451-),
452-).toBe(false);
453-});
454-455407describe("shouldSwitchToLiveModel", () => {
456408it("returns the persisted selection when liveModelSwitchPending is true and model differs", async () => {
457409const sessionEntry = {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。