@sleep2agi/commhub-server 0.9.0-preview.164 → 0.9.0-preview.166

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sleep2agi/commhub-server",
3
- "version": "0.9.0-preview.164",
3
+ "version": "0.9.0-preview.166",
4
4
  "description": "CommHub Server — AI Agent communication hub with MCP protocol, multi-network isolation, user auth, and MCP tools (17 collaboration-core + node/provider ops tools; authoritative list: docs-site/docs/api/mcp-tools.md).",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -0,0 +1,99 @@
1
+ // #2721 —— 广播扇出分批:把「一条广播 = 几百次同步写」摊成「每批一次事务 + 批间让出」。
2
+ //
3
+ // 现场(2026-10-27 07:10,生产 `.165`):384 行 inbox 让 Hub 出现 143.9 秒的 timer 饥饿,
4
+ // RSS 冲到 2.9GB,`requests_since_last_tick` 高达 1175(饱和而非阻塞)。
5
+ //
6
+ // 这个文件钉住四件事:
7
+ // 1. 收件人逐个入库,条数与收件人一致(语义不变);
8
+ // 2. 每 chunk 一批、批间**真的**让出(`yieldBetweenChunks` 被调用 ⌈n/chunk⌉ 次);
9
+ // 3. 非 active 的收件人静默跳过(RFC-027 best-effort),且不推事件;
10
+ // 4. 事件只推给**真的入库了**的收件人(#1440 的语义)。
11
+
12
+ import { afterAll, beforeAll, describe, expect, test } from "bun:test";
13
+ import { db } from "./db.js";
14
+ import { BROADCAST_CHUNK, enqueueBroadcast } from "./broadcast-fanout.js";
15
+
16
+ const stamp = `${Date.now()}`;
17
+ let NET = "";
18
+
19
+ function targets(n: number, netId = NET) {
20
+ return Array.from({ length: n }, (_, i) => ({
21
+ alias: `fan-${i}-${stamp}`,
22
+ node_id: `n_fan_${i}_${stamp}`,
23
+ network_id: netId,
24
+ }));
25
+ }
26
+
27
+ const inboxRows = (netId = NET) =>
28
+ db.get<{ n: number }>("SELECT COUNT(*) AS n FROM inbox WHERE network_id = ?1 AND type = 'broadcast'", [netId])!.n;
29
+
30
+ beforeAll(async () => {
31
+ const { register } = await import("./auth.js");
32
+ const auth = register(`fan_owner_${stamp}`, "Fan-Owner-Strong-1!", undefined, "tester");
33
+ expect(auth.ok).toBe(true);
34
+ NET = auth.network_id!;
35
+ });
36
+
37
+ afterAll(() => {
38
+ try { db.run("DELETE FROM inbox WHERE network_id = ?1 AND type = 'broadcast'", [NET]); } catch {}
39
+ });
40
+
41
+ describe("#2721 broadcast fan-out is chunked", () => {
42
+ test("逐条入库,条数等于收件人数", async () => {
43
+ const before = inboxRows();
44
+ const res = await enqueueBroadcast(targets(120), "hello", "hub", NET, {
45
+ isActive: () => true,
46
+ notify: () => {},
47
+ yieldBetweenChunks: async () => {},
48
+ });
49
+ expect(res.ids).toHaveLength(120);
50
+ expect(res.delivered).toHaveLength(120);
51
+ expect(inboxRows() - before).toBe(120);
52
+ });
53
+
54
+ test("批间真的让出:⌈120/50⌉ = 3 次", async () => {
55
+ let yields = 0;
56
+ await enqueueBroadcast(targets(120), "hello", "hub", NET, {
57
+ isActive: () => true,
58
+ notify: () => {},
59
+ yieldBetweenChunks: async () => { yields += 1; },
60
+ });
61
+ expect(yields).toBe(Math.ceil(120 / BROADCAST_CHUNK));
62
+ });
63
+
64
+ test("自定义 chunk 生效(10 → 12 批)", async () => {
65
+ let yields = 0;
66
+ await enqueueBroadcast(targets(120), "hello", "hub", NET, {
67
+ isActive: () => true,
68
+ notify: () => {},
69
+ chunkSize: 10,
70
+ yieldBetweenChunks: async () => { yields += 1; },
71
+ });
72
+ expect(yields).toBe(12);
73
+ });
74
+
75
+ test("非 active 收件人:不入库、不推事件", async () => {
76
+ const notified: string[] = [];
77
+ const ts = targets(10);
78
+ const res = await enqueueBroadcast(ts, "hello", "hub", NET, {
79
+ // 只让偶数号 active
80
+ isActive: (alias) => Number(alias.split("-")[1]) % 2 === 0,
81
+ notify: (alias) => notified.push(alias),
82
+ yieldBetweenChunks: async () => {},
83
+ });
84
+ expect(res.ids).toHaveLength(5);
85
+ expect(notified).toHaveLength(5);
86
+ expect(notified.every(a => Number(a.split("-")[1]) % 2 === 0)).toBe(true);
87
+ });
88
+
89
+ test("空收件人列表:不写、不推、不让出", async () => {
90
+ let yields = 0;
91
+ const res = await enqueueBroadcast([], "hello", "hub", NET, {
92
+ isActive: () => true,
93
+ notify: () => {},
94
+ yieldBetweenChunks: async () => { yields += 1; },
95
+ });
96
+ expect(res.ids).toEqual([]);
97
+ expect(yields).toBe(0);
98
+ });
99
+ });
@@ -0,0 +1,71 @@
1
+ // #2721 —— 广播扇出:把「一条广播 = 几百次同步写 + 同一秒全员唤醒」摊开。
2
+ //
3
+ // 现场(2026-10-27 07:10–07:15,生产 `.165`,触发者是我自己的一条广播):
4
+ // 一条广播 → 384 行 inbox(每行一次 autocommit INSERT)
5
+ // → 07:11:16 起连续四次 timer 饥饿:3.5s / 20.0s / **143.9s** / 10.0s
6
+ // → RSS 639MB → 979MB → 2507MB → 2910MB,3 分钟后自行排空
7
+ // → `requests_since_last_tick` 分别是 145 / 123 / **1175** / 294
8
+ // ⇒ 当时的循环是**被打满**(8 req/s 持续),不是被阻塞。
9
+ //
10
+ // 这里只改**节奏**,不改语义:仍然逐行入库、仍然给每个收件人推事件,
11
+ // 但每 50 个收件人一批、批间让出事件循环,把「同一毫秒 384 次 commit」
12
+ // 变成「8 批、每批一次事务」。
13
+ //
14
+ // 为什么有用:真正的负载大头是收件 agent 随后各自的 report_status/get_inbox/send_reply
15
+ // (实测一条广播 ≈ 500+ 次调用)。把入库摊开几百毫秒,能让唤醒时刻自然分散,
16
+ // 而不是让 384 个 agent 在同一秒同时醒来。
17
+
18
+ import { db } from "./db.js";
19
+
20
+ /** 一批多少个收件人。50 是“一次事务不至于太长、又明显少于一次全量”的折中。 */
21
+ export const BROADCAST_CHUNK = 50;
22
+
23
+ export type BroadcastTarget = { alias: string; node_id: string | null; network_id: string | null };
24
+ export type BroadcastDelivered = { alias: string; netId: string | null };
25
+
26
+ export type BroadcastDeps = {
27
+ /** RFC-027 §2.3:非 active 的收件人静默跳过(广播是 best-effort)。 */
28
+ isActive: (alias: string, netId: string | null) => boolean;
29
+ /** 入库之后给该收件人推一次事件(原实现用 pushEvent + pendingInboxCount)。 */
30
+ notify: (alias: string, netId: string | null) => void;
31
+ /** 测试缝:批间的让出动作。 */
32
+ yieldBetweenChunks?: () => Promise<void>;
33
+ chunkSize?: number;
34
+ };
35
+
36
+ export async function enqueueBroadcast(
37
+ targets: readonly BroadcastTarget[],
38
+ message: string,
39
+ fromSession: string,
40
+ effectiveNetId: string | null,
41
+ deps: BroadcastDeps,
42
+ ): Promise<{ ids: string[]; delivered: BroadcastDelivered[] }> {
43
+ const chunk = deps.chunkSize && deps.chunkSize > 0 ? deps.chunkSize : BROADCAST_CHUNK;
44
+ const ids: string[] = [];
45
+ const delivered: BroadcastDelivered[] = [];
46
+ const yieldNow = deps.yieldBetweenChunks ?? (() => Bun.sleep(0));
47
+
48
+ for (let i = 0; i < targets.length; i += chunk) {
49
+ const slice = targets.slice(i, i + chunk);
50
+ // 一批一个事务:把 N 次 autocommit 变成 1 次,既快又不会长时间占写锁。
51
+ db.transaction(() => {
52
+ for (const t of slice) {
53
+ const netId = effectiveNetId ?? t.network_id ?? null;
54
+ if (!deps.isActive(t.alias, netId)) continue;
55
+ const id = crypto.randomUUID();
56
+ db.run(
57
+ `INSERT INTO inbox (id, session_name, node_id, type, priority, content, from_session, network_id)
58
+ VALUES (?1, ?2, ?3, 'broadcast', 'normal', ?4, ?5, ?6)`,
59
+ [id, t.alias, t.node_id ?? null, message, fromSession, netId],
60
+ );
61
+ ids.push(id);
62
+ delivered.push({ alias: t.alias, netId });
63
+ }
64
+ });
65
+ // 批间让出:没有这一句,384 行仍然是在同一个 tick 里写完的。
66
+ await yieldNow();
67
+ }
68
+
69
+ for (const d of delivered) deps.notify(d.alias, d.netId);
70
+ return { ids, delivered };
71
+ }
package/src/db.ts CHANGED
@@ -1467,7 +1467,41 @@ export function backfillMessageNodeIds() {
1467
1467
  console.log(`[commhub] node_id backfill: inbox=${inboxDirect + inboxRenamed}, tasks.to=${tasksToDirect + tasksToRenamed}, tasks.from=${tasksFromDirect + tasksFromRenamed}, total=${total}, took=${Math.round(performance.now() - t0)}ms`);
1468
1468
  }
