cc-claw 0.2.7 → 0.2.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 +18 -5
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -48,7 +48,7 @@ var VERSION;
48
48
  var init_version = __esm({
49
49
  "src/version.ts"() {
50
50
  "use strict";
51
- VERSION = true ? "0.2.7" : (() => {
51
+ VERSION = true ? "0.2.8" : (() => {
52
52
  try {
53
53
  return JSON.parse(readFileSync(join2(process.cwd(), "package.json"), "utf-8")).version ?? "unknown";
54
54
  } catch {
@@ -90,6 +90,7 @@ var init_log = __esm({
90
90
  var store_exports = {};
91
91
  __export(store_exports, {
92
92
  claimTask: () => claimTask,
93
+ cleanupStaleAgents: () => cleanupStaleAgents,
93
94
  clearState: () => clearState,
94
95
  createAgent: () => createAgent,
95
96
  createOrchestration: () => createOrchestration,
@@ -273,6 +274,14 @@ function listActiveAgents(db3) {
273
274
  function listQueuedAgents(db3) {
274
275
  return db3.prepare("SELECT * FROM agents WHERE status = 'queued' ORDER BY createdAt").all();
275
276
  }
277
+ function cleanupStaleAgents(db3) {
278
+ const result = db3.prepare(`
279
+ UPDATE agents SET status = 'failed', completedAt = datetime('now'),
280
+ resultSummary = 'Marked stale after service restart'
281
+ WHERE status IN ('queued', 'starting', 'running', 'idle')
282
+ `).run();
283
+ return result.changes;
284
+ }
276
285
  function getNextQueuedAgent(db3, orchestrationId) {
277
286
  return db3.prepare(
278
287
  "SELECT * FROM agents WHERE orchestrationId = ? AND status = 'queued' ORDER BY createdAt LIMIT 1"
@@ -4351,6 +4360,11 @@ function shutdownOrchestrator() {
4351
4360
  }
4352
4361
  function initOrchestrator() {
4353
4362
  cleanupOrphanedMcpConfigs();
4363
+ const db3 = getDb();
4364
+ const staleCount = cleanupStaleAgents(db3);
4365
+ if (staleCount > 0) {
4366
+ log(`[orchestrator] Cleared ${staleCount} stale agent(s) from previous run`);
4367
+ }
4354
4368
  log("[orchestrator] Initialized");
4355
4369
  }
4356
4370
  var activeProcesses, timeoutTimers, runnerLocks, notifyCallback;
@@ -9735,7 +9749,6 @@ Session reset. Ready!`,
9735
9749
  if (!modelInfo) return;
9736
9750
  setModel(chatId, chosen);
9737
9751
  clearThinkingLevel(chatId);
9738
- clearSession(chatId);
9739
9752
  logActivity(getDb(), { chatId, source: "telegram", eventType: "config_changed", summary: `Model switched to ${modelInfo.label}`, detail: { field: "model", value: chosen } });
9740
9753
  if (modelInfo.thinking === "adjustable" && modelInfo.thinkingLevels) {
9741
9754
  const thinkingButtons = modelInfo.thinkingLevels.map((level) => [{
@@ -9745,16 +9758,16 @@ Session reset. Ready!`,
9745
9758
  if (typeof channel.sendKeyboard === "function") {
9746
9759
  await channel.sendKeyboard(
9747
9760
  chatId,
9748
- `Model set to ${modelInfo.label}.
9761
+ `Model set to ${modelInfo.label}. Session continues.
9749
9762
 
9750
9763
  Select thinking/effort level:`,
9751
9764
  thinkingButtons
9752
9765
  );
9753
9766
  } else {
9754
- await channel.sendText(chatId, `Model set to ${modelInfo.label}. Session reset.`, "plain");
9767
+ await channel.sendText(chatId, `Model set to ${modelInfo.label}. Session continues.`, "plain");
9755
9768
  }
9756
9769
  } else {
9757
- await channel.sendText(chatId, `Model switched to ${modelInfo.label}. Session reset.`, "plain");
9770
+ await channel.sendText(chatId, `Model switched to ${modelInfo.label}. Session continues.`, "plain");
9758
9771
  }
9759
9772
  } else if (data.startsWith("thinking:")) {
9760
9773
  const level = data.slice(9);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-claw",
3
- "version": "0.2.7",
3
+ "version": "0.2.8",
4
4
  "description": "CC-Claw: Personal AI assistant on Telegram — multi-backend (Claude, Gemini, Codex), sub-agent orchestration, MCP management",
5
5
  "type": "module",
6
6
  "main": "dist/cli.js",