claude-flow-novice 1.6.2 → 1.6.3
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/.claude/settings.json +4 -3
- package/.claude-flow-novice/dist/src/api/auth-service.js +84 -38
- package/.claude-flow-novice/dist/src/api/auth-service.js.map +1 -1
- package/.claude-flow-novice/dist/src/monitoring/apm/apm-integration.js +719 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/apm-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/datadog-collector.js +363 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/datadog-collector.js.map +1 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/index.js +97 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/newrelic-collector.js +384 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/newrelic-collector.js.map +1 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/performance-optimizer.js +612 -0
- package/.claude-flow-novice/dist/src/monitoring/apm/performance-optimizer.js.map +1 -0
- package/.claude-flow-novice/dist/src/monitoring/metrics-collector.js +282 -0
- package/.claude-flow-novice/dist/src/monitoring/metrics-collector.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/apm-routes.js +355 -0
- package/.claude-flow-novice/dist/src/web/api/apm-routes.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/frontend/src/utils/security.js +425 -0
- package/.claude-flow-novice/dist/src/web/frontend/src/utils/security.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/security/security-middleware.js +379 -0
- package/.claude-flow-novice/dist/src/web/security/security-middleware.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/websocket/apm-websocket-handler.js +441 -0
- package/.claude-flow-novice/dist/src/web/websocket/apm-websocket-handler.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/websocket/websocket-manager.js +255 -1
- package/.claude-flow-novice/dist/src/web/websocket/websocket-manager.js.map +1 -1
- package/AGENT_PERFORMANCE_GUIDELINES.md +88 -0
- package/CLAUDE.md +31 -3
- package/MEMORY_LEAK_ROOT_CAUSE.md +149 -0
- package/package.json +4 -2
- package/scripts/monitor-loop.sh +65 -0
- package/scripts/monitor-memory.sh +47 -0
- package/scripts/monitor.py +43 -0
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* New Relic APM Integration for Claude Flow Novice
|
|
3
|
+
* Provides comprehensive monitoring, tracing, and metrics collection
|
|
4
|
+
*/ import { Logger } from '../../utils/logger.js';
|
|
5
|
+
export class NewRelicCollector {
|
|
6
|
+
config;
|
|
7
|
+
logger;
|
|
8
|
+
activeTransactions = new Map();
|
|
9
|
+
activeSpans = new Map();
|
|
10
|
+
metricsQueue = [];
|
|
11
|
+
logsQueue = [];
|
|
12
|
+
flushInterval;
|
|
13
|
+
constructor(config){
|
|
14
|
+
this.config = {
|
|
15
|
+
appName: 'Claude Flow Novice',
|
|
16
|
+
env: process.env.NODE_ENV || 'production',
|
|
17
|
+
version: process.env.npm_package_version || '1.6.2',
|
|
18
|
+
tracing: {
|
|
19
|
+
enabled: true,
|
|
20
|
+
distributedTracing: true,
|
|
21
|
+
transactionEvents: true,
|
|
22
|
+
spanEvents: true
|
|
23
|
+
},
|
|
24
|
+
metrics: {
|
|
25
|
+
enabled: true,
|
|
26
|
+
apiHost: 'https://metric-api.newrelic.com',
|
|
27
|
+
metricApiPath: '/metric/v1'
|
|
28
|
+
},
|
|
29
|
+
logs: {
|
|
30
|
+
enabled: true,
|
|
31
|
+
apiHost: 'https://log-api.newrelic.com',
|
|
32
|
+
logApiPath: '/log/v1'
|
|
33
|
+
},
|
|
34
|
+
browserMonitoring: {
|
|
35
|
+
enabled: false
|
|
36
|
+
},
|
|
37
|
+
...config
|
|
38
|
+
};
|
|
39
|
+
this.logger = new Logger('NewRelicCollector');
|
|
40
|
+
this.startFlushing();
|
|
41
|
+
}
|
|
42
|
+
// Transaction Management
|
|
43
|
+
startTransaction(name, type, attributes) {
|
|
44
|
+
if (!this.config.tracing?.enabled) return '';
|
|
45
|
+
const transactionId = this.generateId();
|
|
46
|
+
const transaction = {
|
|
47
|
+
name,
|
|
48
|
+
type,
|
|
49
|
+
startTime: Date.now(),
|
|
50
|
+
duration: 0,
|
|
51
|
+
attributes: {
|
|
52
|
+
'service.name': this.config.appName,
|
|
53
|
+
'service.version': this.config.version,
|
|
54
|
+
'environment': this.config.env,
|
|
55
|
+
...attributes
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
this.activeTransactions.set(transactionId, transaction);
|
|
59
|
+
return transactionId;
|
|
60
|
+
}
|
|
61
|
+
finishTransaction(transactionId, attributes, error) {
|
|
62
|
+
if (!transactionId || !this.activeTransactions.has(transactionId)) return;
|
|
63
|
+
const transaction = this.activeTransactions.get(transactionId);
|
|
64
|
+
transaction.duration = Date.now() - transaction.startTime;
|
|
65
|
+
if (attributes) {
|
|
66
|
+
transaction.attributes = {
|
|
67
|
+
...transaction.attributes,
|
|
68
|
+
...attributes
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
if (error) {
|
|
72
|
+
transaction.error = true;
|
|
73
|
+
transaction.attributes['error.type'] = error.constructor.name;
|
|
74
|
+
transaction.attributes['error.message'] = error.message;
|
|
75
|
+
transaction.attributes['error.stack'] = error.stack || '';
|
|
76
|
+
}
|
|
77
|
+
this.sendTransaction(transaction);
|
|
78
|
+
this.activeTransactions.delete(transactionId);
|
|
79
|
+
}
|
|
80
|
+
// Span Management
|
|
81
|
+
startSpan(transactionId, name, type, parentId, attributes) {
|
|
82
|
+
if (!this.config.tracing?.enabled || !this.activeTransactions.has(transactionId)) return '';
|
|
83
|
+
const spanId = this.generateId();
|
|
84
|
+
const transaction = this.activeTransactions.get(transactionId);
|
|
85
|
+
const span = {
|
|
86
|
+
id: spanId,
|
|
87
|
+
traceId: this.generateId(),
|
|
88
|
+
transactionId,
|
|
89
|
+
parentId,
|
|
90
|
+
name,
|
|
91
|
+
type,
|
|
92
|
+
startTime: Date.now(),
|
|
93
|
+
duration: 0,
|
|
94
|
+
attributes: {
|
|
95
|
+
'service.name': this.config.appName,
|
|
96
|
+
...attributes
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
this.activeSpans.set(spanId, span);
|
|
100
|
+
return spanId;
|
|
101
|
+
}
|
|
102
|
+
finishSpan(spanId, attributes, error) {
|
|
103
|
+
if (!spanId || !this.activeSpans.has(spanId)) return;
|
|
104
|
+
const span = this.activeSpans.get(spanId);
|
|
105
|
+
span.duration = Date.now() - span.startTime;
|
|
106
|
+
if (attributes) {
|
|
107
|
+
span.attributes = {
|
|
108
|
+
...span.attributes,
|
|
109
|
+
...attributes
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
if (error) {
|
|
113
|
+
span.error = true;
|
|
114
|
+
span.attributes['error.type'] = error.constructor.name;
|
|
115
|
+
span.attributes['error.message'] = error.message;
|
|
116
|
+
span.attributes['error.stack'] = error.stack || '';
|
|
117
|
+
}
|
|
118
|
+
this.sendSpan(span);
|
|
119
|
+
this.activeSpans.delete(spanId);
|
|
120
|
+
}
|
|
121
|
+
// Metrics Collection
|
|
122
|
+
recordMetric(name, value, type, attributes) {
|
|
123
|
+
if (!this.config.metrics?.enabled) return;
|
|
124
|
+
const metric = {
|
|
125
|
+
name,
|
|
126
|
+
type,
|
|
127
|
+
value,
|
|
128
|
+
timestamp: Date.now() * 1000000,
|
|
129
|
+
attributes: {
|
|
130
|
+
'service.name': this.config.appName,
|
|
131
|
+
'environment': this.config.env,
|
|
132
|
+
...attributes
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
this.metricsQueue.push(metric);
|
|
136
|
+
}
|
|
137
|
+
// Business Metrics for Agent Operations
|
|
138
|
+
recordAgentOperation(agentType, operation, duration, success) {
|
|
139
|
+
this.recordMetric('AgentOperation', duration, 'histogram', {
|
|
140
|
+
'agent.type': agentType,
|
|
141
|
+
'operation.name': operation,
|
|
142
|
+
'operation.status': success ? 'success' : 'failure'
|
|
143
|
+
});
|
|
144
|
+
this.recordMetric('AgentOperations', 1, 'count', {
|
|
145
|
+
'agent.type': agentType,
|
|
146
|
+
'operation.name': operation,
|
|
147
|
+
'operation.status': success ? 'success' : 'failure'
|
|
148
|
+
});
|
|
149
|
+
if (!success) {
|
|
150
|
+
this.recordMetric('AgentErrors', 1, 'count', {
|
|
151
|
+
'agent.type': agentType,
|
|
152
|
+
'operation.name': operation
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
recordSwarmActivity(swarmSize, topology, duration, success) {
|
|
157
|
+
this.recordMetric('SwarmSize', swarmSize, 'gauge', {
|
|
158
|
+
'swarm.topology': topology
|
|
159
|
+
});
|
|
160
|
+
this.recordMetric('SwarmExecution', duration, 'histogram', {
|
|
161
|
+
'swarm.topology': topology,
|
|
162
|
+
'execution.status': success ? 'success' : 'failure'
|
|
163
|
+
});
|
|
164
|
+
this.recordMetric('SwarmExecutions', 1, 'count', {
|
|
165
|
+
'swarm.topology': topology,
|
|
166
|
+
'execution.status': success ? 'success' : 'failure'
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
recordWebSocketEvent(eventType, duration, success) {
|
|
170
|
+
this.recordMetric('WebSocketEvent', duration, 'histogram', {
|
|
171
|
+
'event.type': eventType,
|
|
172
|
+
'event.status': success ? 'success' : 'failure'
|
|
173
|
+
});
|
|
174
|
+
this.recordMetric('WebSocketEvents', 1, 'count', {
|
|
175
|
+
'event.type': eventType,
|
|
176
|
+
'event.status': success ? 'success' : 'failure'
|
|
177
|
+
});
|
|
178
|
+
// Track active connections
|
|
179
|
+
if (eventType === 'connection') {
|
|
180
|
+
this.recordMetric('ActiveWebSocketConnections', 1, 'gauge');
|
|
181
|
+
} else if (eventType === 'disconnection') {
|
|
182
|
+
this.recordMetric('ActiveWebSocketConnections', -1, 'gauge');
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
recordAPICall(method, route, statusCode, duration) {
|
|
186
|
+
this.recordMetric('APICall', duration, 'histogram', {
|
|
187
|
+
'http.method': method,
|
|
188
|
+
'http.route': route,
|
|
189
|
+
'http.status_code': statusCode.toString()
|
|
190
|
+
});
|
|
191
|
+
this.recordMetric('APICalls', 1, 'count', {
|
|
192
|
+
'http.method': method,
|
|
193
|
+
'http.route': route,
|
|
194
|
+
'http.status_code': statusCode.toString()
|
|
195
|
+
});
|
|
196
|
+
if (statusCode >= 400) {
|
|
197
|
+
this.recordMetric('APIErrors', 1, 'count', {
|
|
198
|
+
'http.method': method,
|
|
199
|
+
'http.route': route,
|
|
200
|
+
'http.status_code': statusCode.toString()
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
// Custom Event Tracking
|
|
205
|
+
recordCustomEvent(eventType, attributes) {
|
|
206
|
+
this.recordMetric('CustomEvent', 1, 'count', {
|
|
207
|
+
'event.type': eventType,
|
|
208
|
+
...attributes
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
// Logging Integration
|
|
212
|
+
log(message, level, attributes, traceId, spanId) {
|
|
213
|
+
if (!this.config.logs?.enabled) return;
|
|
214
|
+
const logEntry = {
|
|
215
|
+
message,
|
|
216
|
+
timestamp: Date.now() * 1000000,
|
|
217
|
+
level: level.toUpperCase(),
|
|
218
|
+
attributes: {
|
|
219
|
+
'service.name': this.config.appName,
|
|
220
|
+
'environment': this.config.env,
|
|
221
|
+
...attributes
|
|
222
|
+
},
|
|
223
|
+
traceId,
|
|
224
|
+
spanId
|
|
225
|
+
};
|
|
226
|
+
this.logsQueue.push(logEntry);
|
|
227
|
+
}
|
|
228
|
+
// Performance Monitoring
|
|
229
|
+
recordPerformanceMetric(operation, duration, attributes) {
|
|
230
|
+
this.recordMetric('PerformanceOperation', duration, 'histogram', {
|
|
231
|
+
'operation.name': operation,
|
|
232
|
+
...attributes
|
|
233
|
+
});
|
|
234
|
+
if (duration > 5000) {
|
|
235
|
+
this.log(`Slow operation detected: ${operation}`, 'warn', {
|
|
236
|
+
duration,
|
|
237
|
+
operation,
|
|
238
|
+
...attributes
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
// Browser Monitoring
|
|
243
|
+
getBrowserMonitoringScript() {
|
|
244
|
+
if (!this.config.browserMonitoring?.enabled || !this.config.licenseKey) return '';
|
|
245
|
+
// Return the New Relic browser monitoring script
|
|
246
|
+
return `
|
|
247
|
+
(function(window){
|
|
248
|
+
window.NREUM||(window.NREUM={});
|
|
249
|
+
NREUM.init={...}; // Configuration would go here
|
|
250
|
+
})(window);
|
|
251
|
+
`;
|
|
252
|
+
}
|
|
253
|
+
// Health Check
|
|
254
|
+
async healthCheck() {
|
|
255
|
+
try {
|
|
256
|
+
const health = {
|
|
257
|
+
status: 'healthy',
|
|
258
|
+
details: {
|
|
259
|
+
config: {
|
|
260
|
+
tracing: this.config.tracing?.enabled || false,
|
|
261
|
+
metrics: this.config.metrics?.enabled || false,
|
|
262
|
+
logs: this.config.logs?.enabled || false,
|
|
263
|
+
browserMonitoring: this.config.browserMonitoring?.enabled || false
|
|
264
|
+
},
|
|
265
|
+
activeTransactions: this.activeTransactions.size,
|
|
266
|
+
activeSpans: this.activeSpans.size,
|
|
267
|
+
queuedMetrics: this.metricsQueue.length,
|
|
268
|
+
queuedLogs: this.logsQueue.length,
|
|
269
|
+
lastFlush: Date.now()
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
// Check if queues are growing too large
|
|
273
|
+
if (this.metricsQueue.length > 1000 || this.logsQueue.length > 1000) {
|
|
274
|
+
health.status = 'degraded';
|
|
275
|
+
health.details.queues = 'high';
|
|
276
|
+
}
|
|
277
|
+
return health;
|
|
278
|
+
} catch (error) {
|
|
279
|
+
return {
|
|
280
|
+
status: 'unhealthy',
|
|
281
|
+
details: {
|
|
282
|
+
error: error.message
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
// Private Methods
|
|
288
|
+
generateId() {
|
|
289
|
+
return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
|
|
290
|
+
}
|
|
291
|
+
sendTransaction(transaction) {
|
|
292
|
+
if (!this.config.licenseKey) return;
|
|
293
|
+
// In a real implementation, you would send this to New Relic's API
|
|
294
|
+
this.logger.debug('Sending transaction to New Relic', {
|
|
295
|
+
name: transaction.name,
|
|
296
|
+
duration: transaction.duration,
|
|
297
|
+
error: transaction.error
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
sendSpan(span) {
|
|
301
|
+
if (!this.config.licenseKey) return;
|
|
302
|
+
// In a real implementation, you would send this to New Relic's API
|
|
303
|
+
this.logger.debug('Sending span to New Relic', {
|
|
304
|
+
id: span.id,
|
|
305
|
+
name: span.name,
|
|
306
|
+
duration: span.duration,
|
|
307
|
+
error: span.error
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
async flushMetrics() {
|
|
311
|
+
if (!this.config.licenseKey || this.metricsQueue.length === 0) return;
|
|
312
|
+
const metricsToSend = [
|
|
313
|
+
...this.metricsQueue
|
|
314
|
+
];
|
|
315
|
+
this.metricsQueue = [];
|
|
316
|
+
try {
|
|
317
|
+
// In a real implementation, send to New Relic's metrics API
|
|
318
|
+
this.logger.debug(`Flushing ${metricsToSend.length} metrics to New Relic`);
|
|
319
|
+
} catch (error) {
|
|
320
|
+
this.logger.error('Failed to flush metrics to New Relic', {
|
|
321
|
+
error: error.message
|
|
322
|
+
});
|
|
323
|
+
// Re-queue failed metrics
|
|
324
|
+
this.metricsQueue.unshift(...metricsToSend);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
async flushLogs() {
|
|
328
|
+
if (!this.config.logs?.enabled || !this.config.licenseKey || this.logsQueue.length === 0) return;
|
|
329
|
+
const logsToSend = [
|
|
330
|
+
...this.logsQueue
|
|
331
|
+
];
|
|
332
|
+
this.logsQueue = [];
|
|
333
|
+
try {
|
|
334
|
+
// In a real implementation, send to New Relic's logs API
|
|
335
|
+
this.logger.debug(`Flushing ${logsToSend.length} logs to New Relic`);
|
|
336
|
+
} catch (error) {
|
|
337
|
+
this.logger.error('Failed to flush logs to New Relic', {
|
|
338
|
+
error: error.message
|
|
339
|
+
});
|
|
340
|
+
// Re-queue failed logs
|
|
341
|
+
this.logsQueue.unshift(...logsToSend);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
startFlushing() {
|
|
345
|
+
this.flushInterval = setInterval(async ()=>{
|
|
346
|
+
await Promise.all([
|
|
347
|
+
this.flushMetrics(),
|
|
348
|
+
this.flushLogs()
|
|
349
|
+
]);
|
|
350
|
+
}, 10000); // Flush every 10 seconds
|
|
351
|
+
}
|
|
352
|
+
// Shutdown
|
|
353
|
+
async shutdown() {
|
|
354
|
+
this.logger.info('Shutting down New Relic collector');
|
|
355
|
+
if (this.flushInterval) {
|
|
356
|
+
clearInterval(this.flushInterval);
|
|
357
|
+
}
|
|
358
|
+
// Flush any remaining data
|
|
359
|
+
await Promise.all([
|
|
360
|
+
this.flushMetrics(),
|
|
361
|
+
this.flushLogs()
|
|
362
|
+
]);
|
|
363
|
+
// Clean up any remaining transactions and spans
|
|
364
|
+
for (const transactionId of this.activeTransactions.keys()){
|
|
365
|
+
this.finishTransaction(transactionId, {
|
|
366
|
+
'shutdown': 'true'
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
for (const spanId of this.activeSpans.keys()){
|
|
370
|
+
this.finishSpan(spanId, {
|
|
371
|
+
'shutdown': 'true'
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
this.logger.info('New Relic collector shutdown complete');
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
export function createNewRelicCollector(config = {}) {
|
|
378
|
+
return new NewRelicCollector({
|
|
379
|
+
enabled: true,
|
|
380
|
+
...config
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
//# sourceMappingURL=newrelic-collector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../src/monitoring/apm/newrelic-collector.ts"],"names":["Logger","NewRelicCollector","config","logger","activeTransactions","Map","activeSpans","metricsQueue","logsQueue","flushInterval","appName","env","process","NODE_ENV","version","npm_package_version","tracing","enabled","distributedTracing","transactionEvents","spanEvents","metrics","apiHost","metricApiPath","logs","logApiPath","browserMonitoring","startFlushing","startTransaction","name","type","attributes","transactionId","generateId","transaction","startTime","Date","now","duration","set","finishTransaction","error","has","get","message","stack","sendTransaction","delete","startSpan","parentId","spanId","span","id","traceId","finishSpan","sendSpan","recordMetric","value","metric","timestamp","push","recordAgentOperation","agentType","operation","success","recordSwarmActivity","swarmSize","topology","recordWebSocketEvent","eventType","recordAPICall","method","route","statusCode","toString","recordCustomEvent","log","level","logEntry","toUpperCase","recordPerformanceMetric","getBrowserMonitoringScript","licenseKey","healthCheck","health","status","details","size","queuedMetrics","length","queuedLogs","lastFlush","queues","Math","random","substring","debug","flushMetrics","metricsToSend","unshift","flushLogs","logsToSend","setInterval","Promise","all","shutdown","info","clearInterval","keys","createNewRelicCollector"],"mappings":"AAAA;;;CAGC,GAED,SAASA,MAAM,QAAQ,wBAAwB;AAsE/C,OAAO,MAAMC;IACHC,OAAuB;IACvBC,OAAe;IACfC,qBAAuD,IAAIC,MAAM;IACjEC,cAAyC,IAAID,MAAM;IACnDE,eAAiC,EAAE,CAAC;IACpCC,YAA2B,EAAE,CAAC;IAC9BC,cAA+B;IAEvC,YAAYP,MAAsB,CAAE;QAClC,IAAI,CAACA,MAAM,GAAG;YACZQ,SAAS;YACTC,KAAKC,QAAQD,GAAG,CAACE,QAAQ,IAAI;YAC7BC,SAASF,QAAQD,GAAG,CAACI,mBAAmB,IAAI;YAC5CC,SAAS;gBACPC,SAAS;gBACTC,oBAAoB;gBACpBC,mBAAmB;gBACnBC,YAAY;YACd;YACAC,SAAS;gBACPJ,SAAS;gBACTK,SAAS;gBACTC,eAAe;YACjB;YACAC,MAAM;gBACJP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