cc-claw 0.3.0 → 0.3.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.
@@ -185,7 +185,7 @@ server.tool(
185
185
  `Task: ${agent.task ?? "none"}`,
186
186
  `Role: ${agent.role}`,
187
187
  `Tokens: ${agent.tokenInput} in / ${agent.tokenOutput} out`,
188
- agent.resultSummary ? `Result: ${agent.resultSummary.slice(0, 500)}` : null
188
+ agent.resultSummary ? `Result: ${agent.resultSummary.slice(0, 5e3)}` : null
189
189
  ].filter(Boolean).join("\n")
190
190
  }]
191
191
  };
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.3.0" : (() => {
51
+ VERSION = true ? "0.3.2" : (() => {
52
52
  try {
53
53
  return JSON.parse(readFileSync(join2(process.cwd(), "package.json"), "utf-8")).version ?? "unknown";
54
54
  } catch {
@@ -4104,6 +4104,9 @@ async function startAgent(agentId, chatId, opts) {
4104
4104
  }
4105
4105
  let mcpExtraArgs = [];
4106
4106
  let orchestratorMcpName = "";
4107
+ if (process.env.DASHBOARD_ENABLED !== "1") {
4108
+ warn(`[orchestrator] DASHBOARD_ENABLED is not set \u2014 agent ${agentId.slice(0, 8)} will NOT have orchestrator MCP tools (set_state, send_message, etc.)`);
4109
+ }
4107
4110
  if (process.env.DASHBOARD_ENABLED === "1") {
4108
4111
  try {
4109
4112
  const { createSubAgentToken: createSubAgentToken2 } = await Promise.resolve().then(() => (init_server(), server_exports));
@@ -4123,6 +4126,9 @@ async function startAgent(agentId, chatId, opts) {
4123
4126
  });
4124
4127
  mcpsAdded = [...mcpsAdded, orchestratorMcpName];
4125
4128
  updateAgentMcpsAdded(db3, agentId, mcpsAdded);
4129
+ if (runner.id === "gemini") {
4130
+ mcpExtraArgs = [`--allowed-mcp-server-names=${orchestratorMcpName}`];
4131
+ }
4126
4132
  log(`[orchestrator] Injected cc-claw MCP via add-remove for agent ${agentId.slice(0, 8)}`);
4127
4133
  }
4128
4134
  } catch (err) {
@@ -6124,61 +6130,38 @@ var init_cron = __esm({
6124
6130
 
6125
6131
  // src/agents/runners/wrap-backend.ts
6126
6132
  import { join as join8 } from "path";
6127
- import { writeFileSync as writeFileSync4, unlinkSync as unlinkSync2, mkdirSync as mkdirSync4 } from "fs";
6128
6133
  function buildMcpCommands(backendId) {
6129
6134
  const exe = backendId;
6130
6135
  return {
6131
6136
  add: (server) => {
6132
6137
  const cmd = [exe, "mcp", "add"];
6133
- if (backendId === "codex") {
6134
- if (server.env && Object.keys(server.env).length > 0 && server.command) {
6135
- const wrapperPath = writeEnvWrapper(server);
6136
- cmd.push(server.name, "--", "sh", wrapperPath);
6137
- return cmd;
6138
- }
6139
- cmd.push(server.name);
6140
- if (server.transport === "stdio" && server.command) {
6141
- cmd.push("--", server.command, ...server.args ?? []);
6142
- }
6143
- return cmd;
6138
+ if (backendId === "gemini") {
6139
+ cmd.push("-s", "user");
6144
6140
  }
6145
- if (server.env) {
6141
+ if (backendId !== "codex" && server.env) {
6146
6142
  for (const [k, v] of Object.entries(server.env)) {
6147
6143
  cmd.push("-e", `${k}=${v}`);
6148
6144
  }
6149
6145
  }
6150
6146
  cmd.push(server.name);
6151
6147
  if (server.transport === "stdio" && server.command) {
6152
- if (backendId === "claude") {
6153
- cmd.push("--", server.command, ...server.args ?? []);
6154
- } else {
6148
+ if (backendId === "gemini") {
6155
6149
  cmd.push(server.command, ...server.args ?? []);
6150
+ } else {
6151
+ cmd.push("--", server.command, ...server.args ?? []);
6156
6152
  }
6157
6153
  }
6158
6154
  return cmd;
6159
6155
  },
6160
6156
  remove: (name) => {
6161
- try {
6162
- unlinkSync2(join8(CC_CLAW_HOME, "mcp-configs", `wrapper-${name}.sh`));
6163
- } catch {
6157
+ if (backendId === "gemini") {
6158
+ return [exe, "mcp", "remove", "-s", "user", name];
6164
6159
  }
6165
6160
  return [exe, "mcp", "remove", name];
6166
6161
  },
6167
6162
  list: () => [exe, "mcp", "list"]
6168
6163
  };
6169
6164
  }
6170
- function writeEnvWrapper(server) {
6171
- const dir = join8(CC_CLAW_HOME, "mcp-configs");
6172
- mkdirSync4(dir, { recursive: true, mode: 448 });
6173
- const lines = ["#!/bin/sh"];
6174
- for (const [k, v] of Object.entries(server.env ?? {})) {
6175
- lines.push(`export ${k}='${v.replace(/'/g, "'\\''")}'`);
6176
- }
6177
- lines.push(`exec ${server.command} ${(server.args ?? []).map((a) => `'${a.replace(/'/g, "'\\''")}'`).join(" ")}`);
6178
- const path = join8(dir, `wrapper-${server.name}.sh`);
6179
- writeFileSync4(path, lines.join("\n") + "\n", { mode: 448 });
6180
- return path;
6181
- }
6182
6165
  function wrapBackendAdapter(adapter) {
6183
6166
  const caps = BACKEND_CAPABILITIES[adapter.id] ?? {};
6184
6167
  const mcpCmds = buildMcpCommands(adapter.id);
@@ -6213,11 +6196,23 @@ function wrapBackendAdapter(adapter) {
6213
6196
  getMcpListCommand: () => mcpCmds.list(),
6214
6197
  prepareMcpInjection(server) {
6215
6198
  const method = caps.mcpInjection ?? "add-remove";
6216
- if (method === "config-file") {
6217
- const configPath = writeMcpConfigFile(server);
6218
- return ["--mcp-config", configPath];
6199
+ if (method !== "config-file") return [];
6200
+ if (adapter.id === "codex") {
6201
+ const safeName = server.name.replace(/[^a-zA-Z0-9_-]/g, "_");
6202
+ const args = [];
6203
+ args.push("-c", `mcp_servers.${safeName}.command="${server.command}"`);
6204
+ if (server.args?.length) {
6205
+ args.push("-c", `mcp_servers.${safeName}.args=${JSON.stringify(server.args)}`);
6206
+ }
6207
+ if (server.env) {
6208
+ for (const [k, v] of Object.entries(server.env)) {
6209
+ args.push("-c", `mcp_servers.${safeName}.env.${k}="${v}"`);
6210
+ }
6211
+ }
6212
+ return args;
6219
6213
  }
6220
- return [];
6214
+ const configPath = writeMcpConfigFile(server);
6215
+ return ["--mcp-config", configPath];
6221
6216
  },
6222
6217
  getSkillPath: () => join8(SKILLS_PATH, `agent-${adapter.id}.md`)
6223
6218
  };
@@ -6254,14 +6249,14 @@ var init_wrap_backend = __esm({
6254
6249
  supportsPermissionModes: true,
6255
6250
  maxConcurrentSessions: 4,
6256
6251
  specialties: ["code-generation", "refactoring"],
6257
- mcpInjection: "add-remove"
6252
+ mcpInjection: "config-file"
6258
6253
  }
6259
6254
  };
6260
6255
  }
6261
6256
  });
6262
6257
 
6263
6258
  // src/agents/runners/config-loader.ts
6264
- import { readFileSync as readFileSync6, readdirSync as readdirSync4, existsSync as existsSync9, mkdirSync as mkdirSync5, watchFile, unwatchFile } from "fs";
6259
+ import { readFileSync as readFileSync6, readdirSync as readdirSync4, existsSync as existsSync9, mkdirSync as mkdirSync4, watchFile, unwatchFile } from "fs";
6265
6260
  import { join as join9 } from "path";
6266
6261
  import { execFileSync } from "child_process";
6267
6262
  function resolveExecutable(config2) {
@@ -6412,7 +6407,7 @@ function loadRunnerConfig(filePath) {
6412
6407
  }
6413
6408
  function loadAllRunnerConfigs() {
6414
6409
  if (!existsSync9(RUNNERS_PATH)) {
6415
- mkdirSync5(RUNNERS_PATH, { recursive: true });
6410
+ mkdirSync4(RUNNERS_PATH, { recursive: true });
6416
6411
  return [];
6417
6412
  }
6418
6413
  const files = readdirSync4(RUNNERS_PATH).filter((f) => f.endsWith(".json"));
@@ -7294,7 +7289,7 @@ var init_install = __esm({
7294
7289
  });
7295
7290
 
7296
7291
  // src/bootstrap/profile.ts
7297
- import { readFileSync as readFileSync7, writeFileSync as writeFileSync5, existsSync as existsSync11 } from "fs";
7292
+ import { readFileSync as readFileSync7, writeFileSync as writeFileSync4, existsSync as existsSync11 } from "fs";
7298
7293
  import { join as join12 } from "path";
7299
7294
  function hasActiveProfile(chatId) {
7300
7295
  return activeProfiles.has(chatId);
@@ -7398,7 +7393,7 @@ async function finalizeProfile(chatId, state, channel) {
7398
7393
  "<!-- Add any additional preferences below this line -->",
7399
7394
  ""
7400
7395
  ].join("\n");
7401
- writeFileSync5(USER_PATH3, content, "utf-8");
7396
+ writeFileSync4(USER_PATH3, content, "utf-8");
7402
7397
  activeProfiles.delete(chatId);
7403
7398
  log(`[profile] User profile saved for chat ${chatId}`);
7404
7399
  await channel.sendText(
@@ -7431,7 +7426,7 @@ function appendToUserProfile(key, value) {
7431
7426
  const updated = content.trimEnd() + `
7432
7427
  ${line}
7433
7428
  `;
7434
- writeFileSync5(USER_PATH3, updated, "utf-8");
7429
+ writeFileSync4(USER_PATH3, updated, "utf-8");
7435
7430
  log(`[profile] Appended preference: ${key}=${value}`);
7436
7431
  }
7437
7432
  var USER_PATH3, activeProfiles;
@@ -10771,7 +10766,7 @@ __export(ai_skill_exports, {
10771
10766
  generateAiSkill: () => generateAiSkill,
10772
10767
  installAiSkill: () => installAiSkill
10773
10768
  });
10774
- import { existsSync as existsSync14, writeFileSync as writeFileSync6, mkdirSync as mkdirSync6 } from "fs";
10769
+ import { existsSync as existsSync14, writeFileSync as writeFileSync5, mkdirSync as mkdirSync5 } from "fs";
10775
10770
  import { join as join15 } from "path";
10776
10771
  import { homedir as homedir3 } from "os";
10777
10772
  function generateAiSkill() {
@@ -11003,8 +10998,8 @@ function installAiSkill() {
11003
10998
  const skillDir = join15(dir, "cc-claw-cli");
11004
10999
  const skillPath = join15(skillDir, "SKILL.md");
11005
11000
  try {
11006
- mkdirSync6(skillDir, { recursive: true });
11007
- writeFileSync6(skillPath, skill, "utf-8");
11001
+ mkdirSync5(skillDir, { recursive: true });
11002
+ writeFileSync5(skillPath, skill, "utf-8");
11008
11003
  installed.push(skillPath);
11009
11004
  } catch {
11010
11005
  failed.push(skillPath);
@@ -11033,7 +11028,7 @@ var index_exports = {};
11033
11028
  __export(index_exports, {
11034
11029
  main: () => main
11035
11030
  });
11036
- import { mkdirSync as mkdirSync7, existsSync as existsSync15, renameSync, statSync as statSync3 } from "fs";
11031
+ import { mkdirSync as mkdirSync6, existsSync as existsSync15, renameSync, statSync as statSync3 } from "fs";
11037
11032
  import { join as join16 } from "path";
11038
11033
  import dotenv from "dotenv";
11039
11034
  function migrateLayout() {
@@ -11131,11 +11126,11 @@ async function main() {
11131
11126
  bootstrapSkills().catch((err) => error("[cc-claw] Skill bootstrap failed:", err));
11132
11127
  try {
11133
11128
  const { generateAiSkill: generateAiSkill2 } = await Promise.resolve().then(() => (init_ai_skill(), ai_skill_exports));
11134
- const { writeFileSync: writeFileSync9, mkdirSync: mkdirSync11 } = await import("fs");
11129
+ const { writeFileSync: writeFileSync8, mkdirSync: mkdirSync10 } = await import("fs");
11135
11130
  const { join: join19 } = await import("path");
11136
11131
  const skillDir = join19(SKILLS_PATH, "cc-claw-cli");
11137
- mkdirSync11(skillDir, { recursive: true });
11138
- writeFileSync9(join19(skillDir, "SKILL.md"), generateAiSkill2(), "utf-8");
11132
+ mkdirSync10(skillDir, { recursive: true });
11133
+ writeFileSync8(join19(skillDir, "SKILL.md"), generateAiSkill2(), "utf-8");
11139
11134
  log("[cc-claw] AI skill updated");
11140
11135
  } catch {
11141
11136
  }
@@ -11191,7 +11186,7 @@ var init_index = __esm({
11191
11186
  init_bootstrap2();
11192
11187
  init_health2();
11193
11188
  for (const dir of [CC_CLAW_HOME, DATA_PATH, LOGS_PATH, SKILLS_PATH, RUNNERS_PATH, AGENTS_PATH]) {
11194
- if (!existsSync15(dir)) mkdirSync7(dir, { recursive: true });
11189
+ if (!existsSync15(dir)) mkdirSync6(dir, { recursive: true });
11195
11190
  }
11196
11191
  migrateLayout();
11197
11192
  if (existsSync15(ENV_PATH)) {
@@ -11215,7 +11210,7 @@ __export(service_exports, {
11215
11210
  serviceStatus: () => serviceStatus,
11216
11211
  uninstallService: () => uninstallService
11217
11212
  });
11218
- import { existsSync as existsSync16, mkdirSync as mkdirSync8, writeFileSync as writeFileSync7, unlinkSync as unlinkSync3 } from "fs";
11213
+ import { existsSync as existsSync16, mkdirSync as mkdirSync7, writeFileSync as writeFileSync6, unlinkSync as unlinkSync2 } from "fs";
11219
11214
  import { execFileSync as execFileSync2, execSync as execSync5 } from "child_process";
11220
11215
  import { homedir as homedir4, platform } from "os";
11221
11216
  import { join as join17, dirname as dirname4 } from "path";
@@ -11293,15 +11288,15 @@ function generatePlist() {
11293
11288
  }
11294
11289
  function installMacOS() {
11295
11290
  const agentsDir = dirname4(PLIST_PATH);
11296
- if (!existsSync16(agentsDir)) mkdirSync8(agentsDir, { recursive: true });
11297
- if (!existsSync16(LOGS_PATH)) mkdirSync8(LOGS_PATH, { recursive: true });
11291
+ if (!existsSync16(agentsDir)) mkdirSync7(agentsDir, { recursive: true });
11292
+ if (!existsSync16(LOGS_PATH)) mkdirSync7(LOGS_PATH, { recursive: true });
11298
11293
  if (existsSync16(PLIST_PATH)) {
11299
11294
  try {
11300
11295
  execFileSync2("launchctl", ["unload", PLIST_PATH]);
11301
11296
  } catch {
11302
11297
  }
11303
11298
  }
11304
- writeFileSync7(PLIST_PATH, generatePlist());
11299
+ writeFileSync6(PLIST_PATH, generatePlist());
11305
11300
  console.log(` Installed: ${PLIST_PATH}`);
11306
11301
  execFileSync2("launchctl", ["load", PLIST_PATH]);
11307
11302
  console.log(" Service loaded and starting.");
@@ -11315,7 +11310,7 @@ function uninstallMacOS() {
11315
11310
  execFileSync2("launchctl", ["unload", PLIST_PATH]);
11316
11311
  } catch {
11317
11312
  }
11318
- unlinkSync3(PLIST_PATH);
11313
+ unlinkSync2(PLIST_PATH);
11319
11314
  console.log(" Service uninstalled.");
11320
11315
  }
11321
11316
  function statusMacOS() {
@@ -11358,9 +11353,9 @@ WantedBy=default.target
11358
11353
  `;
11359
11354
  }
11360
11355
  function installLinux() {
11361
- if (!existsSync16(SYSTEMD_DIR)) mkdirSync8(SYSTEMD_DIR, { recursive: true });
11362
- if (!existsSync16(LOGS_PATH)) mkdirSync8(LOGS_PATH, { recursive: true });
11363
- writeFileSync7(UNIT_PATH, generateUnit());
11356
+ if (!existsSync16(SYSTEMD_DIR)) mkdirSync7(SYSTEMD_DIR, { recursive: true });
11357
+ if (!existsSync16(LOGS_PATH)) mkdirSync7(LOGS_PATH, { recursive: true });
11358
+ writeFileSync6(UNIT_PATH, generateUnit());
11364
11359
  console.log(` Installed: ${UNIT_PATH}`);
11365
11360
  execFileSync2("systemctl", ["--user", "daemon-reload"]);
11366
11361
  execFileSync2("systemctl", ["--user", "enable", "cc-claw"]);
@@ -11380,7 +11375,7 @@ function uninstallLinux() {
11380
11375
  execFileSync2("systemctl", ["--user", "disable", "cc-claw"]);
11381
11376
  } catch {
11382
11377
  }
11383
- unlinkSync3(UNIT_PATH);
11378
+ unlinkSync2(UNIT_PATH);
11384
11379
  execFileSync2("systemctl", ["--user", "daemon-reload"]);
11385
11380
  console.log(" Service uninstalled.");
11386
11381
  }
@@ -12014,7 +12009,7 @@ async function doctorCommand(globalOpts, localOpts) {
12014
12009
  const r = d;
12015
12010
  const lines = [
12016
12011
  "",
12017
- box("CC-Claw Doctor"),
12012
+ box(`CC-Claw Doctor v${VERSION}`),
12018
12013
  ""
12019
12014
  ];
12020
12015
  for (const c of r.checks) {
@@ -12044,6 +12039,7 @@ var init_doctor = __esm({
12044
12039
  "use strict";
12045
12040
  init_format();
12046
12041
  init_paths();
12042
+ init_version();
12047
12043
  }
12048
12044
  });
12049
12045
 
@@ -12758,7 +12754,7 @@ __export(db_exports, {
12758
12754
  dbPath: () => dbPath,
12759
12755
  dbStats: () => dbStats
12760
12756
  });
12761
- import { existsSync as existsSync26, statSync as statSync6, copyFileSync, mkdirSync as mkdirSync9 } from "fs";
12757
+ import { existsSync as existsSync26, statSync as statSync6, copyFileSync, mkdirSync as mkdirSync8 } from "fs";
12762
12758
  import { dirname as dirname5 } from "path";
12763
12759
  async function dbStats(globalOpts) {
12764
12760
  if (!existsSync26(DB_PATH)) {
@@ -12809,7 +12805,7 @@ async function dbBackup(globalOpts, destPath) {
12809
12805
  }
12810
12806
  const dest = destPath ?? `${DB_PATH}.backup-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-")}`;
12811
12807
  try {
12812
- mkdirSync9(dirname5(dest), { recursive: true });
12808
+ mkdirSync8(dirname5(dest), { recursive: true });
12813
12809
  copyFileSync(DB_PATH, dest);
12814
12810
  const walPath = DB_PATH + "-wal";
12815
12811
  if (existsSync26(walPath)) copyFileSync(walPath, dest + "-wal");
@@ -14205,7 +14201,7 @@ var init_completion = __esm({
14205
14201
 
14206
14202
  // src/setup.ts
14207
14203
  var setup_exports = {};
14208
- import { existsSync as existsSync37, writeFileSync as writeFileSync8, readFileSync as readFileSync16, copyFileSync as copyFileSync2, mkdirSync as mkdirSync10, statSync as statSync7 } from "fs";
14204
+ import { existsSync as existsSync37, writeFileSync as writeFileSync7, readFileSync as readFileSync16, copyFileSync as copyFileSync2, mkdirSync as mkdirSync9, statSync as statSync7 } from "fs";
14209
14205
  import { execFileSync as execFileSync4 } from "child_process";
14210
14206
  import { createInterface as createInterface5 } from "readline";
14211
14207
  import { join as join18 } from "path";
@@ -14282,7 +14278,7 @@ async function setup() {
14282
14278
  }
14283
14279
  console.log("");
14284
14280
  for (const dir of [CC_CLAW_HOME, DATA_PATH, LOGS_PATH, SKILLS_PATH, RUNNERS_PATH, AGENTS_PATH]) {
14285
- if (!existsSync37(dir)) mkdirSync10(dir, { recursive: true });
14281
+ if (!existsSync37(dir)) mkdirSync9(dir, { recursive: true });
14286
14282
  }
14287
14283
  const env = {};
14288
14284
  const envSource = existsSync37(ENV_PATH) ? ENV_PATH : existsSync37(".env") ? ".env" : null;
@@ -14490,7 +14486,7 @@ async function setup() {
14490
14486
  envLines.push("", "# Video Analysis", `GEMINI_API_KEY=${env.GEMINI_API_KEY}`);
14491
14487
  }
14492
14488
  const envContent = envLines.join("\n") + "\n";
14493
- writeFileSync8(ENV_PATH, envContent, { mode: 384 });
14489
+ writeFileSync7(ENV_PATH, envContent, { mode: 384 });
14494
14490
  console.log(green(` Config saved to ${ENV_PATH} (permissions: owner-only)`));
14495
14491
  header(6, TOTAL_STEPS, "Run on Startup (Daemon)");
14496
14492
  console.log(" CC-Claw can run automatically in the background, starting");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-claw",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
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",