@inetafrica/open-claudia 1.4.2 → 1.4.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/bot.js +24 -11
- package/package.json +1 -1
package/bot.js
CHANGED
|
@@ -475,7 +475,7 @@ ${lastSessionId ? "Resuming conversation — you have prior context." : "New con
|
|
|
475
475
|
- For long output (logs, diffs, large code), save to a file and send via the Telegram API curl above — don't paste walls of text.
|
|
476
476
|
- Act on screenshots (fix bugs, implement designs) — don't just describe what you see.
|
|
477
477
|
- When the user sends a file, it's saved in ${FILES_DIR}. Read it with the Read tool.
|
|
478
|
-
- When
|
|
478
|
+
- When the user sends a credential, token, or API key, store it in the vault immediately using the vault CLI or bot commands. Tell them it's stored and that you've deleted their message for security. Don't tell them to use /vault manually — handle it for them.
|
|
479
479
|
- When asked to change your personality, edit ${SOUL_FILE}.
|
|
480
480
|
- When asked about yourself, you are Open Claudia — an AI coding assistant running Claude Code via Telegram.
|
|
481
481
|
- If a task will take a while, let the user know upfront.
|
|
@@ -636,7 +636,7 @@ async function runClaude(prompt, cwd, replyToMsgId, opts = {}) {
|
|
|
636
636
|
streamInterval = setInterval(async () => {
|
|
637
637
|
bot.sendChatAction(CHAT_ID, "typing");
|
|
638
638
|
const elapsed = Math.floor((Date.now() - startTime) / 1000);
|
|
639
|
-
const display = formatProgress(assistantText, toolUses, currentTool);
|
|
639
|
+
const display = formatProgress(assistantText, toolUses, currentTool, elapsed);
|
|
640
640
|
if (display && display !== lastUpdate) {
|
|
641
641
|
if (!statusMessageId && assistantText) {
|
|
642
642
|
statusMessageId = await send(display.length > 4000 ? display.slice(-4000) : display, { replyTo: replyToMsgId });
|
|
@@ -676,11 +676,8 @@ async function runClaude(prompt, cwd, replyToMsgId, opts = {}) {
|
|
|
676
676
|
clearInterval(streamInterval); streamInterval = null;
|
|
677
677
|
const finalText = assistantText || "(no output)";
|
|
678
678
|
const chunks = splitMessage(finalText);
|
|
679
|
-
//
|
|
679
|
+
// Keep the streaming progress message and send final result as a new message
|
|
680
680
|
// This ensures the user gets a notification for the final answer
|
|
681
|
-
if (statusMessageId) {
|
|
682
|
-
await deleteMessage(statusMessageId);
|
|
683
|
-
}
|
|
684
681
|
await send(chunks[0], { replyTo: replyToMsgId });
|
|
685
682
|
for (let i = 1; i < chunks.length; i++) {
|
|
686
683
|
await send(chunks[i]);
|
|
@@ -727,13 +724,17 @@ async function runClaudeSilent(prompt, cwd, label) {
|
|
|
727
724
|
});
|
|
728
725
|
}
|
|
729
726
|
|
|
730
|
-
function formatProgress(text, tools, currentTool) {
|
|
727
|
+
function formatProgress(text, tools, currentTool, elapsed) {
|
|
728
|
+
const mins = Math.floor(elapsed / 60);
|
|
729
|
+
const secs = elapsed % 60;
|
|
730
|
+
const time = mins > 0 ? `${mins}m ${secs}s` : `${secs}s`;
|
|
731
|
+
|
|
731
732
|
const parts = [];
|
|
732
|
-
|
|
733
|
-
|
|
733
|
+
const status = currentTool ? `Working: ${currentTool}` : (tools.length > 0 ? "Processing..." : "Thinking...");
|
|
734
|
+
parts.push(`${status} (${time})`);
|
|
735
|
+
if (tools.length > 0) parts.push(`Steps: ${[...new Set(tools)].join(" > ")}`);
|
|
734
736
|
if (text) parts.push(text.length > 800 ? "..." + text.slice(-800) : text);
|
|
735
|
-
|
|
736
|
-
return parts.join("\n\n") || "Thinking...";
|
|
737
|
+
return parts.join("\n\n");
|
|
737
738
|
}
|
|
738
739
|
|
|
739
740
|
// ── Cron System ─────────────────────────────────────────────────────
|
|
@@ -1228,6 +1229,18 @@ bot.on("message", async (msg) => {
|
|
|
1228
1229
|
// Normal message
|
|
1229
1230
|
if (!requireSession(msg)) return;
|
|
1230
1231
|
|
|
1232
|
+
// Detect credential-like messages and delete them from chat
|
|
1233
|
+
const text = msg.text;
|
|
1234
|
+
const credPatterns = [
|
|
1235
|
+
/^(sk-ant-|sk-|glpat-|ghp_|gho_|github_pat_|xoxb-|xoxp-|AKIA|AIza)/, // API keys
|
|
1236
|
+
/^[A-Za-z0-9_-]{20,}$/, // Long token-like strings with no spaces
|
|
1237
|
+
/^(Bearer |token:|key:|secret:|password:)/i, // Prefixed credentials
|
|
1238
|
+
];
|
|
1239
|
+
const looksLikeCredential = credPatterns.some((p) => p.test(text.trim()));
|
|
1240
|
+
if (looksLikeCredential) {
|
|
1241
|
+
await deleteMessage(msg.message_id);
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1231
1244
|
let prompt = msg.text;
|
|
1232
1245
|
const reply = msg.reply_to_message;
|
|
1233
1246
|
if (reply) {
|