1469
1469
 
1470
- backfillMessageNodeIds();
1470
+ // #2664 —— 不在 import 时跑(见 runDeferredBootBackfills 的说明)。这里留一行**准确**的日志:
1471
+ // · 有测试/运维会 grep `node_id backfill` 来确认迁移路径被走到过;
1472
+ // · 真正的汇总行(带 took=)在 runDeferredBootBackfills() 里,启动后 15 秒出现。
1473
+ console.log("[commhub] node_id backfill: deferred until after start (#2664)");
1474
+
1475
+ /**
1476
+ * #2664 —— 两个 boot 期的历史回填,挪到「服务已开始监听之后」再跑。
1477
+ *
1478
+ * 为什么:这两条语句在生产上合计约 3.5 秒(慢 SQL 日志实测:`UPDATE tasks … FROM` 1511ms +
1479
+ * `INSERT OR IGNORE INTO task_terminal_events` 2137ms),而它们只修**历史缺口**——
1480
+ * 新行由触发器实时写入。把 3.5 秒挡在启动路径上,等于让 369 个会话的重连风暴多等 3.5 秒,
1481
+ * 而这段时间里 Hub 本来就最脆弱。
1482
+ *
1483
+ * 调用点:startHub() 监听成功后延迟数秒执行(见 server.ts)。
1484
+ */
1485
+ export function runDeferredBootBackfills(): { nodeIdsMs: number; terminalEventsMs: number } {
1486
+ const t0 = performance.now();
1487
+ try { backfillMessageNodeIds(); } catch (e: any) {
1488
+ console.error(`[commhub] node_id backfill failed: ${e?.message || e}`);
1489
+ }
1490
+ const t1 = performance.now();
1491
+ try {
1492
+ if (db.dialect === "sqlite") {
1493
+ db.run(`INSERT OR IGNORE INTO task_terminal_events (task_id, network_id, from_node_id, completed_at)
1494
+ SELECT task_id, network_id, from_node_id, COALESCE(completed_at, created_at)
1495
+ FROM tasks
1496
+ WHERE status IN ('replied', 'failed', 'cancelled', 'expired')
1497
+ ORDER BY COALESCE(completed_at, created_at), task_id`);
1498
+ }
1499
+ } catch (e: any) {
1500
+ console.error(`[commhub] task_terminal_events backfill failed: ${e?.message || e}`);
1501
+ }
1502
+ const t2 = performance.now();
1503
+ return { nodeIdsMs: Math.round(t1 - t0), terminalEventsMs: Math.round(t2 - t1) };
1504
+ }
1471
1505
 
