Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
test(plugins): 补齐运行接口相关回归夹具
liugaoweied7ede509fdb
diff --git a/apps/desktop/src/main/cindy-brain/__tests__/ghostInstanceBoundaries.test.ts b/apps/desktop/src/main/cindy-brain/__tests__/ghostInstanceBoundaries.test.tsindex 0138301ec8..cad6b3ef28 100644--- a/apps/desktop/src/main/cindy-brain/__tests__/ghostInstanceBoundaries.test.ts+++ b/apps/desktop/src/main/cindy-brain/__tests__/ghostInstanceBoundaries.test.ts@@ -45,6 +45,7 @@ function harness() {pluginDeviceSync: { beginMutation: vi.fn(() => vi.fn()) },getGhostNodeRuntimeBroker: () => ({ stop }), getGhostSubscriptionGateway: () => ({ dropGhost: vi.fn() }),getGhostErrandSlot: () => ({ clearGhost: vi.fn() }),+ harnessSlotSingleton: null,getGhostLibrarySlot: () => ({ disposeGhost: vi.fn() }),suspendGhostUnreadProjection: vi.fn(), refreshMivoLibraryExtraDirGrant: async () => {},broadcastGhostsChanged: vi.fn(),diff --git a/apps/desktop/src/main/cindy-brain/__tests__/ghostLocalFileIpc.test.ts b/apps/desktop/src/main/cindy-brain/__tests__/ghostLocalFileIpc.test.tsindex 2b3a847f1a..ccf8ad38d9 100644--- a/apps/desktop/src/main/cindy-brain/__tests__/ghostLocalFileIpc.test.ts+++ b/apps/desktop/src/main/cindy-brain/__tests__/ghostLocalFileIpc.test.ts@@ -21,7 +21,7 @@ import { loadGhostFirstPartyFactsLoader } from '../ghostFirstPartyFacts.js';import { authorizeGhostTokenBroker } from '../ghostFirstPartyPrivilege.js';import { createGhostInstallReceipt, type GhostInstallReceipt } from '../ghostInstallReceipt.js';import { classifyGhostLocalUpdateSource } from '../ghostLocalUpdateSource.js';-import { confirmedTaskCapability } from '../ghostInstallConsent.js';+import { confirmedHarnessCapabilities, confirmedTaskCapability } from '../ghostInstallConsent.js';type Handler = (event: unknown, ...args: unknown[]) => Promise<unknown>;@@ -270,6 +270,7 @@ function harness(createWindowGhostInstallConsentPrompt: vi.fn(),assertGhostInstallConsent: vi.fn(),confirmedTaskCapability,+ confirmedHarnessCapabilities,withGhostInstallLock: async (_id: string, task: () => unknown) => task(),withActiveOwnerGhostOauthMutationLock: async (_id: string, task: () => unknown) => task(),getGhostRuntime: () => runtime,@@ -280,6 +281,7 @@ function harness(networkSlotSingleton: { hasInFlightRequests: () => options.networkBusy === true },getGhostNodeRuntimeBroker: () => ({ stopAndWait: vi.fn() }),getGhostAgentSlot: () => ({ clearGhost: vi.fn() }),+ harnessSlotSingleton: null,getGhostErrandSlot: () => ({ clearGhost: vi.fn() }),getGhostOauthAccountManager: () => ({ prepareAccountsForChangedClients: vi.fn() }),ghostSourceStateArchiveId: () => '_ns__cindy-archive-test__filo-local',diff --git a/apps/desktop/src/main/cindy-brain/__tests__/ghostLocalInstallIdentity.test.ts b/apps/desktop/src/main/cindy-brain/__tests__/ghostLocalInstallIdentity.test.tsindex 5aa18d0e02..7048c2a3b0 100644--- a/apps/desktop/src/main/cindy-brain/__tests__/ghostLocalInstallIdentity.test.ts+++ b/apps/desktop/src/main/cindy-brain/__tests__/ghostLocalInstallIdentity.test.ts@@ -2,7 +2,7 @@ import { describe, expect, it, vi } from 'vitest';import type { InstalledGhost } from '../../../shared/ghost.js';import type { GhostInstallConsentRequest } from '../../../shared/ghostInstallConsent.js';import { findInstalledGhostForDeliveryTarget, installedGhostStoragePart } from '../../../shared/pluginIdentity.js';-import { assertGhostInstallConsent, confirmedTaskCapability, obtainGhostInstallConsent } from '../ghostInstallConsent.js';+import { assertGhostInstallConsent, confirmedHarnessCapabilities, confirmedTaskCapability, obtainGhostInstallConsent } from '../ghostInstallConsent.js';import { createGhostProductionCallbacks } from './ghostProductionCallbacksFixture.js';const createCallbacks = createGhostProductionCallbacks<{@@ -38,7 +38,7 @@ describe('local root installation consent identity', () => {rejectBrokerWithoutDeclaredRedirectPort: vi.fn(), rejectUnauthorizedTokenBroker: vi.fn(),throwIpcError: (code: string) => { throw new Error(code); },throwInstallError: () => { throw new Error('install rejected'); },- obtainGhostInstallConsent, assertGhostInstallConsent, confirmedTaskCapability,+ obtainGhostInstallConsent, assertGhostInstallConsent, confirmedTaskCapability, confirmedHarnessCapabilities,createWindowGhostInstallConsentPrompt: () => prompt,findInstalledGhostForDeliveryTarget, installedGhostStoragePart,withGhostInstallLock: async (_id: string, operation: () => unknown) => operation(),diff --git a/packages/maker-core/src/agents/claude-code/__tests__/plan-mode.test.ts b/packages/maker-core/src/agents/claude-code/__tests__/plan-mode.test.tsindex 93c861538f..493b86a9e4 100644--- a/packages/maker-core/src/agents/claude-code/__tests__/plan-mode.test.ts+++ b/packages/maker-core/src/agents/claude-code/__tests__/plan-mode.test.ts@@ -161,7 +161,8 @@ async function startPlanSession(systemPrompt?: { append?: string };hooks?: {PreToolUse?: Array<{- hooks: Array<(input: Record<string, unknown>) => Promise<Record<string, unknown>>>;+ hooks: Array<(input: Record<string, unknown>, toolUseId?: string,+ options?: { signal: AbortSignal }) => Promise<Record<string, unknown>>>;}>;};}@@ -584,7 +585,7 @@ describe('ClaudeCodeAgent plan mode', () => {for (const hook of group.hooks) {const decision = await hook({hook_event_name: 'PreToolUse', tool_name: toolName, tool_input: {},- });+ }, undefined, { signal: new AbortController().signal });expect(decision.hookSpecificOutput).not.toMatchObject({ permissionDecision: 'deny' });}}diff --git a/packages/maker-core/src/agents/codex/app-server/stdioTransport.test.ts b/packages/maker-core/src/agents/codex/app-server/stdioTransport.test.tsindex df57d72c55..61a5707aa4 100644--- a/packages/maker-core/src/agents/codex/app-server/stdioTransport.test.ts+++ b/packages/maker-core/src/agents/codex/app-server/stdioTransport.test.ts@@ -235,7 +235,9 @@ describe('production stdio initialization recovery', () => {if (rpc.method) requests[index].push(rpc.method);queueMicrotask(() => {if (index === 2 && scenario === 'recover') {- if (rpc.id != null) readers[index].emit('line', JSON.stringify({ id: rpc.id, result: {} }));+ if (rpc.id != null) readers[index].emit('line', JSON.stringify({ id: rpc.id,+ result: rpc.method === 'initialize' ? { userAgent: 'codex/0.0.0', codexHome: '/x' } : {},+ }));} else if (rpc.method === 'initialize') {child.stderr.emit('data', 'Error: failed to initialize sqlite state runtime under /x: failed to initialize state runtime at ');child.emit('exit', 1, null);diff --git a/packages/maker-core/src/agents/pi/__tests__/cindyBridgeSource.test.ts b/packages/maker-core/src/agents/pi/__tests__/cindyBridgeSource.test.tsindex 806a22b808..93d21ef8a5 100644--- a/packages/maker-core/src/agents/pi/__tests__/cindyBridgeSource.test.ts+++ b/packages/maker-core/src/agents/pi/__tests__/cindyBridgeSource.test.ts@@ -52,12 +52,13 @@ it('keeps text-only policy local and ordinary tools independent of host UI failuconst source = CINDY_BRIDGE_EXTENSION_SOURCE;const helperStart = source.indexOf('let textOnlyTurnActive = false');const helperEnd = source.indexOf('function currentPermissionState', helperStart);+ const harnessHookStart = source.indexOf(' const runHarnessHook =');const handlerStart = source.indexOf(" pi.on('tool_call', async");const handlerEnd = source.indexOf('\n });', handlerStart) + '\n });'.length;const handlers = new Map<string, (event: any, ctx: any) => any>();let permissionReads = 0;const compiled = ts.transpileModule(- source.slice(helperStart, helperEnd) + '\ninstallTextOnlyTurnPolicy(pi);\n' + source.slice(handlerStart, handlerEnd),+ source.slice(helperStart, helperEnd) + '\ninstallTextOnlyTurnPolicy(pi);\n' + source.slice(harnessHookStart, handlerEnd),{ compilerOptions: { target: ts.ScriptTarget.ES2022 } },).outputText;runInNewContext(compiled, {