@clawos-dev/clawd 0.2.191-beta.382.4a6606c → 0.2.191-beta.383.956b6ae
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/dist/cli.cjs +8 -4
- package/dist/inbox/mcp-server.cjs +31 -8
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -47586,12 +47586,13 @@ function inboxMcpConfigPath(dataDir) {
|
|
|
47586
47586
|
async function writeInboxMcpConfig(args) {
|
|
47587
47587
|
const cfgPath = inboxMcpConfigPath(args.dataDir);
|
|
47588
47588
|
const content = {
|
|
47589
|
-
_comment: "daemon \u542F\u52A8\u65F6\u81EA\u52A8\u751F\u6210\uFF1Bcc spawn \u901A\u8FC7 --mcp-config \u6CE8\u5165\u3002inbox/mcp-server.cjs \u662F daemon \u81EA\u5E26\u7684 stdio MCP server\uFF0C\u66B4\u9732 sendDm tool\uFF08persona \u53D7\u63A7\u53D1 P2P IM DM\uFF09\u3002",
|
|
47589
|
+
_comment: "daemon \u542F\u52A8\u65F6\u81EA\u52A8\u751F\u6210\uFF1Bcc spawn \u901A\u8FC7 --mcp-config \u6CE8\u5165\u3002inbox/mcp-server.cjs \u662F daemon \u81EA\u5E26\u7684 stdio MCP server\uFF0C\u66B4\u9732 sendDm tool\uFF08persona \u53D7\u63A7\u53D1 P2P IM DM\uFF09\u3002env.CLAWD_INBOX_LOG \u6307 server \u5199\u65E5\u5FD7\u7684 append \u6587\u4EF6\u8DEF\u5F84\u3002",
|
|
47590
47590
|
mcpServers: {
|
|
47591
47591
|
"clawd-inbox": {
|
|
47592
47592
|
type: "stdio",
|
|
47593
47593
|
command: "node",
|
|
47594
|
-
args: [args.serverScriptPath]
|
|
47594
|
+
args: [args.serverScriptPath],
|
|
47595
|
+
...args.logPath ? { env: { CLAWD_INBOX_LOG: args.logPath } } : {}
|
|
47595
47596
|
}
|
|
47596
47597
|
}
|
|
47597
47598
|
};
|
|
@@ -57543,13 +57544,16 @@ async function startDaemon(config) {
|
|
|
57543
57544
|
const inboxServerScriptPath = inboxServerCandidates.find((p2) => import_node_fs42.default.existsSync(p2));
|
|
57544
57545
|
let inboxMcpConfigPath2;
|
|
57545
57546
|
if (inboxServerScriptPath) {
|
|
57547
|
+
const inboxLogPath = import_node_path54.default.join(config.dataDir, "inbox-mcp-server.log");
|
|
57546
57548
|
inboxMcpConfigPath2 = await writeInboxMcpConfig({
|
|
57547
57549
|
dataDir: config.dataDir,
|
|
57548
|
-
serverScriptPath: inboxServerScriptPath
|
|
57550
|
+
serverScriptPath: inboxServerScriptPath,
|
|
57551
|
+
logPath: inboxLogPath
|
|
57549
57552
|
});
|
|
57550
57553
|
logger.info("inbox.mcp.json written", {
|
|
57551
57554
|
path: inboxMcpConfigPath2,
|
|
57552
|
-
server: inboxServerScriptPath
|
|
57555
|
+
server: inboxServerScriptPath,
|
|
57556
|
+
serverLog: inboxLogPath
|
|
57553
57557
|
});
|
|
57554
57558
|
} else {
|
|
57555
57559
|
logger.warn(
|
|
@@ -4402,11 +4402,11 @@ var require_core = __commonJS({
|
|
|
4402
4402
|
Ajv2.ValidationError = validation_error_1.default;
|
|
4403
4403
|
Ajv2.MissingRefError = ref_error_1.default;
|
|
4404
4404
|
exports2.default = Ajv2;
|
|
4405
|
-
function checkOptions(checkOpts, options, msg,
|
|
4405
|
+
function checkOptions(checkOpts, options, msg, log2 = "error") {
|
|
4406
4406
|
for (const key in checkOpts) {
|
|
4407
4407
|
const opt = key;
|
|
4408
4408
|
if (opt in options)
|
|
4409
|
-
this.logger[
|
|
4409
|
+
this.logger[log2](`${msg}: option ${key}. ${checkOpts[opt]}`);
|
|
4410
4410
|
}
|
|
4411
4411
|
}
|
|
4412
4412
|
function getSchEnv(keyRef) {
|
|
@@ -6874,12 +6874,12 @@ var require_dist = __commonJS({
|
|
|
6874
6874
|
throw new Error(`Unknown format "${name}"`);
|
|
6875
6875
|
return f;
|
|
6876
6876
|
};
|
|
6877
|
-
function addFormats(ajv, list,
|
|
6877
|
+
function addFormats(ajv, list, fs2, exportName) {
|
|
6878
6878
|
var _a;
|
|
6879
6879
|
var _b;
|
|
6880
6880
|
(_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
6881
6881
|
for (const f of list)
|
|
6882
|
-
ajv.addFormat(f,
|
|
6882
|
+
ajv.addFormat(f, fs2[f]);
|
|
6883
6883
|
}
|
|
6884
6884
|
module2.exports = exports2 = formatsPlugin;
|
|
6885
6885
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -6893,6 +6893,7 @@ __export(mcp_server_exports, {
|
|
|
6893
6893
|
handleSendDmCall: () => handleSendDmCall
|
|
6894
6894
|
});
|
|
6895
6895
|
module.exports = __toCommonJS(mcp_server_exports);
|
|
6896
|
+
var import_node_fs = __toESM(require("fs"), 1);
|
|
6896
6897
|
|
|
6897
6898
|
// ../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
|
|
6898
6899
|
var external_exports = {};
|
|
@@ -21107,19 +21108,38 @@ var StdioServerTransport = class {
|
|
|
21107
21108
|
};
|
|
21108
21109
|
|
|
21109
21110
|
// src/inbox/mcp-server.ts
|
|
21111
|
+
var INBOX_LOG = process.env.CLAWD_INBOX_LOG;
|
|
21112
|
+
function log(msg, info) {
|
|
21113
|
+
const line = `[${(/* @__PURE__ */ new Date()).toISOString()}] inbox-mcp ${msg}${info ? " " + JSON.stringify(info) : ""}
|
|
21114
|
+
`;
|
|
21115
|
+
if (INBOX_LOG) {
|
|
21116
|
+
try {
|
|
21117
|
+
import_node_fs.default.appendFileSync(INBOX_LOG, line);
|
|
21118
|
+
return;
|
|
21119
|
+
} catch {
|
|
21120
|
+
}
|
|
21121
|
+
}
|
|
21122
|
+
try {
|
|
21123
|
+
process.stderr.write(line);
|
|
21124
|
+
} catch {
|
|
21125
|
+
}
|
|
21126
|
+
}
|
|
21110
21127
|
async function handleSendDmCall(params, ctx = {}) {
|
|
21111
21128
|
const daemonUrl = process.env.CLAWD_DAEMON_URL;
|
|
21112
21129
|
const sessionId = process.env.CLAWD_SESSION_ID;
|
|
21113
21130
|
if (!daemonUrl) {
|
|
21131
|
+
log("sendDm CLAWD_DAEMON_URL missing");
|
|
21114
21132
|
return { content: [{ type: "text", text: "Error: CLAWD_DAEMON_URL not set; cannot call daemon." }], isError: true };
|
|
21115
21133
|
}
|
|
21116
21134
|
if (!sessionId) {
|
|
21135
|
+
log("sendDm CLAWD_SESSION_ID missing");
|
|
21117
21136
|
return {
|
|
21118
21137
|
content: [{ type: "text", text: "Error: CLAWD_SESSION_ID not set; sendDm can only run from a persona session." }],
|
|
21119
21138
|
isError: true
|
|
21120
21139
|
};
|
|
21121
21140
|
}
|
|
21122
21141
|
const f = ctx.fetch ?? fetch;
|
|
21142
|
+
log("sendDm pre-fetch", { hasPeerDeviceId: Boolean(params.peerDeviceId), textLen: params.text.length });
|
|
21123
21143
|
let res;
|
|
21124
21144
|
try {
|
|
21125
21145
|
res = await f(`${daemonUrl}/api/rpc/inbox.sendDm`, {
|
|
@@ -21131,20 +21151,23 @@ async function handleSendDmCall(params, ctx = {}) {
|
|
|
21131
21151
|
})
|
|
21132
21152
|
});
|
|
21133
21153
|
} catch (err) {
|
|
21134
|
-
|
|
21135
|
-
|
|
21136
|
-
|
|
21137
|
-
};
|
|
21154
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
21155
|
+
log("sendDm fetch threw", { msg });
|
|
21156
|
+
return { content: [{ type: "text", text: `sendDm fetch failed: ${msg}` }], isError: true };
|
|
21138
21157
|
}
|
|
21158
|
+
log("sendDm post-fetch", { status: res.status });
|
|
21139
21159
|
let json;
|
|
21140
21160
|
try {
|
|
21141
21161
|
json = await res.json();
|
|
21142
21162
|
} catch {
|
|
21163
|
+
log("sendDm non-JSON", { status: res.status });
|
|
21143
21164
|
return { content: [{ type: "text", text: `sendDm RPC returned non-JSON: status ${res.status}` }], isError: true };
|
|
21144
21165
|
}
|
|
21145
21166
|
if (json.ok === false) {
|
|
21167
|
+
log("sendDm adapter error", { error: json.error, message: json.message });
|
|
21146
21168
|
return { content: [{ type: "text", text: `sendDm failed: ${json.error}: ${json.message}` }], isError: true };
|
|
21147
21169
|
}
|
|
21170
|
+
log("sendDm ok");
|
|
21148
21171
|
return { content: [{ type: "text", text: JSON.stringify(json.result) }] };
|
|
21149
21172
|
}
|
|
21150
21173
|
async function main() {
|
package/package.json
CHANGED