@slock-ai/daemon 0.37.1-alpha.0 → 0.38.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.
@@ -973,7 +973,7 @@ server.tool(
973
973
  1. By task number: claim existing tasks shown in list_tasks. Use task_numbers=[1, 3].
974
974
  2. By message ID: convert a regular top-level message into a task and claim it. Use message_ids=["a1b2c3d4"]. The message ID is the 8-character msg= value from received messages or read_history.
975
975
 
976
- Thread messages and system messages (e.g. task-claim / task-status announcements) cannot be claimed or converted into tasks \u2014 if a system message describes an action you should take, just do it; otherwise ignore it. If a task is in "todo" status, claiming auto-advances it to "in_progress". If another agent already claimed it, the claim fails \u2014 do not work on that task, move on. Always claim before starting any work to prevent duplicate effort.`,
976
+ Thread messages cannot be claimed or converted into tasks. If a task is in "todo" status, claiming auto-advances it to "in_progress". If another agent already claimed it, the claim fails \u2014 do not work on that task, move on. Always claim before starting any work to prevent duplicate effort.`,
977
977
  {
978
978
  channel: z.string().describe("The channel \u2014 e.g. '#engineering'"),
979
979
  task_numbers: z.array(z.number()).optional().describe("Task numbers to claim (from list_tasks output, e.g. [1, 3])"),
@@ -7,6 +7,7 @@ import {
7
7
  import path10 from "path";
8
8
  import os4 from "os";
9
9
  import { createRequire } from "module";
10
+ import { execSync as execSync2 } from "child_process";
10
11
  import { accessSync } from "fs";
11
12
  import { fileURLToPath } from "url";
12
13
 
@@ -231,7 +232,7 @@ var RUNTIMES = [
231
232
  { id: "codex", displayName: "Codex CLI", binary: "codex", supported: true },
232
233
  { id: "kimi", displayName: "Kimi CLI", binary: "kimi", supported: true },
233
234
  { id: "copilot", displayName: "Copilot CLI", binary: "copilot", supported: true },
234
- { id: "cursor", displayName: "Cursor CLI", binary: "cursor-agent", supported: true },
235
+ { id: "cursor", displayName: "Cursor CLI", binary: "agent", supported: true },
235
236
  { id: "gemini", displayName: "Gemini CLI", binary: "gemini", supported: true }
236
237
  ];
237
238
  var PLAN_CONFIG = {
@@ -352,8 +353,6 @@ Header fields:
352
353
  - \`time=\` \u2014 timestamp.
353
354
  - \`type=\` \u2014 sender kind. Values are \`human\`, \`agent\`, or \`system\`.
354
355
 
355
- \`type=system\` messages announce state changes in the channel (task events, channel archived/unarchived, etc.). They are informational \u2014 don't reply to them unless they clearly request action (e.g. a task was just assigned to you). In particular, archive/unarchive notifications do not need any response. If a channel is archived, further writes there will be rejected.
356
-
357
356
  ### Sending messages
358
357
 
359
358
  - **Reply to a channel**: \`send_message(target="#channel-name", content="...")\`
@@ -591,34 +590,11 @@ import path from "path";
591
590
  function normalizeExecOutput(raw) {
592
591
  return Buffer.isBuffer(raw) ? raw.toString("utf8") : String(raw ?? "");
593
592
  }
594
- function resolveCommandOnWindows(command, env, execFileSyncFn) {
595
- const script = "$cmd = Get-Command -Name $args[0] -ErrorAction Stop | Select-Object -First 1; if ($cmd.Path) { $cmd.Path } elseif ($cmd.Source) { $cmd.Source } elseif ($cmd.Definition) { $cmd.Definition }";
596
- try {
597
- const output = normalizeExecOutput(execFileSyncFn("powershell.exe", [
598
- "-NoProfile",
599
- "-NonInteractive",
600
- "-Command",
601
- script,
602
- "--%",
603
- command
604
- ], {
605
- stdio: ["ignore", "pipe", "ignore"],
606
- env
607
- }));
608
- const resolved = output.trim().split(/\r?\n/)[0];
609
- return resolved || command;
610
- } catch {
611
- return null;
612
- }
613
- }
614
593
  function resolveCommandOnPath(command, deps = {}) {
615
594
  const platform = deps.platform ?? process.platform;
616
595
  const env = deps.env ?? process.env;
617
596
  const execFileSyncFn = deps.execFileSyncFn ?? execFileSync;
618
- if (platform === "win32") {
619
- return resolveCommandOnWindows(command, env, execFileSyncFn);
620
- }
621
- const locator = "which";
597
+ const locator = platform === "win32" ? "where" : "which";
622
598
  try {
623
599
  const output = normalizeExecOutput(execFileSyncFn(locator, [command], {
624
600
  stdio: ["ignore", "pipe", "ignore"],
@@ -1490,7 +1466,7 @@ var CursorDriver = class {
1490
1466
  }
1491
1467
  args.push(ctx.prompt);
1492
1468
  const spawnEnv = { ...process.env, FORCE_COLOR: "0", NO_COLOR: "1", ...ctx.config.envVars || {} };
1493
- const proc = spawn4("cursor-agent", args, {
1469
+ const proc = spawn4("agent", args, {
1494
1470
  cwd: ctx.workingDirectory,
1495
1471
  stdio: ["pipe", "pipe", "pipe"],
1496
1472
  env: spawnEnv,
@@ -2180,15 +2156,13 @@ var AgentProcessManager = class _AgentProcessManager {
2180
2156
  chatBridgePath;
2181
2157
  sendToServer;
2182
2158
  daemonApiKey;
2183
- serverUrl;
2184
2159
  dataDir;
2185
2160
  driverResolver;
2186
2161
  defaultAgentEnvVarsProvider;
2187
- constructor(chatBridgePath, sendToServer, daemonApiKey, opts) {
2162
+ constructor(chatBridgePath, sendToServer, daemonApiKey, opts = {}) {
2188
2163
  this.chatBridgePath = chatBridgePath;
2189
2164
  this.sendToServer = sendToServer;
2190
2165
  this.daemonApiKey = daemonApiKey;
2191
- this.serverUrl = opts.serverUrl;
2192
2166
  this.dataDir = opts.dataDir || DATA_DIR;
2193
2167
  this.driverResolver = opts.driverResolver || getDriver;
2194
2168
  this.defaultAgentEnvVarsProvider = opts.defaultAgentEnvVarsProvider || null;
@@ -2443,28 +2417,27 @@ Use read_history to catch up on the channels listed above, then stop. Read each
2443
2417
  }
2444
2418
  }
2445
2419
  async buildSpawnConfig(agentId, config) {
2446
- const baseConfig = config.serverUrl === this.serverUrl ? config : { ...config, serverUrl: this.serverUrl };
2447
2420
  if (!this.defaultAgentEnvVarsProvider) {
2448
- return baseConfig;
2421
+ return config;
2449
2422
  }
2450
2423
  try {
2451
2424
  const defaultEnvVars = await this.defaultAgentEnvVarsProvider({
2452
- runtime: baseConfig.runtime,
2453
- model: baseConfig.model,
2454
- envVars: baseConfig.envVars
2425
+ runtime: config.runtime,
2426
+ model: config.model,
2427
+ envVars: config.envVars
2455
2428
  });
2456
2429
  if (!defaultEnvVars || Object.keys(defaultEnvVars).length === 0) {
2457
- return baseConfig;
2430
+ return config;
2458
2431
  }
2459
2432
  const mergedEnvVars = {
2460
2433
  ...defaultEnvVars,
2461
- ...baseConfig.envVars ?? {}
2434
+ ...config.envVars ?? {}
2462
2435
  };
2463
- if (this.sameEnvVars(mergedEnvVars, baseConfig.envVars)) {
2464
- return baseConfig;
2436
+ if (this.sameEnvVars(mergedEnvVars, config.envVars)) {
2437
+ return config;
2465
2438
  }
2466
2439
  return {
2467
- ...baseConfig,
2440
+ ...config,
2468
2441
  envVars: mergedEnvVars
2469
2442
  };
2470
2443
  } catch (error) {
@@ -2472,7 +2445,7 @@ Use read_history to catch up on the channels listed above, then stop. Read each
2472
2445
  logger.warn(
2473
2446
  `[Agent ${agentId}] Failed to resolve default runtime env vars \u2014 continuing without machine-level defaults (${reason})`
2474
2447
  );
2475
- return baseConfig;
2448
+ return config;
2476
2449
  }
2477
2450
  }
2478
2451
  sameEnvVars(left, right) {
@@ -3149,6 +3122,7 @@ function resolveChatBridgePath(moduleUrl = import.meta.url) {
3149
3122
  function detectRuntimes() {
3150
3123
  const ids = [];
3151
3124
  const versions = {};
3125
+ const cmd = process.platform === "win32" ? "where" : "which";
3152
3126
  for (const runtime of RUNTIMES) {
3153
3127
  try {
3154
3128
  const probe = getDriver(runtime.id).probe?.();
@@ -3159,16 +3133,15 @@ function detectRuntimes() {
3159
3133
  }
3160
3134
  } catch {
3161
3135
  }
3162
- const detectionBinaries = [runtime.binary];
3163
- for (const binary of detectionBinaries) {
3164
- const resolved = resolveCommandOnPath(binary);
3165
- if (!resolved) continue;
3136
+ try {
3137
+ execSync2(`${cmd} ${runtime.binary}`, { stdio: "pipe" });
3166
3138
  ids.push(runtime.id);
3167
- const version = readCommandVersion(binary);
3168
- if (version) {
3139
+ try {
3140
+ const version = execSync2(`${runtime.binary} --version`, { stdio: "pipe", timeout: 5e3 }).toString().trim().split("\n")[0];
3169
3141
  versions[runtime.id] = version;
3142
+ } catch {
3170
3143
  }
3171
- break;
3144
+ } catch {
3172
3145
  }
3173
3146
  }
3174
3147
  return { ids, versions };
@@ -3215,7 +3188,6 @@ var DaemonCore = class {
3215
3188
  let connection;
3216
3189
  const agentManagerOptions = {
3217
3190
  dataDir: options.dataDir,
3218
- serverUrl: options.serverUrl,
3219
3191
  defaultAgentEnvVarsProvider: options.defaultAgentEnvVarsProvider
3220
3192
  };
3221
3193
  this.agentManager = options.agentManagerFactory ? options.agentManagerFactory(this.chatBridgePath, (msg) => connection.send(msg), options.apiKey, agentManagerOptions) : new AgentProcessManager(this.chatBridgePath, (msg) => connection.send(msg), options.apiKey, agentManagerOptions);
package/dist/core.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  resolveChatBridgePath,
9
9
  resolveWorkspaceDirectoryPath,
10
10
  scanWorkspaceDirectories
11
- } from "./chunk-72UW4SIL.js";
11
+ } from "./chunk-GCL6DIFU.js";
12
12
  import {
13
13
  subscribeDaemonLogs
14
14
  } from "./chunk-E6OOH3IC.js";
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  DAEMON_CLI_USAGE,
4
4
  DaemonCore,
5
5
  parseDaemonCliArgs
6
- } from "./chunk-72UW4SIL.js";
6
+ } from "./chunk-GCL6DIFU.js";
7
7
  import "./chunk-E6OOH3IC.js";
8
8
 
9
9
  // src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slock-ai/daemon",
3
- "version": "0.37.1-alpha.0",
3
+ "version": "0.38.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "slock-daemon": "dist/index.js"