@delt/claude-alarm 0.6.2 → 0.6.4
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 +17 -2
- package/dist/cli.js.map +1 -1
- package/dist/dashboard/index.html +43 -22
- package/dist/hub/server.js +17 -2
- package/dist/hub/server.js.map +1 -1
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/dashboard/index.html +43 -22
package/dist/cli.js
CHANGED
|
@@ -531,20 +531,34 @@ ${sessionList}`);
|
|
|
531
531
|
/** Send a permission request with inline buttons */
|
|
532
532
|
async sendPermissionRequest(sessionId2, sessionLabel, requestId, toolName, description, inputPreview) {
|
|
533
533
|
let preview = inputPreview;
|
|
534
|
+
let truncated = false;
|
|
534
535
|
try {
|
|
535
536
|
const p = JSON.parse(inputPreview);
|
|
536
537
|
if (p.command) preview = `$ ${p.command}`;
|
|
537
|
-
else if (p.file_path)
|
|
538
|
+
else if (p.file_path) {
|
|
539
|
+
preview = p.file_path;
|
|
540
|
+
if (p.content) {
|
|
541
|
+
preview += "\n" + p.content.slice(0, 500);
|
|
542
|
+
if (p.content.length > 500) truncated = true;
|
|
543
|
+
}
|
|
544
|
+
} else if (p.content && typeof p.content === "string") {
|
|
545
|
+
preview = p.content.slice(0, 500);
|
|
546
|
+
if (p.content.length > 500) truncated = true;
|
|
547
|
+
}
|
|
538
548
|
} catch {
|
|
549
|
+
truncated = true;
|
|
539
550
|
const cmdMatch = inputPreview.match(/"command"\s*:\s*"((?:[^"\\]|\\.)*)"/);
|
|
551
|
+
const contentMatch = inputPreview.match(/"content"\s*:\s*"((?:[^"\\]|\\.)*)"/);
|
|
540
552
|
if (cmdMatch) preview = `$ ${cmdMatch[1]}`;
|
|
553
|
+
else if (contentMatch) preview = contentMatch[1].slice(0, 500);
|
|
541
554
|
}
|
|
555
|
+
const truncNote = truncated ? "\n<i>...truncated</i>" : "";
|
|
542
556
|
const text = `\u26A0\uFE0F <b>Permission Request</b>
|
|
543
557
|
|
|
544
558
|
\u{1F4C2} <b>${this.escHtml(sessionLabel)}</b>
|
|
545
559
|
\u{1F527} <code>${this.escHtml(toolName)}</code> \u2014 ${this.escHtml(description)}
|
|
546
560
|
|
|
547
|
-
<pre>${this.escHtml(preview.slice(0,
|
|
561
|
+
<pre>${this.escHtml(preview.slice(0, 800))}</pre>${truncNote}`;
|
|
548
562
|
const replyMarkup = {
|
|
549
563
|
inline_keyboard: [[
|
|
550
564
|
{ text: "\u2705 Allow", callback_data: `perm:allow:${sessionId2}:${requestId}` },
|
|
@@ -1069,6 +1083,7 @@ var init_server = __esm({
|
|
|
1069
1083
|
channelWs.send(JSON.stringify(msg));
|
|
1070
1084
|
logger.info(`Telegram permission verdict [${requestId}]: ${behavior} -> session ${sessionId2}`);
|
|
1071
1085
|
}
|
|
1086
|
+
this.broadcastToDashboards({ type: "permission_response", sessionId: sessionId2, requestId, behavior });
|
|
1072
1087
|
};
|
|
1073
1088
|
this.notifier.configure({ telegramBot: this.telegramBot });
|
|
1074
1089
|
this.telegramBot.startPolling();
|