@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.
- package/dist/chat-bridge.js +1 -1
- package/dist/{chunk-72UW4SIL.js → chunk-GCL6DIFU.js} +22 -50
- package/dist/core.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/chat-bridge.js
CHANGED
|
@@ -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
|
|
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: "
|
|
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
|
-
|
|
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("
|
|
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
|
|
2421
|
+
return config;
|
|
2449
2422
|
}
|
|
2450
2423
|
try {
|
|
2451
2424
|
const defaultEnvVars = await this.defaultAgentEnvVarsProvider({
|
|
2452
|
-
runtime:
|
|
2453
|
-
model:
|
|
2454
|
-
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
|
|
2430
|
+
return config;
|
|
2458
2431
|
}
|
|
2459
2432
|
const mergedEnvVars = {
|
|
2460
2433
|
...defaultEnvVars,
|
|
2461
|
-
...
|
|
2434
|
+
...config.envVars ?? {}
|
|
2462
2435
|
};
|
|
2463
|
-
if (this.sameEnvVars(mergedEnvVars,
|
|
2464
|
-
return
|
|
2436
|
+
if (this.sameEnvVars(mergedEnvVars, config.envVars)) {
|
|
2437
|
+
return config;
|
|
2465
2438
|
}
|
|
2466
2439
|
return {
|
|
2467
|
-
...
|
|
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
|
|
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
|
-
|
|
3163
|
-
|
|
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
|
-
|
|
3168
|
-
|
|
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
|
-
|
|
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
package/dist/index.js
CHANGED