1472
1506
  // ── P0: sessions alias uniqueness is network-scoped.
1473
1507
  // Older SQLite databases created `alias TEXT UNIQUE`, which prevents the same
@@ -1565,6 +1599,11 @@ migrateSessionsNetworkAliasUnique();
1565
1599
  try { db.exec("CREATE INDEX IF NOT EXISTS idx_sessions_network ON sessions(network_id)"); } catch {}
1566
1600
  try { db.exec("CREATE UNIQUE INDEX IF NOT EXISTS idx_sessions_network_alias_unique ON sessions(network_id, alias)"); } catch {}
1567
1601
  try { db.exec("CREATE INDEX IF NOT EXISTS idx_tasks_network ON tasks(network_id)"); } catch {}
1602
+ // #2722 —— 任务统计(`SELECT status, COUNT(*) FROM tasks WHERE network_id=? GROUP BY status`)是
1603
+ // Dashboard/状态接口最常走的聚合:只有上面的单列索引时,它要扫该网络**全部**行再建临时 B 树
1604
+ // (生产 116k 行实测 **5325ms**;同库副本 294ms)。加覆盖索引后副本 **24ms(12×)**。
1605
+ // 只加列、不改任何查询;老库首次启动多花约 0.4 秒建索引。
1606
+ try { db.exec("CREATE INDEX IF NOT EXISTS idx_tasks_network_status ON tasks(network_id, status)"); } catch {}
1568
1607
  // #500 — covering index for the full /api/status queue_depth GROUP BY (task-queue-ahead.ts queueDepthQuery): the 24 h
