@clawos-dev/clawd 0.2.157-beta.329.b324109 → 0.2.157

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 CHANGED
@@ -37744,7 +37744,7 @@ function ticketMcpConfigPath(dataDir) {
37744
37744
  function writeTicketMcpConfig(args) {
37745
37745
  const cfgPath = ticketMcpConfigPath(args.dataDir);
37746
37746
  const content = {
37747
- _comment: "daemon \u542F\u52A8\u65F6\u81EA\u52A8\u751F\u6210\uFF1Bcc spawn \u901A\u8FC7 --mcp-config \u6CE8\u5165\u3002ticket-mcp-server.cjs \u662F daemon \u81EA\u5E26\u7684 stdio MCP server\uFF0CHTTP client \u8C03 clawos api /clawd-tickets/*\u3002env \u542B api url\u3001\u5199\u6B7B API key\u3001\u98DE\u4E66 unionId\u3001displayName snapshot\u3002",
37747
+ _comment: "daemon \u542F\u52A8\u65F6\u81EA\u52A8\u751F\u6210\uFF1Bcc spawn \u901A\u8FC7 --mcp-config \u6CE8\u5165\u3002ticket-mcp-server.cjs \u662F daemon \u81EA\u5E26\u7684 stdio MCP server\uFF0CHTTP client \u8C03 clawos api /clawd-tickets/*\u3002env \u542B api url\u3001\u5199\u6B7B API key\u3001\u98DE\u4E66 unionId\u3001displayName snapshot\uFF1BCLAWD_TICKET_LOG \u6307 server \u5199\u65E5\u5FD7\u7684 append \u6587\u4EF6\u8DEF\u5F84\uFF08\u542F\u52A8\u8282\u70B9 + tool \u8C03\u7528 + \u9519\u8BEF\u7EC6\u8282\uFF09\u3002",
37748
37748
  mcpServers: {
37749
37749
  "clawd-ticket": {
37750
37750
  type: "stdio",
@@ -37754,7 +37754,8 @@ function writeTicketMcpConfig(args) {
37754
37754
  CLAWD_TICKET_API_URL: args.apiBaseUrl,
37755
37755
  CLAWD_TICKET_API_KEY: args.apiKey,
37756
37756
  CLAWD_TICKET_OWNER_UNION_ID: args.ownerUnionId,
37757
- CLAWD_TICKET_OWNER_NAME: args.ownerName
37757
+ CLAWD_TICKET_OWNER_NAME: args.ownerName,
37758
+ ...args.logPath ? { CLAWD_TICKET_LOG: args.logPath } : {}
37758
37759
  }
37759
37760
  }
37760
37761
  }
@@ -46577,15 +46578,21 @@ async function startDaemon(config) {
46577
46578
  const ticketOwnerName = feishuIdentity?.identity.displayName ?? "";
46578
46579
  let ticketMcpConfigPath2;
46579
46580
  if (ticketServerScriptPath && ticketOwnerUnionId) {
46581
+ const ticketLogPath = import_node_path48.default.join(config.dataDir, "ticket-mcp-server.log");
46580
46582
  ticketMcpConfigPath2 = writeTicketMcpConfig({
46581
46583
  dataDir: config.dataDir,
46582
46584
  serverScriptPath: ticketServerScriptPath,
46583
46585
  apiBaseUrl: config.clawosApi ?? DEFAULT_CLAWOS_API,
46584
46586
  apiKey: resolveClawdTicketsApiKey(),
46585
46587
  ownerUnionId: ticketOwnerUnionId,
46586
- ownerName: ticketOwnerName
46588
+ ownerName: ticketOwnerName,
46589
+ logPath: ticketLogPath
46590
+ });
46591
+ logger.info("ticket.mcp.json written", {
46592
+ path: ticketMcpConfigPath2,
46593
+ server: ticketServerScriptPath,
46594
+ serverLog: ticketLogPath
46587
46595
  });
46588
- logger.info("ticket.mcp.json written", { path: ticketMcpConfigPath2 });
46589
46596
  } else {
46590
46597
  logger.warn("ticket-mcp skipped", {
46591
46598
  reason: !ticketOwnerUnionId ? "feishu unionId missing (login required)" : "ticket-mcp-server.cjs not found (need build)"
@@ -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, fs, exportName) {
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, fs[f]);
6882
+ ajv.addFormat(f, fs2[f]);
6883
6883
  }
6884
6884
  module2.exports = exports2 = formatsPlugin;
6885
6885
  Object.defineProperty(exports2, "__esModule", { value: true });
@@ -6896,6 +6896,7 @@ __export(mcp_server_exports, {
6896
6896
  handleUpdateTicket: () => handleUpdateTicket
6897
6897
  });
6898
6898
  module.exports = __toCommonJS(mcp_server_exports);
6899
+ var import_node_fs = __toESM(require("fs"), 1);
6899
6900
 
6900
6901
  // ../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/external.js
6901
6902
  var external_exports = {};
@@ -21112,6 +21113,22 @@ var StdioServerTransport = class {
21112
21113
  // src/ticket/mcp-server.ts
21113
21114
  var SERVER_NAME = "clawd-ticket";
21114
21115
  var SERVER_VERSION = "0.1.0";
21116
+ var TICKET_LOG = process.env.CLAWD_TICKET_LOG;
21117
+ function logLine(msg, info) {
21118
+ const line = `[${(/* @__PURE__ */ new Date()).toISOString()}] ticket-mcp ${msg}${info ? " " + JSON.stringify(info) : ""}
21119
+ `;
21120
+ if (TICKET_LOG) {
21121
+ try {
21122
+ import_node_fs.default.appendFileSync(TICKET_LOG, line);
21123
+ return;
21124
+ } catch {
21125
+ }
21126
+ }
21127
+ try {
21128
+ process.stderr.write(line);
21129
+ } catch {
21130
+ }
21131
+ }
21115
21132
  function ok(text) {
21116
21133
  return { content: [{ type: "text", text }] };
21117
21134
  }
@@ -21122,6 +21139,7 @@ async function callApi(ctx, method, pathAndQuery, body) {
21122
21139
  const f = ctx.fetch ?? fetch;
21123
21140
  const base = ctx.apiUrl.replace(/\/+$/, "");
21124
21141
  const url = `${base}/api${pathAndQuery}`;
21142
+ logLine("tool call \u2192 api", { method, path: pathAndQuery });
21125
21143
  let res;
21126
21144
  try {
21127
21145
  res = await f(url, {
@@ -21135,10 +21153,12 @@ async function callApi(ctx, method, pathAndQuery, body) {
21135
21153
  body: body == null ? void 0 : JSON.stringify(body)
21136
21154
  });
21137
21155
  } catch (e) {
21156
+ logLine("fetch threw", { url, error: String(e) });
21138
21157
  return fail(`network error calling ${url}: ${String(e)}`);
21139
21158
  }
21140
21159
  const text = await res.text();
21141
21160
  if (!res.ok) {
21161
+ logLine("non-2xx response", { url, status: res.status, body: text.slice(0, 200) });
21142
21162
  let msg = `${res.status}`;
21143
21163
  try {
21144
21164
  const j = JSON.parse(text);
@@ -21182,14 +21202,25 @@ function readCtxFromEnv() {
21182
21202
  const ownerUnionId = process.env.CLAWD_TICKET_OWNER_UNION_ID ?? "";
21183
21203
  const ownerName = process.env.CLAWD_TICKET_OWNER_NAME ?? "";
21184
21204
  if (!apiUrl || !apiKey || !ownerUnionId) {
21185
- process.stderr.write(
21186
- "[ticket-mcp] missing env (API_URL / API_KEY / OWNER_UNION_ID)\n"
21187
- );
21205
+ logLine("startup: missing env", {
21206
+ hasApiUrl: !!apiUrl,
21207
+ hasApiKey: !!apiKey,
21208
+ hasOwnerUnionId: !!ownerUnionId,
21209
+ hasOwnerName: !!ownerName
21210
+ });
21188
21211
  }
21189
21212
  return { apiUrl, apiKey, ownerUnionId, ownerName };
21190
21213
  }
21191
21214
  async function main() {
21192
21215
  const ctx = readCtxFromEnv();
21216
+ logLine("startup: server boot", {
21217
+ name: SERVER_NAME,
21218
+ version: SERVER_VERSION,
21219
+ apiUrl: ctx.apiUrl,
21220
+ ownerUnionId: ctx.ownerUnionId,
21221
+ ownerName: ctx.ownerName,
21222
+ logTarget: TICKET_LOG ?? "stderr (no CLAWD_TICKET_LOG env)"
21223
+ });
21193
21224
  const server = new McpServer({ name: SERVER_NAME, version: SERVER_VERSION });
21194
21225
  server.tool(
21195
21226
  "create_ticket",
@@ -21229,11 +21260,11 @@ async function main() {
21229
21260
  );
21230
21261
  const transport = new StdioServerTransport();
21231
21262
  await server.connect(transport);
21263
+ logLine("startup: stdio transport connected, ready for tool calls");
21232
21264
  }
21233
21265
  if (require.main === module) {
21234
21266
  main().catch((err) => {
21235
- process.stderr.write(`[ticket-mcp] fatal: ${String(err)}
21236
- `);
21267
+ logLine("fatal", { error: String(err), stack: err?.stack });
21237
21268
  process.exit(1);
21238
21269
  });
21239
21270
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clawos-dev/clawd",
3
- "version": "0.2.157-beta.329.b324109",
3
+ "version": "0.2.157",
4
4
  "description": "Standalone clawd daemon — Claude Code (and future Codex) session server over WebSocket",
5
5
  "type": "module",
6
6
  "license": "MIT",