@yeaft/webchat-agent 0.0.114 → 0.0.116

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 (2) hide show
  1. package/crew.js +17 -4
  2. package/package.json +1 -1
package/crew.js CHANGED
@@ -1464,13 +1464,26 @@ export async function handleCrewHumanInput(msg) {
1464
1464
  return;
1465
1465
  }
1466
1466
 
1467
- // 解析 @role 指令
1468
- const atMatch = content.match(/^@(\w+)\s*([\s\S]*)/);
1467
+ // 解析 @role 指令(支持 name 和 displayName)
1468
+ const atMatch = content.match(/^@(\S+)\s*([\s\S]*)/);
1469
1469
  if (atMatch) {
1470
- const target = atMatch[1].toLowerCase();
1470
+ const atTarget = atMatch[1];
1471
1471
  const message = atMatch[2].trim() || content;
1472
1472
 
1473
- if (session.roles.has(target)) {
1473
+ // 先精确匹配 role.name,再匹配 displayName
1474
+ let target = null;
1475
+ for (const [name, role] of session.roles) {
1476
+ if (name === atTarget.toLowerCase()) {
1477
+ target = name;
1478
+ break;
1479
+ }
1480
+ if (role.displayName === atTarget) {
1481
+ target = name;
1482
+ break;
1483
+ }
1484
+ }
1485
+
1486
+ if (target) {
1474
1487
  // 检查目标角色是否正在忙
1475
1488
  const targetState = session.roleStates.get(target);
1476
1489
  if (targetState?.turnActive) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "0.0.114",
3
+ "version": "0.0.116",
4
4
  "description": "Remote agent for Yeaft WebChat — connects worker machines to the central server",
5
5
  "main": "index.js",
6
6
  "type": "module",