@staticpayload/zai-code 1.4.2 → 1.4.4
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/context/context_builder.d.ts +5 -18
- package/dist/context/context_builder.d.ts.map +1 -1
- package/dist/context/context_builder.js +108 -202
- package/dist/context/context_builder.js.map +1 -1
- package/dist/context/project_memory.d.ts +3 -12
- package/dist/context/project_memory.d.ts.map +1 -1
- package/dist/context/project_memory.js +46 -89
- package/dist/context/project_memory.js.map +1 -1
- package/dist/orchestrator.d.ts.map +1 -1
- package/dist/orchestrator.js +77 -34
- package/dist/orchestrator.js.map +1 -1
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +12 -1
- package/dist/session.js.map +1 -1
- package/dist/settings.d.ts +4 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +17 -0
- package/dist/settings.js.map +1 -1
- package/dist/tui.d.ts.map +1 -1
- package/dist/tui.js +120 -123
- package/dist/tui.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
declare const MAX_FILE_SIZE = 50000;
|
|
3
|
-
declare const MAX_FILES = 50;
|
|
1
|
+
import { IntentType } from '../session';
|
|
4
2
|
export interface FileScore {
|
|
5
3
|
path: string;
|
|
6
4
|
score: number;
|
|
@@ -8,22 +6,11 @@ export interface FileScore {
|
|
|
8
6
|
extension: string;
|
|
9
7
|
}
|
|
10
8
|
export interface ContextResult {
|
|
11
|
-
files:
|
|
12
|
-
path: string;
|
|
13
|
-
content: string;
|
|
14
|
-
truncated: boolean;
|
|
15
|
-
}>;
|
|
9
|
+
files: FileScore[];
|
|
16
10
|
totalTokens: number;
|
|
17
|
-
fileCount: number;
|
|
18
|
-
truncatedCount: number;
|
|
19
|
-
}
|
|
20
|
-
export declare function indexWorkspace(rootPath: string): FileScore[];
|
|
21
|
-
export declare function scoreFileRelevance(file: FileScore, intent: string, intentType: string): number;
|
|
22
|
-
export declare function summarizeFile(content: string, maxChars: number): {
|
|
23
|
-
summary: string;
|
|
24
11
|
truncated: boolean;
|
|
25
|
-
}
|
|
26
|
-
export declare function
|
|
12
|
+
}
|
|
13
|
+
export declare function indexWorkspace(workingDir: string, maxDepth?: number): FileScore[];
|
|
14
|
+
export declare function buildContext(workingDir: string, intent: string, intentType: IntentType, openFiles?: string[], maxTokens?: number): ContextResult;
|
|
27
15
|
export declare function formatContextForModel(context: ContextResult): string;
|
|
28
|
-
export { MAX_CONTEXT_TOKENS, MAX_FILE_SIZE, MAX_FILES };
|
|
29
16
|
//# sourceMappingURL=context_builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context_builder.d.ts","sourceRoot":"","sources":["../../src/context/context_builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context_builder.d.ts","sourceRoot":"","sources":["../../src/context/context_builder.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;CACpB;AAgED,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAU,GAAG,SAAS,EAAE,CAmDpF;AAiCD,wBAAgB,YAAY,CAC1B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,SAAS,GAAE,MAAM,EAAO,EACxB,SAAS,GAAE,MAAc,GACxB,aAAa,CAyCf;AAGD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAiBpE"}
|
|
@@ -33,23 +33,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.MAX_FILES = exports.MAX_FILE_SIZE = exports.MAX_CONTEXT_TOKENS = void 0;
|
|
37
36
|
exports.indexWorkspace = indexWorkspace;
|
|
38
|
-
exports.scoreFileRelevance = scoreFileRelevance;
|
|
39
|
-
exports.summarizeFile = summarizeFile;
|
|
40
37
|
exports.buildContext = buildContext;
|
|
41
38
|
exports.formatContextForModel = formatContextForModel;
|
|
42
39
|
const fs = __importStar(require("fs"));
|
|
43
40
|
const path = __importStar(require("path"));
|
|
44
|
-
//
|
|
45
|
-
const MAX_CONTEXT_TOKENS = 50000; // Approximate max tokens
|
|
46
|
-
exports.MAX_CONTEXT_TOKENS = MAX_CONTEXT_TOKENS;
|
|
47
|
-
const MAX_FILE_SIZE = 50000; // Max bytes per file
|
|
48
|
-
exports.MAX_FILE_SIZE = MAX_FILE_SIZE;
|
|
49
|
-
const MAX_FILES = 50; // Max files to include
|
|
50
|
-
exports.MAX_FILES = MAX_FILES;
|
|
51
|
-
const CHARS_PER_TOKEN = 4; // Approximate chars per token
|
|
52
|
-
// File extensions by priority
|
|
41
|
+
// File extensions priority for code context
|
|
53
42
|
const EXTENSION_PRIORITY = {
|
|
54
43
|
'.ts': 10,
|
|
55
44
|
'.tsx': 10,
|
|
@@ -76,7 +65,7 @@ const EXTENSION_PRIORITY = {
|
|
|
76
65
|
'.sh': 5,
|
|
77
66
|
'.bash': 5,
|
|
78
67
|
};
|
|
79
|
-
// Directories to
|
|
68
|
+
// Directories to skip
|
|
80
69
|
const SKIP_DIRS = new Set([
|
|
81
70
|
'node_modules',
|
|
82
71
|
'.git',
|
|
@@ -85,238 +74,155 @@ const SKIP_DIRS = new Set([
|
|
|
85
74
|
'dist',
|
|
86
75
|
'build',
|
|
87
76
|
'out',
|
|
88
|
-
'target',
|
|
89
|
-
'__pycache__',
|
|
90
|
-
'.cache',
|
|
91
77
|
'.next',
|
|
92
78
|
'.nuxt',
|
|
93
|
-
'
|
|
79
|
+
'__pycache__',
|
|
80
|
+
'.pytest_cache',
|
|
94
81
|
'coverage',
|
|
95
82
|
'.nyc_output',
|
|
83
|
+
'vendor',
|
|
84
|
+
'.zai',
|
|
96
85
|
]);
|
|
97
|
-
// Files to
|
|
86
|
+
// Files to skip
|
|
98
87
|
const SKIP_FILES = new Set([
|
|
99
88
|
'package-lock.json',
|
|
100
89
|
'yarn.lock',
|
|
101
90
|
'pnpm-lock.yaml',
|
|
102
|
-
'
|
|
103
|
-
'
|
|
104
|
-
'Cargo.lock',
|
|
105
|
-
'go.sum',
|
|
91
|
+
'.DS_Store',
|
|
92
|
+
'Thumbs.db',
|
|
106
93
|
]);
|
|
107
|
-
//
|
|
108
|
-
function
|
|
94
|
+
// Estimate tokens from content (rough: 1 token ≈ 4 chars)
|
|
95
|
+
function estimateTokens(content) {
|
|
96
|
+
return Math.ceil(content.length / 4);
|
|
97
|
+
}
|
|
98
|
+
// Index workspace files
|
|
99
|
+
function indexWorkspace(workingDir, maxDepth = 5) {
|
|
109
100
|
const files = [];
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
function walk(dir, depth = 0) {
|
|
115
|
-
if (depth > 10)
|
|
116
|
-
return; // Max depth
|
|
101
|
+
function walk(dir, depth) {
|
|
102
|
+
if (depth > maxDepth)
|
|
103
|
+
return;
|
|
104
|
+
let entries;
|
|
117
105
|
try {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
106
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
107
|
+
}
|
|
108
|
+
catch {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
for (const entry of entries) {
|
|
112
|
+
const fullPath = path.join(dir, entry.name);
|
|
113
|
+
const relativePath = path.relative(workingDir, fullPath);
|
|
114
|
+
if (entry.isDirectory()) {
|
|
115
|
+
if (!SKIP_DIRS.has(entry.name) && !entry.name.startsWith('.')) {
|
|
116
|
+
walk(fullPath, depth + 1);
|
|
126
117
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
size: stats.size,
|
|
143
|
-
extension: ext,
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
catch {
|
|
147
|
-
// Skip files we can't stat
|
|
148
|
-
}
|
|
118
|
+
}
|
|
119
|
+
else if (entry.isFile()) {
|
|
120
|
+
if (SKIP_FILES.has(entry.name))
|
|
121
|
+
continue;
|
|
122
|
+
if (entry.name.startsWith('.'))
|
|
123
|
+
continue;
|
|
124
|
+
const ext = path.extname(entry.name).toLowerCase();
|
|
125
|
+
const priority = EXTENSION_PRIORITY[ext] || 1;
|
|
126
|
+
let size = 0;
|
|
127
|
+
try {
|
|
128
|
+
const stat = fs.statSync(fullPath);
|
|
129
|
+
size = stat.size;
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
continue;
|
|
149
133
|
}
|
|
134
|
+
// Skip very large files (> 100KB)
|
|
135
|
+
if (size > 100000)
|
|
136
|
+
continue;
|
|
137
|
+
files.push({
|
|
138
|
+
path: relativePath,
|
|
139
|
+
score: priority,
|
|
140
|
+
size,
|
|
141
|
+
extension: ext,
|
|
142
|
+
});
|
|
150
143
|
}
|
|
151
144
|
}
|
|
152
|
-
catch {
|
|
153
|
-
// Skip directories we can't read
|
|
154
|
-
}
|
|
155
145
|
}
|
|
156
|
-
walk(
|
|
146
|
+
walk(workingDir, 0);
|
|
157
147
|
return files;
|
|
158
148
|
}
|
|
159
|
-
// Score
|
|
149
|
+
// Score files based on relevance to intent
|
|
160
150
|
function scoreFileRelevance(file, intent, intentType) {
|
|
161
151
|
let score = file.score;
|
|
162
|
-
const
|
|
163
|
-
const
|
|
164
|
-
// Boost
|
|
165
|
-
const
|
|
166
|
-
for (const word of
|
|
167
|
-
if (
|
|
152
|
+
const lowerPath = file.path.toLowerCase();
|
|
153
|
+
const lowerIntent = intent.toLowerCase();
|
|
154
|
+
// Boost files mentioned in intent
|
|
155
|
+
const words = lowerIntent.split(/\s+/);
|
|
156
|
+
for (const word of words) {
|
|
157
|
+
if (word.length > 2 && lowerPath.includes(word)) {
|
|
168
158
|
score += 5;
|
|
169
159
|
}
|
|
170
160
|
}
|
|
171
161
|
// Boost based on intent type
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
// Prefer test files and error-related files
|
|
175
|
-
if (pathLower.includes('test') || pathLower.includes('spec')) {
|
|
176
|
-
score += 3;
|
|
177
|
-
}
|
|
178
|
-
if (pathLower.includes('error') || pathLower.includes('exception')) {
|
|
179
|
-
score += 3;
|
|
180
|
-
}
|
|
181
|
-
break;
|
|
182
|
-
case 'REFACTOR':
|
|
183
|
-
// Prefer main source files
|
|
184
|
-
if (pathLower.includes('src/') || pathLower.includes('lib/')) {
|
|
185
|
-
score += 3;
|
|
186
|
-
}
|
|
187
|
-
break;
|
|
188
|
-
case 'REVIEW':
|
|
189
|
-
// Prefer config and doc files
|
|
190
|
-
if (file.extension === '.md' || file.extension === '.json') {
|
|
191
|
-
score += 2;
|
|
192
|
-
}
|
|
193
|
-
break;
|
|
162
|
+
if (intentType === 'DEBUG' && (lowerPath.includes('test') || lowerPath.includes('spec'))) {
|
|
163
|
+
score += 3;
|
|
194
164
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
score -= 2;
|
|
165
|
+
if (intentType === 'REVIEW' && lowerPath.includes('readme')) {
|
|
166
|
+
score += 2;
|
|
198
167
|
}
|
|
199
|
-
|
|
200
|
-
|
|
168
|
+
// Boost entry points
|
|
169
|
+
if (lowerPath === 'index.ts' || lowerPath === 'index.js' || lowerPath === 'main.ts') {
|
|
170
|
+
score += 2;
|
|
201
171
|
}
|
|
202
172
|
return score;
|
|
203
173
|
}
|
|
204
|
-
//
|
|
205
|
-
function
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
209
|
-
if (content.length <= maxChars) {
|
|
210
|
-
return { summary: content, truncated: false };
|
|
211
|
-
}
|
|
212
|
-
// Include first portion and last portion
|
|
213
|
-
const headSize = Math.floor(maxChars * 0.7);
|
|
214
|
-
const tailSize = Math.floor(maxChars * 0.2);
|
|
215
|
-
const truncationMessage = `\n\n... [${content.length - headSize - tailSize} chars truncated] ...\n\n`;
|
|
216
|
-
// Ensure we have room for the truncation message
|
|
217
|
-
const effectiveMaxChars = maxChars - truncationMessage.length;
|
|
218
|
-
if (effectiveMaxChars <= 0) {
|
|
219
|
-
return { summary: content.slice(0, maxChars), truncated: true };
|
|
220
|
-
}
|
|
221
|
-
const effectiveHeadSize = Math.floor(effectiveMaxChars * 0.7);
|
|
222
|
-
const effectiveTailSize = Math.floor(effectiveMaxChars * 0.2);
|
|
223
|
-
const head = content.slice(0, effectiveHeadSize);
|
|
224
|
-
const tail = content.slice(-effectiveTailSize);
|
|
225
|
-
const summary = `${head}${truncationMessage}${tail}`;
|
|
226
|
-
return { summary, truncated: true };
|
|
227
|
-
}
|
|
228
|
-
// Build context for a task
|
|
229
|
-
function buildContext(rootPath, intent, intentType, additionalFiles = []) {
|
|
230
|
-
// Index workspace
|
|
231
|
-
const allFiles = indexWorkspace(rootPath);
|
|
232
|
-
// Score files by relevance
|
|
174
|
+
// Build context for API call
|
|
175
|
+
function buildContext(workingDir, intent, intentType, openFiles = [], maxTokens = 50000) {
|
|
176
|
+
const allFiles = indexWorkspace(workingDir);
|
|
177
|
+
// Score and sort files
|
|
233
178
|
const scoredFiles = allFiles.map(f => ({
|
|
234
179
|
...f,
|
|
235
|
-
|
|
180
|
+
score: scoreFileRelevance(f, intent, intentType),
|
|
236
181
|
}));
|
|
237
|
-
//
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
files: [],
|
|
244
|
-
totalTokens: 0,
|
|
245
|
-
fileCount: 0,
|
|
246
|
-
truncatedCount: 0,
|
|
247
|
-
};
|
|
248
|
-
const maxChars = MAX_CONTEXT_TOKENS * CHARS_PER_TOKEN;
|
|
249
|
-
let currentChars = 0;
|
|
250
|
-
// First, add explicitly requested files
|
|
251
|
-
for (const relPath of additionalSet) {
|
|
252
|
-
const fullPath = path.join(rootPath, relPath);
|
|
253
|
-
try {
|
|
254
|
-
const content = fs.readFileSync(fullPath, 'utf-8');
|
|
255
|
-
const { summary, truncated } = summarizeFile(content, Math.min(content.length, MAX_FILE_SIZE));
|
|
256
|
-
if (currentChars + summary.length > maxChars)
|
|
257
|
-
break;
|
|
258
|
-
result.files.push({
|
|
259
|
-
path: relPath,
|
|
260
|
-
content: summary,
|
|
261
|
-
truncated,
|
|
262
|
-
});
|
|
263
|
-
currentChars += summary.length;
|
|
264
|
-
result.fileCount++;
|
|
265
|
-
if (truncated)
|
|
266
|
-
result.truncatedCount++;
|
|
267
|
-
}
|
|
268
|
-
catch {
|
|
269
|
-
// Skip files we can't read
|
|
182
|
+
// Prioritize open files
|
|
183
|
+
for (const openFile of openFiles) {
|
|
184
|
+
const relative = path.relative(workingDir, openFile);
|
|
185
|
+
const found = scoredFiles.find(f => f.path === relative);
|
|
186
|
+
if (found) {
|
|
187
|
+
found.score += 20;
|
|
270
188
|
}
|
|
271
189
|
}
|
|
272
|
-
//
|
|
190
|
+
// Sort by score descending
|
|
191
|
+
scoredFiles.sort((a, b) => b.score - a.score);
|
|
192
|
+
// Select files within token budget
|
|
193
|
+
const selectedFiles = [];
|
|
194
|
+
let totalTokens = 0;
|
|
195
|
+
let truncated = false;
|
|
273
196
|
for (const file of scoredFiles) {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
break;
|
|
278
|
-
if (additionalSet.has(file.path))
|
|
197
|
+
const estimatedTokens = Math.ceil(file.size / 4);
|
|
198
|
+
if (totalTokens + estimatedTokens > maxTokens) {
|
|
199
|
+
truncated = true;
|
|
279
200
|
continue;
|
|
280
|
-
const fullPath = path.join(rootPath, file.path);
|
|
281
|
-
try {
|
|
282
|
-
const content = fs.readFileSync(fullPath, 'utf-8');
|
|
283
|
-
const maxFileChars = Math.min(MAX_FILE_SIZE, Math.floor((maxChars - currentChars) / 2) // Leave room for other files
|
|
284
|
-
);
|
|
285
|
-
const { summary, truncated } = summarizeFile(content, maxFileChars);
|
|
286
|
-
if (currentChars + summary.length > maxChars)
|
|
287
|
-
break;
|
|
288
|
-
result.files.push({
|
|
289
|
-
path: file.path,
|
|
290
|
-
content: summary,
|
|
291
|
-
truncated,
|
|
292
|
-
});
|
|
293
|
-
currentChars += summary.length;
|
|
294
|
-
result.fileCount++;
|
|
295
|
-
if (truncated)
|
|
296
|
-
result.truncatedCount++;
|
|
297
|
-
}
|
|
298
|
-
catch {
|
|
299
|
-
// Skip files we can't read
|
|
300
201
|
}
|
|
202
|
+
selectedFiles.push(file);
|
|
203
|
+
totalTokens += estimatedTokens;
|
|
301
204
|
}
|
|
302
|
-
|
|
303
|
-
|
|
205
|
+
return {
|
|
206
|
+
files: selectedFiles,
|
|
207
|
+
totalTokens,
|
|
208
|
+
truncated,
|
|
209
|
+
};
|
|
304
210
|
}
|
|
305
|
-
// Format context for model
|
|
211
|
+
// Format context for model
|
|
306
212
|
function formatContextForModel(context) {
|
|
307
213
|
if (context.files.length === 0) {
|
|
308
|
-
return '
|
|
309
|
-
}
|
|
310
|
-
let output = `Context: ${context.fileCount} files (~${context.totalTokens} tokens)`;
|
|
311
|
-
if (context.truncatedCount > 0) {
|
|
312
|
-
output += ` [${context.truncatedCount} truncated]`;
|
|
214
|
+
return '';
|
|
313
215
|
}
|
|
314
|
-
|
|
315
|
-
for (const file of context.files) {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
216
|
+
const parts = [];
|
|
217
|
+
for (const file of context.files.slice(0, 20)) {
|
|
218
|
+
try {
|
|
219
|
+
const content = fs.readFileSync(file.path, 'utf-8');
|
|
220
|
+
parts.push(`--- ${file.path} ---\n${content}\n`);
|
|
221
|
+
}
|
|
222
|
+
catch {
|
|
223
|
+
// Skip unreadable files
|
|
224
|
+
}
|
|
319
225
|
}
|
|
320
|
-
return
|
|
226
|
+
return parts.join('\n');
|
|
321
227
|
}
|
|
322
228
|
//# sourceMappingURL=context_builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context_builder.js","sourceRoot":"","sources":["../../src/context/context_builder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"context_builder.js","sourceRoot":"","sources":["../../src/context/context_builder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+EA,wCAmDC;AAiCD,oCA+CC;AAGD,sDAiBC;AAtOD,uCAAyB;AACzB,2CAA6B;AAgB7B,4CAA4C;AAC5C,MAAM,kBAAkB,GAA2B;IACjD,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;C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AC;IAE3B,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;QAC9C,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACpD,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,SAAS,OAAO,IAAI,CAAC,CAAC;QACnD,CAAC;QAAC,MAAM,CAAC;YACP,wBAAwB;QAC1B,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
declare
|
|
2
|
-
declare
|
|
3
|
-
export declare function loadProjectContext(workingDir?: string): string;
|
|
4
|
-
export declare function saveProjectContext(content: string, workingDir?: string): boolean;
|
|
5
|
-
export declare function appendProjectRule(rule: string, workingDir?: string): boolean;
|
|
1
|
+
export declare function loadProjectContext(workingDir: string): string | null;
|
|
2
|
+
export declare function saveProjectContext(workingDir: string, content: string): boolean;
|
|
6
3
|
export declare function getSystemPrompt(workingDir?: string): string;
|
|
7
|
-
export
|
|
8
|
-
load(): Promise<string>;
|
|
9
|
-
append(rule: string): Promise<void>;
|
|
10
|
-
getSystemPrompt(): Promise<string>;
|
|
11
|
-
}
|
|
12
|
-
export declare function createProjectMemory(workingDir?: string): ProjectMemory;
|
|
13
|
-
export { MEMORY_FILE, BASE_SYSTEM_PROMPT };
|
|
4
|
+
export declare function hasProjectContext(workingDir: string): boolean;
|
|
14
5
|
//# sourceMappingURL=project_memory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project_memory.d.ts","sourceRoot":"","sources":["../../src/context/project_memory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"project_memory.d.ts","sourceRoot":"","sources":["../../src/context/project_memory.ts"],"names":[],"mappings":"AA6BA,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYpE;AAGD,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAa/E;AAGD,wBAAgB,eAAe,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAW3D;AAGD,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAG7D"}
|