@bangdao-ai/acw-tools 1.3.6-beta.2 → 1.3.6

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.
@@ -187,10 +187,9 @@ function parseCodeChanges(bubble) {
187
187
  * @param {Object} composerData - Composer数据
188
188
  * @param {Array} bubbles - 会话气泡数组
189
189
  * @param {string} markdownContent - Markdown内容(用于计算大小)
190
- * @param {Function} debugLogger - 可选的debug日志函数,用于输出详细的bubble数据
191
190
  * @returns {Object} 返回 { additionalInfo, executionsList }
192
191
  */
193
- function extractAdditionalInfo(composerData, bubbles, markdownContent = '', debugLogger = null) {
192
+ function extractAdditionalInfo(composerData, bubbles, markdownContent = '') {
194
193
  // 计算内容大小(KB)
195
194
  const contentSizeBytes = Buffer.byteLength(markdownContent, 'utf8');
196
195
  const contentSizeKb = parseFloat((contentSizeBytes / 1024).toFixed(2));
@@ -308,30 +307,11 @@ function extractAdditionalInfo(composerData, bubbles, markdownContent = '', debu
308
307
  const tokenCount = bubble.tokenCount || {};
309
308
  const modelInfo = bubble.modelInfo || {};
310
309
 
311
- // DEBUG模式:输出完整的bubble数据用于排查timingInfo问题
310
+ // DEBUG: 输出原始 bubble.timingInfo 情况(仅在有问题时输出)
312
311
  const hasRawTimingInfo = !!bubble.timingInfo;
313
312
  const hasClientRpcSendTime = !!(bubble.timingInfo && bubble.timingInfo.clientRpcSendTime);
314
313
  const hasClientSettleTime = !!(bubble.timingInfo && bubble.timingInfo.clientSettleTime);
315
314
 
316
- // 如果没有timingInfo或缺少关键字段,输出详细日志
317
- if (debugLogger && (!hasRawTimingInfo || !hasClientRpcSendTime || !hasClientSettleTime)) {
318
- debugLogger('🔍 [DEBUG] AI bubble缺少timingInfo关键字段', {
319
- bubbleId: bubble.bubbleId,
320
- hasTimingInfo: hasRawTimingInfo,
321
- hasClientRpcSendTime,
322
- hasClientSettleTime,
323
- timingInfoKeys: bubble.timingInfo ? Object.keys(bubble.timingInfo) : [],
324
- timingInfoValues: bubble.timingInfo || null,
325
- // 输出bubble的其他关键字段帮助排查
326
- bubbleKeys: Object.keys(bubble),
327
- modelName: modelInfo.modelName || null,
328
- tokenCount: tokenCount,
329
- createdAt: bubble.createdAt,
330
- // 完整bubble数据(JSON字符串,便于分析)
331
- fullBubbleJson: JSON.stringify(bubble, null, 2)
332
- });
333
- }
334
-
335
315
  let executionTime = 0;
336
316
  if (aiTimingInfo.clientRpcSendTime && aiTimingInfo.clientSettleTime) {
337
317
  executionTime = aiTimingInfo.clientSettleTime - aiTimingInfo.clientRpcSendTime;
@@ -598,9 +578,8 @@ function formatListDirResult(directoryTree) {
598
578
  * @param {string} composerId - Composer ID
599
579
  * @param {string} outputPath - 输出文件路径
600
580
  * @param {Object} db - 已打开的数据库连接
601
- * @param {Function} debugLogger - 可选的debug日志函数
602
581
  */
603
- function extractConversationCore(composerId, outputPath, db, debugLogger = null) {
582
+ function extractConversationCore(composerId, outputPath, db) {
604
583
  try {
605
584
  // 1. 获取composer元数据
606
585
  const composerDataRow = db.prepare(
@@ -1434,7 +1413,7 @@ function extractConversationCore(composerId, outputPath, db, debugLogger = null)
1434
1413
  fs.writeFileSync(outputPath, markdown, 'utf-8');
1435
1414
 
1436
1415
  // 提取附加信息和执行明细列表
1437
- const { additionalInfo, executionsList } = extractAdditionalInfo(composerData, bubbles, markdown, debugLogger);
1416
+ const { additionalInfo, executionsList } = extractAdditionalInfo(composerData, bubbles, markdown);
1438
1417
 
1439
1418
  return {
1440
1419
  success: true,
@@ -1459,9 +1438,8 @@ function extractConversationCore(composerId, outputPath, db, debugLogger = null)
1459
1438
  * @param {string} composerId - Composer ID
1460
1439
  * @param {string} outputPath - 输出文件路径
1461
1440
  * @param {string} [customDbPath] - 自定义数据库路径(可选,默认使用系统全局数据库)
1462
- * @param {Function} [debugLogger] - 可选的debug日志函数,用于输出详细的bubble数据
1463
1441
  */
1464
- export async function extractConversationFromGlobalDb(composerId, outputPath, customDbPath = null, debugLogger = null) {
1442
+ export async function extractConversationFromGlobalDb(composerId, outputPath, customDbPath = null) {
1465
1443
  const globalDbPath = customDbPath || getGlobalDbPath();
1466
1444
 
1467
1445
  if (!fs.existsSync(globalDbPath)) {
@@ -1473,7 +1451,7 @@ export async function extractConversationFromGlobalDb(composerId, outputPath, cu
1473
1451
  const db = new Database(globalDbPath, { readonly: true });
1474
1452
 
1475
1453
  try {
1476
- return extractConversationCore(composerId, outputPath, db, debugLogger);
1454
+ return extractConversationCore(composerId, outputPath, db);
1477
1455
  } finally {
1478
1456
  db.close();
1479
1457
  }
@@ -1484,10 +1462,9 @@ export async function extractConversationFromGlobalDb(composerId, outputPath, cu
1484
1462
  * @param {string} composerId - Composer ID
1485
1463
  * @param {string} outputPath - 输出文件路径
1486
1464
  * @param {Object} db - 已打开的数据库连接
1487
- * @param {Function} [debugLogger] - 可选的debug日志函数,用于输出详细的bubble数据
1488
1465
  */
1489
- export function extractConversationFromGlobalDbWithConnection(composerId, outputPath, db, debugLogger = null) {
1490
- return extractConversationCore(composerId, outputPath, db, debugLogger);
1466
+ export function extractConversationFromGlobalDbWithConnection(composerId, outputPath, db) {
1467
+ return extractConversationCore(composerId, outputPath, db);
1491
1468
  }
1492
1469
 
1493
1470
  /**
package/index.js CHANGED
@@ -25,7 +25,6 @@ const RETRY_BASE_DELAY = 2000; // 重试基础延迟(2秒)
25
25
  // ==================== 压缩配置 ====================
26
26
  const COMPRESSION_ENABLED = process.env.MCP_COMPRESSION_ENABLED !== 'false'; // 默认启用
27
27
  const COMPRESSION_THRESHOLD = parseInt(process.env.MCP_COMPRESSION_THRESHOLD || '1048576', 10); // 默认1MB阈值
28
- const DEBUG_MODE = process.env.ACW_DEBUG === 'true'; // Debug模式:输出详细的bubble日志用于排查问题
29
28
 
30
29
  // ==================== 数据库引擎加载(使用 better-sqlite3)====================
31
30
  let dbEngine = null;
@@ -242,11 +241,6 @@ function cleanOldLogs() {
242
241
  // 清理旧日志
243
242
  cleanOldLogs();
244
243
 
245
- // 启动时记录 DEBUG 模式状态
246
- if (DEBUG_MODE) {
247
- logger.info('🔧 DEBUG模式已启用 - 将输出详细的bubble数据用于排查timingInfo问题');
248
- }
249
-
250
244
  // ==================== 版本信息初始化 ====================
251
245
 
252
246
  const __filename = fileURLToPath(import.meta.url);
@@ -684,9 +678,7 @@ async function generateMarkdownFromComposerData(composerId, db) {
684
678
 
685
679
  try {
686
680
  // 调用完整的解析器(传入已打开的数据库连接)
687
- // DEBUG模式下传入logger.debug用于输出详细的bubble数据
688
- const debugLoggerFn = DEBUG_MODE ? (msg, data) => logger.debug(msg, data) : null;
689
- const result = parserModule.extractConversationFromGlobalDbWithConnection(composerId, tempFile, db, debugLoggerFn);
681
+ const result = parserModule.extractConversationFromGlobalDbWithConnection(composerId, tempFile, db);
690
682
 
691
683
  if (!result || !result.success) {
692
684
  logger.warn('解析器返回失败', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bangdao-ai/acw-tools",
3
- "version": "1.3.6-beta.2",
3
+ "version": "1.3.6",
4
4
  "type": "module",
5
5
  "description": "MCP (Model Context Protocol) tools for ACW - download rules and initialize Common Admin projects",
6
6
  "main": "index.js",