cc-claw 0.3.7 → 0.3.9
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 +94 -12
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -48,7 +48,7 @@ var VERSION;
|
|
|
48
48
|
var init_version = __esm({
|
|
49
49
|
"src/version.ts"() {
|
|
50
50
|
"use strict";
|
|
51
|
-
VERSION = true ? "0.3.
|
|
51
|
+
VERSION = true ? "0.3.9" : (() => {
|
|
52
52
|
try {
|
|
53
53
|
return JSON.parse(readFileSync(join2(process.cwd(), "package.json"), "utf-8")).version ?? "unknown";
|
|
54
54
|
} catch {
|
|
@@ -9086,7 +9086,7 @@ function pickReactionEmoji(msg) {
|
|
|
9086
9086
|
}
|
|
9087
9087
|
async function handleMessage(msg, channel) {
|
|
9088
9088
|
const { chatId } = msg;
|
|
9089
|
-
if (msg.messageId && typeof channel.reactToMessage === "function") {
|
|
9089
|
+
if (msg.messageId && typeof channel.reactToMessage === "function" && msg.type !== "text" && msg.type !== "command") {
|
|
9090
9090
|
channel.reactToMessage(chatId, msg.messageId, pickReactionEmoji(msg)).catch(() => {
|
|
9091
9091
|
});
|
|
9092
9092
|
}
|
|
@@ -10244,7 +10244,7 @@ async function handleVoice(msg, channel) {
|
|
|
10244
10244
|
const vToolCb = vVerbose !== "off" ? makeToolActionCallback(chatId, channel, vVerbose) : void 0;
|
|
10245
10245
|
const response = await askAgent(chatId, transcript, { cwd: getCwd(chatId), model: vModel, permMode: mode, onToolAction: vToolCb });
|
|
10246
10246
|
if (response.usage) addUsage(chatId, response.usage.input, response.usage.output, response.usage.cacheRead, vModel);
|
|
10247
|
-
await sendResponse(chatId, channel, response.text);
|
|
10247
|
+
await sendResponse(chatId, channel, response.text, msg.messageId);
|
|
10248
10248
|
} catch (err) {
|
|
10249
10249
|
error("[router] Voice error:", err);
|
|
10250
10250
|
await channel.sendText(chatId, `Voice processing error: ${errorMessage(err)}`, "plain");
|
|
@@ -10291,7 +10291,7 @@ Summarize this for the user.`;
|
|
|
10291
10291
|
const vidToolCb = vidVerbose !== "off" ? makeToolActionCallback(chatId, channel, vidVerbose) : void 0;
|
|
10292
10292
|
const response2 = await askAgent(chatId, prompt2, { cwd: getCwd(chatId), model: vidModel, permMode: vMode, onToolAction: vidToolCb });
|
|
10293
10293
|
if (response2.usage) addUsage(chatId, response2.usage.input, response2.usage.output, response2.usage.cacheRead, vidModel);
|
|
10294
|
-
await sendResponse(chatId, channel, response2.text);
|
|
10294
|
+
await sendResponse(chatId, channel, response2.text, msg.messageId);
|
|
10295
10295
|
return;
|
|
10296
10296
|
}
|
|
10297
10297
|
const fileBuffer = await channel.downloadFile(fileName);
|
|
@@ -10332,7 +10332,7 @@ ${content}
|
|
|
10332
10332
|
const mToolCb = mVerbose !== "off" ? makeToolActionCallback(chatId, channel, mVerbose) : void 0;
|
|
10333
10333
|
const response = await askAgent(chatId, prompt, { cwd: getCwd(chatId), model: mediaModel, permMode: mMode, onToolAction: mToolCb });
|
|
10334
10334
|
if (response.usage) addUsage(chatId, response.usage.input, response.usage.output, response.usage.cacheRead, mediaModel);
|
|
10335
|
-
await sendResponse(chatId, channel, response.text);
|
|
10335
|
+
await sendResponse(chatId, channel, response.text, msg.messageId);
|
|
10336
10336
|
if (tempFilePath) {
|
|
10337
10337
|
unlink2(tempFilePath).catch(() => {
|
|
10338
10338
|
});
|
|
@@ -10397,11 +10397,11 @@ async function handleText(msg, channel) {
|
|
|
10397
10397
|
const tToolCb = tVerbose !== "off" ? makeToolActionCallback(chatId, channel, tVerbose) : void 0;
|
|
10398
10398
|
const response = await askAgent(chatId, text, { cwd: getCwd(chatId), model: model2, permMode: tMode, onToolAction: tToolCb });
|
|
10399
10399
|
if (response.usage) addUsage(chatId, response.usage.input, response.usage.output, response.usage.cacheRead, model2);
|
|
10400
|
-
await sendResponse(chatId, channel, response.text);
|
|
10400
|
+
await sendResponse(chatId, channel, response.text, msg.messageId);
|
|
10401
10401
|
} catch (err) {
|
|
10402
10402
|
error("[router] Error:", err);
|
|
10403
|
-
const
|
|
10404
|
-
const userMsg = diagnoseAgentError(
|
|
10403
|
+
const errMsg = errorMessage(err);
|
|
10404
|
+
const userMsg = diagnoseAgentError(errMsg, chatId);
|
|
10405
10405
|
await channel.sendText(chatId, userMsg, "plain");
|
|
10406
10406
|
} finally {
|
|
10407
10407
|
typingActive = false;
|
|
@@ -10505,7 +10505,19 @@ async function processFileSends2(chatId, channel, text) {
|
|
|
10505
10505
|
}
|
|
10506
10506
|
return text.replace(fileSendPattern, "").trim();
|
|
10507
10507
|
}
|
|
10508
|
-
async function
|
|
10508
|
+
async function processReaction(chatId, channel, text, messageId) {
|
|
10509
|
+
const reactPattern = /\[REACT:(.+?)\]/;
|
|
10510
|
+
const match = text.match(reactPattern);
|
|
10511
|
+
if (!match) return text;
|
|
10512
|
+
const emoji = match[1].trim();
|
|
10513
|
+
if (messageId && typeof channel.reactToMessage === "function" && ALLOWED_REACTION_EMOJIS.has(emoji)) {
|
|
10514
|
+
channel.reactToMessage(chatId, messageId, emoji).catch(() => {
|
|
10515
|
+
});
|
|
10516
|
+
}
|
|
10517
|
+
return text.replace(reactPattern, "").trim();
|
|
10518
|
+
}
|
|
10519
|
+
async function sendResponse(chatId, channel, text, messageId) {
|
|
10520
|
+
text = await processReaction(chatId, channel, text, messageId);
|
|
10509
10521
|
const { cleanText: afterUpdates, updates } = extractUserUpdates(text);
|
|
10510
10522
|
for (const { key, value } of updates) {
|
|
10511
10523
|
if (typeof channel.sendKeyboard === "function") {
|
|
@@ -10945,7 +10957,7 @@ Use /skills <page> to navigate (e.g. /skills 2)` : "";
|
|
|
10945
10957
|
const header2 = totalPages > 1 ? `${skills2.length} skills (page ${safePage}/${totalPages}). Select one to invoke:` : `${skills2.length} skills available. Select one to invoke:`;
|
|
10946
10958
|
await channel.sendKeyboard(chatId, header2, buttons);
|
|
10947
10959
|
}
|
|
10948
|
-
var PERM_MODES, VERBOSE_LEVELS, CLI_INSTALL_HINTS, BLOCKED_PATH_PATTERNS2, SKILLS_PER_PAGE;
|
|
10960
|
+
var PERM_MODES, VERBOSE_LEVELS, CLI_INSTALL_HINTS, BLOCKED_PATH_PATTERNS2, ALLOWED_REACTION_EMOJIS, SKILLS_PER_PAGE;
|
|
10949
10961
|
var init_router = __esm({
|
|
10950
10962
|
"src/router.ts"() {
|
|
10951
10963
|
"use strict";
|
|
@@ -11002,6 +11014,77 @@ var init_router = __esm({
|
|
|
11002
11014
|
/\/etc\/shadow$/,
|
|
11003
11015
|
/\/etc\/passwd$/
|
|
11004
11016
|
];
|
|
11017
|
+
ALLOWED_REACTION_EMOJIS = /* @__PURE__ */ new Set([
|
|
11018
|
+
"\u{1F44D}",
|
|
11019
|
+
"\u{1F44E}",
|
|
11020
|
+
"\u2764",
|
|
11021
|
+
"\u{1F525}",
|
|
11022
|
+
"\u{1F970}",
|
|
11023
|
+
"\u{1F44F}",
|
|
11024
|
+
"\u{1F601}",
|
|
11025
|
+
"\u{1F914}",
|
|
11026
|
+
"\u{1F92F}",
|
|
11027
|
+
"\u{1F631}",
|
|
11028
|
+
"\u{1F92C}",
|
|
11029
|
+
"\u{1F622}",
|
|
11030
|
+
"\u{1F389}",
|
|
11031
|
+
"\u{1F929}",
|
|
11032
|
+
"\u{1F92E}",
|
|
11033
|
+
"\u{1F4A9}",
|
|
11034
|
+
"\u{1F64F}",
|
|
11035
|
+
"\u{1F44C}",
|
|
11036
|
+
"\u{1F54A}\uFE0F",
|
|
11037
|
+
"\u{1F921}",
|
|
11038
|
+
"\u{1F971}",
|
|
11039
|
+
"\u{1F974}",
|
|
11040
|
+
"\u{1F60D}",
|
|
11041
|
+
"\u{1F433}",
|
|
11042
|
+
"\u{1F31A}",
|
|
11043
|
+
"\u{1F32D}",
|
|
11044
|
+
"\u{1F4AF}",
|
|
11045
|
+
"\u{1F923}",
|
|
11046
|
+
"\u26A1",
|
|
11047
|
+
"\u{1F34C}",
|
|
11048
|
+
"\u{1F3C6}",
|
|
11049
|
+
"\u{1F494}",
|
|
11050
|
+
"\u{1F928}",
|
|
11051
|
+
"\u{1F610}",
|
|
11052
|
+
"\u{1F353}",
|
|
11053
|
+
"\u{1F37E}",
|
|
11054
|
+
"\u{1F48B}",
|
|
11055
|
+
"\u{1F595}",
|
|
11056
|
+
"\u{1F608}",
|
|
11057
|
+
"\u{1F634}",
|
|
11058
|
+
"\u{1F62D}",
|
|
11059
|
+
"\u{1F913}",
|
|
11060
|
+
"\u{1F47B}",
|
|
11061
|
+
"\u{1F468}\u200D\u{1F4BB}",
|
|
11062
|
+
"\u{1F440}",
|
|
11063
|
+
"\u{1F383}",
|
|
11064
|
+
"\u{1F648}",
|
|
11065
|
+
"\u{1F607}",
|
|
11066
|
+
"\u{1F628}",
|
|
11067
|
+
"\u{1F91D}",
|
|
11068
|
+
"\u{1F917}",
|
|
11069
|
+
"\u{1FAE1}",
|
|
11070
|
+
"\u{1F385}",
|
|
11071
|
+
"\u{1F384}",
|
|
11072
|
+
"\u2603\uFE0F",
|
|
11073
|
+
"\u{1F485}",
|
|
11074
|
+
"\u{1F92A}",
|
|
11075
|
+
"\u{1F5FF}",
|
|
11076
|
+
"\u{1F192}",
|
|
11077
|
+
"\u{1F498}",
|
|
11078
|
+
"\u{1F649}",
|
|
11079
|
+
"\u{1F984}",
|
|
11080
|
+
"\u{1F618}",
|
|
11081
|
+
"\u{1F48A}",
|
|
11082
|
+
"\u{1F64A}",
|
|
11083
|
+
"\u{1F60E}",
|
|
11084
|
+
"\u{1F47E}",
|
|
11085
|
+
"\u{1F937}",
|
|
11086
|
+
"\u{1F621}"
|
|
11087
|
+
]);
|
|
11005
11088
|
SKILLS_PER_PAGE = 25;
|
|
11006
11089
|
}
|
|
11007
11090
|
});
|
|
@@ -11635,9 +11718,8 @@ async function main() {
|
|
|
11635
11718
|
} catch {
|
|
11636
11719
|
log("[cc-claw] Session summarization skipped (timeout or backend unavailable)");
|
|
11637
11720
|
}
|
|
11638
|
-
clearAllSessions();
|
|
11639
11721
|
setBootTime();
|
|
11640
|
-
log("[cc-claw] Database initialized (
|
|
11722
|
+
log("[cc-claw] Database initialized (sessions preserved for resume)");
|
|
11641
11723
|
if (process.env.TELEGRAM_BOT_TOKEN) {
|
|
11642
11724
|
channelRegistry.register(new TelegramChannel());
|
|
11643
11725
|
}
|
package/package.json
CHANGED