1569
1608
  // created_at range plus every column that query reads, so it never touches the (wide) task rows. Here, not in the
1570
1609
  // CREATE TABLE block: tasks.network_id only exists after the ALTER above. On a read-only copy of the production DB
@@ -1656,11 +1695,8 @@ if (db.dialect === "sqlite") {
1656
1695
  VALUES (NEW.task_id, NEW.network_id, NEW.from_node_id, COALESCE(NEW.completed_at, datetime('now')));
1657
1696
  END;
1658
1697
  `);
1659
- db.run(`INSERT OR IGNORE INTO task_terminal_events (task_id, network_id, from_node_id, completed_at)
1660
- SELECT task_id, network_id, from_node_id, COALESCE(completed_at, created_at)
1661
- FROM tasks
1662
- WHERE status IN ('replied', 'failed', 'cancelled', 'expired')
1663
- ORDER BY COALESCE(completed_at, created_at), task_id`);
1698
+ // #2664 —— 回填本身挪到 runDeferredBootBackfills()(启动后再跑)。这里只留触发器定义:
1699
+ // 触发器负责**新**行的写入,回填只修历史缺口,不该占启动的关键路径。
1664
1700
  } else {
1665
1701
  db.exec(`
1666
1702
  CREATE OR REPLACE FUNCTION record_task_terminal_event() RETURNS trigger AS $$
package/src/server.ts CHANGED
@@ -23,7 +23,7 @@ import { normalizeSessionRuntime } from "./runtime-label.js";
23
23
  import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
24
24
  import { z } from "zod/v4";
25
25
  import { registerTools } from "./tools.js";
26
- import { db, logTaskEvent, logAudit, syncScheduledRunForTask } from "./db.js";
26
+ import { db, logTaskEvent, logAudit, syncScheduledRunForTask, runDeferredBootBackfills } from "./db.js";
27
27
  import { ensureNetworkRulesOnce, readNetworkRules, writeNetworkRules } from "./network-rules.js";
28
28
  import { deriveTeamRulesView } from "./team-rules-status.js";
29
29
  import { recentNodeIdentityConflicts } from "./node-identity-conflict.js";
@@ -31,6 +31,7 @@ import { createSSEStream, createNetworkObserverStream, createUserEventStream, pu
31
31
  import { enterMcpInflight, leaveMcpInflight, getMcpInflightStats } from "./mcp-inflight.js";
32
32
  import { eventLoopStats, startEventLoopLagMonitor } from "./event-loop-lag.js";
33
33
  import { refreshAliasBaseline } from "./alias-baseline.js";
34
+ import { enqueueBroadcast } from "./broadcast-fanout.js";
34
35
  import { assertNodeActive } from "./lifecycle-guard.js";
35
36
  import { pendingInboxCount } from "./inbox-count.js";
36
37
  import { notifyExpiredTasks, type ExpiredTaskRow } from "./task-expiry-notice.js";
@@ -4372,29 +4373,12 @@ return Bun.serve({
4372
4373
  if (body.filter_server) { sql += " AND server = ?"; params.push(body.filter_server); }
4373
4374
  if (body.filter_status) { sql += " AND status = ?"; params.push(body.filter_status); }
4374
4375
  const targets = db.all<{ alias: string; node_id: string | null; network_id: string | null }>(sql, ...params);
4375
- const ids: string[] = [];
4376
- // #1440 ① — mirrors the MCP handler: push to the recipients that
4377
- // actually got an inbox row, not to every candidate target.
4378
- const delivered: Array<{ alias: string; netId: string | null }> = [];
4379
- for (const t of targets) {
4380
- // RFC-027 §2.3 inbox-enqueue lifecycle guard (PR1.2a REST site
4381
- // 2/2). Broadcast skips non-active recipients silently per its
4382
- // best-effort semantics — mirrors the MCP broadcast handler
4383
- // in tools.ts (PR1.1 site 6/6).
4384
- const lc = assertNodeActive(t.alias, t.network_id ?? null);
4385
- if (!lc.ok) continue;
4386
- const id = crypto.randomUUID();
4387
- db.run(
4388
- `INSERT INTO inbox (id, session_name, node_id, type, priority, content, from_session, network_id)
4389
- VALUES (?1, ?2, ?3, 'broadcast', 'normal', ?4, 'api', ?5)`,
4390
- [id, t.alias, t.node_id ?? null, body.message, t.network_id]
4391
- );
4392
- ids.push(id);
4393
- delivered.push({ alias: t.alias, netId: t.network_id });
4394
- }
4395
- for (const d of delivered) {
4396
- pushEvent(d.alias, { type: "broadcast", inbox_count: pendingInboxCount(d.alias, d.netId) }, d.netId);
4397
- }
4376
+ // #2721 —— 与 MCP broadcast 同一条分批路径(reason 见 broadcast-fanout.ts 顶部)。
4377
+ const { ids } = await enqueueBroadcast(targets, body.message, "api", null, {
4378
+ // RFC-027 §2.3 inbox-enqueue lifecycle guard (PR1.2a REST site 2/2).
4379
+ isActive: (alias, netId) => assertNodeActive(alias, netId).ok,
4380
+ notify: (alias, netId) => pushEvent(alias, { type: "broadcast", inbox_count: pendingInboxCount(alias, netId) }, netId),
4381
+ });
4398
4382
  return withCors(req, Response.json({ ok: true, recipients: ids.length, message_ids: ids }));
4399
4383
  }
4400
4384
 
@@ -5658,6 +5642,19 @@ export function startHub(opts?: { port?: number; hostname?: string }): ReturnTyp
5658
5642
  // “同一秒里 retention 跑了 10 秒 + 有两百个请求在排队”。
5659
5643
  const eventLoopLagTimer = startEventLoopLagMonitor();
5660
5644
 
5645
+ // #2664 —— 两个历史回填(node_id 映射 / task_terminal_events)原来在 import 阶段跑,
5646
+ // 生产实测合计约 3.5 秒,正好落在会话重连风暴窗口里。现在等监听稳定后再跑:
5647
+ // 它们只修历史缺口,新行由触发器实时写入。
5648
+ const deferredBackfillTimer = setTimeout(() => {
5649
+ try {
5650
+ const r = runDeferredBootBackfills();
5651
+ console.log(`[commhub] deferred boot backfills: node_id=${r.nodeIdsMs}ms terminal_events=${r.terminalEventsMs}ms`);
5652
+ } catch (e: any) {
5653
+ console.error(`[commhub] deferred boot backfills failed: ${e?.message || e}`);
5654
+ }
5655
+ }, Number(process.env.COMMHUB_BOOT_BACKFILL_DELAY_MS) >= 0 ? Number(process.env.COMMHUB_BOOT_BACKFILL_DELAY_MS) : 15_000);
5656
+ (deferredBackfillTimer as any)?.unref?.();
5657
+
5661
5658
  // #2571(第三轮)—— 每个目标自己的投递延迟 p99 基线,供 delivered_stale 判据使用。
5662
5659
  // 生产库上重算一次约 0.46s(116k tasks / 7 天窗口),所以只每小时一次、且与 retention 错开。
5663
5660
  // 失败不影响任何请求路径:基线表只是缓存,读不到就退回全局阈值。
@@ -5720,6 +5717,7 @@ export function startHub(opts?: { port?: number; hostname?: string }): ReturnTyp
5720
5717
  clearInterval(retentionSweeperTimer);
5721
5718
  clearInterval(eventLoopLagTimer);
5722
5719
  clearInterval(aliasBaselineTimer);
5720
+ clearTimeout(deferredBackfillTimer);
5723
5721
  clearInterval(staleSweeperTimer);
5724
5722
  clearInterval(rateLimitSweepTimer);
5725
5723
  clearInterval(taskPatrolTimer);
package/src/tools.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { parseScheduledWorkOutcome, qualifyScheduledWorkOutcome, saveScheduledWorkOutcome } from "./scheduled-work-outcome.js";
2
+ import { enqueueBroadcast } from "./broadcast-fanout.js";
2
3
  import { selectHumanInboxIds } from "./human-inbox.js";
3
4
  import { hostSupervisorIdentityRows } from "./host-supervisor-identity.js";
4
5
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -3351,34 +3352,13 @@ export function registerTools(server: McpServer, clientIP?: string, enforceNetwo
3351
3352
  if (filter_status) { sql += " AND status = ?"; params.push(filter_status); }
3352
3353
 
3353
3354
  const targets = db.all<{ alias: string; node_id: string | null; network_id: string | null }>(sql, ...params);
3354
- const ids: string[] = [];
3355
- // #1440 ① — the push loop must walk the recipients that actually
3356
- // got an inbox row, not every candidate target. Walking `targets`
3357
- // announced a broadcast to nodes the lifecycle guard had just
3358
- // skipped, i.e. nodes with nothing to fetch.
3359
- const delivered: Array<{ alias: string; netId: string | null }> = [];
3360
-
3361
- for (const t of targets) {
3355
+ // #2721 —— 分批入库 + 批间让出(见 broadcast-fanout.ts 顶部:一条广播 384 行曾把 Hub
3356
+ // 打成 143.9 秒的 timer 饥饿)。语义不变:仍然逐个收件人一行、仍然 best-effort 跳过非 active。
3357
+ const { ids } = await enqueueBroadcast(targets, message, "hub", effectiveNetId, {
3362
3358
  // RFC-027 §2.3 inbox-enqueue lifecycle guard (PR1.1 site 6/6).
3363
- // Broadcast skips non-active recipients silently rather than
3364
- // failing the entire send — broadcast semantics are best-effort
3365
- // per-recipient and a stopped node simply gets nothing.
3366
- const netId = effectiveNetId ?? t.network_id ?? null;
3367
- const lc = assertNodeActive(t.alias, netId);
3368
- if (!lc.ok) continue;
3369
- const id = uuidv4();
3370
- db.run(
3371
- `INSERT INTO inbox (id, session_name, node_id, type, priority, content, from_session, network_id)
3372
- VALUES (?1, ?2, ?3, 'broadcast', 'normal', ?4, 'hub', ?5)`,
3373
- [id, t.alias, t.node_id ?? null, message, netId]
3374
- );
3375
- ids.push(id);
3376
- delivered.push({ alias: t.alias, netId });
3377
- }
3378
-
3379
- for (const d of delivered) {
3380
- pushEvent(d.alias, { type: "broadcast", inbox_count: pendingInboxCount(d.alias, d.netId) }, d.netId);
3381
- }
3359
+ isActive: (alias, netId) => assertNodeActive(alias, netId).ok,
3360
+ notify: (alias, netId) => pushEvent(alias, { type: "broadcast", inbox_count: pendingInboxCount(alias, netId) }, netId),
3361
+ });
3382
3362
 
3383
3363
  return {
3384
3364
  content: [