LeoYeAI/agent-master-skills / skills/agent-comm-hub
agent-comm-hub
Flagged多智能体协同通信基础设施——基于 MCP+SSE 的实时消息、任务调度、记忆共享与进化引擎。支持 WorkBuddy、Hermes、QClaw 及任意 MCP 兼容 Agent 接入。53 个 MCP 工具、4 级权限、零外部依赖 Python SDK。触发词:agent通信、智能体通信、hub通信、多智能体、跨agent通信、任务调度、assign_task、send_message、hermes通信、workbuddy通信、agent hub、通信hub、mcp通信、记忆共享、进化引擎、策略共享、经验分享、共享记忆,共同进化
src/logger.js
View on GitHub/**
* logger.ts — 结构化 JSON 日志(Phase 5b)
* 替换 console.log/error/warn 为 JSON 格式输出
*
* 输出目标:stdout(info/debug)+ stderr(warn/error)
* 格式:{"timestamp":"ISO8601","level":"info","traceId":"xxx","module":"server","msg":"xxx",...meta}
*
* 环境变量:LOG_LEVEL(默认 info)
*/
const LOG_LEVEL_PRIORITY = {
debug: 0,
info: 1,
warn: 2,
error: 3,
};
const MIN_LEVEL = process.env.LOG_LEVEL || "info";
function shouldLog(level) {
return LOG_LEVEL_PRIORITY[level] >= LOG_LEVEL_PRIORITY[MIN_LEVEL];
}
function write(entry) {
if (!shouldLog(entry.level))
return;
const line = JSON.stringify(entry);
if (entry.level === "warn" || entry.level === "error") {
process.stderr.write(line + "\n");
}
else {
process.stdout.write(line + "\n");
}
}
function formatMsg(args) {
return args.map(a => {
if (a instanceof Error)
return a.message;
if (typeof a === "object" && a !== null)
return JSON.stringify(a);
return String(a);
}).join(" ");
}
export const logger = {
info(msg, meta) {
write({ timestamp: new Date().toISOString(), level: "info", msg, ...meta });
},
warn(msg, meta) {
write({ timestamp: new Date().toISOString(), level: "warn", msg, ...meta });
},
error(msg, meta) {
write({ timestamp: new Date().toISOString(), level: "error", msg, ...meta });
},
debug(msg, meta) {
write({ timestamp: new Date().toISOString(), level: "debug", msg, ...meta });
},
child(bindings) {
return {
info(msg, meta) {
write({ timestamp: new Date().toISOString(), level: "info", traceId: bindings.traceId, module: bindings.module, msg, ...meta });
},
warn(msg, meta) {
write({ timestamp: new Date().toISOString(), level: "warn", traceId: bindings.traceId, module: bindings.module, msg, ...meta });
},
error(msg, meta) {
write({ timestamp: new Date().toISOString(), level: "error", traceId: bindings.traceId, module: bindings.module, msg, ...meta });
},
debug(msg, meta) {
write({ timestamp: new Date().toISOString(), level: "debug", traceId: bindings.traceId, module: bindings.module, msg, ...meta });
},
};
},
};
/** 记录带 Error.stack 的错误(仅写入 stderr,不暴露给客户端) */
export function logError(label, err, meta) {
const message = err instanceof Error ? err.message : String(err);
const stack = err instanceof Error ? err.stack : undefined;
write({ timestamp: new Date().toISOString(), level: "error", msg: label, error: message, stack, ...meta });
}
//# sourceMappingURL=logger.js.mapRelated skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |