@sleep2agi/commhub-server 0.5.0-preview.2 → 0.5.0-preview.3
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/tools.ts +7 -5
package/package.json
CHANGED
package/src/tools.ts
CHANGED
|
@@ -35,8 +35,9 @@ export function registerTools(server: McpServer, clientIP?: string) {
|
|
|
35
35
|
config_path: z.string().max(1000).optional().describe("Config file path"),
|
|
36
36
|
channels: z.string().max(2000).optional().describe("JSON array of channels"),
|
|
37
37
|
model: z.string().max(200).optional().describe("AI model name"),
|
|
38
|
+
node_name: z.string().max(200).optional().describe("Stable node display name (may differ from alias)"),
|
|
38
39
|
},
|
|
39
|
-
async ({ resume_id, alias, status, task, output, score, progress, server: srv, hostname: hn, agent: ag, project_dir: pd, version: ver, tmux_name: tmux, node_id, session_id, config_path, channels, model: mdl }) => {
|
|
40
|
+
async ({ resume_id, alias, status, task, output, score, progress, server: srv, hostname: hn, agent: ag, project_dir: pd, version: ver, tmux_name: tmux, node_id, session_id, config_path, channels, model: mdl, node_name: nn }) => {
|
|
40
41
|
console.log(`[${ts()}] ${alias} (${resume_id.slice(0, 8)}) → report_status: ${status}${task ? " | " + task.slice(0, 60) : ""}`);
|
|
41
42
|
const trimmedOutput = output?.slice(0, 4000);
|
|
42
43
|
|
|
@@ -103,7 +104,7 @@ export function registerTools(server: McpServer, clientIP?: string) {
|
|
|
103
104
|
server = COALESCE(?8, nodes.server),
|
|
104
105
|
hostname = COALESCE(?9, nodes.hostname),
|
|
105
106
|
updated_at = datetime('now')`,
|
|
106
|
-
[node_id, alias, alias, nodeRuntime, mdl ?? null, config_path ?? null, channels ?? null, srv ?? null, hn ?? null]
|
|
107
|
+
[node_id, nn || alias, alias, nodeRuntime, mdl ?? null, config_path ?? null, channels ?? null, srv ?? null, hn ?? null]
|
|
107
108
|
);
|
|
108
109
|
} catch {}
|
|
109
110
|
}
|
|
@@ -319,8 +320,9 @@ export function registerTools(server: McpServer, clientIP?: string) {
|
|
|
319
320
|
priority: z.enum(["high", "normal", "low"]).optional().default("normal"),
|
|
320
321
|
context: z.string().max(10000).optional(),
|
|
321
322
|
from_session: z.string().max(200).optional().default("hub"),
|
|
323
|
+
ttl_seconds: z.number().min(1).max(86400).optional().describe("Task TTL in seconds (default: 3600)"),
|
|
322
324
|
},
|
|
323
|
-
async ({ alias, task, priority, context, from_session }) => {
|
|
325
|
+
async ({ alias, task, priority, context, from_session, ttl_seconds }) => {
|
|
324
326
|
console.log(`[${ts()}] ${from_session} → send_task → ${alias}: ${task.slice(0, 60)}${priority === "high" ? " [HIGH]" : ""}`);
|
|
325
327
|
const id = uuidv4();
|
|
326
328
|
// 事务:inbox + tasks 双写
|
|
@@ -333,8 +335,8 @@ export function registerTools(server: McpServer, clientIP?: string) {
|
|
|
333
335
|
);
|
|
334
336
|
db.run(
|
|
335
337
|
`INSERT INTO tasks (task_id, from_name, to_name, priority, status, content, requires_response, created_at, delivered_at, expires_at)
|
|
336
|
-
VALUES (?1, ?2, ?3, ?4, 'delivered', ?5, 'reply', datetime('now'), datetime('now'), datetime('now',
|
|
337
|
-
[id, from_session, alias, priority, task]
|
|
338
|
+
VALUES (?1, ?2, ?3, ?4, 'delivered', ?5, 'reply', datetime('now'), datetime('now'), datetime('now', ?6))`,
|
|
339
|
+
[id, from_session, alias, priority, task, `+${ttl_seconds || 3600} seconds`]
|
|
338
340
|
);
|
|
339
341
|
db.run("COMMIT");
|
|
340
342
|
} catch (e) {
|