@delt/claude-alarm 0.6.8 → 0.6.10

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.js CHANGED
@@ -535,8 +535,7 @@ ${sessionList}`);
535
535
  try {
536
536
  const p = JSON.parse(inputPreview);
537
537
  if (p.command) preview = `$ ${p.command}`;
538
- else if (p.title && p.message) preview = `${p.title}
539
- ${p.message}`;
538
+ else if (p.title && p.message) preview = p.message;
540
539
  else if (p.file_path) {
541
540
  preview = p.file_path;
542
541
  if (p.content) {
@@ -558,9 +557,22 @@ ${p.message}`;
558
557
  const previewSlice = preview.slice(0, 800);
559
558
  const isShort = !previewSlice.includes("\n") && previewSlice.length < 100;
560
559
  const previewHtml = isShort ? `<code>${this.escHtml(previewSlice)}</code>` : this.escHtml(previewSlice);
560
+ let displayTool = toolName;
561
+ if ((toolName.endsWith("__notify") || toolName === "notify") && inputPreview) {
562
+ try {
563
+ const pp = JSON.parse(inputPreview);
564
+ if (pp.title) displayTool = pp.title;
565
+ } catch {
566
+ const tm = inputPreview.match(/"title"\s*:\s*"((?:[^"\\]|\\.)*)"/);
567
+ if (tm) displayTool = tm[1];
568
+ }
569
+ } else {
570
+ const mcpMatch = toolName.match(/__([^_]+)$/);
571
+ if (mcpMatch) displayTool = mcpMatch[1].charAt(0).toUpperCase() + mcpMatch[1].slice(1);
572
+ }
561
573
  const text = `\u26A0\uFE0F <b>Permission Request</b> \u2014 ${this.escHtml(sessionLabel)}
562
574
 
563
- \u{1F527} <code>${this.escHtml(toolName)}</code>
575
+ \u{1F527} <b>${this.escHtml(displayTool)}</b>
564
576
  ${previewHtml}${truncNote}`;
565
577
  const replyMarkup = {
566
578
  inline_keyboard: [[
@@ -582,7 +594,7 @@ ${previewHtml}${truncNote}`;
582
594
  await this.answerCallbackQuery(query.id, behavior === "allow" ? "\u2705 Allowed" : "\u274C Denied");
583
595
  if (query.message) {
584
596
  const label = behavior === "allow" ? "\u2705 <b>Allowed</b>" : "\u274C <b>Denied</b>";
585
- const original = query.message.text || "";
597
+ const original = this.escHtml(query.message.text || "");
586
598
  await this.editMessageText(query.message.chat.id, query.message.message_id, original + `
587
599
 
588
600
  ${label}`);