2025-11-11 20:06:43 -08:00
|
|
|
/**
|
|
|
|
|
* @license
|
|
|
|
|
* Copyright 2025 Google LLC
|
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import { describe, it, expect } from 'vitest';
|
|
|
|
|
import { CodebaseInvestigatorAgent } from './codebase-investigator.js';
|
|
|
|
|
import {
|
|
|
|
|
GLOB_TOOL_NAME,
|
|
|
|
|
GREP_TOOL_NAME,
|
|
|
|
|
LS_TOOL_NAME,
|
|
|
|
|
READ_FILE_TOOL_NAME,
|
|
|
|
|
} from '../tools/tool-names.js';
|
2025-12-09 16:07:50 -05:00
|
|
|
import { GEMINI_MODEL_ALIAS_PRO } from '../config/models.js';
|
2025-11-11 20:06:43 -08:00
|
|
|
|
|
|
|
|
describe('CodebaseInvestigatorAgent', () => {
|
|
|
|
|
it('should have the correct agent definition', () => {
|
|
|
|
|
expect(CodebaseInvestigatorAgent.name).toBe('codebase_investigator');
|
|
|
|
|
expect(CodebaseInvestigatorAgent.displayName).toBe(
|
|
|
|
|
'Codebase Investigator Agent',
|
|
|
|
|
);
|
|
|
|
|
expect(CodebaseInvestigatorAgent.description).toBeDefined();
|
|
|
|
|
expect(
|
|
|
|
|
CodebaseInvestigatorAgent.inputConfig.inputs['objective'].required,
|
|
|
|
|
).toBe(true);
|
|
|
|
|
expect(CodebaseInvestigatorAgent.outputConfig?.outputName).toBe('report');
|
|
|
|
|
expect(CodebaseInvestigatorAgent.modelConfig?.model).toBe(
|
2025-12-09 16:07:50 -05:00
|
|
|
GEMINI_MODEL_ALIAS_PRO,
|
2025-11-11 20:06:43 -08:00
|
|
|
);
|
|
|
|
|
expect(CodebaseInvestigatorAgent.toolConfig?.tools).toEqual([
|
|
|
|
|
LS_TOOL_NAME,
|
|
|
|
|
READ_FILE_TOOL_NAME,
|
|
|
|
|
GLOB_TOOL_NAME,
|
|
|
|
|
GREP_TOOL_NAME,
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
it('should process output to a formatted JSON string', () => {
|
|
|
|
|
const report = {
|
|
|
|
|
SummaryOfFindings: 'summary',
|
|
|
|
|
ExplorationTrace: ['trace'],
|
|
|
|
|
RelevantLocations: [],
|
|
|
|
|
};
|
|
|
|
|
const processed = CodebaseInvestigatorAgent.processOutput?.(report);
|
|
|
|
|
expect(processed).toBe(JSON.stringify(report, null, 2));
|
|
|
|
|
});
|
|
|
|
|
});
|