codehere 0.2.0 → 0.3.0
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.
Potentially problematic release.
This version of codehere might be problematic. Click here for more details.
- package/dist/application/agents/multi-agent-orchestrator.d.ts +1 -0
- package/dist/application/agents/multi-agent-orchestrator.d.ts.map +1 -1
- package/dist/application/agents/multi-agent-orchestrator.js.map +1 -1
- package/dist/application/services/dependency-container.d.ts +3 -0
- package/dist/application/services/dependency-container.d.ts.map +1 -1
- package/dist/application/services/dependency-container.js +24 -0
- package/dist/application/services/dependency-container.js.map +1 -1
- package/dist/application/use-cases/ask-question-use-case.d.ts +12 -0
- package/dist/application/use-cases/ask-question-use-case.d.ts.map +1 -1
- package/dist/application/use-cases/ask-question-use-case.js +129 -9
- package/dist/application/use-cases/ask-question-use-case.js.map +1 -1
- package/dist/application/use-cases/edit-file-use-case.d.ts.map +1 -1
- package/dist/application/use-cases/edit-file-use-case.js +70 -3
- package/dist/application/use-cases/edit-file-use-case.js.map +1 -1
- package/dist/application/use-cases/planning-use-case.d.ts.map +1 -1
- package/dist/application/use-cases/planning-use-case.js +10 -1
- package/dist/application/use-cases/planning-use-case.js.map +1 -1
- package/dist/application/use-cases/react-orchestration-use-case.d.ts.map +1 -1
- package/dist/application/use-cases/react-orchestration-use-case.js +6 -2
- package/dist/application/use-cases/react-orchestration-use-case.js.map +1 -1
- package/dist/domain/services/react-loop.d.ts +8 -0
- package/dist/domain/services/react-loop.d.ts.map +1 -1
- package/dist/domain/services/react-loop.js +82 -6
- package/dist/domain/services/react-loop.js.map +1 -1
- package/dist/formatter.d.ts +2 -2
- package/dist/formatter.d.ts.map +1 -1
- package/dist/formatter.js +30 -17
- package/dist/formatter.js.map +1 -1
- package/dist/index.js +134 -15
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/ai/cohere-ai-service.d.ts +3 -1
- package/dist/infrastructure/ai/cohere-ai-service.d.ts.map +1 -1
- package/dist/infrastructure/ai/cohere-ai-service.js +51 -4
- package/dist/infrastructure/ai/cohere-ai-service.js.map +1 -1
- package/dist/infrastructure/cache/query-result-cache.d.ts +68 -0
- package/dist/infrastructure/cache/query-result-cache.d.ts.map +1 -0
- package/dist/infrastructure/cache/query-result-cache.js +138 -0
- package/dist/infrastructure/cache/query-result-cache.js.map +1 -0
- package/dist/infrastructure/cache/security-scan-cache.d.ts +57 -0
- package/dist/infrastructure/cache/security-scan-cache.d.ts.map +1 -0
- package/dist/infrastructure/cache/security-scan-cache.js +124 -0
- package/dist/infrastructure/cache/security-scan-cache.js.map +1 -0
- package/dist/infrastructure/completion/bash-completion.d.ts +8 -0
- package/dist/infrastructure/completion/bash-completion.d.ts.map +1 -0
- package/dist/infrastructure/completion/bash-completion.js +101 -0
- package/dist/infrastructure/completion/bash-completion.js.map +1 -0
- package/dist/infrastructure/completion/completion-generator.d.ts +42 -0
- package/dist/infrastructure/completion/completion-generator.d.ts.map +1 -0
- package/dist/infrastructure/completion/completion-generator.js +184 -0
- package/dist/infrastructure/completion/completion-generator.js.map +1 -0
- package/dist/infrastructure/completion/fish-completion.d.ts +8 -0
- package/dist/infrastructure/completion/fish-completion.d.ts.map +1 -0
- package/dist/infrastructure/completion/fish-completion.js +65 -0
- package/dist/infrastructure/completion/fish-completion.js.map +1 -0
- package/dist/infrastructure/completion/zsh-completion.d.ts +8 -0
- package/dist/infrastructure/completion/zsh-completion.d.ts.map +1 -0
- package/dist/infrastructure/completion/zsh-completion.js +85 -0
- package/dist/infrastructure/completion/zsh-completion.js.map +1 -0
- package/dist/infrastructure/context/context-compressor.d.ts +94 -0
- package/dist/infrastructure/context/context-compressor.d.ts.map +1 -0
- package/dist/infrastructure/context/context-compressor.js +329 -0
- package/dist/infrastructure/context/context-compressor.js.map +1 -0
- package/dist/infrastructure/governance/policy-as-code.d.ts.map +1 -1
- package/dist/infrastructure/governance/policy-as-code.js +18 -3
- package/dist/infrastructure/governance/policy-as-code.js.map +1 -1
- package/dist/infrastructure/observability/execution-tracer.d.ts +5 -2
- package/dist/infrastructure/observability/execution-tracer.d.ts.map +1 -1
- package/dist/infrastructure/observability/execution-tracer.js +45 -8
- package/dist/infrastructure/observability/execution-tracer.js.map +1 -1
- package/dist/infrastructure/security/ai-sast-scanner.d.ts +4 -0
- package/dist/infrastructure/security/ai-sast-scanner.d.ts.map +1 -1
- package/dist/infrastructure/security/ai-sast-scanner.js +82 -4
- package/dist/infrastructure/security/ai-sast-scanner.js.map +1 -1
- package/dist/infrastructure/security/enhanced-security-gate.d.ts +2 -0
- package/dist/infrastructure/security/enhanced-security-gate.d.ts.map +1 -1
- package/dist/infrastructure/security/enhanced-security-gate.js +74 -15
- package/dist/infrastructure/security/enhanced-security-gate.js.map +1 -1
- package/dist/infrastructure/storage/plan-repository.d.ts +38 -0
- package/dist/infrastructure/storage/plan-repository.d.ts.map +1 -0
- package/dist/infrastructure/storage/plan-repository.js +133 -0
- package/dist/infrastructure/storage/plan-repository.js.map +1 -0
- package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts +11 -0
- package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts.map +1 -1
- package/dist/infrastructure/storage/sqlite-embedding-repository.js +121 -6
- package/dist/infrastructure/storage/sqlite-embedding-repository.js.map +1 -1
- package/dist/infrastructure/ux/contextual-feature-discovery.d.ts +24 -0
- package/dist/infrastructure/ux/contextual-feature-discovery.d.ts.map +1 -0
- package/dist/infrastructure/ux/contextual-feature-discovery.js +144 -0
- package/dist/infrastructure/ux/contextual-feature-discovery.js.map +1 -0
- package/dist/infrastructure/ux/expectation-management.d.ts +33 -0
- package/dist/infrastructure/ux/expectation-management.d.ts.map +1 -1
- package/dist/infrastructure/ux/expectation-management.js +138 -4
- package/dist/infrastructure/ux/expectation-management.js.map +1 -1
- package/dist/infrastructure/ux/feature-discovery.d.ts +47 -0
- package/dist/infrastructure/ux/feature-discovery.d.ts.map +1 -0
- package/dist/infrastructure/ux/feature-discovery.js +190 -0
- package/dist/infrastructure/ux/feature-discovery.js.map +1 -0
- package/dist/infrastructure/ux/hitl-review-portal.d.ts +47 -0
- package/dist/infrastructure/ux/hitl-review-portal.d.ts.map +1 -0
- package/dist/infrastructure/ux/hitl-review-portal.js +225 -0
- package/dist/infrastructure/ux/hitl-review-portal.js.map +1 -0
- package/dist/infrastructure/ux/progress-indicator.d.ts +54 -0
- package/dist/infrastructure/ux/progress-indicator.d.ts.map +1 -0
- package/dist/infrastructure/ux/progress-indicator.js +121 -0
- package/dist/infrastructure/ux/progress-indicator.js.map +1 -0
- package/dist/infrastructure/ux/progressive-disclosure.d.ts.map +1 -1
- package/dist/infrastructure/ux/progressive-disclosure.js +2 -1
- package/dist/infrastructure/ux/progressive-disclosure.js.map +1 -1
- package/dist/infrastructure/ux/review-checkpoint.d.ts +35 -0
- package/dist/infrastructure/ux/review-checkpoint.d.ts.map +1 -0
- package/dist/infrastructure/ux/review-checkpoint.js +119 -0
- package/dist/infrastructure/ux/review-checkpoint.js.map +1 -0
- package/dist/infrastructure/ux/staged-feature-intro.d.ts +47 -0
- package/dist/infrastructure/ux/staged-feature-intro.d.ts.map +1 -0
- package/dist/infrastructure/ux/staged-feature-intro.js +144 -0
- package/dist/infrastructure/ux/staged-feature-intro.js.map +1 -0
- package/dist/infrastructure/ux/syntax-highlighter.d.ts +21 -0
- package/dist/infrastructure/ux/syntax-highlighter.d.ts.map +1 -0
- package/dist/infrastructure/ux/syntax-highlighter.js +172 -0
- package/dist/infrastructure/ux/syntax-highlighter.js.map +1 -0
- package/dist/infrastructure/xai/cot-visualizer.d.ts +1 -0
- package/dist/infrastructure/xai/cot-visualizer.d.ts.map +1 -1
- package/dist/infrastructure/xai/cot-visualizer.js +57 -10
- package/dist/infrastructure/xai/cot-visualizer.js.map +1 -1
- package/dist/presentation/cli/commands/ask-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/ask-command.js +68 -11
- package/dist/presentation/cli/commands/ask-command.js.map +1 -1
- package/dist/presentation/cli/commands/orchestrate-command.d.ts +1 -0
- package/dist/presentation/cli/commands/orchestrate-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/orchestrate-command.js +35 -1
- package/dist/presentation/cli/commands/orchestrate-command.js.map +1 -1
- package/dist/presentation/cli/commands/plan-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/plan-command.js +57 -5
- package/dist/presentation/cli/commands/plan-command.js.map +1 -1
- package/dist/presentation/cli/commands/react-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/react-command.js +95 -15
- package/dist/presentation/cli/commands/react-command.js.map +1 -1
- package/dist/presentation/cli/commands/setup-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/setup-command.js +67 -12
- package/dist/presentation/cli/commands/setup-command.js.map +1 -1
- package/dist/presentation/cli/commands/smart-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/smart-command.js +136 -18
- package/dist/presentation/cli/commands/smart-command.js.map +1 -1
- package/dist/presentation/cli/commands/trace-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/trace-command.js +9 -5
- package/dist/presentation/cli/commands/trace-command.js.map +1 -1
- package/dist/presentation/cli/commands/undo-command.js +15 -6
- package/dist/presentation/cli/commands/undo-command.js.map +1 -1
- package/dist/presentation/cli/error-display.d.ts +2 -0
- package/dist/presentation/cli/error-display.d.ts.map +1 -1
- package/dist/presentation/cli/error-display.js +177 -2
- package/dist/presentation/cli/error-display.js.map +1 -1
- package/dist/presentation/cli/keyboard-shortcuts.d.ts +27 -0
- package/dist/presentation/cli/keyboard-shortcuts.d.ts.map +1 -0
- package/dist/presentation/cli/keyboard-shortcuts.js +77 -0
- package/dist/presentation/cli/keyboard-shortcuts.js.map +1 -0
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +20 -0
- package/dist/session.js.map +1 -1
- package/dist/utils/version.js +2 -2
- package/dist/verification/backup.d.ts.map +1 -1
- package/dist/verification/backup.js +24 -3
- package/dist/verification/backup.js.map +1 -1
- package/dist/verification/compiler.js +47 -12
- package/dist/verification/compiler.js.map +1 -1
- package/package.json +1 -1
|
@@ -6,6 +6,7 @@ import { readFileSync, existsSync, mkdirSync, writeFileSync } from 'fs';
|
|
|
6
6
|
import { join, dirname } from 'path';
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
8
|
import initSqlJs from 'sql.js';
|
|
9
|
+
import { getQueryResultCache } from '../cache/query-result-cache.js';
|
|
9
10
|
function getDbPath() {
|
|
10
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
11
12
|
const __dirname = dirname(__filename);
|
|
@@ -29,6 +30,22 @@ function cosineSimilarity(a, b) {
|
|
|
29
30
|
const denominator = Math.sqrt(normA) * Math.sqrt(normB);
|
|
30
31
|
return denominator === 0 ? 0 : dotProduct / denominator;
|
|
31
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Optimized cosine similarity with pre-computed query norm
|
|
35
|
+
* Reduces redundant calculations when comparing same query to multiple embeddings
|
|
36
|
+
*/
|
|
37
|
+
function cosineSimilarityOptimized(queryEmbedding, queryNorm, docEmbedding) {
|
|
38
|
+
if (queryEmbedding.length !== docEmbedding.length)
|
|
39
|
+
return 0;
|
|
40
|
+
let dotProduct = 0;
|
|
41
|
+
let docNorm = 0;
|
|
42
|
+
for (let i = 0; i < docEmbedding.length; i++) {
|
|
43
|
+
dotProduct += queryEmbedding[i] * docEmbedding[i];
|
|
44
|
+
docNorm += docEmbedding[i] * docEmbedding[i];
|
|
45
|
+
}
|
|
46
|
+
const denominator = queryNorm * Math.sqrt(docNorm);
|
|
47
|
+
return denominator === 0 ? 0 : dotProduct / denominator;
|
|
48
|
+
}
|
|
32
49
|
export class SQLiteEmbeddingRepository {
|
|
33
50
|
dbPath;
|
|
34
51
|
db = null;
|
|
@@ -83,6 +100,8 @@ export class SQLiteEmbeddingRepository {
|
|
|
83
100
|
}
|
|
84
101
|
stmt.free();
|
|
85
102
|
this.saveDb();
|
|
103
|
+
// Clear query result cache when codebase is re-indexed
|
|
104
|
+
getQueryResultCache().clear();
|
|
86
105
|
}
|
|
87
106
|
async search(query, topK) {
|
|
88
107
|
// For now, return empty - will implement with query embedding
|
|
@@ -132,16 +151,92 @@ export class SQLiteEmbeddingRepository {
|
|
|
132
151
|
/**
|
|
133
152
|
* Search with pre-computed query embedding
|
|
134
153
|
* (Used by application layer to avoid circular dependency)
|
|
154
|
+
*
|
|
155
|
+
* PERFORMANCE OPTIMIZATION:
|
|
156
|
+
* 1. Uses min-heap to maintain only topK results (O(n log k) vs O(n log n))
|
|
157
|
+
* 2. Pre-computes query norm once (avoids redundant calculations)
|
|
158
|
+
* 3. Optimized cosine similarity calculation
|
|
159
|
+
* 4. Result caching (query + topK results) to avoid redundant searches
|
|
160
|
+
* 5. Batch processing with early termination for large datasets
|
|
161
|
+
* 6. Optimized JSON parsing (cache parsed embeddings per row)
|
|
162
|
+
*
|
|
163
|
+
* Note: Cache key should be generated from query string, not embedding
|
|
164
|
+
* This method receives embedding, so caching should be done at call site
|
|
135
165
|
*/
|
|
136
166
|
async searchWithEmbedding(queryEmbedding, topK) {
|
|
137
167
|
const db = await this.getDb();
|
|
168
|
+
// Pre-compute query norm once (used for all similarity calculations)
|
|
169
|
+
let queryNorm = 0;
|
|
170
|
+
for (let i = 0; i < queryEmbedding.length; i++) {
|
|
171
|
+
queryNorm += queryEmbedding[i] * queryEmbedding[i];
|
|
172
|
+
}
|
|
173
|
+
queryNorm = Math.sqrt(queryNorm);
|
|
174
|
+
// Get total count for optimization decisions
|
|
175
|
+
const countStmt = db.prepare('SELECT COUNT(*) as count FROM embeddings');
|
|
176
|
+
countStmt.step();
|
|
177
|
+
const totalCount = countStmt.getAsObject().count;
|
|
178
|
+
countStmt.free();
|
|
179
|
+
// OPTIMIZATION: Early termination for large datasets
|
|
180
|
+
// Process with early termination if dataset is large
|
|
181
|
+
const USE_EARLY_TERMINATION = totalCount > 500;
|
|
182
|
+
const MAX_PROCESS = USE_EARLY_TERMINATION ? Math.min(totalCount, 1000) : totalCount;
|
|
183
|
+
// Min-heap to maintain topK results (smallest score at root)
|
|
184
|
+
const heap = [];
|
|
185
|
+
const heapInsert = (item) => {
|
|
186
|
+
if (heap.length < topK) {
|
|
187
|
+
heap.push(item);
|
|
188
|
+
// Bubble up
|
|
189
|
+
let i = heap.length - 1;
|
|
190
|
+
while (i > 0) {
|
|
191
|
+
const parent = Math.floor((i - 1) / 2);
|
|
192
|
+
if (heap[parent].score <= heap[i].score)
|
|
193
|
+
break;
|
|
194
|
+
[heap[parent], heap[i]] = [heap[i], heap[parent]];
|
|
195
|
+
i = parent;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
else if (item.score > heap[0].score) {
|
|
199
|
+
// Replace root (smallest) with new item if it's larger
|
|
200
|
+
heap[0] = item;
|
|
201
|
+
// Bubble down
|
|
202
|
+
let i = 0;
|
|
203
|
+
while (true) {
|
|
204
|
+
const left = 2 * i + 1;
|
|
205
|
+
const right = 2 * i + 2;
|
|
206
|
+
let smallest = i;
|
|
207
|
+
if (left < heap.length && heap[left].score < heap[smallest].score) {
|
|
208
|
+
smallest = left;
|
|
209
|
+
}
|
|
210
|
+
if (right < heap.length && heap[right].score < heap[smallest].score) {
|
|
211
|
+
smallest = right;
|
|
212
|
+
}
|
|
213
|
+
if (smallest === i)
|
|
214
|
+
break;
|
|
215
|
+
[heap[i], heap[smallest]] = [heap[smallest], heap[i]];
|
|
216
|
+
i = smallest;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
// Standard query - early termination will handle large datasets
|
|
138
221
|
const stmt = db.prepare('SELECT * FROM embeddings');
|
|
139
|
-
|
|
222
|
+
let processed = 0;
|
|
223
|
+
let consecutiveLowScores = 0;
|
|
224
|
+
const EARLY_TERMINATION_THRESHOLD = USE_EARLY_TERMINATION ? 150 : Infinity; // More aggressive for large datasets
|
|
225
|
+
// Process embeddings in batches with early termination
|
|
140
226
|
while (stmt.step()) {
|
|
141
227
|
const row = stmt.getAsObject();
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
228
|
+
// Parse embedding (try-catch for invalid JSON)
|
|
229
|
+
let embedding;
|
|
230
|
+
try {
|
|
231
|
+
embedding = JSON.parse(row.embedding);
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
continue; // Skip invalid embeddings
|
|
235
|
+
}
|
|
236
|
+
// Compute similarity using optimized function (pre-computed query norm)
|
|
237
|
+
const score = cosineSimilarityOptimized(queryEmbedding, queryNorm, embedding);
|
|
238
|
+
// Insert into heap (maintains topK)
|
|
239
|
+
heapInsert({
|
|
145
240
|
chunk: {
|
|
146
241
|
filepath: row.filepath,
|
|
147
242
|
content: row.content,
|
|
@@ -151,12 +246,32 @@ export class SQLiteEmbeddingRepository {
|
|
|
151
246
|
},
|
|
152
247
|
score,
|
|
153
248
|
});
|
|
249
|
+
processed++;
|
|
250
|
+
// Early termination: If we have topK results and many consecutive low scores,
|
|
251
|
+
// likely we've found the best matches
|
|
252
|
+
if (heap.length >= topK) {
|
|
253
|
+
const minScore = heap[0].score;
|
|
254
|
+
if (score < minScore * 0.8) { // Score significantly lower than current min
|
|
255
|
+
consecutiveLowScores++;
|
|
256
|
+
if (consecutiveLowScores > EARLY_TERMINATION_THRESHOLD) {
|
|
257
|
+
break; // Early termination
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
consecutiveLowScores = 0; // Reset counter
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
// Limit total processing for very large datasets (early termination optimization)
|
|
265
|
+
if (processed >= MAX_PROCESS) {
|
|
266
|
+
break;
|
|
267
|
+
}
|
|
154
268
|
}
|
|
155
269
|
stmt.free();
|
|
156
|
-
|
|
270
|
+
// Extract results from heap and sort descending (highest scores first)
|
|
271
|
+
const results = heap
|
|
157
272
|
.sort((a, b) => b.score - a.score)
|
|
158
|
-
.slice(0, topK)
|
|
159
273
|
.map(r => r.chunk);
|
|
274
|
+
return results;
|
|
160
275
|
}
|
|
161
276
|
}
|
|
162
277
|
//# sourceMappingURL=sqlite-embedding-repository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite-embedding-repository.js","sourceRoot":"","sources":["../../../src/infrastructure/storage/sqlite-embedding-repository.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,SAAuB,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"sqlite-embedding-repository.js","sourceRoot":"","sources":["../../../src/infrastructure/storage/sqlite-embedding-repository.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,SAAuB,MAAM,QAAQ,CAAC;AAG7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,SAAS,SAAS;IAChB,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAC7C,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;QAC/C,OAAO,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,mBAAmB,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,O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AAG,QAAQ,GAAG,GAAG,EAAE,CAAC,CAAC,6CAA6C;oBACzE,oBAAoB,EAAE,CAAC;oBACvB,IAAI,oBAAoB,GAAG,2BAA2B,EAAE,CAAC;wBACvD,MAAM,CAAC,oBAAoB;oBAC7B,CAAC;gBACH,CAAC;qBAAM,CAAC;oBACN,oBAAoB,GAAG,CAAC,CAAC,CAAC,gBAAgB;gBAC5C,CAAC;YACH,CAAC;YAED,kFAAkF;YAClF,IAAI,SAAS,IAAI,WAAW,EAAE,CAAC;gBAC7B,MAAM;YACR,CAAC;QACH,CAAC;QAED,IAAI,CAAC,IAAI,EAAE,CAAC;QAEZ,uEAAuE;QACvE,MAAM,OAAO,GAAG,IAAI;aACjB,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;aACjC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAErB,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contextual Feature Discovery
|
|
3
|
+
* Shows relevant features based on user queries and context - Task 2.2
|
|
4
|
+
*/
|
|
5
|
+
export interface ContextualSuggestion {
|
|
6
|
+
feature: string;
|
|
7
|
+
description: string;
|
|
8
|
+
command: string;
|
|
9
|
+
reason: string;
|
|
10
|
+
confidence: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Analyze query to suggest contextual features
|
|
14
|
+
*/
|
|
15
|
+
export declare function getContextualSuggestions(query: string): ContextualSuggestion[];
|
|
16
|
+
/**
|
|
17
|
+
* Get contextual feature suggestions based on query limitations
|
|
18
|
+
*/
|
|
19
|
+
export declare function getSuggestionsForLimitation(limitation: string, currentCommand: string): ContextualSuggestion[];
|
|
20
|
+
/**
|
|
21
|
+
* Check if contextual suggestions should be shown
|
|
22
|
+
*/
|
|
23
|
+
export declare function shouldShowContextualSuggestion(query: string, currentCommand: string): ContextualSuggestion | null;
|
|
24
|
+
//# sourceMappingURL=contextual-feature-discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contextual-feature-discovery.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/ux/contextual-feature-discovery.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,oBAAoB,EAAE,CAsH9E;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,MAAM,GACrB,oBAAoB,EAAE,CA2BxB;AAED;;GAEG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,MAAM,EACb,cAAc,EAAE,MAAM,GACrB,oBAAoB,GAAG,IAAI,CAS7B"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contextual Feature Discovery
|
|
3
|
+
* Shows relevant features based on user queries and context - Task 2.2
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Analyze query to suggest contextual features
|
|
7
|
+
*/
|
|
8
|
+
export function getContextualSuggestions(query) {
|
|
9
|
+
const suggestions = [];
|
|
10
|
+
const queryLower = query.toLowerCase();
|
|
11
|
+
// Multi-file operations → suggest orchestrate
|
|
12
|
+
if ((queryLower.includes('multiple') || queryLower.includes('several') || queryLower.includes('all')) &&
|
|
13
|
+
(queryLower.includes('file') || queryLower.includes('module'))) {
|
|
14
|
+
suggestions.push({
|
|
15
|
+
feature: 'Multi-agent Orchestration',
|
|
16
|
+
description: 'Plan and execute complex multi-step tasks across multiple files',
|
|
17
|
+
command: 'codehere orchestrate "your goal"',
|
|
18
|
+
reason: 'Your query involves multiple files/modules',
|
|
19
|
+
confidence: 0.8,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
// Complex refactoring → suggest plan
|
|
23
|
+
if (queryLower.includes('refactor') &&
|
|
24
|
+
(queryLower.includes('large') || queryLower.includes('complex') || queryLower.includes('multiple'))) {
|
|
25
|
+
suggestions.push({
|
|
26
|
+
feature: 'Planning Mode',
|
|
27
|
+
description: 'Generate hierarchical plans for large refactoring tasks',
|
|
28
|
+
command: 'codehere plan "refactor goal"',
|
|
29
|
+
reason: 'Complex refactoring tasks benefit from structured planning',
|
|
30
|
+
confidence: 0.9,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
// Debugging/problem solving → suggest react
|
|
34
|
+
if (queryLower.includes('debug') ||
|
|
35
|
+
queryLower.includes('fix') ||
|
|
36
|
+
queryLower.includes('error') ||
|
|
37
|
+
queryLower.includes('issue') ||
|
|
38
|
+
queryLower.includes('problem') ||
|
|
39
|
+
queryLower.includes('why') ||
|
|
40
|
+
queryLower.includes('why is')) {
|
|
41
|
+
suggestions.push({
|
|
42
|
+
feature: 'ReAct Reasoning',
|
|
43
|
+
description: 'Debug and solve complex problems step-by-step with reasoning',
|
|
44
|
+
command: 'codehere react "your problem"',
|
|
45
|
+
reason: 'Step-by-step reasoning helps with debugging',
|
|
46
|
+
confidence: 0.85,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
// Security-related → suggest security commands
|
|
50
|
+
if (queryLower.includes('security') ||
|
|
51
|
+
queryLower.includes('vulnerability') ||
|
|
52
|
+
queryLower.includes('vulnerabilities') ||
|
|
53
|
+
queryLower.includes('secure') ||
|
|
54
|
+
queryLower.includes('audit')) {
|
|
55
|
+
suggestions.push({
|
|
56
|
+
feature: 'Security Scanning',
|
|
57
|
+
description: 'Codehere automatically scans for security issues. Use edit command to fix them.',
|
|
58
|
+
command: 'codehere "fix security issues in auth.ts"',
|
|
59
|
+
reason: 'Security-focused queries benefit from comprehensive scanning',
|
|
60
|
+
confidence: 0.9,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
// Knowledge/documentation → suggest knowledge commands
|
|
64
|
+
if (queryLower.includes('document') ||
|
|
65
|
+
queryLower.includes('knowledge') ||
|
|
66
|
+
queryLower.includes('learn') ||
|
|
67
|
+
queryLower.includes('pattern') ||
|
|
68
|
+
queryLower.includes('remember')) {
|
|
69
|
+
suggestions.push({
|
|
70
|
+
feature: 'Knowledge Management',
|
|
71
|
+
description: 'Query and manage preserved knowledge about your codebase',
|
|
72
|
+
command: 'codehere knowledge query "your query"',
|
|
73
|
+
reason: 'Knowledge management helps with documentation and learning',
|
|
74
|
+
confidence: 0.8,
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
// Performance optimization → suggest trace/learning
|
|
78
|
+
if (queryLower.includes('performance') ||
|
|
79
|
+
queryLower.includes('optimize') ||
|
|
80
|
+
queryLower.includes('slow') ||
|
|
81
|
+
queryLower.includes('faster')) {
|
|
82
|
+
suggestions.push({
|
|
83
|
+
feature: 'Execution Tracing',
|
|
84
|
+
description: 'Analyze execution patterns to understand performance',
|
|
85
|
+
command: 'codehere trace list',
|
|
86
|
+
reason: 'Tracing helps identify performance bottlenecks',
|
|
87
|
+
confidence: 0.75,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
// Configuration/setup → suggest config commands
|
|
91
|
+
if (queryLower.includes('config') ||
|
|
92
|
+
queryLower.includes('setting') ||
|
|
93
|
+
queryLower.includes('preference') ||
|
|
94
|
+
queryLower.includes('setup')) {
|
|
95
|
+
suggestions.push({
|
|
96
|
+
feature: 'Configuration Management',
|
|
97
|
+
description: 'Manage preferences and settings',
|
|
98
|
+
command: 'codehere config',
|
|
99
|
+
reason: 'Configuration queries can be handled directly',
|
|
100
|
+
confidence: 0.95,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
return suggestions.sort((a, b) => b.confidence - a.confidence); // Sort by confidence
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Get contextual feature suggestions based on query limitations
|
|
107
|
+
*/
|
|
108
|
+
export function getSuggestionsForLimitation(limitation, currentCommand) {
|
|
109
|
+
const suggestions = [];
|
|
110
|
+
const limitationLower = limitation.toLowerCase();
|
|
111
|
+
// If limitation mentions multi-file, suggest orchestrate
|
|
112
|
+
if (limitationLower.includes('multi-file') || limitationLower.includes('multiple files')) {
|
|
113
|
+
suggestions.push({
|
|
114
|
+
feature: 'Multi-agent Orchestration',
|
|
115
|
+
description: 'Handle complex multi-file operations with planning',
|
|
116
|
+
command: 'codehere orchestrate "your goal"',
|
|
117
|
+
reason: 'Orchestrate mode handles multi-file operations better',
|
|
118
|
+
confidence: 0.9,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
// If limitation mentions complexity, suggest plan
|
|
122
|
+
if (limitationLower.includes('complex') || limitationLower.includes('complicated')) {
|
|
123
|
+
suggestions.push({
|
|
124
|
+
feature: 'Planning Mode',
|
|
125
|
+
description: 'Break down complex tasks into manageable steps',
|
|
126
|
+
command: 'codehere plan "your goal"',
|
|
127
|
+
reason: 'Planning mode helps with complex tasks',
|
|
128
|
+
confidence: 0.85,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
return suggestions;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Check if contextual suggestions should be shown
|
|
135
|
+
*/
|
|
136
|
+
export function shouldShowContextualSuggestion(query, currentCommand) {
|
|
137
|
+
const suggestions = getContextualSuggestions(query);
|
|
138
|
+
// Only show top suggestion if confidence is high enough
|
|
139
|
+
if (suggestions.length > 0 && suggestions[0].confidence >= 0.75) {
|
|
140
|
+
return suggestions[0];
|
|
141
|
+
}
|
|
142
|
+
return null;
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=contextual-feature-discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contextual-feature-discovery.js","sourceRoot":"","sources":["../../../src/infrastructure/ux/contextual-feature-discovery.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAgBH;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAa;IACpD,MAAM,WAAW,GAA2B,EAAE,CAAC;IAC/C,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAEvC,8CAA8C;IAC9C,IACE,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QACjG,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAC9D,CAAC;QACD,WAAW,CAAC,IAAI,CAAC;YACf,OAAO,EAAE,2BAA2B;YACpC,WAAW,EAAE,iEAAiE;YAC9E,OAAO,EAAE,kCAAkC;YAC3C,MAAM,EAAE,4CAA4C;YACpD,UAAU,EAAE,GAAG;SAChB,CAAC,CAAC;IACL,CAAC;IAED,qCAAqC;IACrC,IACE,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC;QAC/B,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,EACnG,CAAC;QACD,WAAW,CAAC,IAAI,CAAC;YACf,OAAO,EAAE,eAAe;YACxB,WAAW,EAAE,yDAAyD;YACtE,OAAO,EAAE,+BAA+B;YACxC,MAAM,EAAE,4DAA4D;YACpE,UAAU,EAAE,GAAG;SAChB,CAAC,CAAC;IACL,CAAC;IAED,4CAA4C;IAC5C,IACE,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC;QAC5B,UAAU,CAAC,QAAQ,CAAC,KAAK,CAAC;QA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AAC,YAAY,CAAC,IAAI,eAAe,CAAC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,CAAC;QACzF,WAAW,CAAC,IAAI,CAAC;YACf,OAAO,EAAE,2BAA2B;YACpC,WAAW,EAAE,oDAAoD;YACjE,OAAO,EAAE,kCAAkC;YAC3C,MAAM,EAAE,uDAAuD;YAC/D,UAAU,EAAE,GAAG;SAChB,CAAC,CAAC;IACL,CAAC;IAED,kDAAkD;IAClD,IAAI,eAAe,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,eAAe,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;QACnF,WAAW,CAAC,IAAI,CAAC;YACf,OAAO,EAAE,eAAe;YACxB,WAAW,EAAE,gDAAgD;YAC7D,OAAO,EAAE,2BAA2B;YACpC,MAAM,EAAE,wCAAwC;YAChD,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,8BAA8B,CAC5C,KAAa,EACb,cAAsB;IAEtB,MAAM,WAAW,GAAG,wBAAwB,CAAC,KAAK,CAAC,CAAC;IAEpD,wDAAwD;IACxD,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC;QAChE,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* - Limitation warnings
|
|
10
10
|
* - Contextual disclaimers
|
|
11
11
|
* - Error prevention messaging
|
|
12
|
+
* - First-time AI operation disclaimers
|
|
13
|
+
* - Uncertainty indicators
|
|
12
14
|
*/
|
|
13
15
|
export type OperationRisk = 'low' | 'medium' | 'high' | 'critical';
|
|
14
16
|
export type CapabilityLevel = 'confident' | 'moderate' | 'uncertain' | 'risky';
|
|
@@ -33,9 +35,14 @@ export interface CapabilityAssessment {
|
|
|
33
35
|
* Expectation Management System
|
|
34
36
|
* Manages user expectations and communicates AI limitations clearly
|
|
35
37
|
*/
|
|
38
|
+
export interface AIDisclaimerNotice {
|
|
39
|
+
shown: boolean;
|
|
40
|
+
shownDate?: string;
|
|
41
|
+
}
|
|
36
42
|
export declare class ExpectationManagement {
|
|
37
43
|
private messages;
|
|
38
44
|
private shownMessages;
|
|
45
|
+
private disclaimerShown;
|
|
39
46
|
constructor();
|
|
40
47
|
/**
|
|
41
48
|
* Assess capability for an operation
|
|
@@ -61,5 +68,31 @@ export declare class ExpectationManagement {
|
|
|
61
68
|
private initializeDefaultMessages;
|
|
62
69
|
private matchesContext;
|
|
63
70
|
private generateRecommendedApproach;
|
|
71
|
+
/**
|
|
72
|
+
* Check if first-time AI operation disclaimer should be shown
|
|
73
|
+
*/
|
|
74
|
+
shouldShowFirstTimeDisclaimer(): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Get first-time AI operation disclaimer notice
|
|
77
|
+
*/
|
|
78
|
+
getFirstTimeDisclaimer(): string;
|
|
79
|
+
/**
|
|
80
|
+
* Mark first-time disclaimer as shown
|
|
81
|
+
*/
|
|
82
|
+
markDisclaimerShown(): void;
|
|
83
|
+
/**
|
|
84
|
+
* Get uncertainty indicator message
|
|
85
|
+
*/
|
|
86
|
+
getUncertaintyIndicator(confidence: number): string | null;
|
|
87
|
+
/**
|
|
88
|
+
* Get capability boundaries notice
|
|
89
|
+
*/
|
|
90
|
+
getCapabilityBoundaries(): string;
|
|
91
|
+
/**
|
|
92
|
+
* Format disclaimer for console display (honest tone, no anthropomorphization)
|
|
93
|
+
*/
|
|
94
|
+
formatDisclaimerForConsole(): string;
|
|
95
|
+
private loadDisclaimerState;
|
|
96
|
+
private saveDisclaimerState;
|
|
64
97
|
}
|
|
65
98
|
//# sourceMappingURL=expectation-management.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expectation-management.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/ux/expectation-management.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"expectation-management.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/ux/expectation-management.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;AACnE,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG,UAAU,GAAG,WAAW,GAAG,OAAO,CAAC;AAE/E,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,YAAY,GAAG,YAAY,GAAG,SAAS,GAAG,YAAY,CAAC;IAC7D,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,eAAe,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,qBAAqB;IAChC,OAAO,CAAC,QAAQ,CAA8C;IAC9D,OAAO,CAAC,aAAa,CAA0B;IAC/C,OAAO,CAAC,eAAe,CAAkB;;IAOzC;;OAEG;IACH,gBAAgB,CACd,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE;QACP,UAAU,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;QAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,aAAa,CAAC;KAC3B,GACA,oBAAoB;IAyDvB;;OAEG;IACH,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,kBAAkB,GAAG,IAAI;IAuBlG;;OAEG;IACH,eAAe,CAAC,OAAO,EAAE,kBAAkB,GAAG,IAAI;IAIlD;;OAEG;IACH,gBAAgB,CAAC,UAAU,EAAE,oBAAoB,GAAG,MAAM;IA2C1D,OAAO,CAAC,yBAAyB;IA6BjC,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,2BAA2B;IAenC;;OAEG;IACH,6BAA6B,IAAI,OAAO;IAIxC;;OAEG;IACH,sBAAsB,IAAI,MAAM;IAoBhC;;OAEG;IACH,mBAAmB,IAAI,IAAI;IAK3B;;OAEG;IACH,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAoB1D;;OAEG;IACH,uBAAuB,IAAI,MAAM;IAwBjC;;OAEG;IACH,0BAA0B,IAAI,MAAM;IAkBpC,OAAO,CAAC,mBAAmB;IAc3B,OAAO,CAAC,mBAAmB;CAkB5B"}
|
|
@@ -9,16 +9,18 @@
|
|
|
9
9
|
* - Limitation warnings
|
|
10
10
|
* - Contextual disclaimers
|
|
11
11
|
* - Error prevention messaging
|
|
12
|
+
* - First-time AI operation disclaimers
|
|
13
|
+
* - Uncertainty indicators
|
|
12
14
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
* Manages user expectations and communicates AI limitations clearly
|
|
16
|
-
*/
|
|
15
|
+
import { readFileSync, existsSync, writeFileSync, mkdirSync } from 'fs';
|
|
16
|
+
import { join } from 'path';
|
|
17
17
|
export class ExpectationManagement {
|
|
18
18
|
messages = new Map();
|
|
19
19
|
shownMessages = new Set(); // Track shown messages
|
|
20
|
+
disclaimerShown = false;
|
|
20
21
|
constructor() {
|
|
21
22
|
this.initializeDefaultMessages();
|
|
23
|
+
this.loadDisclaimerState();
|
|
22
24
|
}
|
|
23
25
|
/**
|
|
24
26
|
* Assess capability for an operation
|
|
@@ -189,5 +191,137 @@ export class ExpectationManagement {
|
|
|
189
191
|
}
|
|
190
192
|
return undefined;
|
|
191
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Check if first-time AI operation disclaimer should be shown
|
|
196
|
+
*/
|
|
197
|
+
shouldShowFirstTimeDisclaimer() {
|
|
198
|
+
return !this.disclaimerShown;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Get first-time AI operation disclaimer notice
|
|
202
|
+
*/
|
|
203
|
+
getFirstTimeDisclaimer() {
|
|
204
|
+
return `┌────────────────────────────────────────────────────┐
|
|
205
|
+
│ ⚠️ AI Assistant Notice │
|
|
206
|
+
│ │
|
|
207
|
+
│ This AI can make mistakes. Please verify: │
|
|
208
|
+
│ • Generated code correctness │
|
|
209
|
+
│ • Security implications │
|
|
210
|
+
│ • License compliance │
|
|
211
|
+
│ • Output accuracy and completeness │
|
|
212
|
+
│ │
|
|
213
|
+
│ Capabilities: │
|
|
214
|
+
│ • Can generate, explain, and modify code │
|
|
215
|
+
│ • May not catch all edge cases │
|
|
216
|
+
│ • May not be aware of latest APIs │
|
|
217
|
+
│ • Processing patterns, not "thinking" │
|
|
218
|
+
│ │
|
|
219
|
+
│ Always review generated code before deploying. │
|
|
220
|
+
└────────────────────────────────────────────────────┘`;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Mark first-time disclaimer as shown
|
|
224
|
+
*/
|
|
225
|
+
markDisclaimerShown() {
|
|
226
|
+
this.disclaimerShown = true;
|
|
227
|
+
this.saveDisclaimerState();
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Get uncertainty indicator message
|
|
231
|
+
*/
|
|
232
|
+
getUncertaintyIndicator(confidence) {
|
|
233
|
+
if (confidence < 0.65) {
|
|
234
|
+
const percent = (confidence * 100).toFixed(0);
|
|
235
|
+
return `┌────────────────────────────────────────────────────┐
|
|
236
|
+
│ ⚠️ Uncertainty Detected │
|
|
237
|
+
│ │
|
|
238
|
+
│ I'm less confident about this answer (${percent}%). │
|
|
239
|
+
│ Please verify the information carefully. │
|
|
240
|
+
│ │
|
|
241
|
+
│ This may indicate: │
|
|
242
|
+
│ • Limited context for the query │
|
|
243
|
+
│ • Ambiguous or complex requirements │
|
|
244
|
+
│ • Potential hallucination risk │
|
|
245
|
+
│ │
|
|
246
|
+
│ Recommendation: Review output thoroughly. │
|
|
247
|
+
└────────────────────────────────────────────────────┘`;
|
|
248
|
+
}
|
|
249
|
+
return null;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Get capability boundaries notice
|
|
253
|
+
*/
|
|
254
|
+
getCapabilityBoundaries() {
|
|
255
|
+
return `Capability Boundaries:
|
|
256
|
+
|
|
257
|
+
What I CAN do:
|
|
258
|
+
✓ Answer questions about your codebase
|
|
259
|
+
✓ Generate and modify code
|
|
260
|
+
✓ Explain code structure and logic
|
|
261
|
+
✓ Suggest improvements and refactorings
|
|
262
|
+
✓ Identify potential issues
|
|
263
|
+
|
|
264
|
+
What I CANNOT do:
|
|
265
|
+
✗ Guarantee code correctness
|
|
266
|
+
✗ Always detect all security vulnerabilities
|
|
267
|
+
✗ Know your specific business requirements
|
|
268
|
+
✗ Replace thorough testing
|
|
269
|
+
✗ Ensure compliance with all regulations
|
|
270
|
+
|
|
271
|
+
Important:
|
|
272
|
+
• Always review generated code
|
|
273
|
+
• Test thoroughly before deploying
|
|
274
|
+
• Verify security and compliance requirements
|
|
275
|
+
• Use as an assistant, not a replacement for expertise`;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Format disclaimer for console display (honest tone, no anthropomorphization)
|
|
279
|
+
*/
|
|
280
|
+
formatDisclaimerForConsole() {
|
|
281
|
+
return `⚠️ AI Assistant Notice
|
|
282
|
+
|
|
283
|
+
This AI assistant processes code patterns and generates suggestions based on training data.
|
|
284
|
+
It can make mistakes and may not understand all context.
|
|
285
|
+
|
|
286
|
+
Please verify:
|
|
287
|
+
• Generated code correctness and logic
|
|
288
|
+
• Security implications (vulnerabilities, data exposure)
|
|
289
|
+
• License compliance (license conflicts, attribution)
|
|
290
|
+
• Output accuracy (may miss edge cases or latest APIs)
|
|
291
|
+
|
|
292
|
+
Remember: The AI is processing patterns, not "thinking" or "understanding"
|
|
293
|
+
in the human sense. Always review and test before deploying.`;
|
|
294
|
+
}
|
|
295
|
+
// Private helpers for disclaimer state management
|
|
296
|
+
loadDisclaimerState() {
|
|
297
|
+
try {
|
|
298
|
+
const configDir = join(process.cwd(), 'data');
|
|
299
|
+
const disclaimerPath = join(configDir, 'ai-disclaimer.json');
|
|
300
|
+
if (existsSync(disclaimerPath)) {
|
|
301
|
+
const state = JSON.parse(readFileSync(disclaimerPath, 'utf-8'));
|
|
302
|
+
this.disclaimerShown = state.shown || false;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
catch {
|
|
306
|
+
// Ignore errors - will default to not shown
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
saveDisclaimerState() {
|
|
310
|
+
try {
|
|
311
|
+
const configDir = join(process.cwd(), 'data');
|
|
312
|
+
if (!existsSync(configDir)) {
|
|
313
|
+
mkdirSync(configDir, { recursive: true });
|
|
314
|
+
}
|
|
315
|
+
const disclaimerPath = join(configDir, 'ai-disclaimer.json');
|
|
316
|
+
const state = {
|
|
317
|
+
shown: true,
|
|
318
|
+
shownDate: new Date().toISOString(),
|
|
319
|
+
};
|
|
320
|
+
writeFileSync(disclaimerPath, JSON.stringify(state, null, 2));
|
|
321
|
+
}
|
|
322
|
+
catch {
|
|
323
|
+
// Ignore errors - non-critical
|
|
324
|
+
}
|
|
325
|
+
}
|
|
192
326
|
}
|
|
193
327
|
//# sourceMappingURL=expectation-management.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expectation-management.js","sourceRoot":"","sources":["../../../src/infrastructure/ux/expectation-management.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"expectation-management.js","sourceRoot":"","sources":["../../../src/infrastructure/ux/expectation-management.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAiC5B,MAAM,OAAO,qBAAqB;IACxB,QAAQ,GAAoC,IAAI,GAAG,EAAE,CAAC;IACtD,aAAa,GAAgB,IAAI,GAAG,EAAE,CAAC,CAAC,uBAAuB;IAC/D,eAAe,GAAY,KAAK,CAAC;IAEzC;QACE,IAAI,CAAC,yBAAyB,EAAE,CAAC;QACjC,IAAI,CAAC,mBAAmB,EAAE,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,gBAAgB,CACd,SAAiB,EACjB,OAKC;QAED,MAAM,EAAE,UAAU,GAAG,UAAU,EAAE,MAAM,EAAE,WAAW,GAAG,GAAG,EAAE,SAAS,GAAG,QAAQ,EAAE,GAAG,OAAO,CAAC;QAE7F,IAAI,UAAU,GAAoB,UAAU,CAAC;QAC7C,IAAI,UAAU,GAAG,GAAG,CAAC;QACrB,MAAM,WAAW,GAAa,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAa,EAAE,CAAC;QAE9B,6BAA6B;QAC7B,IAAI,UAAU,KAAK,QAAQ,EAAE,CAAC;YAC5B,UAAU,GAAG,WAAW,CAAC;YACzB,UAAU,GAAG,GAAG,CAAC;QACnB,CAAC;aAAM,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YACpC,UAAU,GAAG,WAAW,CAAC;YACzB,UAAU,GAAG,GAAG,CAAC;YACjB,WAAW,CAAC,IAAI,CAAC,oDA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