aws-runtime-bridge 1.9.58 → 1.9.61

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.
Files changed (36) hide show
  1. package/dist/routes/sub-agents.js +14 -6
  2. package/package/acode/dist/fs-utils.d.ts +21 -0
  3. package/package/acode/dist/fs-utils.d.ts.map +1 -0
  4. package/package/acode/dist/fs-utils.js +79 -0
  5. package/package/acode/dist/runtime.d.ts.map +1 -1
  6. package/package/acode/dist/runtime.js +67 -8
  7. package/package/acode/dist/sub-agent-manager.d.ts +36 -0
  8. package/package/acode/dist/sub-agent-manager.d.ts.map +1 -1
  9. package/package/acode/dist/sub-agent-manager.js +184 -45
  10. package/package/acode/dist/sub-agent-store.d.ts +44 -5
  11. package/package/acode/dist/sub-agent-store.d.ts.map +1 -1
  12. package/package/acode/dist/sub-agent-store.js +88 -16
  13. package/package/acode/dist/todo-store.d.ts +1 -0
  14. package/package/acode/dist/todo-store.d.ts.map +1 -1
  15. package/package/acode/dist/todo-store.js +6 -1
  16. package/package/acode/dist/types.d.ts +11 -0
  17. package/package/acode/dist/types.d.ts.map +1 -1
  18. package/package/aws-client-agent-mcp/dist/agent-client.d.ts.map +1 -1
  19. package/package/aws-client-agent-mcp/dist/agent-client.js +5 -1
  20. package/package/aws-client-agent-mcp/dist/agent-client.js.map +1 -1
  21. package/package/aws-client-agent-mcp/dist/logger.d.ts +12 -2
  22. package/package/aws-client-agent-mcp/dist/logger.d.ts.map +1 -1
  23. package/package/aws-client-agent-mcp/dist/logger.js +53 -12
  24. package/package/aws-client-agent-mcp/dist/logger.js.map +1 -1
  25. package/package/aws-client-agent-mcp/dist/logger.test.js +5 -8
  26. package/package/aws-client-agent-mcp/dist/logger.test.js.map +1 -1
  27. package/package/aws-client-agent-mcp/dist/mcp-server.d.ts +21 -0
  28. package/package/aws-client-agent-mcp/dist/mcp-server.d.ts.map +1 -1
  29. package/package/aws-client-agent-mcp/dist/mcp-server.js +105 -7
  30. package/package/aws-client-agent-mcp/dist/mcp-server.js.map +1 -1
  31. package/package/aws-client-agent-mcp/dist/mcp-server.test.js +4 -2
  32. package/package/aws-client-agent-mcp/dist/mcp-server.test.js.map +1 -1
  33. package/package/aws-client-agent-mcp/dist/types.d.ts +26 -0
  34. package/package/aws-client-agent-mcp/dist/types.d.ts.map +1 -1
  35. package/package/aws-client-agent-mcp/dist/types.js.map +1 -1
  36. package/package.json +1 -1
@@ -407,10 +407,11 @@ export class McpServer {
407
407
  if (reportableResult !== null) {
408
408
  // 正常结果:上报 toolResult + thinking(工具调用完成,回到思考状态)
409
409
  statusReporter.reportToolResult(reportableResult);
410
+ statusReporter.reportThinking();
410
411
  }
411
- // 委托消息(reportableResult === null):跳过 reportToolResult(避免委托通知泄露到时间线),
412
- // 但仍调用 reportThinking(工具调用已完成,Agent 回到思考状态等待 ACode runtime 重新 poll)
413
- statusReporter.reportThinking();
412
+ // 委托消息(reportableResult === null):跳过 reportToolResult 和 reportThinking,
413
+ // 保持 tool_using 状态。主 agent 仍在 poll_message 循环中等待真正的消息,
414
+ // 委托给子 agent 处理不应影响主 agent 的状态显示。
414
415
  }
415
416
  return result;
416
417
  }
@@ -2015,6 +2016,15 @@ export class McpServer {
2015
2016
  _acodeAutoDelegate: {
2016
2017
  type: 'memory_file_change',
2017
2018
  uris: updatingChanges.slice(0, 5).map(c => c.memoryUri),
2019
+ fileChanges: updatingChanges.slice(0, 5).map(c => {
2020
+ const memory = updatingMemories.find(m => m.id === c.memoryId);
2021
+ return {
2022
+ uri: c.memoryUri,
2023
+ boundFiles: memory?.bound_files ?? [],
2024
+ fileStatuses: c.fileStatuses,
2025
+ changedFiles: c.changedFiles,
2026
+ };
2027
+ }),
2018
2028
  },
2019
2029
  };
2020
2030
  }
