@codebolt/agent 6.1.10 → 6.1.12

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.
@@ -13,6 +13,7 @@ export declare class EnvironmentContextModifier extends BaseMessageModifier {
13
13
  private readonly defaultExcludePatterns;
14
14
  constructor(options?: EnvironmentContextOptions);
15
15
  modify(_originalRequest: FlatUserMessage, createdMessage: ProcessedMessage): Promise<ProcessedMessage>;
16
+ private readProjectAgentMd;
16
17
  private generateFullContext;
17
18
  private findRelevantFiles;
18
19
  private walkDirectory;
@@ -102,6 +102,10 @@ ${directoryListing}
102
102
  `.trim();
103
103
  // Prepare context parts (same as gemini-cli)
104
104
  const contextParts = [environmentContext];
105
+ const agentMdContext = await this.readProjectAgentMd(currentDir);
106
+ if (agentMdContext) {
107
+ contextParts.push(agentMdContext);
108
+ }
105
109
  // Add full file context if enabled (just like gemini-cli does)
106
110
  if (this.options.enableFullContext) {
107
111
  try {
@@ -125,6 +129,7 @@ ${directoryListing}
125
129
  metadata: {
126
130
  ...createdMessage.metadata,
127
131
  environmentContextAdded: true,
132
+ projectAgentMdContextAdded: Boolean(agentMdContext),
128
133
  fullContextAdded: this.options.enableFullContext,
129
134
  contextFilesCount: this.options.enableFullContext ? await this.countContextFiles(currentDir) : 0,
130
135
  environmentInfo: {
@@ -140,6 +145,31 @@ ${directoryListing}
140
145
  return createdMessage;
141
146
  }
142
147
  }
148
+ async readProjectAgentMd(basePath) {
149
+ const agentMdPath = path.join(basePath, '.codebolt', 'agent.md');
150
+ const relativePath = path.relative(basePath, agentMdPath);
151
+ try {
152
+ const stats = await fs.promises.stat(agentMdPath);
153
+ if (!stats.isFile()) {
154
+ return '';
155
+ }
156
+ if (stats.size > this.options.maxFileSize) {
157
+ return `--- Project Agent Instructions (${relativePath}) ---\n[File too large: ${stats.size} bytes]`;
158
+ }
159
+ const content = await fs.promises.readFile(agentMdPath, 'utf-8');
160
+ if (!content.trim()) {
161
+ return '';
162
+ }
163
+ return `--- Project Agent Instructions (${relativePath}) ---\n${content}`;
164
+ }
165
+ catch (error) {
166
+ const nodeError = error;
167
+ if (nodeError.code !== 'ENOENT') {
168
+ console.error(`Error reading ${relativePath}:`, error);
169
+ }
170
+ return '';
171
+ }
172
+ }
143
173
  // Full context methods (integrated like gemini-cli)
144
174
  async generateFullContext(basePath) {
145
175
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codebolt/agent",
3
- "version": "6.1.10",
3
+ "version": "6.1.12",
4
4
  "description": "CodeBolt Agent utilities for building and managing AI agents",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",