@google/gemini-cli-core 0.9.0-nightly.20251002.aa8b2abe → 0.9.0-nightly.20251004.7db79e14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/src/agents/codebase-investigator.d.ts +36 -1
- package/dist/src/agents/codebase-investigator.js +58 -86
- package/dist/src/agents/codebase-investigator.js.map +1 -1
- package/dist/src/agents/executor.d.ts +7 -11
- package/dist/src/agents/executor.js +225 -94
- package/dist/src/agents/executor.js.map +1 -1
- package/dist/src/agents/executor.test.js +327 -287
- package/dist/src/agents/executor.test.js.map +1 -1
- package/dist/src/agents/invocation.d.ts +3 -2
- package/dist/src/agents/invocation.js +1 -0
- package/dist/src/agents/invocation.js.map +1 -1
- package/dist/src/agents/invocation.test.js +1 -0
- package/dist/src/agents/invocation.test.js.map +1 -1
- package/dist/src/agents/registry.d.ts +2 -1
- package/dist/src/agents/registry.js +2 -0
- package/dist/src/agents/registry.js.map +1 -1
- package/dist/src/agents/types.d.ts +28 -6
- package/dist/src/agents/types.js +1 -0
- package/dist/src/agents/types.js.map +1 -1
- package/dist/src/config/config.d.ts +4 -0
- package/dist/src/config/config.js +8 -0
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/core/client.js +2 -2
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +1 -1
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/geminiChat.js +1 -14
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js +14 -18
- package/dist/src/core/geminiChat.test.js.map +1 -1
- package/dist/src/core/prompts.d.ts +2 -1
- package/dist/src/core/prompts.js +81 -8
- package/dist/src/core/prompts.js.map +1 -1
- package/dist/src/core/prompts.test.js +73 -24
- package/dist/src/core/prompts.test.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +0 -8
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +2 -2
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +4 -4
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
- package/dist/src/telemetry/constants.d.ts +1 -0
- package/dist/src/telemetry/constants.js +1 -0
- package/dist/src/telemetry/constants.js.map +1 -1
- package/dist/src/telemetry/loggers.js +2 -2
- package/dist/src/telemetry/loggers.js.map +1 -1
- package/dist/src/telemetry/loggers.test.js +2 -2
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/tools/mcp-client.d.ts +3 -2
- package/dist/src/tools/mcp-client.js +28 -30
- package/dist/src/tools/mcp-client.js.map +1 -1
- package/dist/src/tools/mcp-client.test.js +168 -5
- package/dist/src/tools/mcp-client.test.js.map +1 -1
- package/dist/src/utils/errorParsing.d.ts +1 -1
- package/dist/src/utils/errorParsing.js +5 -33
- package/dist/src/utils/errorParsing.js.map +1 -1
- package/dist/src/utils/errorParsing.test.js +0 -88
- package/dist/src/utils/errorParsing.test.js.map +1 -1
- package/dist/src/utils/flashFallback.test.js +26 -45
- package/dist/src/utils/flashFallback.test.js.map +1 -1
- package/dist/src/utils/googleErrors.d.ts +104 -0
- package/dist/src/utils/googleErrors.js +108 -0
- package/dist/src/utils/googleErrors.js.map +1 -0
- package/dist/src/utils/googleErrors.test.d.ts +6 -0
- package/dist/src/utils/googleErrors.test.js +212 -0
- package/dist/src/utils/googleErrors.test.js.map +1 -0
- package/dist/src/utils/googleQuotaErrors.d.ts +35 -0
- package/dist/src/utils/googleQuotaErrors.js +108 -0
- package/dist/src/utils/googleQuotaErrors.js.map +1 -0
- package/dist/src/utils/googleQuotaErrors.test.d.ts +6 -0
- package/dist/src/utils/googleQuotaErrors.test.js +189 -0
- package/dist/src/utils/googleQuotaErrors.test.js.map +1 -0
- package/dist/src/utils/memoryDiscovery.d.ts +1 -0
- package/dist/src/utils/memoryDiscovery.js +2 -1
- package/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.test.js +99 -21
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
- package/dist/src/utils/quotaErrorDetection.d.ts +0 -2
- package/dist/src/utils/quotaErrorDetection.js +0 -46
- package/dist/src/utils/quotaErrorDetection.js.map +1 -1
- package/dist/src/utils/retry.js +40 -157
- package/dist/src/utils/retry.js.map +1 -1
- package/dist/src/utils/retry.test.js +85 -144
- package/dist/src/utils/retry.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -128,7 +128,7 @@ gemini
|
|
|
128
128
|
|
|
129
129
|
```bash
|
|
130
130
|
# Set your Google Cloud Project
|
|
131
|
-
export GOOGLE_CLOUD_PROJECT="
|
|
131
|
+
export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
|
|
132
132
|
gemini
|
|
133
133
|
```
|
|
134
134
|
|
|
@@ -294,6 +294,7 @@ Check our [Official Roadmap](https://github.com/orgs/google-gemini/projects/11)
|
|
|
294
294
|
## 📖 Resources
|
|
295
295
|
|
|
296
296
|
- **[Official Roadmap](./ROADMAP.md)** - See what's coming next.
|
|
297
|
+
- **[Changelog](./docs/changelogs/index.md)** - See recent notable updates.
|
|
297
298
|
- **[NPM Package](https://www.npmjs.com/package/@google/gemini-cli)** - Package registry.
|
|
298
299
|
- **[GitHub Issues](https://github.com/google-gemini/gemini-cli/issues)** - Report bugs or request features.
|
|
299
300
|
- **[Security Advisories](https://github.com/google-gemini/gemini-cli/security/advisories)** - Security updates.
|
package/dist/index.d.ts
CHANGED
|
@@ -15,3 +15,5 @@ export { makeFakeConfig } from './src/test-utils/config.js';
|
|
|
15
15
|
export * from './src/utils/pathReader.js';
|
|
16
16
|
export { ClearcutLogger } from './src/telemetry/clearcut-logger/clearcut-logger.js';
|
|
17
17
|
export { logModelSlashCommand } from './src/telemetry/loggers.js';
|
|
18
|
+
export * from './src/utils/googleQuotaErrors.js';
|
|
19
|
+
export type { GoogleApiError } from './src/utils/googleErrors.js';
|
package/dist/index.js
CHANGED
|
@@ -15,4 +15,5 @@ export { makeFakeConfig } from './src/test-utils/config.js';
|
|
|
15
15
|
export * from './src/utils/pathReader.js';
|
|
16
16
|
export { ClearcutLogger } from './src/telemetry/clearcut-logger/clearcut-logger.js';
|
|
17
17
|
export { logModelSlashCommand } from './src/telemetry/loggers.js';
|
|
18
|
+
export * from './src/utils/googleQuotaErrors.js';
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,EAC1B,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,yBAAyB,GAI1B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,kCAAkC,EAClC,sCAAsC,GACvC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,EAC1B,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,yBAAyB,GAI1B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,kCAAkC,EAClC,sCAAsC,GACvC,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,GACvB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,cAAc,2BAA2B,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,cAAc,kCAAkC,CAAC"}
|
|
@@ -4,8 +4,43 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import type { AgentDefinition } from './types.js';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
declare const CodebaseInvestigationReportSchema: z.ZodObject<{
|
|
9
|
+
SummaryOfFindings: z.ZodString;
|
|
10
|
+
ExplorationTrace: z.ZodArray<z.ZodString, "many">;
|
|
11
|
+
RelevantLocations: z.ZodArray<z.ZodObject<{
|
|
12
|
+
FilePath: z.ZodString;
|
|
13
|
+
Reasoning: z.ZodString;
|
|
14
|
+
KeySymbols: z.ZodArray<z.ZodString, "many">;
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
FilePath: string;
|
|
17
|
+
Reasoning: string;
|
|
18
|
+
KeySymbols: string[];
|
|
19
|
+
}, {
|
|
20
|
+
FilePath: string;
|
|
21
|
+
Reasoning: string;
|
|
22
|
+
KeySymbols: string[];
|
|
23
|
+
}>, "many">;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
SummaryOfFindings: string;
|
|
26
|
+
ExplorationTrace: string[];
|
|
27
|
+
RelevantLocations: {
|
|
28
|
+
FilePath: string;
|
|
29
|
+
Reasoning: string;
|
|
30
|
+
KeySymbols: string[];
|
|
31
|
+
}[];
|
|
32
|
+
}, {
|
|
33
|
+
SummaryOfFindings: string;
|
|
34
|
+
ExplorationTrace: string[];
|
|
35
|
+
RelevantLocations: {
|
|
36
|
+
FilePath: string;
|
|
37
|
+
Reasoning: string;
|
|
38
|
+
KeySymbols: string[];
|
|
39
|
+
}[];
|
|
40
|
+
}>;
|
|
7
41
|
/**
|
|
8
42
|
* A Proof-of-Concept subagent specialized in analyzing codebase structure,
|
|
9
43
|
* dependencies, and technologies.
|
|
10
44
|
*/
|
|
11
|
-
export declare const CodebaseInvestigatorAgent: AgentDefinition
|
|
45
|
+
export declare const CodebaseInvestigatorAgent: AgentDefinition<typeof CodebaseInvestigationReportSchema>;
|
|
46
|
+
export {};
|
|
@@ -8,50 +8,23 @@ import { ReadFileTool } from '../tools/read-file.js';
|
|
|
8
8
|
import { GLOB_TOOL_NAME } from '../tools/tool-names.js';
|
|
9
9
|
import { GrepTool } from '../tools/grep.js';
|
|
10
10
|
import { DEFAULT_GEMINI_MODEL } from '../config/models.js';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
7. Read \`packages/core/src/config/config.ts\` to understand the \`Config\` class and \`ConfigParameters\` interface.
|
|
29
|
-
</ExplorationTrace>
|
|
30
|
-
<RelevantLocations>
|
|
31
|
-
<Location>
|
|
32
|
-
<FilePath>packages/cli/src/ui/commands/types.ts</FilePath>
|
|
33
|
-
<Reasoning>This file contains the definition of the \`CommandContext\` interface, which is the central piece of this investigation. The property \`config: Config | null\` needs to be changed to \`config: Config\` here.</Reasoning>
|
|
34
|
-
<KeySymbols>
|
|
35
|
-
<Symbol>CommandContext</Symbol>
|
|
36
|
-
</KeySymbols>
|
|
37
|
-
</Location>
|
|
38
|
-
<Location>
|
|
39
|
-
<FilePath>packages/cli/src/test-utils/mockCommandContext.ts</FilePath>
|
|
40
|
-
<Reasoning>This file contains the \`createMockCommandContext\` function, which is used in many tests to create mock \`CommandContext\` objects. This function needs to be updated to provide a default mock \`Config\` object instead of \`null\`.</Reasoning>
|
|
41
|
-
<KeySymbols>
|
|
42
|
-
<Symbol>createMockCommandContext</Symbol>
|
|
43
|
-
</KeySymbols>
|
|
44
|
-
</Location>
|
|
45
|
-
<Location>
|
|
46
|
-
<FilePath>packages/core/src/config/config.ts</FilePath>
|
|
47
|
-
<Reasoning>This file defines the \`Config\` class and the \`ConfigParameters\` interface. This information is needed to create a proper mock \`Config\` object to be used in the updated \`createMockCommandContext\` function.</Reasoning>
|
|
48
|
-
<KeySymbols>
|
|
49
|
-
<Symbol>Config</Symbol>
|
|
50
|
-
<Symbol>ConfigParameters</Symbol>
|
|
51
|
-
</KeySymbols>
|
|
52
|
-
</Location>
|
|
53
|
-
</RelevantLocations>
|
|
54
|
-
</CodebaseReport>`;
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
// Define a type that matches the outputConfig schema for type safety.
|
|
13
|
+
const CodebaseInvestigationReportSchema = z.object({
|
|
14
|
+
SummaryOfFindings: z
|
|
15
|
+
.string()
|
|
16
|
+
.describe("A summary of the investigation's conclusions and insights for the main agent."),
|
|
17
|
+
ExplorationTrace: z
|
|
18
|
+
.array(z.string())
|
|
19
|
+
.describe('A step-by-step list of actions and tools used during the investigation.'),
|
|
20
|
+
RelevantLocations: z
|
|
21
|
+
.array(z.object({
|
|
22
|
+
FilePath: z.string(),
|
|
23
|
+
Reasoning: z.string(),
|
|
24
|
+
KeySymbols: z.array(z.string()),
|
|
25
|
+
}))
|
|
26
|
+
.describe('A list of relevant files and the key symbols within them.'),
|
|
27
|
+
});
|
|
55
28
|
/**
|
|
56
29
|
* A Proof-of-Concept subagent specialized in analyzing codebase structure,
|
|
57
30
|
* dependencies, and technologies.
|
|
@@ -59,9 +32,10 @@ const CODEBASE_REPORT_MARKDOWN = `<CodebaseReport>
|
|
|
59
32
|
export const CodebaseInvestigatorAgent = {
|
|
60
33
|
name: 'codebase_investigator',
|
|
61
34
|
displayName: 'Codebase Investigator Agent',
|
|
62
|
-
description: `
|
|
63
|
-
|
|
64
|
-
|
|
35
|
+
description: `Your primary tool for multifile search tasks and codebase exploration.
|
|
36
|
+
Invoke this tool to delegate search tasks to an autonomous subagent.
|
|
37
|
+
Use this to find features, understand context, or locate specific files, functions, or symbols.
|
|
38
|
+
Returns a structured Json report with key file paths, symbols, architectural map and insights to solve a task or answer questions`,
|
|
65
39
|
inputConfig: {
|
|
66
40
|
inputs: {
|
|
67
41
|
objective: {
|
|
@@ -73,18 +47,12 @@ export const CodebaseInvestigatorAgent = {
|
|
|
73
47
|
},
|
|
74
48
|
},
|
|
75
49
|
outputConfig: {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
The report should strictly follow a format like this example:
|
|
80
|
-
${CODEBASE_REPORT_MARKDOWN}
|
|
81
|
-
`,
|
|
82
|
-
completion_criteria: [
|
|
83
|
-
'The report must directly address the initial `objective`.',
|
|
84
|
-
'Cite specific files, functions, or configuration snippets and symbols as evidence for your findings.',
|
|
85
|
-
'Conclude with a xml markdown summary of the key files, symbols, technologies, architectural patterns, and conventions discovered.',
|
|
86
|
-
],
|
|
50
|
+
outputName: 'report',
|
|
51
|
+
description: 'The final investigation report as a JSON object.',
|
|
52
|
+
schema: CodebaseInvestigationReportSchema,
|
|
87
53
|
},
|
|
54
|
+
// The 'output' parameter is now strongly typed as CodebaseInvestigationReportSchema
|
|
55
|
+
processOutput: (output) => JSON.stringify(output, null, 2),
|
|
88
56
|
modelConfig: {
|
|
89
57
|
model: DEFAULT_GEMINI_MODEL,
|
|
90
58
|
temp: 0.1,
|
|
@@ -127,37 +95,41 @@ You operate in a non-interactive loop and must reason based on the information p
|
|
|
127
95
|
**This is your most critical function. Your scratchpad is your memory and your plan.**
|
|
128
96
|
1. **Initialization:** On your very first turn, you **MUST** create the \`<scratchpad>\` section. Analyze the \`task\` and create an initial \`Checklist\` of investigation goals and a \`Questions to Resolve\` section for any initial uncertainties.
|
|
129
97
|
2. **Constant Updates:** After **every** \`<OBSERVATION>\`, you **MUST** update the scratchpad.
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
98
|
+
* Mark checklist items as complete: \`[x]\`.
|
|
99
|
+
* Add new checklist items as you trace the architecture.
|
|
100
|
+
* **Explicitly log questions in \`Questions to Resolve\`** (e.g., \`[ ] What is the purpose of the 'None' element in this list?\`). Do not consider your investigation complete until this list is empty.
|
|
101
|
+
* Record \`Key Findings\` with file paths and notes about their purpose and relevance.
|
|
102
|
+
* Update \`Irrelevant Paths to Ignore\` to avoid re-investigating dead ends.
|
|
135
103
|
3. **Thinking on Paper:** The scratchpad must show your reasoning process, including how you resolve your questions.
|
|
136
104
|
---
|
|
137
|
-
## Scratchpad
|
|
138
|
-
For every turn, you **MUST** update your internal state based on the observation.
|
|
139
|
-
Scratchpad example:
|
|
140
|
-
<SCRATCHPAD>
|
|
141
|
-
**Checklist:**
|
|
142
|
-
- [x] Find the main translation loading logic.
|
|
143
|
-
- [ ] **(New)** Investigate the \`gettext.translation\` function to understand its arguments.
|
|
144
|
-
- [ ] **(New)** Check the signature of \`locale.init\` and its callers for type consistency.
|
|
145
|
-
**Questions to Resolve:**
|
|
146
|
-
- [x] ~~What is the purpose of the 'None' element in the \`locale_dirs\` list?~~ **Finding:** It's for system-wide gettext catalogs.
|
|
147
|
-
**Key Findings:**
|
|
148
|
-
- \`sphinx/application.py\`: Assembles the \`locale_dirs\` list. The order is critical.
|
|
149
|
-
- \`sphinx/locale/__init__.py\`: Consumes \`locale_dirs\`. Its \`init\` function signature might need a type hint update if \`None\` is passed.
|
|
150
|
-
**Irrelevant Paths to Ignore:**
|
|
151
|
-
- \`README.md\`
|
|
152
|
-
**Next Step:**
|
|
153
|
-
- I will use \`web_fetch\` to search for "python gettext translation localedir None" to resolve my open question.
|
|
154
|
-
</SCRATCHPAD>
|
|
155
105
|
## Termination
|
|
156
|
-
Your mission is complete **ONLY** when your \`Questions to Resolve\` list is empty and you
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
106
|
+
Your mission is complete **ONLY** when your \`Questions to Resolve\` list is empty and you have identified all files and necessary change *considerations*.
|
|
107
|
+
When you are finished, you **MUST** call the \`complete_task\` tool. The \`report\` argument for this tool **MUST** be a valid JSON object containing your findings.
|
|
108
|
+
|
|
109
|
+
**Example of the final report**
|
|
110
|
+
\`\`\`json
|
|
111
|
+
{
|
|
112
|
+
"SummaryOfFindings": "The core issue is a race condition in the \`updateUser\` function. The function reads the user's state, performs an asynchronous operation, and then writes the state back. If another request modifies the user state during the async operation, that change will be overwritten. The fix requires implementing a transactional read-modify-write pattern, potentially using a database lock or a versioning system.",
|
|
113
|
+
"ExplorationTrace": [
|
|
114
|
+
"Used \`grep\` to search for \`updateUser\` to locate the primary function.",
|
|
115
|
+
"Read the file \`src/controllers/userController.js\` to understand the function's logic.",
|
|
116
|
+
"Used \`ls -R\` to look for related files, such as services or database models.",
|
|
117
|
+
"Read \`src/services/userService.js\` and \`src/models/User.js\` to understand the data flow and how state is managed."
|
|
118
|
+
],
|
|
119
|
+
"RelevantLocations": [
|
|
120
|
+
{
|
|
121
|
+
"FilePath": "src/controllers/userController.js",
|
|
122
|
+
"Reasoning": "This file contains the \`updateUser\` function which has the race condition. It's the entry point for the problematic logic.",
|
|
123
|
+
"KeySymbols": ["updateUser", "getUser", "saveUser"]
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"FilePath": "src/services/userService.js",
|
|
127
|
+
"Reasoning": "This service is called by the controller and handles the direct interaction with the data layer. Any locking mechanism would likely be implemented here.",
|
|
128
|
+
"KeySymbols": ["updateUserData"]
|
|
129
|
+
}
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
\`\`\`
|
|
161
133
|
`,
|
|
162
134
|
},
|
|
163
135
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codebase-investigator.js","sourceRoot":"","sources":["../../../src/agents/codebase-investigator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"codebase-investigator.js","sourceRoot":"","sources":["../../../src/agents/codebase-investigator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,sEAAsE;AACtE,MAAM,iCAAiC,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,iBAAiB,EAAE,CAAC;SACjB,MAAM,EAAE;SACR,QAAQ,CACP,+EAA+E,CAChF;IACH,gBAAgB,EAAE,CAAC;SAChB,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;SACjB,QAAQ,CACP,yEAAyE,CAC1E;IACH,iBAAiB,EAAE,CAAC;SACjB,KAAK,CACJ,CAAC,CAAC,MAAM,CAAC;QACP,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;QACpB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;KAChC,CAAC,CACH;SACA,QAAQ,CAAC,2DAA2D,CAAC;CACzE,CAAC,CAAC;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAElC;IACF,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE,6BAA6B;IAC1C,WAAW,EAAE;;;sIAGuH;IACpI,WAAW,EAAE;QACX,MAAM,EAAE;YACN,SAAS,EAAE;gBACT,WAAW,EAAE;4HACuG;gBACpH,IAAI,EAAE,QAAQ;gBACd,QAAQ,EAAE,IAAI;aACf;SACF;KACF;IACD,YAAY,EAAE;QACZ,UAAU,EAAE,QAAQ;QACpB,WAAW,EAAE,kDAAkD;QAC/D,MAAM,EAAE,iCAAiC;KAC1C;IAED,oFAAoF;IACpF,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IAE1D,WAAW,EAAE;QACX,KAAK,EAAE,oBAAoB;QAC3B,IAAI,EAAE,GAAG;QACT,KAAK,EAAE,IAAI;QACX,cAAc,EAAE,CAAC,CAAC;KACnB;IAED,SAAS,EAAE;QACT,gBAAgB,EAAE,CAAC;QACnB,SAAS,EAAE,EAAE;KACd;IAED,UAAU,EAAE;QACV,wCAAwC;QACxC,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,EAAE,cAAc,EAAE,QAAQ,CAAC,IAAI,CAAC;KACvE;IAED,YAAY,EAAE;QACZ,KAAK,EAAE;;;aAGE;QACT,YAAY,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DjB;KACE;CACF,CAAC"}
|
|
@@ -5,19 +5,17 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { Config } from '../config/config.js';
|
|
7
7
|
import type { AgentDefinition, AgentInputs, OutputObject, SubagentActivityEvent } from './types.js';
|
|
8
|
+
import { type z } from 'zod';
|
|
8
9
|
/** A callback function to report on agent activity. */
|
|
9
10
|
export type ActivityCallback = (activity: SubagentActivityEvent) => void;
|
|
10
11
|
/**
|
|
11
12
|
* Executes an agent loop based on an {@link AgentDefinition}.
|
|
12
13
|
*
|
|
13
|
-
* This executor
|
|
14
|
-
*
|
|
15
|
-
* gathered all necessary information to fulfill its goal.
|
|
16
|
-
* 2. **Extraction Phase:** A final prompt is sent to the model to summarize
|
|
17
|
-
* the work and extract the final result in the desired format.
|
|
14
|
+
* This executor runs the agent in a loop, calling tools until it calls the
|
|
15
|
+
* mandatory `complete_task` tool to signal completion.
|
|
18
16
|
*/
|
|
19
|
-
export declare class AgentExecutor {
|
|
20
|
-
readonly definition: AgentDefinition
|
|
17
|
+
export declare class AgentExecutor<TOutput extends z.ZodTypeAny> {
|
|
18
|
+
readonly definition: AgentDefinition<TOutput>;
|
|
21
19
|
private readonly agentId;
|
|
22
20
|
private readonly toolRegistry;
|
|
23
21
|
private readonly runtimeContext;
|
|
@@ -33,7 +31,7 @@ export declare class AgentExecutor {
|
|
|
33
31
|
* @param onActivity An optional callback to receive activity events.
|
|
34
32
|
* @returns A promise that resolves to a new `AgentExecutor` instance.
|
|
35
33
|
*/
|
|
36
|
-
static create(definition: AgentDefinition
|
|
34
|
+
static create<TOutput extends z.ZodTypeAny>(definition: AgentDefinition<TOutput>, runtimeContext: Config, onActivity?: ActivityCallback): Promise<AgentExecutor<TOutput>>;
|
|
37
35
|
/**
|
|
38
36
|
* Constructs a new AgentExecutor instance.
|
|
39
37
|
*
|
|
@@ -60,7 +58,7 @@ export declare class AgentExecutor {
|
|
|
60
58
|
/**
|
|
61
59
|
* Executes function calls requested by the model and returns the results.
|
|
62
60
|
*
|
|
63
|
-
* @returns A new `Content` object
|
|
61
|
+
* @returns A new `Content` object for history, any submitted output, and completion status.
|
|
64
62
|
*/
|
|
65
63
|
private processFunctionCalls;
|
|
66
64
|
/**
|
|
@@ -69,8 +67,6 @@ export declare class AgentExecutor {
|
|
|
69
67
|
private prepareToolsList;
|
|
70
68
|
/** Builds the system prompt from the agent definition and inputs. */
|
|
71
69
|
private buildSystemPrompt;
|
|
72
|
-
/** Builds the final message for the extraction phase. */
|
|
73
|
-
private buildExtractionMessage;
|
|
74
70
|
/**
|
|
75
71
|
* Applies template strings to initial messages.
|
|
76
72
|
*
|