cc-claw 0.20.0 → 0.20.1

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.
Files changed (2) hide show
  1. package/dist/cli.js +54 -9
  2. 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.0" : (() => {
36
+ VERSION = true ? "0.20.1" : (() => {
37
37
  try {
38
38
  return JSON.parse(readFileSync(join(process.cwd(), "package.json"), "utf-8")).version ?? "unknown";
39
39
  } catch {
@@ -1774,6 +1774,12 @@ function initSchema(db3) {
1774
1774
  value INTEGER NOT NULL DEFAULT 0
1775
1775
  );
1776
1776
  `);
1777
+ db3.exec(`
1778
+ CREATE TABLE IF NOT EXISTS chat_skill_suggestions (
1779
+ chat_id TEXT PRIMARY KEY,
1780
+ value INTEGER NOT NULL DEFAULT 1
1781
+ );
1782
+ `);
1777
1783
  db3.exec(`
1778
1784
  CREATE TABLE IF NOT EXISTS chat_session_log (
1779
1785
  chat_id TEXT PRIMARY KEY,
@@ -2543,6 +2549,7 @@ __export(chat_settings_exports, {
2543
2549
  getRecentBookmarks: () => getRecentBookmarks,
2544
2550
  getSessionLogEnabled: () => getSessionLogEnabled,
2545
2551
  getShowThinkingUi: () => getShowThinkingUi,
2552
+ getSkillSuggestionsEnabled: () => getSkillSuggestionsEnabled,
2546
2553
  getSummarizer: () => getSummarizer,
2547
2554
  getThinkingLevel: () => getThinkingLevel,
2548
2555
  getToolsMap: () => getToolsMap,
@@ -2559,6 +2566,7 @@ __export(chat_settings_exports, {
2559
2566
  setModel: () => setModel,
2560
2567
  setSessionLogEnabled: () => setSessionLogEnabled,
2561
2568
  setShowThinkingUi: () => setShowThinkingUi,
2569
+ setSkillSuggestionsEnabled: () => setSkillSuggestionsEnabled,
2562
2570
  setSummarizer: () => setSummarizer,
2563
2571
  setThinkingLevel: () => setThinkingLevel,
2564
2572
  setVerboseLevel: () => setVerboseLevel,
@@ -2686,6 +2694,19 @@ function toggleShowThinkingUi(chatId) {
2686
2694
  setShowThinkingUi(chatId, next);
2687
2695
  return next;
2688
2696
  }
2697
+ function getSkillSuggestionsEnabled(chatId) {
2698
+ const row = getDb().prepare(
2699
+ "SELECT value FROM chat_skill_suggestions WHERE chat_id = ?"
2700
+ ).get(chatId);
2701
+ return (row?.value ?? 1) === 1;
2702
+ }
2703
+ function setSkillSuggestionsEnabled(chatId, enabled) {
2704
+ getDb().prepare(`
2705
+ INSERT INTO chat_skill_suggestions (chat_id, value)
2706
+ VALUES (?, ?)
2707
+ ON CONFLICT(chat_id) DO UPDATE SET value = ?
2708
+ `).run(chatId, enabled ? 1 : 0, enabled ? 1 : 0);
2709
+ }
2689
2710
  function getMode(chatId) {
2690
2711
  const row = getDb().prepare(
2691
2712
  "SELECT mode FROM chat_mode WHERE chat_id = ?"
@@ -3897,6 +3918,7 @@ __export(store_exports5, {
3897
3918
  getSessionSummaries: () => getSessionSummaries,
3898
3919
  getSessionSummariesWithoutEmbeddings: () => getSessionSummariesWithoutEmbeddings,
3899
3920
  getShowThinkingUi: () => getShowThinkingUi,
3921
+ getSkillSuggestionsEnabled: () => getSkillSuggestionsEnabled,
3900
3922
  getSummarizer: () => getSummarizer,
3901
3923
  getThinkingLevel: () => getThinkingLevel,
3902
3924
  getToolsMap: () => getToolsMap,
@@ -3965,6 +3987,7 @@ __export(store_exports5, {
3965
3987
  setSessionLogEnabled: () => setSessionLogEnabled,
3966
3988
  setSessionStartedAt: () => setSessionStartedAt,
3967
3989
  setShowThinkingUi: () => setShowThinkingUi,
3990
+ setSkillSuggestionsEnabled: () => setSkillSuggestionsEnabled,
3968
3991
  setSummarizer: () => setSummarizer,
3969
3992
  setThinkingLevel: () => setThinkingLevel,
3970
3993
  setVerboseLevel: () => setVerboseLevel,
@@ -7102,7 +7125,7 @@ function searchContext(userMessage) {
7102
7125
  }
7103
7126
  return null;
7104
7127
  }
7105
- async function assembleBootstrapPrompt(userMessage, tier = "full", chatId, permMode, responseStyle, agentMode, sideQuestContext, planningDirective) {
7128
+ async function assembleBootstrapPrompt(userMessage, tier = "full", chatId, permMode, responseStyle, agentMode, sideQuestContext, planningDirective, chatContext) {
7106
7129
  const sections = [];
7107
7130
  if (planningDirective) {
7108
7131
  sections.push(planningDirective);
@@ -7121,6 +7144,19 @@ async function assembleBootstrapPrompt(userMessage, tier = "full", chatId, permM
7121
7144
  sections.push("[Response Style]\nYou should be detailed and thorough in your responses. Explain concepts fully and provide comprehensive answers.");
7122
7145
  }
7123
7146
  }
7147
+ if (chatId && tier !== "slim") {
7148
+ const parts = [`Chat ID: ${chatId}`];
7149
+ if (chatContext?.chatTitle) parts.push(`Group: ${chatContext.chatTitle}`);
7150
+ if (chatContext?.threadId) parts.push(`Forum topic thread: ${chatContext.threadId}`);
7151
+ try {
7152
+ const { getAllChatAliases: getAllChatAliases3 } = await Promise.resolve().then(() => (init_store5(), store_exports5));
7153
+ const match = getAllChatAliases3().find((a) => a.chatId === chatId);
7154
+ if (match) parts.push(`Alias: ${match.alias}`);
7155
+ } catch {
7156
+ }
7157
+ sections.push(`[Current chat]
7158
+ ${parts.join("\n")}`);
7159
+ }
7124
7160
  if (tier === "full") {
7125
7161
  const ctx = searchContext(userMessage);
7126
7162
  if (ctx) {
@@ -13578,7 +13614,7 @@ async function askAgentImpl(chatId, userMessage, opts) {
13578
13614
  const tier = bootstrapTier ?? "full";
13579
13615
  const effectiveAgentMode = optsAgentMode ?? getAgentMode(settingsChat);
13580
13616
  const sideQuestCtx = settingsSourceChatId ? { parentChatId: settingsSourceChatId, actualChatId: chatId } : void 0;
13581
- const fullPrompt = await assembleBootstrapPrompt(userMessage, tier, settingsChat, mode, responseStyle, effectiveAgentMode, sideQuestCtx, planningDirective);
13617
+ const fullPrompt = await assembleBootstrapPrompt(userMessage, tier, settingsChat, mode, responseStyle, effectiveAgentMode, sideQuestCtx, planningDirective, opts?.chatContext);
13582
13618
  if (adapter.streamDirect) {
13583
13619
  const resolvedModel2 = model2 ?? adapter.defaultModel;
13584
13620
  const abortController = new AbortController();
@@ -22535,10 +22571,12 @@ import { join as join25 } from "path";
22535
22571
  import { writeFile as writeFile4, mkdir as mkdir3 } from "fs/promises";
22536
22572
  function isSkillWorthy(signals) {
22537
22573
  const { toolUseCount, tokenOutput, elapsedMs, userMessage } = signals;
22538
- if (toolUseCount < 3) return false;
22574
+ if (toolUseCount < 8) return false;
22539
22575
  const supplementary = [
22540
- tokenOutput >= 1500,
22541
- elapsedMs >= 2e4
22576
+ tokenOutput >= 3e3,
22577
+ // substantial output
22578
+ elapsedMs >= 45e3
22579
+ // took real effort (45s+)
22542
22580
  ].filter(Boolean).length;
22543
22581
  if (supplementary < 1) return false;
22544
22582
  const words = userMessage.split(/\s+/).length;
@@ -23693,7 +23731,7 @@ Use /skills to see all available skills.`, { parseMode: "plain" });
23693
23731
  } else if (data === "skill:discard") {
23694
23732
  const { clearPendingDraft: clearPendingDraft2 } = await Promise.resolve().then(() => (init_auto_create(), auto_create_exports));
23695
23733
  clearPendingDraft2(chatId);
23696
- await channel.sendText(chatId, "Skill draft discarded.", { parseMode: "plain" });
23734
+ if (messageId) await replaceWithText("\u{1F44C} Noted.");
23697
23735
  return;
23698
23736
  } else if (data.startsWith("skill:")) {
23699
23737
  const parts = data.slice(6).split(":");
@@ -24597,6 +24635,7 @@ Debating: "${question.slice(0, 100)}${question.length > 100 ? "\u2026" : ""}"`,
24597
24635
  maxTurns,
24598
24636
  agentMode: effectiveAgentMode,
24599
24637
  ...effectiveThinking ? { thinkingLevel: effectiveThinking } : {},
24638
+ chatContext: { chatTitle: msg.chatTitle, threadId: msg.threadId },
24600
24639
  onThinking: liveStatus || sessionLog ? (chunk) => {
24601
24640
  if (liveStatus) liveStatus.addThinking(chunk);
24602
24641
  if (sessionLog) sessionLog.logThinking(chunk);
@@ -24702,7 +24741,8 @@ Debating: "${question.slice(0, 100)}${question.length > 100 ? "\u2026" : ""}"`,
24702
24741
  log(`[reflection] Signal detection error: ${e}`);
24703
24742
  }
24704
24743
  try {
24705
- if (intent === "agentic" && toolUseCount > 0) {
24744
+ const { getSkillSuggestionsEnabled: getSkillSuggestionsEnabled2 } = await Promise.resolve().then(() => (init_store5(), store_exports5));
24745
+ if (intent === "agentic" && toolUseCount > 0 && getSkillSuggestionsEnabled2(chatId)) {
24706
24746
  const { isSkillWorthy: isSkillWorthy2 } = await Promise.resolve().then(() => (init_auto_create(), auto_create_exports));
24707
24747
  const signals = {
24708
24748
  toolUseCount,
@@ -24712,6 +24752,7 @@ Debating: "${question.slice(0, 100)}${question.length > 100 ? "\u2026" : ""}"`,
24712
24752
  };
24713
24753
  if (isSkillWorthy2(signals) && typeof channel.sendKeyboard === "function") {
24714
24754
  const { storePendingDraft: storePendingDraft2 } = await Promise.resolve().then(() => (init_auto_create(), auto_create_exports));
24755
+ const taskSummary = (cleanText || text).slice(0, 120) + ((cleanText || text).length > 120 ? "\u2026" : "");
24715
24756
  storePendingDraft2(chatId, {
24716
24757
  name: "",
24717
24758
  content: "",
@@ -24720,7 +24761,11 @@ Debating: "${question.slice(0, 100)}${question.length > 100 ? "\u2026" : ""}"`,
24720
24761
  });
24721
24762
  await channel.sendKeyboard(
24722
24763
  chatId,
24723
- "\u{1F4A1} That looked like a reusable workflow. Want me to extract it as a skill?",
24764
+ `\u{1F4A1} That looked like a reusable workflow:
24765
+
24766
+ "${taskSummary}"
24767
+
24768
+ Want me to extract it as a reusable skill? (${toolUseCount} tools used, ${elapsedSec}s)`,
24724
24769
  [[
24725
24770
  { label: "\u2705 Extract Skill", data: "skill:extract", style: "success" },
24726
24771
  { label: "\u2715 No thanks", data: "skill:discard" }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-claw",
3
- "version": "0.20.0",
3
+ "version": "0.20.1",
4
4
  "description": "CC-Claw: Personal AI assistant on Telegram — multi-backend (Claude, Gemini, Codex, Cursor), sub-agent orchestration, MCP management",
5
5
  "type": "module",
6
6
  "main": "dist/cli.js",