@codebolt/agent 6.1.12 → 6.1.13
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/dist/processor-pieces/messageModifiers/atFileProcessorModifier.js +6 -1
- package/dist/processor-pieces/messageModifiers/coreSystemPromptModifier.js +14 -0
- package/dist/processor-pieces/messageModifiers/directoryContextModifier.js +8 -3
- package/dist/processor-pieces/messageModifiers/environmentContextModifier.js +16 -6
- package/dist/processor-pieces/postToolCallProcessors/shellProcessorModifier.js +1 -1
- package/package.json +1 -1
|
@@ -126,7 +126,8 @@ class AtFileProcessorModifier extends base_1.BaseMessageModifier {
|
|
|
126
126
|
let workspaceDirectories = [];
|
|
127
127
|
try {
|
|
128
128
|
const { projectPath } = await codeboltjs_1.default.project.getProjectPath();
|
|
129
|
-
|
|
129
|
+
const effectiveProjectPath = process.env['CODEBOLT_EFFECTIVE_PROJECT_PATH'] || process.env['CODEBOLT_PROJECT_PATH'] || projectPath;
|
|
130
|
+
workspaceDirectories = effectiveProjectPath ? [effectiveProjectPath] : [await this.getProjectPath()];
|
|
130
131
|
}
|
|
131
132
|
catch (error) {
|
|
132
133
|
workspaceDirectories = [await this.getProjectPath()];
|
|
@@ -357,6 +358,10 @@ class AtFileProcessorModifier extends base_1.BaseMessageModifier {
|
|
|
357
358
|
return -1;
|
|
358
359
|
}
|
|
359
360
|
async getProjectPath() {
|
|
361
|
+
const effectiveProjectPath = process.env['CODEBOLT_EFFECTIVE_PROJECT_PATH'] || process.env['CODEBOLT_PROJECT_PATH'];
|
|
362
|
+
if (effectiveProjectPath) {
|
|
363
|
+
return effectiveProjectPath;
|
|
364
|
+
}
|
|
360
365
|
try {
|
|
361
366
|
const { projectPath } = await codeboltjs_1.default.project.getProjectPath();
|
|
362
367
|
return projectPath || process.cwd();
|
|
@@ -32,8 +32,22 @@ class CoreSystemPromptModifier extends base_1.BaseMessageModifier {
|
|
|
32
32
|
return `${basePrompt}${memorySuffix}`;
|
|
33
33
|
}
|
|
34
34
|
getDefaultSystemPrompt() {
|
|
35
|
+
const effectiveProjectPath = process.env['CODEBOLT_EFFECTIVE_PROJECT_PATH'] || process.env['CODEBOLT_PROJECT_PATH'];
|
|
36
|
+
const baseProjectPath = process.env['CODEBOLT_BASE_PROJECT_PATH'];
|
|
37
|
+
const workspaceContext = effectiveProjectPath
|
|
38
|
+
? `
|
|
39
|
+
|
|
40
|
+
# Workspace Context
|
|
41
|
+
|
|
42
|
+
- Effective project path for this task: ${effectiveProjectPath}
|
|
43
|
+
${baseProjectPath ? `- CodeBolt base project path: ${baseProjectPath}
|
|
44
|
+
- CodeBolt app-level configuration, providers, plugins, and .codebolt data are loaded from the base project path.
|
|
45
|
+
- File edits, shell commands, and code changes for the user's task must target the effective project path unless the user explicitly asks you to inspect or change base project configuration.` : '- No separate CodeBolt base project path was provided; treat the effective project path as the active project root.'}
|
|
46
|
+
`
|
|
47
|
+
: '';
|
|
35
48
|
return `
|
|
36
49
|
You are an interactive CLI agent specializing in software engineering tasks. Your primary goal is to help users safely and efficiently, adhering strictly to the following instructions and utilizing your available tools.
|
|
50
|
+
${workspaceContext}
|
|
37
51
|
|
|
38
52
|
# Core Mandates
|
|
39
53
|
|
|
@@ -76,7 +76,8 @@ class DirectoryContextModifier extends base_1.BaseMessageModifier {
|
|
|
76
76
|
let workspaceDirectories = this.options.workspaceDirectories;
|
|
77
77
|
if (!workspaceDirectories || workspaceDirectories.length === 0) {
|
|
78
78
|
const { projectPath } = await codeboltjs_1.default.project.getProjectPath();
|
|
79
|
-
|
|
79
|
+
const effectiveProjectPath = process.env['CODEBOLT_EFFECTIVE_PROJECT_PATH'] || process.env['CODEBOLT_PROJECT_PATH'] || projectPath;
|
|
80
|
+
workspaceDirectories = effectiveProjectPath ? [effectiveProjectPath] : [];
|
|
80
81
|
}
|
|
81
82
|
if (workspaceDirectories.length === 0) {
|
|
82
83
|
return createdMessage;
|
|
@@ -86,12 +87,16 @@ class DirectoryContextModifier extends base_1.BaseMessageModifier {
|
|
|
86
87
|
const folderStructures = await Promise.all(workspaceDirectories.map((dir) => this.getFolderStructure(dir)));
|
|
87
88
|
const folderStructure = folderStructures.join('\n');
|
|
88
89
|
let workingDirPreamble;
|
|
90
|
+
const baseProjectPath = process.env['CODEBOLT_BASE_PROJECT_PATH'];
|
|
89
91
|
if (workspaceDirectories.length === 1) {
|
|
90
|
-
workingDirPreamble = `I'm currently working in the directory: ${workspaceDirectories[0]}`;
|
|
92
|
+
workingDirPreamble = `I'm currently working in the effective project directory: ${workspaceDirectories[0]}`;
|
|
91
93
|
}
|
|
92
94
|
else {
|
|
93
95
|
const dirList = workspaceDirectories.map((dir) => ` - ${dir}`).join('\n');
|
|
94
|
-
workingDirPreamble = `I'm currently working in the following directories:\n${dirList}`;
|
|
96
|
+
workingDirPreamble = `I'm currently working in the following effective project directories:\n${dirList}`;
|
|
97
|
+
}
|
|
98
|
+
if (baseProjectPath) {
|
|
99
|
+
workingDirPreamble += `\nCodeBolt base project directory for app-level configuration/plugins: ${baseProjectPath}`;
|
|
95
100
|
}
|
|
96
101
|
const directoryContext = `${workingDirPreamble}
|
|
97
102
|
Here is the folder structure of the current working directories:
|
|
@@ -81,7 +81,8 @@ class EnvironmentContextModifier extends base_1.BaseMessageModifier {
|
|
|
81
81
|
if (!projectPath) {
|
|
82
82
|
return createdMessage;
|
|
83
83
|
}
|
|
84
|
-
const currentDir = projectPath;
|
|
84
|
+
const currentDir = process.env['CODEBOLT_EFFECTIVE_PROJECT_PATH'] || process.env['CODEBOLT_PROJECT_PATH'] || projectPath;
|
|
85
|
+
const baseProjectPath = process.env['CODEBOLT_BASE_PROJECT_PATH'];
|
|
85
86
|
// Get basic directory listing
|
|
86
87
|
let directoryListing = '';
|
|
87
88
|
try {
|
|
@@ -97,7 +98,9 @@ class EnvironmentContextModifier extends base_1.BaseMessageModifier {
|
|
|
97
98
|
This is the CodeBolt AI Agent. Setting up context for our chat.
|
|
98
99
|
Today's date is ${today} (formatted according to the user's locale).
|
|
99
100
|
Operating system: ${platform}
|
|
100
|
-
|
|
101
|
+
Effective project directory for this task: ${currentDir}
|
|
102
|
+
${baseProjectPath ? `CodeBolt base project directory: ${baseProjectPath}
|
|
103
|
+
CodeBolt app-level configuration, providers, plugins, and .codebolt data are loaded from the base project directory. Code changes for the task should still target the effective project directory unless the user explicitly says otherwise.` : ''}
|
|
101
104
|
${directoryListing}
|
|
102
105
|
`.trim();
|
|
103
106
|
// Prepare context parts (same as gemini-cli)
|
|
@@ -106,6 +109,12 @@ ${directoryListing}
|
|
|
106
109
|
if (agentMdContext) {
|
|
107
110
|
contextParts.push(agentMdContext);
|
|
108
111
|
}
|
|
112
|
+
if (baseProjectPath && path.resolve(baseProjectPath) !== path.resolve(currentDir)) {
|
|
113
|
+
const baseAgentMdContext = await this.readProjectAgentMd(baseProjectPath, 'Base Project Agent Instructions');
|
|
114
|
+
if (baseAgentMdContext) {
|
|
115
|
+
contextParts.push(baseAgentMdContext);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
109
118
|
// Add full file context if enabled (just like gemini-cli does)
|
|
110
119
|
if (this.options.enableFullContext) {
|
|
111
120
|
try {
|
|
@@ -135,7 +144,8 @@ ${directoryListing}
|
|
|
135
144
|
environmentInfo: {
|
|
136
145
|
date: today,
|
|
137
146
|
platform,
|
|
138
|
-
currentDir
|
|
147
|
+
currentDir,
|
|
148
|
+
baseProjectPath
|
|
139
149
|
}
|
|
140
150
|
}
|
|
141
151
|
});
|
|
@@ -145,7 +155,7 @@ ${directoryListing}
|
|
|
145
155
|
return createdMessage;
|
|
146
156
|
}
|
|
147
157
|
}
|
|
148
|
-
async readProjectAgentMd(basePath) {
|
|
158
|
+
async readProjectAgentMd(basePath, title = 'Project Agent Instructions') {
|
|
149
159
|
const agentMdPath = path.join(basePath, '.codebolt', 'agent.md');
|
|
150
160
|
const relativePath = path.relative(basePath, agentMdPath);
|
|
151
161
|
try {
|
|
@@ -154,13 +164,13 @@ ${directoryListing}
|
|
|
154
164
|
return '';
|
|
155
165
|
}
|
|
156
166
|
if (stats.size > this.options.maxFileSize) {
|
|
157
|
-
return `---
|
|
167
|
+
return `--- ${title} (${relativePath}) ---\n[File too large: ${stats.size} bytes]`;
|
|
158
168
|
}
|
|
159
169
|
const content = await fs.promises.readFile(agentMdPath, 'utf-8');
|
|
160
170
|
if (!content.trim()) {
|
|
161
171
|
return '';
|
|
162
172
|
}
|
|
163
|
-
return `---
|
|
173
|
+
return `--- ${title} (${relativePath}) ---\n${content}`;
|
|
164
174
|
}
|
|
165
175
|
catch (error) {
|
|
166
176
|
const nodeError = error;
|
|
@@ -16,7 +16,7 @@ class ShellProcessorModifier extends base_1.BasePostToolCallProcessor {
|
|
|
16
16
|
maxExecutionTime: options.maxExecutionTime || 10000, // 10 seconds
|
|
17
17
|
allowedCommands: options.allowedCommands || ['ls', 'pwd', 'echo', 'cat', 'head', 'tail', 'grep', 'find', 'wc'],
|
|
18
18
|
blockedCommands: options.blockedCommands || ['rm', 'del', 'format', 'sudo', 'su', 'chmod', 'chown', 'kill', 'killall'],
|
|
19
|
-
workingDirectory: options.workingDirectory || process.cwd()
|
|
19
|
+
workingDirectory: options.workingDirectory || process.env['CODEBOLT_EFFECTIVE_PROJECT_PATH'] || process.env['CODEBOLT_PROJECT_PATH'] || process.cwd()
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
22
|
async modify(input) {
|