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(pi): use host path semantics in session fixtures

nanaabeaa1dcb58b
diff --git a/packages/maker-core/src/agents/pi/__tests__/pi-startsession-cleanup.test.ts b/packages/maker-core/src/agents/pi/__tests__/pi-startsession-cleanup.test.ts
index 87241dff88..a510a847a5 100644
--- a/packages/maker-core/src/agents/pi/__tests__/pi-startsession-cleanup.test.ts
+++ b/packages/maker-core/src/agents/pi/__tests__/pi-startsession-cleanup.test.ts
@@ -65,6 +65,7 @@ vi.mock('../rpc-client.js', () => ({
}));
import { PiAgent } from '../index.js';
+import { piProjectKey } from '../project-trust.js';
import type { AgentDeps } from '../../base-agent.js';
import type { Logger } from '../../../interfaces/logger.js';
import type { PiProjectTrustInputSnapshot } from '../../../types/pi-project-trust.js';
@@ -151,19 +152,25 @@ describe('PiAgent.startSession failure cleanup (mocked pi process)', () => {
revision: string,
skills: readonly string[],
): PiProjectTrustInputSnapshot {
+ const identity: PiProjectTrustInputSnapshot['identity'] = {
+ workingDir,
+ canonicalWorkingDir: workingDir,
+ canonicalRepoRoot: workingDir,
+ repoRootStatus: 'resolved',
+ platform: process.platform === 'win32' ? 'win32' : 'posix',
+ canonicalPathEncoding: process.platform === 'win32' ? 'utf16-lossless' : 'utf8-lossless',
+ ...(process.platform === 'win32'
+ ? { windowsCaseComparison: 'ordinal-insensitive' as const }
+ : {}),
+ };
+ const scopeKey = piProjectKey(identity);
+ if (!scopeKey) throw new Error('test project identity must be canonical');
return {
- identity: {
- workingDir,
- canonicalWorkingDir: workingDir,
- canonicalRepoRoot: workingDir,
- repoRootStatus: 'resolved',
- platform: 'posix',
- canonicalPathEncoding: 'utf8-lossless',
- },
+ identity,
approval: {
status: 'approved',
scope: 'working-dir',
- scopeKey: `${workingDir}\0${workingDir}`,
+ scopeKey,
revision,
},
discovered: {