cc-claw 0.20.18 → 0.20.19
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 +21 -113
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -33,7 +33,7 @@ var VERSION;
|
|
|
33
33
|
var init_version = __esm({
|
|
34
34
|
"src/version.ts"() {
|
|
35
35
|
"use strict";
|
|
36
|
-
VERSION = true ? "0.20.
|
|
36
|
+
VERSION = true ? "0.20.19" : (() => {
|
|
37
37
|
try {
|
|
38
38
|
return JSON.parse(readFileSync(join(process.cwd(), "package.json"), "utf-8")).version ?? "unknown";
|
|
39
39
|
} catch {
|
|
@@ -7370,11 +7370,6 @@ ${ctx}`);
|
|
|
7370
7370
|
} catch {
|
|
7371
7371
|
}
|
|
7372
7372
|
}
|
|
7373
|
-
if (tier !== "slim" && tier !== "heartbeat") {
|
|
7374
|
-
sections.push(
|
|
7375
|
-
"[React] Start your response with [REACT:emoji] \u2014 one emoji from the Telegram allowed set matching the message tone. Examples: \u{1F914} question, \u{1FAE1} task/request, \u{1F525} exciting, \u{1F923} funny, \u{1F622} sad, \u{1F4AF} agree, \u{1F389} celebrate, \u{1F468}\u200D\u{1F4BB} coding, \u{1F92F} mind-blown, \u{1F440} interesting, \u{1F91D} thanks, \u{1F60E} chill."
|
|
7376
|
-
);
|
|
7377
|
-
}
|
|
7378
7373
|
if (sideQuestContext) {
|
|
7379
7374
|
const { getInFlightMessage: getInFlightMessage3 } = await Promise.resolve().then(() => (init_agent(), agent_exports));
|
|
7380
7375
|
const inFlightMsg = getInFlightMessage3(sideQuestContext.parentChatId);
|
|
@@ -8527,11 +8522,6 @@ function pickFallbackEmoji(userMessage) {
|
|
|
8527
8522
|
}
|
|
8528
8523
|
return "\u{1F44D}";
|
|
8529
8524
|
}
|
|
8530
|
-
function ensureReaction(responseText, userMessage) {
|
|
8531
|
-
if (/\[REACT:.+?\]/.test(responseText)) return responseText;
|
|
8532
|
-
const emoji = pickFallbackEmoji(userMessage);
|
|
8533
|
-
return `[REACT:${emoji}]${responseText}`;
|
|
8534
|
-
}
|
|
8535
8525
|
function isPathAllowed(filePath, cwd) {
|
|
8536
8526
|
const resolved = resolvePath(cwd ?? process.cwd(), filePath);
|
|
8537
8527
|
for (const pattern of BLOCKED_PATH_PATTERNS) {
|
|
@@ -8709,7 +8699,7 @@ async function sendOrEditKeyboard(chatId, channel, messageId, text, buttons) {
|
|
|
8709
8699
|
await channel.sendText(chatId, text, { parseMode: "plain" });
|
|
8710
8700
|
return void 0;
|
|
8711
8701
|
}
|
|
8712
|
-
var TONE_PATTERNS,
|
|
8702
|
+
var TONE_PATTERNS, BLOCKED_PATH_PATTERNS, CLI_INSTALL_HINTS, PERM_MODES, VERBOSE_LEVELS, HELP_CATEGORIES, USAGE_WINDOW_MAP, SKILLS_PER_PAGE, MAX_SIDE_QUESTS;
|
|
8713
8703
|
var init_helpers = __esm({
|
|
8714
8704
|
"src/router/helpers.ts"() {
|
|
8715
8705
|
"use strict";
|
|
@@ -8744,77 +8734,6 @@ var init_helpers = __esm({
|
|
|
8744
8734
|
// Chill / casual greeting
|
|
8745
8735
|
{ pattern: /^(hey|hi|hello|sup|yo|what'?s up|howdy)\b/i, emoji: "\u{1F60E}" }
|
|
8746
8736
|
];
|
|
8747
|
-
ALLOWED_REACTION_EMOJIS = /* @__PURE__ */ new Set([
|
|
8748
|
-
"\u{1F44D}",
|
|
8749
|
-
"\u{1F44E}",
|
|
8750
|
-
"\u2764",
|
|
8751
|
-
"\u{1F525}",
|
|
8752
|
-
"\u{1F970}",
|
|
8753
|
-
"\u{1F44F}",
|
|
8754
|
-
"\u{1F601}",
|
|
8755
|
-
"\u{1F914}",
|
|
8756
|
-
"\u{1F92F}",
|
|
8757
|
-
"\u{1F631}",
|
|
8758
|
-
"\u{1F92C}",
|
|
8759
|
-
"\u{1F622}",
|
|
8760
|
-
"\u{1F389}",
|
|
8761
|
-
"\u{1F929}",
|
|
8762
|
-
"\u{1F92E}",
|
|
8763
|
-
"\u{1F4A9}",
|
|
8764
|
-
"\u{1F64F}",
|
|
8765
|
-
"\u{1F44C}",
|
|
8766
|
-
"\u{1F54A}\uFE0F",
|
|
8767
|
-
"\u{1F921}",
|
|
8768
|
-
"\u{1F971}",
|
|
8769
|
-
"\u{1F974}",
|
|
8770
|
-
"\u{1F60D}",
|
|
8771
|
-
"\u{1F433}",
|
|
8772
|
-
"\u{1F31A}",
|
|
8773
|
-
"\u{1F32D}",
|
|
8774
|
-
"\u{1F4AF}",
|
|
8775
|
-
"\u{1F923}",
|
|
8776
|
-
"\u26A1",
|
|
8777
|
-
"\u{1F34C}",
|
|
8778
|
-
"\u{1F3C6}",
|
|
8779
|
-
"\u{1F494}",
|
|
8780
|
-
"\u{1F928}",
|
|
8781
|
-
"\u{1F610}",
|
|
8782
|
-
"\u{1F353}",
|
|
8783
|
-
"\u{1F37E}",
|
|
8784
|
-
"\u{1F48B}",
|
|
8785
|
-
"\u{1F595}",
|
|
8786
|
-
"\u{1F608}",
|
|
8787
|
-
"\u{1F634}",
|
|
8788
|
-
"\u{1F62D}",
|
|
8789
|
-
"\u{1F913}",
|
|
8790
|
-
"\u{1F47B}",
|
|
8791
|
-
"\u{1F468}\u200D\u{1F4BB}",
|
|
8792
|
-
"\u{1F440}",
|
|
8793
|
-
"\u{1F383}",
|
|
8794
|
-
"\u{1F648}",
|
|
8795
|
-
"\u{1F607}",
|
|
8796
|
-
"\u{1F628}",
|
|
8797
|
-
"\u{1F91D}",
|
|
8798
|
-
"\u{1F917}",
|
|
8799
|
-
"\u{1FAE1}",
|
|
8800
|
-
"\u{1F385}",
|
|
8801
|
-
"\u{1F384}",
|
|
8802
|
-
"\u2603\uFE0F",
|
|
8803
|
-
"\u{1F485}",
|
|
8804
|
-
"\u{1F92A}",
|
|
8805
|
-
"\u{1F5FF}",
|
|
8806
|
-
"\u{1F192}",
|
|
8807
|
-
"\u{1F498}",
|
|
8808
|
-
"\u{1F649}",
|
|
8809
|
-
"\u{1F984}",
|
|
8810
|
-
"\u{1F618}",
|
|
8811
|
-
"\u{1F48A}",
|
|
8812
|
-
"\u{1F64A}",
|
|
8813
|
-
"\u{1F60E}",
|
|
8814
|
-
"\u{1F47E}",
|
|
8815
|
-
"\u{1F937}",
|
|
8816
|
-
"\u{1F621}"
|
|
8817
|
-
]);
|
|
8818
8737
|
BLOCKED_PATH_PATTERNS = [
|
|
8819
8738
|
/\/\.ssh\//,
|
|
8820
8739
|
/\/\.gnupg\//,
|
|
@@ -18096,13 +18015,11 @@ var init_image_gen = __esm({
|
|
|
18096
18015
|
// src/router/response.ts
|
|
18097
18016
|
var response_exports = {};
|
|
18098
18017
|
__export(response_exports, {
|
|
18099
|
-
ensureReaction: () => ensureReaction,
|
|
18100
18018
|
handleResponseExhaustion: () => handleResponseExhaustion,
|
|
18101
18019
|
makeToolActionCallback: () => makeToolActionCallback,
|
|
18102
18020
|
pendingFallbackMessages: () => pendingFallbackMessages,
|
|
18103
18021
|
processFileSends: () => processFileSends2,
|
|
18104
18022
|
processImageGenerations: () => processImageGenerations,
|
|
18105
|
-
processReaction: () => processReaction,
|
|
18106
18023
|
sendResponse: () => sendResponse
|
|
18107
18024
|
});
|
|
18108
18025
|
import { readFile as readFile3 } from "fs/promises";
|
|
@@ -18168,25 +18085,8 @@ async function processImageGenerations(chatId, channel, text) {
|
|
|
18168
18085
|
}
|
|
18169
18086
|
return text.replace(pattern, "").trim();
|
|
18170
18087
|
}
|
|
18171
|
-
async function processReaction(chatId, channel, text, messageId) {
|
|
18172
|
-
const reactPatternGlobal = /\[\s*REACT:\s*(.+?)\s*\]/g;
|
|
18173
|
-
if (!reactPatternGlobal.test(text)) return text;
|
|
18174
|
-
let reacted = false;
|
|
18175
|
-
reactPatternGlobal.lastIndex = 0;
|
|
18176
|
-
let match;
|
|
18177
|
-
while ((match = reactPatternGlobal.exec(text)) !== null) {
|
|
18178
|
-
const emoji = match[1].trim();
|
|
18179
|
-
if (!reacted && messageId && typeof channel.reactToMessage === "function" && ALLOWED_REACTION_EMOJIS.has(emoji)) {
|
|
18180
|
-
channel.reactToMessage(chatId, messageId, emoji).catch((err) => {
|
|
18181
|
-
log(`[reaction] Failed for chat=${chatId}: ${err}`);
|
|
18182
|
-
});
|
|
18183
|
-
reacted = true;
|
|
18184
|
-
}
|
|
18185
|
-
}
|
|
18186
|
-
return text.replace(/\[\s*REACT:\s*(.+?)\s*\]/g, "").trim();
|
|
18187
|
-
}
|
|
18188
18088
|
async function sendResponse(chatId, channel, text, messageId, replyToMessageId) {
|
|
18189
|
-
text =
|
|
18089
|
+
text = text.replace(/\[\s*REACT:\s*(.+?)\s*\]/g, "").trim();
|
|
18190
18090
|
const { cleanText: afterUpdates, updates } = extractUserUpdates(text);
|
|
18191
18091
|
for (const { key, value } of updates) {
|
|
18192
18092
|
if (typeof channel.sendKeyboard === "function") {
|
|
@@ -18623,8 +18523,7 @@ async function handleVoice(msg, channel) {
|
|
|
18623
18523
|
if (vLiveStatus) await vLiveStatus.finalize(Date.now() - sigT0);
|
|
18624
18524
|
if (response.usage) addUsage(chatId, response.usage.input, response.usage.output, response.usage.cacheRead, vModel, void 0, response.usage.contextSize);
|
|
18625
18525
|
if (await handleResponseExhaustion(response.text, chatId, msg, channel)) return;
|
|
18626
|
-
|
|
18627
|
-
await sendResponse(chatId, channel, voiceResponse, msg.messageId);
|
|
18526
|
+
await sendResponse(chatId, channel, response.text, msg.messageId);
|
|
18628
18527
|
} catch (err) {
|
|
18629
18528
|
error("[router] Voice error:", err);
|
|
18630
18529
|
await channel.sendText(chatId, `Voice processing error: ${errorMessage(err)}`, { parseMode: "plain" });
|
|
@@ -18706,8 +18605,7 @@ Acknowledge receipt. Do NOT analyze the video unless they ask you to.`;
|
|
|
18706
18605
|
if (vidLiveStatus) await vidLiveStatus.finalize(Date.now() - vidT0);
|
|
18707
18606
|
if (response2.usage) addUsage(chatId, response2.usage.input, response2.usage.output, response2.usage.cacheRead, vidModel, void 0, response2.usage.contextSize);
|
|
18708
18607
|
if (await handleResponseExhaustion(response2.text, chatId, msg, channel)) return;
|
|
18709
|
-
|
|
18710
|
-
await sendResponse(chatId, channel, vidResponse, msg.messageId);
|
|
18608
|
+
await sendResponse(chatId, channel, response2.text, msg.messageId);
|
|
18711
18609
|
return;
|
|
18712
18610
|
}
|
|
18713
18611
|
if (!fileName) {
|
|
@@ -18780,8 +18678,7 @@ ${content}
|
|
|
18780
18678
|
if (mLiveStatus) await mLiveStatus.finalize(Date.now() - mT0);
|
|
18781
18679
|
if (response.usage) addUsage(chatId, response.usage.input, response.usage.output, response.usage.cacheRead, mediaModel, void 0, response.usage.contextSize);
|
|
18782
18680
|
if (await handleResponseExhaustion(response.text, chatId, msg, channel)) return;
|
|
18783
|
-
|
|
18784
|
-
await sendResponse(chatId, channel, mediaResponse, msg.messageId);
|
|
18681
|
+
await sendResponse(chatId, channel, response.text, msg.messageId);
|
|
18785
18682
|
} catch (err) {
|
|
18786
18683
|
error("[router] Media error:", err);
|
|
18787
18684
|
const errStr = errorMessage(err);
|
|
@@ -24524,7 +24421,9 @@ ${PERM_MODES[chosen]}`,
|
|
|
24524
24421
|
return;
|
|
24525
24422
|
}
|
|
24526
24423
|
removePendingPlan(chatId);
|
|
24527
|
-
await replaceWithText(
|
|
24424
|
+
await replaceWithText(`\u{1F50D} ${plan.plan}
|
|
24425
|
+
|
|
24426
|
+
\u2705 Approved. Executing...`);
|
|
24528
24427
|
bypassBusyCheck.add(chatId);
|
|
24529
24428
|
const { handleMessage: handleMessage2 } = await Promise.resolve().then(() => (init_router2(), router_exports));
|
|
24530
24429
|
const overrideMsg = `[SYSTEM: Planning mode disabled. Execution APPROVED. Please execute the plan.]
|
|
@@ -24542,7 +24441,9 @@ ${plan.originalMessage}`;
|
|
|
24542
24441
|
}
|
|
24543
24442
|
removePendingPlan(chatId);
|
|
24544
24443
|
setRejectionMode(chatId);
|
|
24545
|
-
await
|
|
24444
|
+
await replaceWithText(`\u{1F50D} ${plan.plan}
|
|
24445
|
+
|
|
24446
|
+
\u274C Rejected \u2014 send feedback to revise.`);
|
|
24546
24447
|
return;
|
|
24547
24448
|
} else if (data === "exec:yolo") {
|
|
24548
24449
|
const plan = getPendingPlan(chatId);
|
|
@@ -24552,7 +24453,9 @@ ${plan.originalMessage}`;
|
|
|
24552
24453
|
}
|
|
24553
24454
|
removePendingPlan(chatId);
|
|
24554
24455
|
setExecMode(chatId, "yolo");
|
|
24555
|
-
await
|
|
24456
|
+
await replaceWithText(`\u{1F50D} ${plan.plan}
|
|
24457
|
+
|
|
24458
|
+
\u26A1 YOLO mode. Executing...`);
|
|
24556
24459
|
bypassBusyCheck.add(chatId);
|
|
24557
24460
|
const { handleMessage: handleMessage2 } = await Promise.resolve().then(() => (init_router2(), router_exports));
|
|
24558
24461
|
const overrideMsg = `[SYSTEM: Planning mode disabled. YOLO mode enabled. Proceed immediately without asking for approval.]
|
|
@@ -26286,6 +26189,12 @@ async function handleText(msg, channel) {
|
|
|
26286
26189
|
await channel.sendText(chatId, "Got it, I'll remember that.", { parseMode: "plain" });
|
|
26287
26190
|
return;
|
|
26288
26191
|
}
|
|
26192
|
+
if (msg.messageId && typeof channel.reactToMessage === "function") {
|
|
26193
|
+
const ackEmoji = pickFallbackEmoji(text);
|
|
26194
|
+
channel.reactToMessage(chatId, msg.messageId, ackEmoji).catch(() => {
|
|
26195
|
+
});
|
|
26196
|
+
}
|
|
26197
|
+
await channel.sendTyping?.(chatId);
|
|
26289
26198
|
const model2 = resolveModel(chatId);
|
|
26290
26199
|
let autoRouted = false;
|
|
26291
26200
|
let effectiveModel = model2;
|
|
@@ -26704,7 +26613,6 @@ Debating: "${question.slice(0, 100)}${question.length > 100 ? "\u2026" : ""}"`,
|
|
|
26704
26613
|
if (activeSideQuests.has(chatId) && responseText && !responseText.startsWith("(No response")) {
|
|
26705
26614
|
responseText = "\u{1F4CB} <b>Main task</b>\n\n" + responseText;
|
|
26706
26615
|
}
|
|
26707
|
-
responseText = ensureReaction(responseText, cleanText || text);
|
|
26708
26616
|
await sendResponse(chatId, channel, responseText, msg.messageId);
|
|
26709
26617
|
try {
|
|
26710
26618
|
const adapter2 = getAdapterForChat(chatId);
|
package/package.json
CHANGED