@sleep2agi/commhub-server 0.9.0-preview.267 → 0.9.0-preview.268
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 +2 -2
- package/package.json +1 -1
- package/src/list-tasks-since.test.ts +8 -0
- package/src/tools.ts +6 -1
package/build-info.json
CHANGED
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.268",
|
|
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",
|
|
@@ -63,6 +63,14 @@ describe("#3119 list_tasks 的增量与水印", () => {
|
|
|
63
63
|
expect(r.tasks.map((t: any) => t.task_id)).toEqual(['t_since_new']);
|
|
64
64
|
});
|
|
65
65
|
|
|
66
|
+
test("①b ISO 带 T/Z 传参也必须生效(字符串比较会在第 11 个字符判错)", async () => {
|
|
67
|
+
const call = client();
|
|
68
|
+
// 同一天的午夜:用 ISO 传,库里是 'YYYY-MM-DD HH:MM:SS'(空格)。
|
|
69
|
+
// 直接字符串比较 ⇒ ' ' < 'T' ⇒ 库里那条被判成"更早" ⇒ 返回空。
|
|
70
|
+
const r = await call('list_tasks', { alias, network_id: net, created_since: '2026-11-05T00:00:00Z', omit_stats: true, limit: 20 });
|
|
71
|
+
expect(r.tasks.map((t: any) => t.task_id).sort()).toEqual(['t_since_new', 't_since_old']);
|
|
72
|
+
});
|
|
73
|
+
|
|
66
74
|
test("② 镜像:不传 created_since ⇒ 两条都在(旧调用方零影响)", async () => {
|
|
67
75
|
const call = client();
|
|
68
76
|
const r = await call('list_tasks', { alias, network_id: net, limit: 20 });
|
package/src/tools.ts
CHANGED
|
@@ -3188,7 +3188,12 @@ export function registerTools(server: McpServer, clientIP?: string, enforceNetwo
|
|
|
3188
3188
|
if (status) { sql += ` AND status = ?${params.length + 1}`; params.push(status); }
|
|
3189
3189
|
if (from_name) { sql += ` AND from_name = ?${params.length + 1}`; params.push(from_name); }
|
|
3190
3190
|
if (from_node_id) { sql += ` AND from_node_id = ?${params.length + 1}`; params.push(from_node_id); }
|
|
3191
|
-
|
|
3191
|
+
// #3119 —— 必须用 julianday 比,不能直接拿字符串比:
|
|
3192
|
+
// tasks.created_at 存的是 'YYYY-MM-DD HH:MM:SS'(空格),而客户端传 ISO 带 'T' 与 'Z'。
|
|
3193
|
+
// 字符串比较在第 11 个字符就分高低(' ' 0x20 < 'T' 0x54)⇒ **同一天的记录会被判成"更早"**
|
|
3194
|
+
// ⇒ 用 ISO 传参几乎永远返回空列表。上线后发现(生产实测:传 2026-11-05T00:00:00Z 返回 0 条,
|
|
3195
|
+
// 而库里当天明明有记录)。julianday 两种格式都认。
|
|
3196
|
+
if (created_since) { sql += ` AND julianday(created_at) > julianday(?${params.length + 1})`; params.push(created_since); }
|
|
3192
3197
|
if (before_created_at && before_task_id) {
|
|
3193
3198
|
sql += ` AND (created_at < ?${params.length + 1} OR (created_at = ?${params.length + 1} AND task_id < ?${params.length + 2}))`;
|
|
3194
3199
|
params.push(before_created_at, before_task_id);
|