cc-claw 0.17.0 → 0.17.2
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 +42 -13
- 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.17.
|
|
36
|
+
VERSION = true ? "0.17.2" : (() => {
|
|
37
37
|
try {
|
|
38
38
|
return JSON.parse(readFileSync(join(process.cwd(), "package.json"), "utf-8")).version ?? "unknown";
|
|
39
39
|
} catch {
|
|
@@ -12834,7 +12834,6 @@ var init_classify2 = __esm({
|
|
|
12834
12834
|
function shouldRequireApproval(input) {
|
|
12835
12835
|
if (input.execMode !== "approved") return false;
|
|
12836
12836
|
if (input.intent !== "agentic") return false;
|
|
12837
|
-
if (input.isResuming) return false;
|
|
12838
12837
|
if (input.messageText.startsWith(">>")) return false;
|
|
12839
12838
|
if (EXEMPT_TIERS.has(input.bootstrapTier)) return false;
|
|
12840
12839
|
if (input.isSideQuest) return false;
|
|
@@ -16468,8 +16467,23 @@ Tap to toggle:`,
|
|
|
16468
16467
|
setSessionStartedAt(chatId);
|
|
16469
16468
|
logActivity(getDb(), { chatId, source: "telegram", eventType: "config_changed", summary: "New session started", detail: { field: "session", action: "reset", summarized } });
|
|
16470
16469
|
if (typeof channel.sendKeyboard === "function" && oldSessionId) {
|
|
16471
|
-
|
|
16470
|
+
let adapter;
|
|
16471
|
+
try {
|
|
16472
|
+
adapter = getAdapterForChat(chatId);
|
|
16473
|
+
} catch {
|
|
16474
|
+
adapter = null;
|
|
16475
|
+
}
|
|
16476
|
+
const currentModel = getModel(chatId) ?? adapter?.defaultModel ?? "default";
|
|
16477
|
+
const modelLabel = adapter ? formatModelShort(currentModel) : currentModel;
|
|
16478
|
+
const backendLabel = adapter?.displayName ?? getBackend(chatId) ?? "not set";
|
|
16479
|
+
const msg2 = `\u2705 New session started. Previous session archived${exchangeCount > 0 ? ` (${exchangeCount} exchanges)` : ""}.
|
|
16480
|
+
|
|
16481
|
+
\u{1F9E0} ${backendLabel} \xB7 ${modelLabel}`;
|
|
16472
16482
|
const kbMsgId = await channel.sendKeyboard(chatId, msg2, [
|
|
16483
|
+
[
|
|
16484
|
+
{ label: "Switch Backend", data: "menu:backend", style: "primary" },
|
|
16485
|
+
{ label: "Switch Model", data: "menu:model", style: "primary" }
|
|
16486
|
+
],
|
|
16473
16487
|
[{ label: "Undo", data: "newchat:undo" }]
|
|
16474
16488
|
]);
|
|
16475
16489
|
if (kbMsgId) {
|
|
@@ -18130,9 +18144,12 @@ ${PERM_MODES[chosen]}`,
|
|
|
18130
18144
|
}
|
|
18131
18145
|
removePendingPlan(chatId);
|
|
18132
18146
|
await channel.sendText(chatId, "\u2705 Approved. Executing...", { parseMode: "plain" });
|
|
18147
|
+
bypassBusyCheck.add(chatId);
|
|
18133
18148
|
const { handleMessage: handleMessage2 } = await Promise.resolve().then(() => (init_router(), router_exports));
|
|
18149
|
+
const overrideMsg = `[SYSTEM: Planning mode disabled. Execution APPROVED. Please execute the plan.]
|
|
18150
|
+
${plan.originalMessage}`;
|
|
18134
18151
|
await handleMessage2(
|
|
18135
|
-
{ text: `>>${
|
|
18152
|
+
{ text: `>>${overrideMsg}`, chatId, source: "telegram", type: "text", senderName: "", messageId: "" },
|
|
18136
18153
|
channel
|
|
18137
18154
|
);
|
|
18138
18155
|
return;
|
|
@@ -18155,9 +18172,12 @@ ${PERM_MODES[chosen]}`,
|
|
|
18155
18172
|
removePendingPlan(chatId);
|
|
18156
18173
|
setExecMode(chatId, "yolo");
|
|
18157
18174
|
await channel.sendText(chatId, "\u26A1 Switched to YOLO mode. Executing without approval gate...", { parseMode: "plain" });
|
|
18175
|
+
bypassBusyCheck.add(chatId);
|
|
18158
18176
|
const { handleMessage: handleMessage2 } = await Promise.resolve().then(() => (init_router(), router_exports));
|
|
18177
|
+
const overrideMsg = `[SYSTEM: Planning mode disabled. YOLO mode enabled. Proceed immediately without asking for approval.]
|
|
18178
|
+
${plan.originalMessage}`;
|
|
18159
18179
|
await handleMessage2(
|
|
18160
|
-
{ text: `>>${
|
|
18180
|
+
{ text: `>>${overrideMsg}`, chatId, source: "telegram", type: "text", senderName: "", messageId: "" },
|
|
18161
18181
|
channel
|
|
18162
18182
|
);
|
|
18163
18183
|
return;
|
|
@@ -19193,14 +19213,11 @@ You're still in discussion mode \u2014 try again or click a button to exit.`, {
|
|
|
19193
19213
|
}
|
|
19194
19214
|
}
|
|
19195
19215
|
const execMode = getExecMode(chatId);
|
|
19196
|
-
const sessionId = getSessionId(chatId);
|
|
19197
|
-
const isResuming = !!sessionId;
|
|
19198
19216
|
if (shouldRequireApproval({
|
|
19199
19217
|
execMode,
|
|
19200
19218
|
intent,
|
|
19201
19219
|
bootstrapTier: bootstrapTier ?? "full",
|
|
19202
19220
|
messageText: text,
|
|
19203
|
-
isResuming,
|
|
19204
19221
|
isSideQuest: hasSqPrefix
|
|
19205
19222
|
})) {
|
|
19206
19223
|
const planDirective = buildPlanningDirective();
|
|
@@ -19227,9 +19244,10 @@ You're still in discussion mode \u2014 try again or click a button to exit.`, {
|
|
|
19227
19244
|
});
|
|
19228
19245
|
typingActive2 = false;
|
|
19229
19246
|
if (planResponse.text) {
|
|
19230
|
-
|
|
19247
|
+
let planText = planResponse.text.replace(/\[REACT:.+?\]/g, "").replace(/\[SEND_FILE:.+?\]/g, "").replace(/\[GENERATE_IMAGE:.+?\]/g, "").replace(/\[HISTORY_SEARCH:[^\]]+\]/g, "").trim();
|
|
19248
|
+
storePendingPlan(chatId, planText, cleanText || text);
|
|
19231
19249
|
if (typeof channel.sendKeyboard === "function") {
|
|
19232
|
-
await channel.sendKeyboard(chatId, `\u{1F50D} ${
|
|
19250
|
+
await channel.sendKeyboard(chatId, `\u{1F50D} ${planText}`, [
|
|
19233
19251
|
[
|
|
19234
19252
|
{ label: "\u2705 Approve", data: "exec:approve", style: "success" },
|
|
19235
19253
|
{ label: "\u274C Reject", data: "exec:reject", style: "danger" }
|
|
@@ -20774,13 +20792,24 @@ var init_telegram2 = __esm({
|
|
|
20774
20792
|
}
|
|
20775
20793
|
keyboard.row();
|
|
20776
20794
|
}
|
|
20795
|
+
const MAX_KEYBOARD_TEXT = 4e3;
|
|
20796
|
+
const safeText = text.length > MAX_KEYBOARD_TEXT ? text.slice(0, MAX_KEYBOARD_TEXT) + "\n\n\u2026(truncated)" : text;
|
|
20777
20797
|
try {
|
|
20778
|
-
const msg = await this.bot.api.sendMessage(numericChatId(chatId),
|
|
20798
|
+
const msg = await this.bot.api.sendMessage(numericChatId(chatId), safeText, {
|
|
20779
20799
|
reply_markup: keyboard
|
|
20780
20800
|
});
|
|
20781
20801
|
return msg.message_id.toString();
|
|
20782
|
-
} catch {
|
|
20783
|
-
|
|
20802
|
+
} catch (err) {
|
|
20803
|
+
error(`[telegram] sendKeyboard failed (chat=${chatId}, textLen=${text.length}):`, err);
|
|
20804
|
+
try {
|
|
20805
|
+
const fallbackMsg = await this.bot.api.sendMessage(numericChatId(chatId), "\u2B06\uFE0F (see above for details)", {
|
|
20806
|
+
reply_markup: keyboard
|
|
20807
|
+
});
|
|
20808
|
+
return fallbackMsg.message_id.toString();
|
|
20809
|
+
} catch (fallbackErr) {
|
|
20810
|
+
error(`[telegram] sendKeyboard fallback also failed:`, fallbackErr);
|
|
20811
|
+
return void 0;
|
|
20812
|
+
}
|
|
20784
20813
|
}
|
|
20785
20814
|
}
|
|
20786
20815
|
async reactToMessage(chatId, messageId, emoji) {
|
package/package.json
CHANGED