Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

test(local-agent): bind takeover dependency in direct-send fixtures

DavidShenc9a30e04c632
diff --git a/apps/desktop/src/main/maker-ipc/__tests__/orcaModelSelectionIntent.test.ts b/apps/desktop/src/main/maker-ipc/__tests__/orcaModelSelectionIntent.test.ts
index f897f0a3b1..8d53866794 100644
--- a/apps/desktop/src/main/maker-ipc/__tests__/orcaModelSelectionIntent.test.ts
+++ b/apps/desktop/src/main/maker-ipc/__tests__/orcaModelSelectionIntent.test.ts
@@ -4,6 +4,7 @@ import { describe, expect, it, vi } from 'vitest';
import { applyPendingAgentSwitchIfIdle, createPendingAgentSwitchRegistry, isUserPendingAgentSwitchIntent, type MakerSessionAgentSwitchHandlerDeps, type PendingAgentSwitchIntent } from '../sessionAgentSwitchHandler';
import { parseOrcaRemoteLead } from '../../../shared/orcaRemoteWorker';
import { acquireSendToSessionLock, withSendToSessionLock } from '../sendToSessionLock';
+import { takeOverLocalAgentVisibleSession } from '../../local-agent/visibleSessions';
import { effectiveSourceIdForModel, findCatalogModel, type ProviderView } from '@cindy/model-providers';
import { resolveSessionRuntimeAxes } from '../sessionRuntimeControl';
import { parseScheduledModelBaseline } from '../../../shared/scheduledModelBaseline';
@@ -197,6 +198,7 @@ describe('complete selection commit boundaries', () => {
profile = automatic;
// A new scope instance also exercises a restart between turns.
const adapter = compile(directSendAdapter, {
+ takeOverLocalAgentVisibleSession,
scheduledModelScope: createScheduledModelScope(deps),
acquireSendToSessionLock, agentSwitchPending: new Map(),
isUserPendingAgentSwitchIntent, reconcileBotModelRoute: vi.fn(),
@@ -239,6 +241,7 @@ describe('complete selection commit boundaries', () => {
const deps = { pendingSwitches: pending, getLiveSession: () => null, selectSameAgentModel: selected,
bootstrapSwitchedSession: vi.fn(), log: { warn: vi.fn() } } as unknown as MakerSessionAgentSwitchHandlerDeps;
const directSend = compile(directSendAdapter, { agentSwitchPending: pending, acquireSendToSessionLock,
+ takeOverLocalAgentVisibleSession,
scheduledModelScope: { restore: vi.fn(async () => {}) },
restoreArchivedSessionForSend: async () => { status = 'active'; },
reconcileBotModelRoute: vi.fn(), applyPendingAgentSwitchIfIdle, isUserPendingAgentSwitchIntent,
@@ -340,6 +343,7 @@ describe('Orca model-only picker intent admission', () => {
bootstrapSwitchedSession: vi.fn(), withCloseSuppressed: (_id: string, fn: () => Promise<unknown>) => fn(),
log: { info: vi.fn(), warn: vi.fn() } } as unknown as MakerSessionAgentSwitchHandlerDeps;
const directSend = compile(directSendAdapter, {
+ takeOverLocalAgentVisibleSession,
scheduledModelScope: { restore: vi.fn(async () => {}) },
agentSwitchPending: pending, restoreArchivedSessionForSend: restore,
acquireSendToSessionLock: acquire, reconcileBotModelRoute: vi.fn(),