@sleep2agi/commhub-server 0.9.0-preview.254 → 0.9.0-preview.255
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/build-info.json +3 -4
- package/package.json +1 -1
- package/src/health-anon-readers.ts +2 -0
- package/src/health-redaction.test.ts +16 -0
- package/src/server.ts +5 -0
package/build-info.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
|
-
"commit": "
|
|
3
|
+
"commit": "e0b9c85b8c1d6d835ead4f14cb552b7d5c20ea3d",
|
|
4
4
|
"dirty": false,
|
|
5
|
-
"built_at": "2026-10-31T22:
|
|
6
|
-
"source": "git"
|
|
7
|
-
"event_sha": "3cd0931c7c1d45d5a1050613ea13fd68c622f162"
|
|
5
|
+
"built_at": "2026-10-31T22:45:21.133Z",
|
|
6
|
+
"source": "git"
|
|
8
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sleep2agi/commhub-server",
|
|
3
|
-
"version": "0.9.0-preview.
|
|
3
|
+
"version": "0.9.0-preview.255",
|
|
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",
|
|
@@ -50,6 +50,8 @@ export const PUBLIC_HEALTH_KEY_READERS: Readonly<Record<string, AnonReaderEntry>
|
|
|
50
50
|
// ⇒ 聚合走匿名投影;by_node 仍是拓扑,不给。
|
|
51
51
|
task_expiries_never_consumed_total: { reader: "operator", why: "运维/agent 判断「派单硬闸有没有真的 fire 过」;只有总数,不含节点名" },
|
|
52
52
|
counters_since: { reader: "operator", why: "上一条的窗口起点:计数器随重启归零,只有总数时「刚重启」与「一次都没发生」同值" },
|
|
53
|
+
// #3193 子卡 —— 与上一条同形:拒绝次数的总数给匿名,by_reason 明细留在鉴权投影。
|
|
54
|
+
task_rejections_total: { reader: "operator", why: "运维/agent 判断「今天拒了多少」而不必翻日志(日志轮转后 grep 会静默 0)" },
|
|
53
55
|
auth: { reader: "cli", why: "客户端据此决定登录方式" },
|
|
54
56
|
security: { reader: "cli", why: "客户端据此提示是否需要 TLS/密钥配置" },
|
|
55
57
|
tmux: { reader: "cli", why: "共存 TUI 的前置检查" },
|
|
@@ -266,6 +266,22 @@ describe("#473 anonymous /health — watchdog contract intact, no topology leak"
|
|
|
266
266
|
expect(Object.keys(agg.by_node)).toContain("unread-probe-node");
|
|
267
267
|
});
|
|
268
268
|
|
|
269
|
+
// #3193 子卡 —— 拒绝次数的**总数**也必须匿名可读(明细 by_reason 仍留鉴权投影)。
|
|
270
|
+
test("#3193 拒绝计数:匿名给总数,by_reason 留鉴权", async () => {
|
|
271
|
+
const { PUBLIC_HEALTH_KEYS } = await import("./server.js");
|
|
272
|
+
expect(PUBLIC_HEALTH_KEYS.has("task_rejections_total")).toBe(true);
|
|
273
|
+
expect(PUBLIC_HEALTH_KEYS.has("counters")).toBe(false); // 明细不外泄
|
|
274
|
+
const { recordTaskRejection, taskRejectionCounters, resetTaskRejectionCounters } = await import("./rejection-counters.js");
|
|
275
|
+
resetTaskRejectionCounters();
|
|
276
|
+
recordTaskRejection(401, "invalid_token");
|
|
277
|
+
recordTaskRejection(401, "invalid_token");
|
|
278
|
+
recordTaskRejection(403, "forbidden");
|
|
279
|
+
const c = taskRejectionCounters();
|
|
280
|
+
expect(c.total).toBe(3);
|
|
281
|
+
expect(c.by_reason["401:invalid_token"]).toBe(2);
|
|
282
|
+
expect(c.by_reason["403:forbidden"]).toBe(1);
|
|
283
|
+
});
|
|
284
|
+
|
|
269
285
|
// 2026-10-31 —— 出口清单里「before_route_table」那一行原本 pinned_by 为空(= 缺口)。
|
|
270
286
|
// 补上它的钉:未匹配的 /api/* 在路由表之前就 404,**不经过 handler,也不计数**。
|
|
271
287
|
// 这一条同时是「清单要能被一次坏输入打出来」的实例(对方那句)。
|
package/src/server.ts
CHANGED
|
@@ -1057,6 +1057,8 @@ export const PUBLIC_HEALTH_KEYS: ReadonlySet<string> = new Set([
|
|
|
1057
1057
|
// #3271 —— 「到死没被取走」的**总数**(聚合,不含 by_node:节点名是拓扑)。
|
|
1058
1058
|
// 配 counters_since 一起读:只有总数时,「进程刚重启」与「一次都没发生」同值。
|
|
1059
1059
|
"task_expiries_never_consumed_total", "counters_since",
|
|
1060
|
+
// 同一个理由:拒绝次数的**总数**是规模读数;by_reason 的明细留在鉴权投影。
|
|
1061
|
+
"task_rejections_total",
|
|
1060
1062
|
// 事件循环停顿是**一个对象**(event_loop: {max_gap_ms, recent_stalls,…}),
|
|
1061
1063
|
// 不是我原先以为的三个顶层键 —— 死条目测试当场抓到了这一点。
|
|
1062
1064
|
"event_loop",
|
|
@@ -1275,6 +1277,7 @@ export const HEALTH_FIELD_META: Readonly<Record<string, HealthFieldMeta>> = {
|
|
|
1275
1277
|
event_loop: { class: "gauge", granularity: "cumulative" },
|
|
1276
1278
|
// #3271 —— 聚合计数:规模/强度,不含拓扑(by_node 留在鉴权投影里)。
|
|
1277
1279
|
task_expiries_never_consumed_total: { class: "gauge", granularity: "cumulative" },
|
|
1280
|
+
task_rejections_total: { class: "gauge", granularity: "cumulative" },
|
|
1278
1281
|
counters_since: { class: "gauge", granularity: "label" },
|
|
1279
1282
|
auth: { class: "gauge", granularity: "label" },
|
|
1280
1283
|
security: { class: "gauge", granularity: "label" },
|
|
@@ -3847,6 +3850,8 @@ return Bun.serve({
|
|
|
3847
3850
|
// ⇒ 聚合值走匿名投影:**只给总数与窗口,不给 by_node**(节点名是拓扑,计数不是)。
|
|
3848
3851
|
// 这也与 sessions_count 同一条取舍:规模可以公开,明细不行。
|
|
3849
3852
|
task_expiries_never_consumed_total: neverConsumedExpiryCounters().total,
|
|
3853
|
+
// #3193 子卡 —— 拒绝计数同一个缺口:原来只在鉴权投影里。聚合给匿名,by_reason 留鉴权。
|
|
3854
|
+
task_rejections_total: taskRejectionCounters().total,
|
|
3850
3855
|
// 窗口的另一端:计数器随进程重启归零,而「归零」与「没有发生」同值 ⇒ 必须配起点。
|
|
3851
3856
|
counters_since: startedAtIso,
|
|
3852
3857
|
// #496 — public, stable capability data. Dashboard upload proxies
|