@@ -2038,6 +2048,12 @@ export class McpServer {
2038
2048
  for (const m of pendingToNotify) {
2039
2049
  this.lastUpdatePendingNotifyAt.set(m.uri, now);
2040
2050
  }
2051
+ // 计算 pending(仍 updating)记忆的逐文件状态,供子 agent 在提示词中标注
2052
+ // (无变更/内容变更/文件找不到),避免「本次变更文件: 未知」歧义。
2053
+ const pendingStatuses = new Map();
2054
+ for (const m of pendingToNotify.slice(0, 5)) {
2055
+ pendingStatuses.set(m.uri, await this.computeBoundFileStatuses(m));
2056
+ }
2041
2057
  const memoryList = pendingToNotify
2042
2058
  .slice(0, 5)
2043
2059
  .map(m => `- ${m.uri} (文件: ${m.bound_files?.join(', ') || '未知'})`)
@@ -2055,6 +2071,13 @@ export class McpServer {
2055
2071
  _acodeAutoDelegate: {
2056
2072
  type: 'memory_file_change',
2057
2073
  uris: pendingToNotify.slice(0, 5).map(m => m.uri),
2074
+ // 此分支为「仍 updating」状态提醒,本轮未检测到新的文件变更,
2075
+ // 仅传递绑定文件清单与逐文件状态供子 agent 直接定位文件,changedFiles 留空。
2076
+ fileChanges: pendingToNotify.slice(0, 5).map(m => ({
2077
+ uri: m.uri,
2078
+ boundFiles: m.bound_files ?? [],
2079
+ fileStatuses: pendingStatuses.get(m.uri) ?? [],
2080
+ })),
2058
2081
  },
2059
2082
  };
2060
2083
  }
@@ -2152,6 +2175,15 @@ export class McpServer {
2152
2175
  _acodeAutoDelegate: {
2153
2176
  type: 'memory_file_change',
2154
2177
  uris: newListableChanges.map(c => c.memoryUri),
2178
+ fileChanges: newListableChanges.map(c => {
2179
+ const memory = listableMemories.find(m => m.id === c.memoryId);
2180
+ return {
2181
+ uri: c.memoryUri,
2182
+ boundFiles: memory?.bound_files ?? [],
2183
+ fileStatuses: c.fileStatuses,
2184
+ changedFiles: c.changedFiles,
2185
+ };
2186
+ }),
2155
2187
  },
2156
2188
  };
2157
2189
  }
@@ -2255,6 +2287,15 @@ export class McpServer {
2255
2287
  _acodeAutoDelegate: {
2256
2288
  type: 'memory_file_change',
2257
2289
  uris: claimedChanges.map(c => c.memoryUri),
2290
+ fileChanges: claimedChanges.map(c => {
2291
+ const memory = permanentList.find(m => m.id === c.memoryId);
2292
+ return {
2293
+ uri: c.memoryUri,
2294
+ boundFiles: memory?.bound_files ?? [],
2295
+ fileStatuses: c.fileStatuses,
2296
+ changedFiles: c.changedFiles,
2297
+ };
2298
+ }),
2258
2299
  },
2259
2300
  };
2260
2301
  }
@@ -2281,6 +2322,43 @@ export class McpServer {
2281
2322
  }
2282
2323
  return true;
2283
2324
  }
