@sleep2agi/commhub-server 0.8.1-preview.1 → 0.8.1-preview.2
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/package.json +1 -1
- package/src/rename.ts +10 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/commhub-server",
|
|
3
|
-
"version": "0.8.1-preview.
|
|
3
|
+
"version": "0.8.1-preview.2",
|
|
4
4
|
"description": "CommHub Server — AI Agent communication hub with MCP protocol, multi-network isolation, user auth, and 17 MCP tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.ts",
|
package/src/rename.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
import { randomUUID } from "crypto";
|
|
16
16
|
import { db } from "./db";
|
|
17
|
-
import { getUserNetworkRole } from "./auth";
|
|
17
|
+
import { getUserNetworkRole, getNetworkMembers } from "./auth";
|
|
18
18
|
import { pushEvent } from "./push";
|
|
19
19
|
|
|
20
20
|
export interface RenameResult {
|
|
@@ -113,6 +113,15 @@ export function commitRename(userId: string, txnId: string): RenameResult {
|
|
|
113
113
|
pushEvent(txn.old_alias, renamedEvent, txn.network_id);
|
|
114
114
|
pushEvent(txn.new_alias, renamedEvent, txn.network_id);
|
|
115
115
|
|
|
116
|
+
// Also push to every network member's user channel. The dashboard subscribes
|
|
117
|
+
// to /events/<username> (a user channel), NOT the per-node-alias streams — so
|
|
118
|
+
// without this it would never receive node.renamed (#84 SSE channel fix:
|
|
119
|
+
// N站马 confirmed the dashboard listens on the user channel). All members get
|
|
120
|
+
// it, not just the owner, since any member's dashboard should reflect the rename.
|
|
121
|
+
for (const member of getNetworkMembers(txn.network_id)) {
|
|
122
|
+
if (member.username) pushEvent(member.username, renamedEvent, txn.network_id);
|
|
123
|
+
}
|
|
124
|
+
|
|
116
125
|
return { ok: true, txn_id: txnId };
|
|
117
126
|
}
|
|
118
127
|
|