cc-claw 0.5.1 → 0.5.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 +63 -23
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -49,7 +49,7 @@ var VERSION;
|
|
|
49
49
|
var init_version = __esm({
|
|
50
50
|
"src/version.ts"() {
|
|
51
51
|
"use strict";
|
|
52
|
-
VERSION = true ? "0.5.
|
|
52
|
+
VERSION = true ? "0.5.2" : (() => {
|
|
53
53
|
try {
|
|
54
54
|
return JSON.parse(readFileSync(join2(process.cwd(), "package.json"), "utf-8")).version ?? "unknown";
|
|
55
55
|
} catch {
|
|
@@ -8702,6 +8702,9 @@ var init_format_time = __esm({
|
|
|
8702
8702
|
});
|
|
8703
8703
|
|
|
8704
8704
|
// src/intent/classify.ts
|
|
8705
|
+
function getIntentStats() {
|
|
8706
|
+
return { ...intentCounts };
|
|
8707
|
+
}
|
|
8705
8708
|
function classifyIntent(text, chatId) {
|
|
8706
8709
|
const trimmed = text.trim();
|
|
8707
8710
|
if (trimmed.startsWith(">>")) return "agentic";
|
|
@@ -8710,6 +8713,7 @@ function classifyIntent(text, chatId) {
|
|
|
8710
8713
|
for (const pattern of AGENTIC_PATTERNS) {
|
|
8711
8714
|
if (pattern.test(trimmed)) {
|
|
8712
8715
|
log(`[intent] "${trimmed.slice(0, 30)}..." -> agentic (pattern: ${pattern})`);
|
|
8716
|
+
intentCounts.agentic++;
|
|
8713
8717
|
return "agentic";
|
|
8714
8718
|
}
|
|
8715
8719
|
}
|
|
@@ -8721,6 +8725,7 @@ function classifyIntent(text, chatId) {
|
|
|
8721
8725
|
if (elapsed < 12e4) {
|
|
8722
8726
|
if (trimmed.length < 30) {
|
|
8723
8727
|
log(`[intent] "${trimmed.slice(0, 30)}" -> agentic (active session, ${(elapsed / 1e3).toFixed(0)}s ago)`);
|
|
8728
|
+
intentCounts.agentic++;
|
|
8724
8729
|
return "agentic";
|
|
8725
8730
|
}
|
|
8726
8731
|
}
|
|
@@ -8728,22 +8733,26 @@ function classifyIntent(text, chatId) {
|
|
|
8728
8733
|
}
|
|
8729
8734
|
if (CHAT_EXACT.has(lower)) {
|
|
8730
8735
|
log(`[intent] "${lower}" -> chat (exact match)`);
|
|
8736
|
+
intentCounts.chat++;
|
|
8731
8737
|
return "chat";
|
|
8732
8738
|
}
|
|
8733
8739
|
if (trimmed.length <= 4 && /^[\p{Emoji}\s]+$/u.test(trimmed)) {
|
|
8734
8740
|
log(`[intent] "${trimmed}" -> chat (emoji-only)`);
|
|
8741
|
+
intentCounts.chat++;
|
|
8735
8742
|
return "chat";
|
|
8736
8743
|
}
|
|
8737
8744
|
log(`[intent] "${trimmed.slice(0, 30)}..." -> agentic (default)`);
|
|
8745
|
+
intentCounts.agentic++;
|
|
8738
8746
|
return "agentic";
|
|
8739
8747
|
}
|
|
8740
|
-
var CHAT_EXACT, AGENTIC_PATTERNS;
|
|
8748
|
+
var intentCounts, CHAT_EXACT, AGENTIC_PATTERNS;
|
|
8741
8749
|
var init_classify = __esm({
|
|
8742
8750
|
"src/intent/classify.ts"() {
|
|
8743
8751
|
"use strict";
|
|
8744
8752
|
init_store4();
|
|
8745
8753
|
init_session_log();
|
|
8746
8754
|
init_log();
|
|
8755
|
+
intentCounts = { chat: 0, agentic: 0 };
|
|
8747
8756
|
CHAT_EXACT = /* @__PURE__ */ new Set([
|
|
8748
8757
|
"hey",
|
|
8749
8758
|
"hi",
|
|
@@ -9991,6 +10000,10 @@ function formatModelShort(modelId) {
|
|
|
9991
10000
|
};
|
|
9992
10001
|
return MAP[modelId] ?? modelId;
|
|
9993
10002
|
}
|
|
10003
|
+
function buildBar(pct) {
|
|
10004
|
+
const filled = Math.round(Math.min(100, Math.max(0, pct)) / 100 * 8);
|
|
10005
|
+
return "\u2593".repeat(filled) + "\u2591".repeat(8 - filled);
|
|
10006
|
+
}
|
|
9994
10007
|
function capitalize(s) {
|
|
9995
10008
|
if (s === "extra_high") return "xHigh";
|
|
9996
10009
|
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
@@ -10204,32 +10217,58 @@ Tap to toggle:`,
|
|
|
10204
10217
|
const voice2 = isVoiceEnabled(chatId);
|
|
10205
10218
|
const usage2 = getUsage(chatId);
|
|
10206
10219
|
const thinking2 = getThinkingLevel(chatId);
|
|
10207
|
-
const
|
|
10208
|
-
const
|
|
10220
|
+
const mode = getMode(chatId);
|
|
10221
|
+
const modelSig = getModelSignature(chatId);
|
|
10209
10222
|
const contextMax = adapter?.contextWindow[model2] ?? 2e5;
|
|
10210
10223
|
const contextUsed = usage2.last_input_tokens + usage2.last_cache_read_tokens;
|
|
10211
|
-
const contextPct = contextMax > 0 ?
|
|
10224
|
+
const contextPct = contextMax > 0 ? contextUsed / contextMax * 100 : 0;
|
|
10225
|
+
const ctxBar = buildBar(contextPct);
|
|
10212
10226
|
const usedK = (contextUsed / 1e3).toFixed(1);
|
|
10213
10227
|
const maxK = (contextMax / 1e3).toFixed(0);
|
|
10214
|
-
const
|
|
10228
|
+
const bootRow = getDb().prepare("SELECT value FROM meta WHERE key = 'boot_time'").get();
|
|
10229
|
+
let uptimeStr = "unknown";
|
|
10230
|
+
if (bootRow) {
|
|
10231
|
+
const bootMs = (/* @__PURE__ */ new Date(bootRow.value + "Z")).getTime();
|
|
10232
|
+
const sec = Math.floor((Date.now() - bootMs) / 1e3);
|
|
10233
|
+
uptimeStr = sec < 60 ? `${sec}s` : sec < 3600 ? `${Math.floor(sec / 60)}m` : sec < 86400 ? `${Math.floor(sec / 3600)}h ${Math.floor(sec % 3600 / 60)}m` : `${Math.floor(sec / 86400)}d ${Math.floor(sec % 86400 / 3600)}h`;
|
|
10234
|
+
}
|
|
10235
|
+
let limitsLine = "";
|
|
10236
|
+
if (adapter) {
|
|
10237
|
+
const limits2 = getAllBackendLimits().filter((l) => l.backend === adapter.id);
|
|
10238
|
+
for (const lim of limits2) {
|
|
10239
|
+
if (!lim.max_input_tokens) continue;
|
|
10240
|
+
const u = getBackendUsageInWindow(adapter.id, lim.window);
|
|
10241
|
+
const pct = u.input_tokens / lim.max_input_tokens * 100;
|
|
10242
|
+
const remaining = Math.max(0, lim.max_input_tokens - u.input_tokens);
|
|
10243
|
+
const remK = (remaining / 1e3).toFixed(0);
|
|
10244
|
+
limitsLine += `
|
|
10245
|
+
\u{1F4CA} ${lim.window}: ${buildBar(pct)} ${pct.toFixed(0)}% used \xB7 ${remK}K left`;
|
|
10246
|
+
}
|
|
10247
|
+
}
|
|
10248
|
+
const iStats = getIntentStats();
|
|
10249
|
+
const iTotal = iStats.chat + iStats.agentic;
|
|
10250
|
+
const intentLine = iTotal > 0 ? `\u26A1 ${iStats.chat} chat \xB7 ${iStats.agentic} agentic (${(iStats.chat / iTotal * 100).toFixed(0)}% fast-path)` : `\u26A1 No messages classified yet`;
|
|
10215
10251
|
const lines = [
|
|
10216
|
-
|
|
10217
|
-
|
|
10218
|
-
|
|
10219
|
-
|
|
10220
|
-
|
|
10221
|
-
|
|
10222
|
-
|
|
10223
|
-
|
|
10224
|
-
|
|
10225
|
-
|
|
10226
|
-
|
|
10227
|
-
|
|
10228
|
-
|
|
10229
|
-
|
|
10230
|
-
|
|
10231
|
-
|
|
10232
|
-
|
|
10252
|
+
`\u{1F43E} CC-Claw v${VERSION}`,
|
|
10253
|
+
`\u23F1 Uptime: ${uptimeStr}`,
|
|
10254
|
+
``,
|
|
10255
|
+
`\u2501\u2501 Engine \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501`,
|
|
10256
|
+
`\u{1F9E0} ${adapter?.displayName ?? backendId ?? "not set"} \xB7 ${formatModelShort(model2)}`,
|
|
10257
|
+
`\u{1F4AD} Think: ${thinking2} \xB7 Mode: ${mode}`,
|
|
10258
|
+
`\u{1F507} Voice: ${voice2 ? "on" : "off"} \xB7 Sig: ${modelSig}`,
|
|
10259
|
+
``,
|
|
10260
|
+
`\u2501\u2501 Session \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501`,
|
|
10261
|
+
`\u{1F4CB} ${sessionId ? sessionId.slice(0, 12) + "..." : "no active session"}`,
|
|
10262
|
+
`\u{1F4C1} ${cwd ?? "default workspace"}`,
|
|
10263
|
+
`\u{1F4D0} Context: ${ctxBar} ${usedK}K/${maxK}K (${contextPct.toFixed(1)}%)`,
|
|
10264
|
+
``,
|
|
10265
|
+
`\u2501\u2501 Usage \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501`,
|
|
10266
|
+
`\u{1F4E8} ${usage2.request_count} requests \xB7 ${(usage2.input_tokens / 1e3).toFixed(0)}K in \xB7 ${(usage2.output_tokens / 1e3).toFixed(0)}K out`,
|
|
10267
|
+
`\u{1F4BE} ${(usage2.cache_read_tokens / 1e3).toFixed(0)}K cached`,
|
|
10268
|
+
...limitsLine ? [limitsLine] : [],
|
|
10269
|
+
``,
|
|
10270
|
+
`\u2501\u2501 Intelligence \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501`,
|
|
10271
|
+
intentLine
|
|
10233
10272
|
];
|
|
10234
10273
|
await channel.sendText(chatId, lines.join("\n"), "plain");
|
|
10235
10274
|
break;
|
|
@@ -12355,6 +12394,7 @@ var init_router = __esm({
|
|
|
12355
12394
|
init_agent();
|
|
12356
12395
|
init_retry();
|
|
12357
12396
|
init_classify();
|
|
12397
|
+
init_version();
|
|
12358
12398
|
init_image_gen();
|
|
12359
12399
|
init_stt();
|
|
12360
12400
|
init_store4();
|
package/package.json
CHANGED