cc-claw 0.12.6 → 0.12.8

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 +131 -45
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -72,7 +72,7 @@ var VERSION;
72
72
  var init_version = __esm({
73
73
  "src/version.ts"() {
74
74
  "use strict";
75
- VERSION = true ? "0.12.6" : (() => {
75
+ VERSION = true ? "0.12.8" : (() => {
76
76
  try {
77
77
  return JSON.parse(readFileSync(join2(process.cwd(), "package.json"), "utf-8")).version ?? "unknown";
78
78
  } catch {
@@ -3489,7 +3489,7 @@ var init_claude = __esm({
3489
3489
  });
3490
3490
 
3491
3491
  // src/backends/gemini.ts
3492
- import { existsSync as existsSync3 } from "fs";
3492
+ import { existsSync as existsSync3, mkdirSync } from "fs";
3493
3493
  import { execSync as execSync2 } from "child_process";
3494
3494
  import { join as join5 } from "path";
3495
3495
  function stripThinkingContent(text) {
@@ -3665,6 +3665,10 @@ var init_gemini = __esm({
3665
3665
  if (!slot) return { env, slot: null };
3666
3666
  if (slot.slotType === "api_key" && slot.apiKey) {
3667
3667
  env.GEMINI_API_KEY = slot.apiKey;
3668
+ const isolatedHome = join5(CC_CLAW_HOME, "gemini-slots", `apikey-${slot.id}`);
3669
+ if (!existsSync3(isolatedHome)) mkdirSync(isolatedHome, { recursive: true });
3670
+ env.GEMINI_CLI_HOME = isolatedHome;
3671
+ delete env.GOOGLE_API_KEY;
3668
3672
  } else if (slot.slotType === "oauth" && slot.configHome) {
3669
3673
  env.GEMINI_CLI_HOME = slot.configHome;
3670
3674
  delete env.GEMINI_API_KEY;
@@ -4243,6 +4247,78 @@ var init_backends = __esm({
4243
4247
  }
4244
4248
  });
4245
4249
 
4250
+ // src/tool-loop-detector.ts
4251
+ function djb2Hash(str) {
4252
+ let hash = 5381;
4253
+ for (let i = 0; i < str.length; i++) {
4254
+ hash = (hash << 5) + hash + str.charCodeAt(i) & 4294967295;
4255
+ }
4256
+ return hash.toString(36);
4257
+ }
4258
+ function extractKeyField(input) {
4259
+ const key = input.file_path ?? input.path ?? input.file ?? input.command ?? input.cmd ?? input.url ?? input.query ?? input.search_query ?? input.pattern ?? input.content;
4260
+ if (key !== void 0 && key !== null) {
4261
+ return String(key);
4262
+ }
4263
+ const sorted = Object.keys(input).sort();
4264
+ const parts = sorted.map((k) => `${k}:${JSON.stringify(input[k])}`);
4265
+ return parts.join("|");
4266
+ }
4267
+ function fingerprint(toolName, input) {
4268
+ const key = extractKeyField(input);
4269
+ return `${toolName}:${djb2Hash(key)}`;
4270
+ }
4271
+ var DEFAULT_WINDOW_SIZE, DEFAULT_THRESHOLD, HARD_TURN_CAP, ToolLoopDetector;
4272
+ var init_tool_loop_detector = __esm({
4273
+ "src/tool-loop-detector.ts"() {
4274
+ "use strict";
4275
+ DEFAULT_WINDOW_SIZE = 15;
4276
+ DEFAULT_THRESHOLD = 3;
4277
+ HARD_TURN_CAP = 200;
4278
+ ToolLoopDetector = class {
4279
+ windowSize;
4280
+ threshold;
4281
+ window = [];
4282
+ constructor(windowSize = DEFAULT_WINDOW_SIZE, threshold = DEFAULT_THRESHOLD) {
4283
+ this.windowSize = windowSize;
4284
+ this.threshold = threshold;
4285
+ }
4286
+ /**
4287
+ * Record a tool call and check for loops.
4288
+ *
4289
+ * @returns `{ isLoop: true, reason }` if the same fingerprint appears
4290
+ * `threshold` or more times in the sliding window.
4291
+ */
4292
+ addCall(toolName, input) {
4293
+ const fp = fingerprint(toolName, input);
4294
+ this.window.push(fp);
4295
+ while (this.window.length > this.windowSize) {
4296
+ this.window.shift();
4297
+ }
4298
+ let count = 0;
4299
+ for (const entry of this.window) {
4300
+ if (entry === fp) count++;
4301
+ }
4302
+ if (count >= this.threshold) {
4303
+ return {
4304
+ isLoop: true,
4305
+ reason: `Tool "${toolName}" called ${count}\xD7 with same input in last ${this.window.length} calls`
4306
+ };
4307
+ }
4308
+ return { isLoop: false };
4309
+ }
4310
+ /** Number of calls tracked so far. */
4311
+ get callCount() {
4312
+ return this.window.length;
4313
+ }
4314
+ /** Reset the detector (e.g., after a retry with a fresh session). */
4315
+ reset() {
4316
+ this.window.length = 0;
4317
+ }
4318
+ };
4319
+ }
4320
+ });
4321
+
4246
4322
  // src/memory/inject.ts
4247
4323
  function daysSince(dateStr) {
4248
4324
  const date = /* @__PURE__ */ new Date(dateStr.replace(" ", "T") + (dateStr.includes("Z") ? "" : "Z"));
@@ -4520,7 +4596,7 @@ If the user asks *how* to do something with CC-Claw, use this expertise to sugge
4520
4596
  import {
4521
4597
  existsSync as existsSync7,
4522
4598
  writeFileSync,
4523
- mkdirSync,
4599
+ mkdirSync as mkdirSync2,
4524
4600
  readFileSync as readFileSync2,
4525
4601
  statSync as statSync2,
4526
4602
  copyFileSync,
@@ -4544,11 +4620,11 @@ function migrateFile(legacyPath, newPath, label2) {
4544
4620
  }
4545
4621
  function bootstrapWorkspaceFiles() {
4546
4622
  if (!existsSync7(IDENTITY_PATH)) {
4547
- mkdirSync(IDENTITY_PATH, { recursive: true });
4623
+ mkdirSync2(IDENTITY_PATH, { recursive: true });
4548
4624
  log("[bootstrap] Created identity/ directory");
4549
4625
  }
4550
4626
  if (!existsSync7(WORKSPACE_PATH)) {
4551
- mkdirSync(WORKSPACE_PATH, { recursive: true });
4627
+ mkdirSync2(WORKSPACE_PATH, { recursive: true });
4552
4628
  }
4553
4629
  migrateFile(LEGACY_SOUL_PATH, SOUL_PATH, "SOUL.md");
4554
4630
  migrateFile(LEGACY_USER_PATH, USER_PATH, "USER.md");
@@ -4575,11 +4651,11 @@ function bootstrapWorkspaceFiles() {
4575
4651
  log(`[bootstrap] Created default USER.md (timezone: ${tz})`);
4576
4652
  }
4577
4653
  if (!existsSync7(CONTEXT_DIR)) {
4578
- mkdirSync(CONTEXT_DIR, { recursive: true });
4654
+ mkdirSync2(CONTEXT_DIR, { recursive: true });
4579
4655
  log("[bootstrap] Created context/ directory");
4580
4656
  }
4581
4657
  if (!existsSync7(MEDIA_PATH)) {
4582
- mkdirSync(MEDIA_PATH, { recursive: true });
4658
+ mkdirSync2(MEDIA_PATH, { recursive: true });
4583
4659
  log("[bootstrap] Created media/ directory");
4584
4660
  }
4585
4661
  const expertisePath = join6(CONTEXT_DIR, "cc-claw-expertise.md");
@@ -5670,7 +5746,7 @@ var init_propagate = __esm({
5670
5746
  });
5671
5747
 
5672
5748
  // src/agents/mcp-config.ts
5673
- import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2, existsSync as existsSync9, readdirSync as readdirSync3, unlinkSync as unlinkSync3 } from "fs";
5749
+ import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync2, existsSync as existsSync9, readdirSync as readdirSync3, unlinkSync as unlinkSync3 } from "fs";
5674
5750
  import { join as join8, dirname } from "path";
5675
5751
  import { fileURLToPath } from "url";
5676
5752
  function generateOrchestratorMcpConfig(opts) {
@@ -5692,7 +5768,7 @@ function generateOrchestratorMcpConfig(opts) {
5692
5768
  };
5693
5769
  }
5694
5770
  function writeMcpConfigFile(config2) {
5695
- mkdirSync2(MCP_CONFIG_DIR, { recursive: true, mode: 448 });
5771
+ mkdirSync3(MCP_CONFIG_DIR, { recursive: true, mode: 448 });
5696
5772
  const jsonConfig = {
5697
5773
  mcpServers: {
5698
5774
  [config2.name]: {
@@ -5835,7 +5911,7 @@ var init_loader2 = __esm({
5835
5911
  });
5836
5912
 
5837
5913
  // src/agents/agent-log.ts
5838
- import { writeFileSync as writeFileSync3, readdirSync as readdirSync5, statSync as statSync3, unlinkSync as unlinkSync4, mkdirSync as mkdirSync3 } from "fs";
5914
+ import { writeFileSync as writeFileSync3, readdirSync as readdirSync5, statSync as statSync3, unlinkSync as unlinkSync4, mkdirSync as mkdirSync4 } from "fs";
5839
5915
  import { join as join10 } from "path";
5840
5916
  function truncate(text, maxBytes) {
5841
5917
  if (Buffer.byteLength(text, "utf-8") <= maxBytes) return text;
@@ -5875,7 +5951,7 @@ function writeAgentLog(data) {
5875
5951
  ""
5876
5952
  ];
5877
5953
  try {
5878
- mkdirSync3(AGENTS_PATH, { recursive: true });
5954
+ mkdirSync4(AGENTS_PATH, { recursive: true });
5879
5955
  writeFileSync3(logPath, lines.join("\n"), "utf-8");
5880
5956
  } catch (err) {
5881
5957
  log(`[agent-log] Failed to write log for ${data.agentId}: ${err}`);
@@ -5884,7 +5960,7 @@ function writeAgentLog(data) {
5884
5960
  }
5885
5961
  function pruneAgentLogs() {
5886
5962
  try {
5887
- mkdirSync3(AGENTS_PATH, { recursive: true });
5963
+ mkdirSync4(AGENTS_PATH, { recursive: true });
5888
5964
  const files = readdirSync5(AGENTS_PATH).filter((f) => f.endsWith(".log")).map((f) => {
5889
5965
  const fullPath = join10(AGENTS_PATH, f);
5890
5966
  const stat2 = statSync3(fullPath);
@@ -7510,7 +7586,7 @@ __export(apply_exports, {
7510
7586
  isTargetAllowed: () => isTargetAllowed,
7511
7587
  rollbackInsight: () => rollbackInsight
7512
7588
  });
7513
- import { readFileSync as readFileSync7, writeFileSync as writeFileSync4, existsSync as existsSync12, mkdirSync as mkdirSync4, readdirSync as readdirSync7, unlinkSync as unlinkSync5 } from "fs";
7589
+ import { readFileSync as readFileSync7, writeFileSync as writeFileSync4, existsSync as existsSync12, mkdirSync as mkdirSync5, readdirSync as readdirSync7, unlinkSync as unlinkSync5 } from "fs";
7514
7590
  import { join as join12, dirname as dirname2 } from "path";
7515
7591
  function isTargetAllowed(relativePath) {
7516
7592
  if (relativePath.includes("..")) return false;
@@ -7625,7 +7701,7 @@ async function applyInsight(insightId) {
7625
7701
  try {
7626
7702
  const parentDir = dirname2(absolutePath);
7627
7703
  if (!existsSync12(parentDir)) {
7628
- mkdirSync4(parentDir, { recursive: true });
7704
+ mkdirSync5(parentDir, { recursive: true });
7629
7705
  }
7630
7706
  if (original) {
7631
7707
  writeFileSync4(backupPath, original, "utf-8");
@@ -7783,7 +7859,7 @@ __export(server_exports, {
7783
7859
  });
7784
7860
  import { createServer } from "http";
7785
7861
  import { randomBytes } from "crypto";
7786
- import { writeFileSync as writeFileSync5, mkdirSync as mkdirSync5, existsSync as existsSync13 } from "fs";
7862
+ import { writeFileSync as writeFileSync5, mkdirSync as mkdirSync6, existsSync as existsSync13 } from "fs";
7787
7863
  function createSubAgentToken(agentId) {
7788
7864
  const token = `sub:${agentId.slice(0, 8)}:${randomBytes(16).toString("hex")}`;
7789
7865
  subAgentTokens.set(token, agentId);
@@ -8619,7 +8695,7 @@ data: ${JSON.stringify(data)}
8619
8695
  });
8620
8696
  server.listen(PORT, "127.0.0.1");
8621
8697
  try {
8622
- mkdirSync5(DATA_PATH, { recursive: true });
8698
+ mkdirSync6(DATA_PATH, { recursive: true });
8623
8699
  const tokenPath = `${DATA_PATH}/api-token`;
8624
8700
  writeFileSync5(tokenPath, DASHBOARD_TOKEN, { mode: 384 });
8625
8701
  } catch (err) {
@@ -9166,6 +9242,7 @@ function spawnQuery(adapter, config2, model2, cancelState, thinkingLevel, timeou
9166
9242
  let sawToolEvents = false;
9167
9243
  let sawResultEvent = false;
9168
9244
  let toolTurnCount = 0;
9245
+ const loopDetector = new ToolLoopDetector();
9169
9246
  const t0 = Date.now();
9170
9247
  const elapsed = () => `${((Date.now() - t0) / 1e3).toFixed(1)}s`;
9171
9248
  const pendingTools = /* @__PURE__ */ new Map();
@@ -9211,10 +9288,19 @@ function spawnQuery(adapter, config2, model2, cancelState, thinkingLevel, timeou
9211
9288
  error("[agent] tool action error:", err);
9212
9289
  });
9213
9290
  }
9214
- if (maxTurns && adapter.id !== "claude") {
9291
+ if (adapter.id !== "claude") {
9215
9292
  toolTurnCount++;
9216
- if (toolTurnCount >= maxTurns) {
9217
- log(`[agent] Turn limit ${maxTurns} reached for ${adapter.id} -- stopping`);
9293
+ if (ev.toolName) {
9294
+ const check = loopDetector.addCall(ev.toolName, ev.toolInput ?? {});
9295
+ if (check.isLoop) {
9296
+ warn(`[agent] Loop detected for ${adapter.id}: ${check.reason} \u2014 stopping`);
9297
+ killProcessGroup(proc, "SIGTERM");
9298
+ }
9299
+ }
9300
+ const effectiveCap = maxTurns ?? HARD_TURN_CAP;
9301
+ if (toolTurnCount >= effectiveCap) {
9302
+ const label2 = maxTurns ? `Turn limit ${maxTurns}` : `Hard cap ${HARD_TURN_CAP}`;
9303
+ warn(`[agent] ${label2} reached for ${adapter.id} \u2014 stopping`);
9218
9304
  killProcessGroup(proc, "SIGTERM");
9219
9305
  }
9220
9306
  }
@@ -9519,6 +9605,7 @@ var activeChats, chatLocks, SPAWN_TIMEOUT_MS, MCP_CONFIG_FLAG;
9519
9605
  var init_agent = __esm({
9520
9606
  "src/agent.ts"() {
9521
9607
  "use strict";
9608
+ init_tool_loop_detector();
9522
9609
  init_store5();
9523
9610
  init_backends();
9524
9611
  init_paths();
@@ -10847,7 +10934,7 @@ var init_classify = __esm({
10847
10934
  });
10848
10935
 
10849
10936
  // src/media/image-gen.ts
10850
- import { mkdirSync as mkdirSync6, existsSync as existsSync17 } from "fs";
10937
+ import { mkdirSync as mkdirSync7, existsSync as existsSync17 } from "fs";
10851
10938
  import { writeFile as writeFile2 } from "fs/promises";
10852
10939
  import { join as join17 } from "path";
10853
10940
  async function generateImage(prompt) {
@@ -10897,7 +10984,7 @@ async function generateImage(prompt) {
10897
10984
  throw new Error(textResponse ?? "Gemini did not generate an image. The prompt may have been filtered.");
10898
10985
  }
10899
10986
  if (!existsSync17(IMAGE_OUTPUT_DIR)) {
10900
- mkdirSync6(IMAGE_OUTPUT_DIR, { recursive: true });
10987
+ mkdirSync7(IMAGE_OUTPUT_DIR, { recursive: true });
10901
10988
  }
10902
10989
  const ext = mimeType.includes("jpeg") || mimeType.includes("jpg") ? "jpg" : "png";
10903
10990
  const filename = `img_${Date.now()}.${ext}`;
@@ -14567,7 +14654,6 @@ async function handleSideQuest(parentChatId, msg, channel) {
14567
14654
  backend: backend2 ?? void 0,
14568
14655
  settingsSourceChatId: parentChatId,
14569
14656
  agentMode: "native",
14570
- maxTurns: 10,
14571
14657
  timeoutMs: 3e5,
14572
14658
  bootstrapTier: "full"
14573
14659
  });
@@ -17472,7 +17558,7 @@ var init_wrap_backend = __esm({
17472
17558
  });
17473
17559
 
17474
17560
  // src/agents/runners/config-loader.ts
17475
- import { readFileSync as readFileSync10, readdirSync as readdirSync8, existsSync as existsSync19, mkdirSync as mkdirSync7, watchFile, unwatchFile } from "fs";
17561
+ import { readFileSync as readFileSync10, readdirSync as readdirSync8, existsSync as existsSync19, mkdirSync as mkdirSync8, watchFile, unwatchFile } from "fs";
17476
17562
  import { join as join20 } from "path";
17477
17563
  import { execFileSync } from "child_process";
17478
17564
  function resolveExecutable(config2) {
@@ -17623,7 +17709,7 @@ function loadRunnerConfig(filePath) {
17623
17709
  }
17624
17710
  function loadAllRunnerConfigs() {
17625
17711
  if (!existsSync19(RUNNERS_PATH)) {
17626
- mkdirSync7(RUNNERS_PATH, { recursive: true });
17712
+ mkdirSync8(RUNNERS_PATH, { recursive: true });
17627
17713
  return [];
17628
17714
  }
17629
17715
  const files = readdirSync8(RUNNERS_PATH).filter((f) => f.endsWith(".json"));
@@ -18664,7 +18750,7 @@ __export(ai_skill_exports, {
18664
18750
  generateAiSkill: () => generateAiSkill,
18665
18751
  installAiSkill: () => installAiSkill
18666
18752
  });
18667
- import { existsSync as existsSync21, writeFileSync as writeFileSync7, mkdirSync as mkdirSync8 } from "fs";
18753
+ import { existsSync as existsSync21, writeFileSync as writeFileSync7, mkdirSync as mkdirSync9 } from "fs";
18668
18754
  import { join as join22 } from "path";
18669
18755
  import { homedir as homedir7 } from "os";
18670
18756
  function generateAiSkill() {
@@ -19069,7 +19155,7 @@ function installAiSkill() {
19069
19155
  const skillDir = join22(dir, "cc-claw-cli");
19070
19156
  const skillPath = join22(skillDir, "SKILL.md");
19071
19157
  try {
19072
- mkdirSync8(skillDir, { recursive: true });
19158
+ mkdirSync9(skillDir, { recursive: true });
19073
19159
  writeFileSync7(skillPath, skill, "utf-8");
19074
19160
  installed.push(skillPath);
19075
19161
  } catch {
@@ -19100,7 +19186,7 @@ var index_exports = {};
19100
19186
  __export(index_exports, {
19101
19187
  main: () => main
19102
19188
  });
19103
- import { mkdirSync as mkdirSync9, existsSync as existsSync22, renameSync, statSync as statSync5, readFileSync as readFileSync12 } from "fs";
19189
+ import { mkdirSync as mkdirSync10, existsSync as existsSync22, renameSync, statSync as statSync5, readFileSync as readFileSync12 } from "fs";
19104
19190
  import { join as join23 } from "path";
19105
19191
  import dotenv from "dotenv";
19106
19192
  function migrateLayout() {
@@ -19248,10 +19334,10 @@ async function main() {
19248
19334
  bootstrapSkills().catch((err) => error("[cc-claw] Skill bootstrap failed:", err));
19249
19335
  try {
19250
19336
  const { generateAiSkill: generateAiSkill2 } = await Promise.resolve().then(() => (init_ai_skill(), ai_skill_exports));
19251
- const { writeFileSync: writeFileSync12, mkdirSync: mkdirSync15 } = await import("fs");
19337
+ const { writeFileSync: writeFileSync12, mkdirSync: mkdirSync16 } = await import("fs");
19252
19338
  const { join: join28 } = await import("path");
19253
19339
  const skillDir = join28(SKILLS_PATH, "cc-claw-cli");
19254
- mkdirSync15(skillDir, { recursive: true });
19340
+ mkdirSync16(skillDir, { recursive: true });
19255
19341
  writeFileSync12(join28(skillDir, "SKILL.md"), generateAiSkill2(), "utf-8");
19256
19342
  log("[cc-claw] AI skill updated");
19257
19343
  } catch {
@@ -19323,7 +19409,7 @@ var init_index = __esm({
19323
19409
  init_bootstrap2();
19324
19410
  init_health3();
19325
19411
  for (const dir of [CC_CLAW_HOME, DATA_PATH, LOGS_PATH, SKILLS_PATH, RUNNERS_PATH, AGENTS_PATH]) {
19326
- if (!existsSync22(dir)) mkdirSync9(dir, { recursive: true });
19412
+ if (!existsSync22(dir)) mkdirSync10(dir, { recursive: true });
19327
19413
  }
19328
19414
  migrateLayout();
19329
19415
  if (existsSync22(ENV_PATH)) {
@@ -19447,7 +19533,7 @@ __export(service_exports, {
19447
19533
  serviceStatus: () => serviceStatus,
19448
19534
  uninstallService: () => uninstallService
19449
19535
  });
19450
- import { existsSync as existsSync24, mkdirSync as mkdirSync10, writeFileSync as writeFileSync8, unlinkSync as unlinkSync6 } from "fs";
19536
+ import { existsSync as existsSync24, mkdirSync as mkdirSync11, writeFileSync as writeFileSync8, unlinkSync as unlinkSync6 } from "fs";
19451
19537
  import { execFileSync as execFileSync2, execSync as execSync7 } from "child_process";
19452
19538
  import { homedir as homedir8, platform } from "os";
19453
19539
  import { join as join24, dirname as dirname4 } from "path";
@@ -19522,8 +19608,8 @@ function generatePlist() {
19522
19608
  }
19523
19609
  function installMacOS() {
19524
19610
  const agentsDir = dirname4(PLIST_PATH);
19525
- if (!existsSync24(agentsDir)) mkdirSync10(agentsDir, { recursive: true });
19526
- if (!existsSync24(LOGS_PATH)) mkdirSync10(LOGS_PATH, { recursive: true });
19611
+ if (!existsSync24(agentsDir)) mkdirSync11(agentsDir, { recursive: true });
19612
+ if (!existsSync24(LOGS_PATH)) mkdirSync11(LOGS_PATH, { recursive: true });
19527
19613
  if (existsSync24(PLIST_PATH)) {
19528
19614
  try {
19529
19615
  execFileSync2("launchctl", ["unload", PLIST_PATH]);
@@ -19610,8 +19696,8 @@ WantedBy=default.target
19610
19696
  `;
19611
19697
  }
19612
19698
  function installLinux() {
19613
- if (!existsSync24(SYSTEMD_DIR)) mkdirSync10(SYSTEMD_DIR, { recursive: true });
19614
- if (!existsSync24(LOGS_PATH)) mkdirSync10(LOGS_PATH, { recursive: true });
19699
+ if (!existsSync24(SYSTEMD_DIR)) mkdirSync11(SYSTEMD_DIR, { recursive: true });
19700
+ if (!existsSync24(LOGS_PATH)) mkdirSync11(LOGS_PATH, { recursive: true });
19615
19701
  writeFileSync8(UNIT_PATH, generateUnit());
19616
19702
  console.log(` Installed: ${UNIT_PATH}`);
19617
19703
  execFileSync2("systemctl", ["--user", "daemon-reload"]);
@@ -20299,7 +20385,7 @@ __export(gemini_exports, {
20299
20385
  geminiReorder: () => geminiReorder,
20300
20386
  geminiRotation: () => geminiRotation
20301
20387
  });
20302
- import { existsSync as existsSync28, mkdirSync as mkdirSync11, writeFileSync as writeFileSync9, readFileSync as readFileSync17, chmodSync } from "fs";
20388
+ import { existsSync as existsSync28, mkdirSync as mkdirSync12, writeFileSync as writeFileSync9, readFileSync as readFileSync17, chmodSync } from "fs";
20303
20389
  import { join as join25 } from "path";
20304
20390
  import { createInterface as createInterface5 } from "readline";
20305
20391
  function requireDb() {
@@ -20413,12 +20499,12 @@ async function geminiAddKey(globalOpts, opts) {
20413
20499
  async function geminiAddAccount(globalOpts, opts) {
20414
20500
  await requireWriteDb();
20415
20501
  const slotsDir = join25(CC_CLAW_HOME, "gemini-slots");
20416
- if (!existsSync28(slotsDir)) mkdirSync11(slotsDir, { recursive: true });
20502
+ if (!existsSync28(slotsDir)) mkdirSync12(slotsDir, { recursive: true });
20417
20503
  const { addGeminiSlot: addGeminiSlot2 } = await Promise.resolve().then(() => (init_store5(), store_exports5));
20418
20504
  const tempId = Date.now();
20419
20505
  const slotDir = join25(slotsDir, `slot-${tempId}`);
20420
- mkdirSync11(slotDir, { recursive: true, mode: 448 });
20421
- mkdirSync11(join25(slotDir, ".gemini"), { recursive: true });
20506
+ mkdirSync12(slotDir, { recursive: true, mode: 448 });
20507
+ mkdirSync12(join25(slotDir, ".gemini"), { recursive: true });
20422
20508
  writeFileSync9(join25(slotDir, ".gemini", "settings.json"), JSON.stringify({
20423
20509
  security: { auth: { selectedType: "oauth-personal" } }
20424
20510
  }, null, 2));
@@ -21262,7 +21348,7 @@ __export(db_exports, {
21262
21348
  dbPath: () => dbPath,
21263
21349
  dbStats: () => dbStats
21264
21350
  });
21265
- import { existsSync as existsSync34, statSync as statSync8, copyFileSync as copyFileSync2, mkdirSync as mkdirSync12 } from "fs";
21351
+ import { existsSync as existsSync34, statSync as statSync8, copyFileSync as copyFileSync2, mkdirSync as mkdirSync13 } from "fs";
21266
21352
  import { dirname as dirname5 } from "path";
21267
21353
  async function dbStats(globalOpts) {
21268
21354
  if (!existsSync34(DB_PATH)) {
@@ -21313,7 +21399,7 @@ async function dbBackup(globalOpts, destPath) {
21313
21399
  }
21314
21400
  const dest = destPath ?? `${DB_PATH}.backup-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}`;
21315
21401
  try {
21316
- mkdirSync12(dirname5(dest), { recursive: true });
21402
+ mkdirSync13(dirname5(dest), { recursive: true });
21317
21403
  copyFileSync2(DB_PATH, dest);
21318
21404
  const walPath = DB_PATH + "-wal";
21319
21405
  if (existsSync34(walPath)) copyFileSync2(walPath, dest + "-wal");
@@ -22564,7 +22650,7 @@ var completion_exports = {};
22564
22650
  __export(completion_exports, {
22565
22651
  completionCommand: () => completionCommand
22566
22652
  });
22567
- import { writeFileSync as writeFileSync10, mkdirSync as mkdirSync13 } from "fs";
22653
+ import { writeFileSync as writeFileSync10, mkdirSync as mkdirSync14 } from "fs";
22568
22654
  import { join as join26 } from "path";
22569
22655
  import { homedir as homedir9 } from "os";
22570
22656
  async function completionCommand(opts) {
@@ -22582,7 +22668,7 @@ async function completionCommand(opts) {
22582
22668
  }
22583
22669
  if (opts.install) {
22584
22670
  const dir = join26(homedir9(), ".config", "cc-claw", "completions");
22585
- mkdirSync13(dir, { recursive: true });
22671
+ mkdirSync14(dir, { recursive: true });
22586
22672
  const filename = shell === "zsh" ? "_cc-claw" : shell === "fish" ? "cc-claw.fish" : "cc-claw.bash";
22587
22673
  const filepath = join26(dir, filename);
22588
22674
  writeFileSync10(filepath, script, "utf-8");
@@ -23173,7 +23259,7 @@ var init_evolve = __esm({
23173
23259
 
23174
23260
  // src/setup.ts
23175
23261
  var setup_exports = {};
23176
- import { existsSync as existsSync46, writeFileSync as writeFileSync11, readFileSync as readFileSync20, copyFileSync as copyFileSync3, mkdirSync as mkdirSync14, statSync as statSync9 } from "fs";
23262
+ import { existsSync as existsSync46, writeFileSync as writeFileSync11, readFileSync as readFileSync20, copyFileSync as copyFileSync3, mkdirSync as mkdirSync15, statSync as statSync9 } from "fs";
23177
23263
  import { execFileSync as execFileSync4 } from "child_process";
23178
23264
  import { createInterface as createInterface7 } from "readline";
23179
23265
  import { join as join27 } from "path";
@@ -23251,7 +23337,7 @@ async function setup() {
23251
23337
  }
23252
23338
  console.log("");
23253
23339
  for (const dir of [CC_CLAW_HOME, DATA_PATH, LOGS_PATH, SKILLS_PATH, RUNNERS_PATH, AGENTS_PATH]) {
23254
- if (!existsSync46(dir)) mkdirSync14(dir, { recursive: true });
23340
+ if (!existsSync46(dir)) mkdirSync15(dir, { recursive: true });
23255
23341
  }
23256
23342
  const env = {};
23257
23343
  const envSource = existsSync46(ENV_PATH) ? ENV_PATH : existsSync46(".env") ? ".env" : null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-claw",
3
- "version": "0.12.6",
3
+ "version": "0.12.8",
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",