passive-agent-startup-fixture.ts 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { mkdirSync } from "node:fs";
  2. import { resolve } from "node:path";
  3. export const PASSIVE_AGENT_STARTUP_WORKSPACE_COUNT = 9;
  4. // 虚拟项目重构(spec 3.6 F13 / D42)后启动只预热上次活动的目录,不再从 recentProjects
  5. // 额外挑选预热目标;期望集合因此只剩 active workspace。
  6. export const PASSIVE_AGENT_STARTUP_SCENARIO = {
  7. workspaceCount: PASSIVE_AGENT_STARTUP_WORKSPACE_COUNT,
  8. activeWorkspaceIndex: 4,
  9. expectedWarmupWorkspaceIndexes: [4],
  10. explicitWorkspaceIndex: 2,
  11. } as const;
  12. export const SMALL_AGENT_WARMUP_SCENARIO = {
  13. workspaceCount: 2,
  14. activeWorkspaceIndex: 1,
  15. expectedWarmupWorkspaceIndexes: [1],
  16. } as const;
  17. export function getPassiveAgentStartupWorkspacePaths(
  18. e2eHomeDir: string,
  19. workspaceCount = PASSIVE_AGENT_STARTUP_WORKSPACE_COUNT,
  20. ): string[] {
  21. return Array.from({ length: workspaceCount }, (_, index) =>
  22. resolve(e2eHomeDir, `PassiveWorkspace-${String(index + 1).padStart(2, "0")}`),
  23. );
  24. }
  25. export function seedPassiveAgentStartupWorkspaces(
  26. e2eHomeDir: string,
  27. workspaceCount = PASSIVE_AGENT_STARTUP_WORKSPACE_COUNT,
  28. ): string[] {
  29. const workspacePaths = getPassiveAgentStartupWorkspacePaths(e2eHomeDir, workspaceCount);
  30. for (const workspacePath of workspacePaths) {
  31. mkdirSync(workspacePath, { recursive: true });
  32. }
  33. return workspacePaths;
  34. }