2325
+ /**
2326
+ * 计算某条记忆全部绑定文件的逐文件状态(纯计算,不修改任何状态)。
2327
+ * - no_change: 文件存在且 MD5 与基线一致(或无基线时保守视为未变)
2328
+ * - content_changed: 文件存在但 MD5 与基线不一致
2329
+ * - not_found: 文件读取不到(被删除/移动)
2330
+ * 注意:无基线(新增绑定文件尚未建基线)的文件保守返回 no_change,避免误报为变更。
2331
+ */
2332
+ async computeBoundFileStatuses(memory) {
2333
+ const result = [];
2334
+ if (!memory.bound_files || memory.bound_files.length === 0)
2335
+ return result;
2336
+ const oldMd5Map = memory.file_md5_map || {};
2337
+ for (const filePath of memory.bound_files) {
2338
+ try {
2339
+ const currentMd5 = await this.calculateFileMd5(filePath);
2340
+ if (currentMd5 === null) {
2341
+ result.push({ path: filePath, status: 'not_found' });
2342
+ continue;
2343
+ }
2344
+ const oldMd5 = oldMd5Map[filePath];
2345
+ if (!oldMd5) {
2346
+ result.push({ path: filePath, status: 'no_change' });
2347
+ }
2348
+ else if (oldMd5 !== currentMd5) {
2349
+ result.push({ path: filePath, status: 'content_changed' });
2350
+ }
2351
+ else {
2352
+ result.push({ path: filePath, status: 'no_change' });
2353
+ }
2354
+ }
2355
+ catch {
2356
+ // MD5 计算失败:保守视为未变更,不误报
2357
+ result.push({ path: filePath, status: 'no_change' });
2358
+ }
2359
+ }
2360
+ return result;
2361
+ }
2284
2362
  /**
2285
2363
  * 检查一组 Memory 的文件变更
2286
2364
  * Memory 增强功能 (v1.6.0)
@@ -2293,6 +2371,7 @@ export class McpServer {
2293
2371
  }
2294
2372
  try {
2295
2373
  const changedFiles = [];
2374
+ const statuses = [];
2296
2375
  const newMd5Map = {};
2297
2376
  const oldMd5Map = memory.file_md5_map || {};
2298
2377
  const workspacePath = process.env.AWS_WORKSPACE_PATH || process.cwd();
@@ -2309,7 +2388,8 @@ export class McpServer {
2309
2388
  const oldMd5ForMissing = oldMd5Map[filePath];
2310
2389
  if (oldMd5ForMissing) {
2311
2390
  // 该文件曾有基线,现在读不到 -> 视为变更(文件被删除/移动)
2312
- changedFiles.push(`${filePath} (文件不存在或无法访问)`);
2391
+ statuses.push({ path: filePath, status: 'not_found' });
2392
+ changedFiles.push(`${filePath} (文件找不到)`);
2313
2393
  // 收口:文件已消失,从 bound_files 移除该路径,消除悬空引用。
2314
2394
  // 否则 listByFile/findByBoundFile 会持续命中无效记录,且文件恢复后因基线已清而变更检测失效。
2315
2395
  // bound_files 修剪结果由调用方在变更回写分支同步持久化(见 buildMemoryFileChangeNotification)。
@@ -2317,6 +2397,10 @@ export class McpServer {
2317
2397
  memory.bound_files = memory.bound_files.filter(f => f !== filePath);
2318
2398
  }
2319
2399
  }
2400
+ else {
2401
+ // 无该文件基线且文件不存在:标注找不到但不计入变更,避免对未知状态误报
2402
+ statuses.push({ path: filePath, status: 'not_found' });
2403
+ }
2320
2404
  // 无该文件基线时静默跳过,避免对未知状态误报
2321
2405
  continue;
2322
2406
  }
@@ -2327,20 +2411,29 @@ export class McpServer {
2327
2411
  // 1) 新增到 bound_files 的文件尚未建基线;
2328
2412
  // 2) 历史 TS/Java 路径规范化不一致(如 Windows 反斜杠)导致键不匹配。
2329
2413
  // 静默建立基线,不视为变更,避免 md5 实际未变却误报需要更新。
2414
+ statuses.push({ path: filePath, status: 'no_change' });
2330
2415
  baselineRepaired = true;
2331
2416
  logger.info(`[McpServer] 建立单文件基线: ${filePath} new=${currentMd5} (workspace=${workspacePath}, memory=${memory.uri})`);
2332
2417
  }
2333
2418
  else if (oldMd5 !== currentMd5) {
2334
2419
  logger.info(`[McpServer] 文件变更: ${filePath} old=${oldMd5} new=${currentMd5} (workspace=${workspacePath})`);
2335
- changedFiles.push(filePath);
2420
+ statuses.push({ path: filePath, status: 'content_changed' });
2421
+ changedFiles.push(`${filePath} (内容变更)`);
2422
+ }
2423
+ else {
2424
+ statuses.push({ path: filePath, status: 'no_change' });
2336
2425
  }
2337
2426
  }
2338
2427
  catch (error) {
2339
2428
  logger.info(`[McpServer] 计算文件 MD5 失败: ${filePath}`, error);
2340
2429
  const oldMd5ForError = oldMd5Map[filePath];
2341
2430
  if (oldMd5ForError) {
2431
+ statuses.push({ path: filePath, status: 'content_changed' });
2342
2432
  changedFiles.push(`${filePath} (MD5计算失败)`);
2343
2433
  }
2434
+ else {
2435
+ statuses.push({ path: filePath, status: 'no_change' });
2436
+ }
2344
2437
  }
2345
2438
  }
2346
2439
  // 无基线时:更新 MD5 map 到 memory 对象(供调用方回写),但不计入变更
@@ -2359,10 +2452,15 @@ export class McpServer {
2359
2452
  changes.push({
2360
2453
  memoryId: memory.id,
2361
2454
  memoryUri: memory.uri,
2455
+ fileStatuses: statuses,
2362
2456
  changedFiles,
2363
2457
  });
2364
- // 更新 MD5 映射
2365
- memory.file_md5_map = newMd5Map;
2458
+ // ⚠️ 不要用 newMd5Map 覆盖 memory.file_md5_map!
2459
+ // 检测阶段只负责"发现变更并通知 agent",MD5 基线必须保留为旧值,
2460
+ // 让调用方把旧基线回写到 DB。否则 agent 收到变更通知后,
2461
+ // 重算文件 MD5 与 DB 中已被覆盖的新基线一致,会误判"文件实际未变"。
2462
+ // 新基线只能由 agent 主动调用 update_memory 处理完变更后重建。
2463
+ // 仅更新检测时间戳,记录本次检查发生过。
2366
2464
  memory.last_check_time = new Date().toISOString();
2367
2465
  }
2368
2466
  }