codehere 0.4.0 → 0.5.0-alpha.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.
- package/README.md +7 -0
- package/dist/application/agents/execution-agent.js +2 -2
- package/dist/application/agents/execution-agent.js.map +1 -1
- package/dist/application/agents/planning-agent.d.ts.map +1 -1
- package/dist/application/agents/planning-agent.js +16 -8
- package/dist/application/agents/planning-agent.js.map +1 -1
- package/dist/application/agents/validation-agent.js +2 -2
- package/dist/application/agents/validation-agent.js.map +1 -1
- package/dist/application/services/dependency-container.d.ts +30 -6
- package/dist/application/services/dependency-container.d.ts.map +1 -1
- package/dist/application/services/dependency-container.js +75 -43
- package/dist/application/services/dependency-container.js.map +1 -1
- package/dist/application/services/intelligent-router.d.ts.map +1 -1
- package/dist/application/services/intelligent-router.js +6 -3
- package/dist/application/services/intelligent-router.js.map +1 -1
- package/dist/domain/entities/task.d.ts.map +1 -1
- package/dist/domain/entities/task.js +1 -1
- package/dist/domain/entities/task.js.map +1 -1
- package/dist/domain/errors/embeddings-not-found-error.d.ts +9 -0
- package/dist/domain/errors/embeddings-not-found-error.d.ts.map +1 -0
- package/dist/domain/errors/embeddings-not-found-error.js +13 -0
- package/dist/domain/errors/embeddings-not-found-error.js.map +1 -0
- package/dist/domain/interfaces/embedding-repository.interface.d.ts +5 -0
- package/dist/domain/interfaces/embedding-repository.interface.d.ts.map +1 -1
- package/dist/domain/services/environment-mode-manager.d.ts +4 -10
- package/dist/domain/services/environment-mode-manager.d.ts.map +1 -1
- package/dist/domain/services/environment-mode-manager.js +7 -22
- package/dist/domain/services/environment-mode-manager.js.map +1 -1
- package/dist/domain/services/risk-tier-detector.d.ts +8 -9
- package/dist/domain/services/risk-tier-detector.d.ts.map +1 -1
- package/dist/domain/services/risk-tier-detector.js +53 -40
- package/dist/domain/services/risk-tier-detector.js.map +1 -1
- package/dist/embed.d.ts.map +1 -1
- package/dist/embed.js +18 -8
- package/dist/embed.js.map +1 -1
- package/dist/index.js +308 -48
- package/dist/index.js.map +1 -1
- package/dist/infrastructure/ai/cohere-ai-service.js +3 -3
- package/dist/infrastructure/ai/cohere-ai-service.js.map +1 -1
- package/dist/infrastructure/ai/provider-ai-service.d.ts.map +1 -1
- package/dist/infrastructure/ai/provider-ai-service.js +6 -6
- package/dist/infrastructure/ai/provider-ai-service.js.map +1 -1
- package/dist/infrastructure/cache/query-result-cache.d.ts +14 -55
- package/dist/infrastructure/cache/query-result-cache.d.ts.map +1 -1
- package/dist/infrastructure/cache/query-result-cache.js +40 -112
- package/dist/infrastructure/cache/query-result-cache.js.map +1 -1
- package/dist/infrastructure/cache/response-cache.d.ts +10 -78
- package/dist/infrastructure/cache/response-cache.d.ts.map +1 -1
- package/dist/infrastructure/cache/response-cache.js +22 -198
- package/dist/infrastructure/cache/response-cache.js.map +1 -1
- package/dist/infrastructure/cache/security-scan-cache.d.ts +8 -49
- package/dist/infrastructure/cache/security-scan-cache.d.ts.map +1 -1
- package/dist/infrastructure/cache/security-scan-cache.js +25 -102
- package/dist/infrastructure/cache/security-scan-cache.js.map +1 -1
- package/dist/infrastructure/completion/bash-completion.d.ts +2 -3
- package/dist/infrastructure/completion/bash-completion.d.ts.map +1 -1
- package/dist/infrastructure/completion/bash-completion.js +11 -87
- package/dist/infrastructure/completion/bash-completion.js.map +1 -1
- package/dist/infrastructure/completion/fish-completion.d.ts +2 -3
- package/dist/infrastructure/completion/fish-completion.d.ts.map +1 -1
- package/dist/infrastructure/completion/fish-completion.js +15 -58
- package/dist/infrastructure/completion/fish-completion.js.map +1 -1
- package/dist/infrastructure/completion/zsh-completion.d.ts +2 -3
- package/dist/infrastructure/completion/zsh-completion.d.ts.map +1 -1
- package/dist/infrastructure/completion/zsh-completion.js +18 -73
- package/dist/infrastructure/completion/zsh-completion.js.map +1 -1
- package/dist/infrastructure/config/config-manager.js +2 -2
- package/dist/infrastructure/config/config-manager.js.map +1 -1
- package/dist/infrastructure/context/conversation-context.d.ts +27 -31
- package/dist/infrastructure/context/conversation-context.d.ts.map +1 -1
- package/dist/infrastructure/context/conversation-context.js +94 -136
- package/dist/infrastructure/context/conversation-context.js.map +1 -1
- package/dist/infrastructure/context/session-manager.d.ts +27 -11
- package/dist/infrastructure/context/session-manager.d.ts.map +1 -1
- package/dist/infrastructure/context/session-manager.js +69 -73
- package/dist/infrastructure/context/session-manager.js.map +1 -1
- package/dist/infrastructure/providers/cohere-provider.d.ts.map +1 -1
- package/dist/infrastructure/providers/cohere-provider.js +102 -17
- package/dist/infrastructure/providers/cohere-provider.js.map +1 -1
- package/dist/infrastructure/providers/openrouter-provider.d.ts +42 -0
- package/dist/infrastructure/providers/openrouter-provider.d.ts.map +1 -0
- package/dist/infrastructure/providers/openrouter-provider.js +399 -0
- package/dist/infrastructure/providers/openrouter-provider.js.map +1 -0
- package/dist/infrastructure/serialization/toon-serializer.d.ts +45 -0
- package/dist/infrastructure/serialization/toon-serializer.d.ts.map +1 -0
- package/dist/infrastructure/serialization/toon-serializer.js +119 -0
- package/dist/infrastructure/serialization/toon-serializer.js.map +1 -0
- package/dist/infrastructure/storage/embeddings-path.d.ts +18 -0
- package/dist/infrastructure/storage/embeddings-path.d.ts.map +1 -0
- package/dist/infrastructure/storage/embeddings-path.js +37 -0
- package/dist/infrastructure/storage/embeddings-path.js.map +1 -0
- package/dist/infrastructure/storage/plan-repository.d.ts +2 -0
- package/dist/infrastructure/storage/plan-repository.d.ts.map +1 -1
- package/dist/infrastructure/storage/plan-repository.js +36 -73
- package/dist/infrastructure/storage/plan-repository.js.map +1 -1
- package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts +10 -1
- package/dist/infrastructure/storage/sqlite-embedding-repository.d.ts.map +1 -1
- package/dist/infrastructure/storage/sqlite-embedding-repository.js +37 -3
- package/dist/infrastructure/storage/sqlite-embedding-repository.js.map +1 -1
- package/dist/infrastructure/storage/task-helpers.d.ts +11 -0
- package/dist/infrastructure/storage/task-helpers.d.ts.map +1 -1
- package/dist/infrastructure/storage/task-helpers.js +47 -7
- package/dist/infrastructure/storage/task-helpers.js.map +1 -1
- package/dist/infrastructure/storage/task-repository.d.ts.map +1 -1
- package/dist/infrastructure/storage/task-repository.js.map +1 -1
- package/dist/infrastructure/ux/capability-boundaries.d.ts +9 -37
- package/dist/infrastructure/ux/capability-boundaries.d.ts.map +1 -1
- package/dist/infrastructure/ux/capability-boundaries.js +23 -148
- package/dist/infrastructure/ux/capability-boundaries.js.map +1 -1
- package/dist/infrastructure/ux/comprehensive-formatter.d.ts +12 -54
- package/dist/infrastructure/ux/comprehensive-formatter.d.ts.map +1 -1
- package/dist/infrastructure/ux/comprehensive-formatter.js +87 -182
- package/dist/infrastructure/ux/comprehensive-formatter.js.map +1 -1
- package/dist/infrastructure/ux/contextual-feature-discovery.d.ts +5 -18
- package/dist/infrastructure/ux/contextual-feature-discovery.d.ts.map +1 -1
- package/dist/infrastructure/ux/contextual-feature-discovery.js +5 -139
- package/dist/infrastructure/ux/contextual-feature-discovery.js.map +1 -1
- package/dist/infrastructure/ux/feature-discovery.d.ts +3 -33
- package/dist/infrastructure/ux/feature-discovery.d.ts.map +1 -1
- package/dist/infrastructure/ux/feature-discovery.js +5 -181
- package/dist/infrastructure/ux/feature-discovery.js.map +1 -1
- package/dist/infrastructure/ux/feedback-prompt.d.ts +15 -31
- package/dist/infrastructure/ux/feedback-prompt.d.ts.map +1 -1
- package/dist/infrastructure/ux/feedback-prompt.js +30 -166
- package/dist/infrastructure/ux/feedback-prompt.js.map +1 -1
- package/dist/infrastructure/ux/progress-indicator.d.ts +3 -5
- package/dist/infrastructure/ux/progress-indicator.d.ts.map +1 -1
- package/dist/infrastructure/ux/progress-indicator.js +34 -49
- package/dist/infrastructure/ux/progress-indicator.js.map +1 -1
- package/dist/infrastructure/ux/review-checkpoint.d.ts +3 -1
- package/dist/infrastructure/ux/review-checkpoint.d.ts.map +1 -1
- package/dist/infrastructure/ux/review-checkpoint.js +33 -80
- package/dist/infrastructure/ux/review-checkpoint.js.map +1 -1
- package/dist/infrastructure/ux/staged-feature-intro.d.ts +14 -39
- package/dist/infrastructure/ux/staged-feature-intro.d.ts.map +1 -1
- package/dist/infrastructure/ux/staged-feature-intro.js +12 -132
- package/dist/infrastructure/ux/staged-feature-intro.js.map +1 -1
- package/dist/infrastructure/ux/syntax-highlighter.d.ts +1 -2
- package/dist/infrastructure/ux/syntax-highlighter.d.ts.map +1 -1
- package/dist/infrastructure/ux/syntax-highlighter.js +67 -148
- package/dist/infrastructure/ux/syntax-highlighter.js.map +1 -1
- package/dist/infrastructure/validation/agent-feedback.d.ts +25 -89
- package/dist/infrastructure/validation/agent-feedback.d.ts.map +1 -1
- package/dist/infrastructure/validation/agent-feedback.js +32 -204
- package/dist/infrastructure/validation/agent-feedback.js.map +1 -1
- package/dist/infrastructure/validation/agent-validation-helper.d.ts +53 -53
- package/dist/infrastructure/validation/agent-validation-helper.d.ts.map +1 -1
- package/dist/infrastructure/validation/agent-validation-helper.js +110 -61
- package/dist/infrastructure/validation/agent-validation-helper.js.map +1 -1
- package/dist/infrastructure/validation/review-handler.d.ts +13 -41
- package/dist/infrastructure/validation/review-handler.d.ts.map +1 -1
- package/dist/infrastructure/validation/review-handler.js +23 -189
- package/dist/infrastructure/validation/review-handler.js.map +1 -1
- package/dist/infrastructure/validation/summary-aggregator.d.ts +25 -22
- package/dist/infrastructure/validation/summary-aggregator.d.ts.map +1 -1
- package/dist/infrastructure/validation/summary-aggregator.js +47 -133
- package/dist/infrastructure/validation/summary-aggregator.js.map +1 -1
- package/dist/infrastructure/validation/summary-extractor.d.ts +13 -48
- package/dist/infrastructure/validation/summary-extractor.d.ts.map +1 -1
- package/dist/infrastructure/validation/summary-extractor.js +32 -89
- package/dist/infrastructure/validation/summary-extractor.js.map +1 -1
- package/dist/infrastructure/validation/trace-summary.d.ts +30 -57
- package/dist/infrastructure/validation/trace-summary.d.ts.map +1 -1
- package/dist/infrastructure/validation/trace-summary.js +37 -356
- package/dist/infrastructure/validation/trace-summary.js.map +1 -1
- package/dist/monitoring.d.ts +1 -1
- package/dist/monitoring.d.ts.map +1 -1
- package/dist/monitoring.js +12 -9
- package/dist/monitoring.js.map +1 -1
- package/dist/parallel-processor.d.ts.map +1 -1
- package/dist/parallel-processor.js +124 -45
- package/dist/parallel-processor.js.map +1 -1
- package/dist/presentation/cli/commands/ask-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/ask-command.js +185 -128
- package/dist/presentation/cli/commands/ask-command.js.map +1 -1
- package/dist/presentation/cli/commands/config-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/config-command.js +8 -6
- package/dist/presentation/cli/commands/config-command.js.map +1 -1
- package/dist/presentation/cli/commands/docs-command.d.ts +3 -1
- package/dist/presentation/cli/commands/docs-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/docs-command.js +13 -184
- package/dist/presentation/cli/commands/docs-command.js.map +1 -1
- package/dist/presentation/cli/commands/fix-command.d.ts +2 -0
- package/dist/presentation/cli/commands/fix-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/fix-command.js +25 -281
- package/dist/presentation/cli/commands/fix-command.js.map +1 -1
- package/dist/presentation/cli/commands/models-command.d.ts +13 -0
- package/dist/presentation/cli/commands/models-command.d.ts.map +1 -0
- package/dist/presentation/cli/commands/models-command.js +194 -0
- package/dist/presentation/cli/commands/models-command.js.map +1 -0
- package/dist/presentation/cli/commands/orchestrate-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/orchestrate-command.js +15 -7
- 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 +9 -6
- package/dist/presentation/cli/commands/plan-command.js.map +1 -1
- package/dist/presentation/cli/commands/product-command.d.ts +6 -4
- package/dist/presentation/cli/commands/product-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/product-command.js +12 -178
- package/dist/presentation/cli/commands/product-command.js.map +1 -1
- package/dist/presentation/cli/commands/review-command.d.ts +7 -7
- package/dist/presentation/cli/commands/review-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/review-command.js +148 -16
- package/dist/presentation/cli/commands/review-command.js.map +1 -1
- package/dist/presentation/cli/commands/run-command.d.ts +6 -8
- package/dist/presentation/cli/commands/run-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/run-command.js +182 -23
- package/dist/presentation/cli/commands/run-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 +15 -0
- package/dist/presentation/cli/commands/setup-command.js.map +1 -1
- package/dist/presentation/cli/commands/smart-command.js +1 -1
- package/dist/presentation/cli/commands/smart-command.js.map +1 -1
- package/dist/presentation/cli/commands/status-command.d.ts +3 -0
- package/dist/presentation/cli/commands/status-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/status-command.js +147 -156
- package/dist/presentation/cli/commands/status-command.js.map +1 -1
- package/dist/presentation/cli/commands/suggest-command.d.ts +3 -5
- package/dist/presentation/cli/commands/suggest-command.d.ts.map +1 -1
- package/dist/presentation/cli/commands/suggest-command.js +132 -19
- package/dist/presentation/cli/commands/suggest-command.js.map +1 -1
- package/dist/search.d.ts.map +1 -1
- package/dist/search.js +6 -1
- package/dist/search.js.map +1 -1
- package/dist/session.js +1 -1
- package/dist/session.js.map +1 -1
- package/dist/ui.d.ts +6 -0
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +35 -1
- package/dist/ui.js.map +1 -1
- package/package.json +8 -3
|
@@ -1,227 +1,55 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Agent Feedback
|
|
3
|
+
* Records and manages feedback about agent operations
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* - Record success/failure, user approval, user modifications, errors
|
|
7
|
-
* - Store anonymously in local memory for pattern improvements
|
|
8
|
-
* - JSON-based, appended per operation
|
|
9
|
-
* - Privacy-first design with opt-out support
|
|
5
|
+
* Phase 1: v0.5.0-alpha.0
|
|
10
6
|
*/
|
|
11
|
-
import { writeFileSync, readFileSync, existsSync, mkdirSync, appendFileSync } from 'fs';
|
|
12
|
-
import { join, dirname } from 'path';
|
|
13
|
-
import { fileURLToPath } from 'url';
|
|
14
|
-
import { randomUUID } from 'crypto';
|
|
15
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
16
|
-
const __dirname = dirname(__filename);
|
|
17
7
|
/**
|
|
18
8
|
* Agent Feedback Manager
|
|
19
|
-
* Lightweight, privacy-first feedback capture
|
|
20
9
|
*/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
feedbackHistory = [];
|
|
25
|
-
constructor(config) {
|
|
26
|
-
// Check opt-out preference
|
|
27
|
-
const optOut = process.env.CODEHERE_FEEDBACK_OPT_OUT === 'true' ||
|
|
28
|
-
process.env.CODEHERE_TELEMETRY_DISABLED === 'true';
|
|
29
|
-
this.config = {
|
|
30
|
-
enabled: !optOut && (config?.enabled !== false),
|
|
31
|
-
anonymize: config?.anonymize !== false,
|
|
32
|
-
optOut: optOut || (config?.optOut === true),
|
|
33
|
-
storagePath: config?.storagePath,
|
|
34
|
-
};
|
|
35
|
-
if (this.config.optOut || !this.config.enabled) {
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
// Set up feedback storage directory
|
|
39
|
-
if (this.config.storagePath) {
|
|
40
|
-
this.feedbackDir = this.config.storagePath;
|
|
41
|
-
}
|
|
42
|
-
else {
|
|
43
|
-
const agentDir = join(__dirname, '../../..');
|
|
44
|
-
this.feedbackDir = join(agentDir, 'data', 'feedback');
|
|
45
|
-
}
|
|
46
|
-
if (!existsSync(this.feedbackDir)) {
|
|
47
|
-
mkdirSync(this.feedbackDir, { recursive: true });
|
|
48
|
-
}
|
|
49
|
-
// Load recent feedback history (for pattern analysis)
|
|
50
|
-
this.loadRecentFeedback();
|
|
51
|
-
}
|
|
10
|
+
class AgentFeedbackManager {
|
|
11
|
+
feedbackRecords = [];
|
|
12
|
+
maxRecords = 1000;
|
|
52
13
|
/**
|
|
53
14
|
* Record feedback for an agent operation
|
|
54
|
-
* userAction is required - must be provided by caller
|
|
55
15
|
*/
|
|
56
16
|
recordFeedback(feedback) {
|
|
57
|
-
|
|
58
|
-
return 'feedback-disabled';
|
|
59
|
-
}
|
|
60
|
-
const feedbackId = randomUUID();
|
|
61
|
-
const fullFeedback = {
|
|
17
|
+
const record = {
|
|
62
18
|
...feedback,
|
|
63
|
-
|
|
64
|
-
timestamp: Date.now(),
|
|
19
|
+
timestamp: feedback.timestamp || Date.now(),
|
|
65
20
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
// Store in memory
|
|
71
|
-
this.feedbackHistory.push(processedFeedback);
|
|
72
|
-
if (this.feedbackHistory.length > 1000) {
|
|
73
|
-
// Keep only last 1000 in memory
|
|
74
|
-
this.feedbackHistory = this.feedbackHistory.slice(-1000);
|
|
75
|
-
}
|
|
76
|
-
// Append to JSON file (one JSON object per line for easy parsing)
|
|
77
|
-
const feedbackFile = join(this.feedbackDir, 'agent-feedback.jsonl');
|
|
78
|
-
try {
|
|
79
|
-
appendFileSync(feedbackFile, JSON.stringify(processedFeedback) + '\n', 'utf-8');
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
// Silent failure - don't break user workflow
|
|
83
|
-
console.error('[AgentFeedback] Failed to write feedback:', error);
|
|
84
|
-
}
|
|
85
|
-
return feedbackId;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Get feedback for a run
|
|
89
|
-
*/
|
|
90
|
-
getFeedbackForRun(runId) {
|
|
91
|
-
return this.feedbackHistory.find(f => f.runId === runId) || null;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Get recent feedback patterns (for learning)
|
|
95
|
-
*/
|
|
96
|
-
getRecentFeedback(limit = 100) {
|
|
97
|
-
return this.feedbackHistory.slice(-limit);
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Get feedback statistics
|
|
101
|
-
*/
|
|
102
|
-
getFeedbackStats() {
|
|
103
|
-
const stats = {
|
|
104
|
-
total: this.feedbackHistory.length,
|
|
105
|
-
byOutcome: {},
|
|
106
|
-
byAgent: {},
|
|
107
|
-
averageRating: undefined,
|
|
108
|
-
};
|
|
109
|
-
let totalRating = 0;
|
|
110
|
-
let ratingCount = 0;
|
|
111
|
-
for (const feedback of this.feedbackHistory) {
|
|
112
|
-
// Count by outcome
|
|
113
|
-
stats.byOutcome[feedback.outcome] = (stats.byOutcome[feedback.outcome] || 0) + 1;
|
|
114
|
-
// Count by agent
|
|
115
|
-
stats.byAgent[feedback.agentName] = (stats.byAgent[feedback.agentName] || 0) + 1;
|
|
116
|
-
// Calculate average rating
|
|
117
|
-
if (feedback.userFeedback?.rating) {
|
|
118
|
-
totalRating += feedback.userFeedback.rating;
|
|
119
|
-
ratingCount++;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
if (ratingCount > 0) {
|
|
123
|
-
stats.averageRating = totalRating / ratingCount;
|
|
21
|
+
this.feedbackRecords.push(record);
|
|
22
|
+
// Trim old records if too many
|
|
23
|
+
if (this.feedbackRecords.length > this.maxRecords) {
|
|
24
|
+
this.feedbackRecords = this.feedbackRecords.slice(-this.maxRecords);
|
|
124
25
|
}
|
|
125
|
-
|
|
26
|
+
// In alpha, feedback is stored in memory only
|
|
27
|
+
// Can be enhanced later to persist to disk
|
|
126
28
|
}
|
|
127
29
|
/**
|
|
128
|
-
*
|
|
30
|
+
* Get feedback records for an agent
|
|
129
31
|
*/
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const keywords = anonymized.query
|
|
136
|
-
.split(/\s+/)
|
|
137
|
-
.filter(w => w.length > 3)
|
|
138
|
-
.slice(0, 5)
|
|
139
|
-
.join(' ');
|
|
140
|
-
anonymized.query = keywords || '[anonymized]';
|
|
141
|
-
}
|
|
142
|
-
// Remove file contents from modifications
|
|
143
|
-
if (anonymized.userModifications) {
|
|
144
|
-
anonymized.userModifications = anonymized.userModifications.map(mod => ({
|
|
145
|
-
filepath: this.anonymizePath(mod.filepath),
|
|
146
|
-
modificationType: mod.modificationType,
|
|
147
|
-
description: mod.description ? '[anonymized]' : undefined,
|
|
148
|
-
}));
|
|
149
|
-
}
|
|
150
|
-
// Anonymize file paths (keep structure, not names)
|
|
151
|
-
if (anonymized.filesChanged) {
|
|
152
|
-
anonymized.filesChanged = anonymized.filesChanged.map(p => this.anonymizePath(p));
|
|
153
|
-
}
|
|
154
|
-
if (anonymized.filesCreated) {
|
|
155
|
-
anonymized.filesCreated = anonymized.filesCreated.map(p => this.anonymizePath(p));
|
|
156
|
-
}
|
|
157
|
-
return anonymized;
|
|
32
|
+
getFeedbackForAgent(agentName, limit = 10) {
|
|
33
|
+
return this.feedbackRecords
|
|
34
|
+
.filter(r => r.agentName === agentName)
|
|
35
|
+
.slice(-limit)
|
|
36
|
+
.reverse();
|
|
158
37
|
}
|
|
159
38
|
/**
|
|
160
|
-
*
|
|
39
|
+
* Get all feedback records
|
|
161
40
|
*/
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
const parts = filepath.split('/');
|
|
165
|
-
return parts.map((part, index) => {
|
|
166
|
-
if (index === parts.length - 1) {
|
|
167
|
-
// Last part is filename
|
|
168
|
-
const ext = part.split('.').pop();
|
|
169
|
-
return `file${ext ? '.' + ext : ''}`;
|
|
170
|
-
}
|
|
171
|
-
return part;
|
|
172
|
-
}).join('/');
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Load recent feedback from disk
|
|
176
|
-
*/
|
|
177
|
-
loadRecentFeedback() {
|
|
178
|
-
const feedbackFile = join(this.feedbackDir, 'agent-feedback.jsonl');
|
|
179
|
-
if (!existsSync(feedbackFile)) {
|
|
180
|
-
return;
|
|
181
|
-
}
|
|
182
|
-
try {
|
|
183
|
-
const content = readFileSync(feedbackFile, 'utf-8');
|
|
184
|
-
const lines = content.trim().split('\n').filter(line => line.trim());
|
|
185
|
-
// Load last 100 entries
|
|
186
|
-
const recentLines = lines.slice(-100);
|
|
187
|
-
this.feedbackHistory = recentLines
|
|
188
|
-
.map(line => {
|
|
189
|
-
try {
|
|
190
|
-
return JSON.parse(line);
|
|
191
|
-
}
|
|
192
|
-
catch {
|
|
193
|
-
return null;
|
|
194
|
-
}
|
|
195
|
-
})
|
|
196
|
-
.filter((f) => f !== null);
|
|
197
|
-
}
|
|
198
|
-
catch (error) {
|
|
199
|
-
// Silent failure
|
|
200
|
-
console.error('[AgentFeedback] Failed to load feedback history:', error);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Clear all feedback (privacy control)
|
|
205
|
-
*/
|
|
206
|
-
clearFeedback() {
|
|
207
|
-
this.feedbackHistory = [];
|
|
208
|
-
const feedbackFile = join(this.feedbackDir, 'agent-feedback.jsonl');
|
|
209
|
-
if (existsSync(feedbackFile)) {
|
|
210
|
-
try {
|
|
211
|
-
writeFileSync(feedbackFile, '', 'utf-8');
|
|
212
|
-
}
|
|
213
|
-
catch {
|
|
214
|
-
// Silent failure
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Check if feedback collection is enabled
|
|
220
|
-
*/
|
|
221
|
-
isEnabled() {
|
|
222
|
-
return !this.config.optOut && this.config.enabled;
|
|
41
|
+
getAllFeedback(limit = 100) {
|
|
42
|
+
return this.feedbackRecords.slice(-limit).reverse();
|
|
223
43
|
}
|
|
224
44
|
}
|
|
225
|
-
// Singleton instance
|
|
226
45
|
export const agentFeedbackManager = new AgentFeedbackManager();
|
|
46
|
+
/**
|
|
47
|
+
* AgentFeedback class (kept for backward compatibility)
|
|
48
|
+
*/
|
|
49
|
+
export class AgentFeedback {
|
|
50
|
+
data;
|
|
51
|
+
constructor(data) {
|
|
52
|
+
this.data = data;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
227
55
|
//# sourceMappingURL=agent-feedback.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-feedback.js","sourceRoot":"","sources":["../../../src/infrastructure/validation/agent-feedback.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agent-feedback.js","sourceRoot":"","sources":["../../../src/infrastructure/validation/agent-feedback.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmBH;;GAEG;AACH,MAAM,oBAAoB;IAChB,eAAe,GAAqB,EAAE,CAAC;IAC9B,UAAU,GAAG,IAAI,CAAC;IAEnC;;OAEG;IACH,cAAc,CAAC,QAAwB;QACrC,MAAM,MAAM,GAAmB;YAC7B,GAAG,QAAQ;YACX,SAAS,EAAE,QAAQ,CAAC,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE;SAC5C,CAAC;QAEF,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAElC,+BAA+B;QAC/B,IAAI,IAAI,CAAC,eAAe,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;YAClD,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACtE,CAAC;QAED,8CAA8C;QAC9C,2CAA2C;IAC7C,CAAC;IAED;;OAEG;IACH,mBAAmB,CAAC,SAAiB,EAAE,QAAgB,EAAE;QACvD,OAAO,IAAI,CAAC,eAAe;aACxB,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,CAAC;aACtC,KAAK,CAAC,CAAC,KAAK,CAAC;aACb,OAAO,EAAE,CAAC;IACf,CAAC;IAED;;OAEG;IACH,cAAc,CAAC,QAAgB,GAAG;QAChC,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;IACtD,CAAC;CACF;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAE/D;;GAEG;AACH,MAAM,OAAO,aAAa;IACL;IAAnB,YAAmB,IAAoB;QAApB,SAAI,GAAJ,IAAI,CAAgB;IAAG,CAAC;CAC5C"}
|
|
@@ -1,75 +1,75 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Agent Validation Helper
|
|
3
|
+
* Validates agent outputs and checks trust scores
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* - Automatic TraceSummary generation
|
|
7
|
-
* - AgentFeedback recording
|
|
8
|
-
* - Run context tracking
|
|
5
|
+
* Phase 1: v0.5.0-alpha.0
|
|
9
6
|
*/
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
import { TraceSummary } from './trace-summary.js';
|
|
8
|
+
export interface ValidationResult {
|
|
9
|
+
passed: boolean;
|
|
10
|
+
issues?: string[];
|
|
11
|
+
warnings?: string[];
|
|
12
|
+
score?: number;
|
|
13
|
+
summary?: TraceSummary;
|
|
14
|
+
feedbackId?: string | null;
|
|
15
|
+
runId?: string | null;
|
|
16
|
+
}
|
|
17
|
+
export interface TrustCheckResult {
|
|
18
|
+
passed: boolean;
|
|
19
|
+
trustScore?: number;
|
|
20
|
+
threshold?: number;
|
|
21
|
+
message?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface ValidationContext {
|
|
14
24
|
agentName: string;
|
|
15
25
|
operation: string;
|
|
16
26
|
startTime: number;
|
|
27
|
+
metadata?: Record<string, any>;
|
|
17
28
|
}
|
|
18
|
-
export interface
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
29
|
+
export interface TraceData {
|
|
30
|
+
operationType: string;
|
|
31
|
+
operationName: string;
|
|
32
|
+
input?: any;
|
|
33
|
+
output?: any;
|
|
34
|
+
error?: Error;
|
|
35
|
+
metadata?: Record<string, any>;
|
|
23
36
|
}
|
|
24
37
|
/**
|
|
25
|
-
*
|
|
38
|
+
* Agent validation helper
|
|
26
39
|
*/
|
|
27
|
-
export declare
|
|
40
|
+
export declare const agentValidationHelper: {
|
|
28
41
|
/**
|
|
29
|
-
* Start
|
|
42
|
+
* Start an agent operation and return validation context
|
|
30
43
|
*/
|
|
31
|
-
startAgentOperation(agentName: string, operation: string,
|
|
32
|
-
query?: string;
|
|
33
|
-
codebaseId?: string;
|
|
34
|
-
}): AgentValidationContext;
|
|
44
|
+
startAgentOperation(agentName: string, operation: string, metadata?: Record<string, any>): ValidationContext;
|
|
35
45
|
/**
|
|
36
|
-
* Complete agent operation and
|
|
46
|
+
* Complete an agent operation and return validation result
|
|
37
47
|
*/
|
|
38
|
-
completeAgentOperation
|
|
39
|
-
outcome
|
|
40
|
-
userAction?: UserAction;
|
|
41
|
-
filesChanged?: string[];
|
|
42
|
-
filesCreated?: string[];
|
|
43
|
-
filesDeleted?: string[];
|
|
44
|
-
errors?: string[];
|
|
45
|
-
warnings?: string[];
|
|
48
|
+
completeAgentOperation(context: ValidationContext, result: Record<string, any> | null, options?: {
|
|
49
|
+
outcome?: "success" | "failure" | "partial_success";
|
|
46
50
|
validationChecks?: Array<{
|
|
47
51
|
check: string;
|
|
48
52
|
passed: boolean;
|
|
49
53
|
message?: string;
|
|
50
|
-
critical?: boolean;
|
|
51
54
|
}>;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
additionalContext?: Record<string, any>;
|
|
60
|
-
}): Promise<AgentValidationResult<T>>;
|
|
55
|
+
filesChanged?: string[];
|
|
56
|
+
filesCreated?: string[];
|
|
57
|
+
filesDeleted?: string[];
|
|
58
|
+
errors?: any[];
|
|
59
|
+
warnings?: any[];
|
|
60
|
+
[key: string]: any;
|
|
61
|
+
}): Promise<ValidationResult>;
|
|
61
62
|
/**
|
|
62
|
-
*
|
|
63
|
+
* Trace an operation step
|
|
63
64
|
*/
|
|
64
|
-
trace(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
export declare const agentValidationHelper: AgentValidationHelper;
|
|
65
|
+
trace(data: TraceData): void;
|
|
66
|
+
/**
|
|
67
|
+
* Validate agent output
|
|
68
|
+
*/
|
|
69
|
+
validate(output: any, context?: any): ValidationResult;
|
|
70
|
+
/**
|
|
71
|
+
* Check trust score for an agent
|
|
72
|
+
*/
|
|
73
|
+
checkTrust(agentName: string, operation: string): TrustCheckResult;
|
|
74
|
+
};
|
|
75
75
|
//# sourceMappingURL=agent-validation-helper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-validation-helper.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/validation/agent-validation-helper.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agent-validation-helper.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/validation/agent-validation-helper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAyB,MAAM,oBAAoB,CAAC;AAIzE,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,OAAO,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAA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S,GAAG,IAAI;IAK5B;;OAEG;qBACc,GAAG,YAAY,GAAG,GAAG,gBAAgB;IAetD;;OAEG;0BACmB,MAAM,aAAa,MAAM,GAAG,gBAAgB;CASnE,CAAC"}
|
|
@@ -1,88 +1,137 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Agent Validation Helper
|
|
3
|
+
* Validates agent outputs and checks trust scores
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* - Automatic TraceSummary generation
|
|
7
|
-
* - AgentFeedback recording
|
|
8
|
-
* - Run context tracking
|
|
5
|
+
* Phase 1: v0.5.0-alpha.0
|
|
9
6
|
*/
|
|
7
|
+
import { TraceSummary } from './trace-summary.js';
|
|
10
8
|
import { executionTracer } from '../observability/execution-tracer.js';
|
|
11
|
-
import {
|
|
12
|
-
import { traceSummaryFormatter } from './trace-summary.js';
|
|
9
|
+
import { randomUUID } from 'crypto';
|
|
13
10
|
/**
|
|
14
|
-
*
|
|
11
|
+
* Agent validation helper
|
|
15
12
|
*/
|
|
16
|
-
export
|
|
13
|
+
export const agentValidationHelper = {
|
|
17
14
|
/**
|
|
18
|
-
* Start
|
|
15
|
+
* Start an agent operation and return validation context
|
|
19
16
|
*/
|
|
20
|
-
startAgentOperation(agentName, operation,
|
|
21
|
-
const runId = executionTracer.startRun(`${agentName}:${operation}`, {
|
|
22
|
-
query: context?.query,
|
|
23
|
-
codebaseId: context?.codebaseId,
|
|
24
|
-
});
|
|
17
|
+
startAgentOperation(agentName, operation, metadata) {
|
|
25
18
|
return {
|
|
26
|
-
runId,
|
|
27
19
|
agentName,
|
|
28
20
|
operation,
|
|
29
21
|
startTime: Date.now(),
|
|
22
|
+
metadata,
|
|
30
23
|
};
|
|
31
|
-
}
|
|
24
|
+
},
|
|
32
25
|
/**
|
|
33
|
-
* Complete agent operation and
|
|
26
|
+
* Complete an agent operation and return validation result
|
|
34
27
|
*/
|
|
35
|
-
async completeAgentOperation(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
startTime: validationContext.startTime,
|
|
50
|
-
endTime: Date.now(),
|
|
51
|
-
operation: validationContext.operation,
|
|
52
|
-
query: metadata.additionalContext?.query,
|
|
53
|
-
codebaseId: metadata.additionalContext?.codebaseId,
|
|
54
|
-
traces: [],
|
|
55
|
-
}, agentFeedbackManager.getFeedbackForRun(validationContext.runId) || undefined, validationContext.agentName);
|
|
56
|
-
// Update summary with metadata if available
|
|
57
|
-
if (metadata.filesChanged) {
|
|
58
|
-
summary.filesChanged = metadata.filesChanged;
|
|
28
|
+
async completeAgentOperation(context, result, options) {
|
|
29
|
+
const endTime = Date.now();
|
|
30
|
+
const duration = endTime - context.startTime;
|
|
31
|
+
const opts = options || {};
|
|
32
|
+
// Basic validation
|
|
33
|
+
const issues = [];
|
|
34
|
+
const warnings = [];
|
|
35
|
+
// Check validation checks
|
|
36
|
+
if (opts.validationChecks) {
|
|
37
|
+
for (const check of opts.validationChecks) {
|
|
38
|
+
if (!check.passed) {
|
|
39
|
+
issues.push(check.message || check.check);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
59
42
|
}
|
|
60
|
-
|
|
61
|
-
|
|
43
|
+
// Check errors
|
|
44
|
+
if (opts.errors && opts.errors.length > 0) {
|
|
45
|
+
issues.push(...opts.errors.map((e) => typeof e === 'string' ? e : e.message || String(e)));
|
|
62
46
|
}
|
|
63
|
-
|
|
64
|
-
|
|
47
|
+
// Check warnings
|
|
48
|
+
if (opts.warnings && opts.warnings.length > 0) {
|
|
49
|
+
warnings.push(...opts.warnings.map((w) => typeof w === 'string' ? w : w.message || String(w)));
|
|
65
50
|
}
|
|
66
|
-
|
|
67
|
-
|
|
51
|
+
// Check outcome
|
|
52
|
+
if (opts.outcome === 'failure') {
|
|
53
|
+
issues.push('Operation failed');
|
|
68
54
|
}
|
|
69
|
-
if (
|
|
70
|
-
|
|
55
|
+
else if (opts.outcome === 'partial_success') {
|
|
56
|
+
warnings.push('Operation partially succeeded');
|
|
71
57
|
}
|
|
58
|
+
// Check overallSuccess in result
|
|
59
|
+
if (result && result.overallSuccess === false) {
|
|
60
|
+
issues.push('Overall operation was not successful');
|
|
61
|
+
}
|
|
62
|
+
// Get runId from execution tracer
|
|
63
|
+
const runId = executionTracer.getCurrentRunId();
|
|
64
|
+
// Generate feedbackId
|
|
65
|
+
const feedbackId = randomUUID();
|
|
66
|
+
// Collect files affected
|
|
67
|
+
const filesAffected = [];
|
|
68
|
+
if (opts.filesChanged)
|
|
69
|
+
filesAffected.push(...opts.filesChanged);
|
|
70
|
+
if (opts.filesCreated)
|
|
71
|
+
filesAffected.push(...opts.filesCreated);
|
|
72
|
+
if (opts.filesDeleted)
|
|
73
|
+
filesAffected.push(...opts.filesDeleted);
|
|
74
|
+
// Create trace summary
|
|
75
|
+
const summaryData = {
|
|
76
|
+
runId: runId || `run-${Date.now()}`,
|
|
77
|
+
agentName: context.agentName,
|
|
78
|
+
operation: context.operation,
|
|
79
|
+
startTime: context.startTime,
|
|
80
|
+
endTime,
|
|
81
|
+
success: issues.length === 0,
|
|
82
|
+
filesAffected: filesAffected.length > 0 ? filesAffected : undefined,
|
|
83
|
+
error: issues.length > 0 ? issues.join('; ') : undefined,
|
|
84
|
+
metadata: {
|
|
85
|
+
...context.metadata,
|
|
86
|
+
duration,
|
|
87
|
+
validationChecks: opts.validationChecks?.length || 0,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
const summary = new TraceSummary(summaryData);
|
|
72
91
|
return {
|
|
73
|
-
|
|
92
|
+
passed: issues.length === 0,
|
|
93
|
+
issues: issues.length > 0 ? issues : undefined,
|
|
94
|
+
warnings: warnings.length > 0 ? warnings : undefined,
|
|
95
|
+
score: issues.length === 0 ? 1.0 : Math.max(0, 1.0 - (issues.length * 0.2)),
|
|
74
96
|
summary,
|
|
75
97
|
feedbackId,
|
|
76
|
-
runId
|
|
98
|
+
runId,
|
|
77
99
|
};
|
|
78
|
-
}
|
|
100
|
+
},
|
|
101
|
+
/**
|
|
102
|
+
* Trace an operation step
|
|
103
|
+
*/
|
|
104
|
+
trace(data) {
|
|
105
|
+
// In alpha, tracing is a no-op
|
|
106
|
+
// Can be enhanced later to log to execution tracer
|
|
107
|
+
},
|
|
79
108
|
/**
|
|
80
|
-
*
|
|
109
|
+
* Validate agent output
|
|
81
110
|
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
111
|
+
validate(output, context) {
|
|
112
|
+
// Basic validation - can be enhanced later
|
|
113
|
+
if (!output) {
|
|
114
|
+
return {
|
|
115
|
+
passed: false,
|
|
116
|
+
issues: ['Output is empty'],
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
return {
|
|
120
|
+
passed: true,
|
|
121
|
+
score: 1.0,
|
|
122
|
+
};
|
|
123
|
+
},
|
|
124
|
+
/**
|
|
125
|
+
* Check trust score for an agent
|
|
126
|
+
*/
|
|
127
|
+
checkTrust(agentName, operation) {
|
|
128
|
+
// In alpha, default to passing
|
|
129
|
+
// Can be enhanced later with actual trust score tracking
|
|
130
|
+
return {
|
|
131
|
+
passed: true,
|
|
132
|
+
trustScore: 1.0,
|
|
133
|
+
threshold: 0.7,
|
|
134
|
+
};
|
|
135
|
+
},
|
|
136
|
+
};
|
|
88
137
|
//# sourceMappingURL=agent-validation-helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-validation-helper.js","sourceRoot":"","sources":["../../../src/infrastructure/validation/agent-validation-helper.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agent-validation-helper.js","sourceRoot":"","sources":["../../../src/infrastructure/validation/agent-validation-helper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EA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