@botiverse/raft-daemon 0.63.2-play.20260620140456 → 0.63.3
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/{chunk-COT7JNSQ.js → chunk-RZHNJV7U.js} +25 -127
- package/dist/core.js +1 -5
- package/dist/index.js +3 -5
- package/package.json +1 -1
|
@@ -2582,19 +2582,6 @@ function listLegacySlockStatePaths(slockHome = resolveSlockHome(), homeDir = os.
|
|
|
2582
2582
|
return candidates.filter((candidate) => existsSync(candidate.path));
|
|
2583
2583
|
}
|
|
2584
2584
|
|
|
2585
|
-
// src/authEnv.ts
|
|
2586
|
-
var DAEMON_API_KEY_ENV = "SLOCK_MACHINE_API_KEY";
|
|
2587
|
-
var SLOCK_AGENT_TOKEN_ENV = "SLOCK_AGENT_TOKEN";
|
|
2588
|
-
function scrubDaemonAuthEnv(env) {
|
|
2589
|
-
delete env[DAEMON_API_KEY_ENV];
|
|
2590
|
-
return env;
|
|
2591
|
-
}
|
|
2592
|
-
function scrubDaemonChildEnv(env) {
|
|
2593
|
-
delete env[DAEMON_API_KEY_ENV];
|
|
2594
|
-
delete env[SLOCK_AGENT_TOKEN_ENV];
|
|
2595
|
-
return env;
|
|
2596
|
-
}
|
|
2597
|
-
|
|
2598
2585
|
// src/agentCredentialProxy.ts
|
|
2599
2586
|
import { randomBytes } from "crypto";
|
|
2600
2587
|
import http from "http";
|
|
@@ -4161,9 +4148,7 @@ var LOOPBACK_NO_PROXY = "127.0.0.1,localhost";
|
|
|
4161
4148
|
var CLI_TRANSPORT_TRACE_DIR_ENV = "SLOCK_CLI_TRANSPORT_TRACE_DIR";
|
|
4162
4149
|
var safePathPart = (value) => value.replace(/[^a-zA-Z0-9_.-]/g, "_");
|
|
4163
4150
|
var RAW_CREDENTIAL_ENV_DENYLIST = [
|
|
4164
|
-
"
|
|
4165
|
-
"SLOCK_AGENT_CREDENTIAL_KEY",
|
|
4166
|
-
"SLOCK_AGENT_CREDENTIAL_KEY_FILE"
|
|
4151
|
+
"SLOCK_AGENT_CREDENTIAL_KEY"
|
|
4167
4152
|
];
|
|
4168
4153
|
var WORKSPACE_CLI_TRANSPORT_FILENAMES = [
|
|
4169
4154
|
"agent-token",
|
|
@@ -4515,7 +4500,7 @@ set "SLOCK_AGENT_ACTIVE_CAPABILITIES=${DEFAULT_ACTIVE_CAPABILITIES}"\r
|
|
|
4515
4500
|
SLOCK_SERVER_URL: ctx.config.serverUrl,
|
|
4516
4501
|
PATH: `${slockDir}${path2.delimiter}${process.env.PATH ?? ""}`
|
|
4517
4502
|
};
|
|
4518
|
-
|
|
4503
|
+
delete spawnEnv.SLOCK_AGENT_TOKEN;
|
|
4519
4504
|
for (const key of RAW_CREDENTIAL_ENV_DENYLIST) {
|
|
4520
4505
|
delete spawnEnv[key];
|
|
4521
4506
|
}
|
|
@@ -5037,7 +5022,7 @@ function requiresWindowsShell(command, platform = process.platform) {
|
|
|
5037
5022
|
}
|
|
5038
5023
|
function resolveCommandOnPath(command, deps = {}) {
|
|
5039
5024
|
const platform = deps.platform ?? process.platform;
|
|
5040
|
-
const env =
|
|
5025
|
+
const env = withWindowsUserEnvironment(deps.env ?? process.env, deps);
|
|
5041
5026
|
const execFileSyncFn = deps.execFileSyncFn ?? execFileSync;
|
|
5042
5027
|
const existsSyncFn = deps.existsSyncFn ?? existsSync3;
|
|
5043
5028
|
if (platform === "win32") {
|
|
@@ -5063,7 +5048,7 @@ function firstExistingPath(candidates, deps = {}) {
|
|
|
5063
5048
|
return null;
|
|
5064
5049
|
}
|
|
5065
5050
|
function readCommandVersion(command, args = [], deps = {}) {
|
|
5066
|
-
const env =
|
|
5051
|
+
const env = withWindowsUserEnvironment(deps.env ?? process.env, deps);
|
|
5067
5052
|
const execFileSyncFn = deps.execFileSyncFn ?? execFileSync;
|
|
5068
5053
|
try {
|
|
5069
5054
|
const output = normalizeExecOutput(execFileSyncFn(command, [...args, "--version"], {
|
|
@@ -7143,11 +7128,11 @@ function detectCursorModels(runCommand = runCursorModelsCommand) {
|
|
|
7143
7128
|
return parseCursorModelsOutput(String(result.stdout || ""));
|
|
7144
7129
|
}
|
|
7145
7130
|
function buildCursorModelProbeEnv(deps = {}) {
|
|
7146
|
-
return
|
|
7131
|
+
return withWindowsUserEnvironment({
|
|
7147
7132
|
...deps.env ?? process.env,
|
|
7148
7133
|
FORCE_COLOR: "0",
|
|
7149
7134
|
NO_COLOR: "1"
|
|
7150
|
-
}, deps)
|
|
7135
|
+
}, deps);
|
|
7151
7136
|
}
|
|
7152
7137
|
function runCursorModelsCommand() {
|
|
7153
7138
|
return spawnSync("cursor-agent", ["models"], {
|
|
@@ -7203,7 +7188,7 @@ function resolveGeminiSpawn(commandArgs, deps = {}) {
|
|
|
7203
7188
|
}
|
|
7204
7189
|
const execFileSyncFn = deps.execFileSyncFn ?? execFileSync3;
|
|
7205
7190
|
const existsSyncFn = deps.existsSyncFn ?? existsSync5;
|
|
7206
|
-
const env =
|
|
7191
|
+
const env = deps.env ?? process.env;
|
|
7207
7192
|
const winPath = path8.win32;
|
|
7208
7193
|
let geminiEntry = null;
|
|
7209
7194
|
try {
|
|
@@ -7340,15 +7325,12 @@ var GeminiDriver = class {
|
|
|
7340
7325
|
// src/drivers/kimi.ts
|
|
7341
7326
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
7342
7327
|
import { spawn as spawn7 } from "child_process";
|
|
7343
|
-
import {
|
|
7328
|
+
import { existsSync as existsSync6, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
7344
7329
|
import os4 from "os";
|
|
7345
7330
|
import path9 from "path";
|
|
7346
7331
|
var KIMI_WIRE_PROTOCOL_VERSION = "1.3";
|
|
7347
7332
|
var KIMI_SYSTEM_PROMPT_FILE = ".slock-kimi-system.md";
|
|
7348
7333
|
var KIMI_AGENT_FILE = ".slock-kimi-agent.yaml";
|
|
7349
|
-
var KIMI_GENERATED_CONFIG_FILE = ".slock-kimi-config.toml";
|
|
7350
|
-
var SLOCK_KIMI_CONFIG_CONTENT_ENV = "SLOCK_KIMI_CONFIG_CONTENT";
|
|
7351
|
-
var SLOCK_KIMI_CONFIG_FILE_ENV = "SLOCK_KIMI_CONFIG_FILE";
|
|
7352
7334
|
function parseToolArguments(raw) {
|
|
7353
7335
|
if (typeof raw !== "string") return raw;
|
|
7354
7336
|
try {
|
|
@@ -7357,73 +7339,6 @@ function parseToolArguments(raw) {
|
|
|
7357
7339
|
return raw;
|
|
7358
7340
|
}
|
|
7359
7341
|
}
|
|
7360
|
-
function readKimiConfigSource(home = os4.homedir(), env = process.env) {
|
|
7361
|
-
const inlineConfig = env[SLOCK_KIMI_CONFIG_CONTENT_ENV];
|
|
7362
|
-
if (inlineConfig && inlineConfig.trim()) {
|
|
7363
|
-
return {
|
|
7364
|
-
raw: inlineConfig,
|
|
7365
|
-
explicitPath: null,
|
|
7366
|
-
sourcePath: SLOCK_KIMI_CONFIG_CONTENT_ENV
|
|
7367
|
-
};
|
|
7368
|
-
}
|
|
7369
|
-
const explicitPath = env[SLOCK_KIMI_CONFIG_FILE_ENV];
|
|
7370
|
-
const configPath = explicitPath && explicitPath.trim() ? explicitPath : path9.join(home, ".kimi", "config.toml");
|
|
7371
|
-
try {
|
|
7372
|
-
return {
|
|
7373
|
-
raw: readFileSync3(configPath, "utf8"),
|
|
7374
|
-
explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
|
|
7375
|
-
sourcePath: configPath
|
|
7376
|
-
};
|
|
7377
|
-
} catch {
|
|
7378
|
-
return {
|
|
7379
|
-
raw: null,
|
|
7380
|
-
explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
|
|
7381
|
-
sourcePath: configPath
|
|
7382
|
-
};
|
|
7383
|
-
}
|
|
7384
|
-
}
|
|
7385
|
-
function buildKimiSpawnEnv(env = process.env) {
|
|
7386
|
-
const spawnEnv = { ...env, FORCE_COLOR: "0", NO_COLOR: "1" };
|
|
7387
|
-
delete spawnEnv[SLOCK_KIMI_CONFIG_CONTENT_ENV];
|
|
7388
|
-
delete spawnEnv[SLOCK_KIMI_CONFIG_FILE_ENV];
|
|
7389
|
-
return scrubDaemonChildEnv(spawnEnv);
|
|
7390
|
-
}
|
|
7391
|
-
function buildKimiEffectiveEnv(ctx, overrideEnv) {
|
|
7392
|
-
return {
|
|
7393
|
-
...process.env,
|
|
7394
|
-
...ctx.config.envVars || {},
|
|
7395
|
-
...overrideEnv || {}
|
|
7396
|
-
};
|
|
7397
|
-
}
|
|
7398
|
-
function buildKimiLaunchOptions(ctx, opts = {}) {
|
|
7399
|
-
const env = buildKimiEffectiveEnv(ctx, opts.env);
|
|
7400
|
-
const source = readKimiConfigSource(opts.home ?? os4.homedir(), env);
|
|
7401
|
-
const args = [];
|
|
7402
|
-
let configFilePath = null;
|
|
7403
|
-
let configContent = null;
|
|
7404
|
-
if (source.explicitPath) {
|
|
7405
|
-
configFilePath = source.explicitPath;
|
|
7406
|
-
} else if (source.raw !== null && source.sourcePath === SLOCK_KIMI_CONFIG_CONTENT_ENV) {
|
|
7407
|
-
configFilePath = path9.join(ctx.workingDirectory, KIMI_GENERATED_CONFIG_FILE);
|
|
7408
|
-
configContent = source.raw;
|
|
7409
|
-
if (opts.writeGeneratedConfig !== false) {
|
|
7410
|
-
writeFileSync3(configFilePath, source.raw, { encoding: "utf8", mode: 384 });
|
|
7411
|
-
chmodSync(configFilePath, 384);
|
|
7412
|
-
}
|
|
7413
|
-
}
|
|
7414
|
-
if (configFilePath) {
|
|
7415
|
-
args.push("--config-file", configFilePath);
|
|
7416
|
-
}
|
|
7417
|
-
if (ctx.config.model && ctx.config.model !== "default") {
|
|
7418
|
-
args.push("--model", ctx.config.model);
|
|
7419
|
-
}
|
|
7420
|
-
return {
|
|
7421
|
-
args,
|
|
7422
|
-
env: buildKimiSpawnEnv(env),
|
|
7423
|
-
configFilePath,
|
|
7424
|
-
configContent
|
|
7425
|
-
};
|
|
7426
|
-
}
|
|
7427
7342
|
function resolveKimiSpawn(commandArgs, deps = {}) {
|
|
7428
7343
|
return {
|
|
7429
7344
|
command: resolveCommandOnPath("kimi", deps) ?? "kimi",
|
|
@@ -7447,25 +7362,7 @@ var KimiDriver = class {
|
|
|
7447
7362
|
};
|
|
7448
7363
|
model = {
|
|
7449
7364
|
detectedModelsVerifiedAs: "launchable",
|
|
7450
|
-
toLaunchSpec: (modelId
|
|
7451
|
-
if (!ctx) return { args: ["--model", modelId] };
|
|
7452
|
-
const launchCtx = {
|
|
7453
|
-
...ctx,
|
|
7454
|
-
config: {
|
|
7455
|
-
...ctx.config,
|
|
7456
|
-
model: modelId
|
|
7457
|
-
}
|
|
7458
|
-
};
|
|
7459
|
-
const launch = buildKimiLaunchOptions(launchCtx, {
|
|
7460
|
-
home: opts?.home,
|
|
7461
|
-
writeGeneratedConfig: false
|
|
7462
|
-
});
|
|
7463
|
-
return {
|
|
7464
|
-
args: launch.args,
|
|
7465
|
-
env: launch.env,
|
|
7466
|
-
configFiles: launch.configFilePath ? [launch.configFilePath] : void 0
|
|
7467
|
-
};
|
|
7468
|
-
}
|
|
7365
|
+
toLaunchSpec: (modelId) => ({ args: ["--model", modelId] })
|
|
7469
7366
|
};
|
|
7470
7367
|
supportsStdinNotification = true;
|
|
7471
7368
|
busyDeliveryMode = "direct";
|
|
@@ -7489,23 +7386,21 @@ var KimiDriver = class {
|
|
|
7489
7386
|
` system_prompt_path: ./${KIMI_SYSTEM_PROMPT_FILE}`,
|
|
7490
7387
|
""
|
|
7491
7388
|
].join("\n"), "utf8");
|
|
7492
|
-
const launch = buildKimiLaunchOptions(ctx);
|
|
7493
7389
|
const args = [
|
|
7494
7390
|
"--wire",
|
|
7495
7391
|
"--yolo",
|
|
7496
7392
|
"--agent-file",
|
|
7497
7393
|
agentFilePath,
|
|
7498
7394
|
"--session",
|
|
7499
|
-
this.sessionId
|
|
7500
|
-
...launch.args
|
|
7395
|
+
this.sessionId
|
|
7501
7396
|
];
|
|
7502
7397
|
const launchRuntimeFields = runtimeConfigToLaunchFields(ctx.config);
|
|
7503
7398
|
if (launchRuntimeFields.model && launchRuntimeFields.model !== "default") {
|
|
7504
7399
|
args.push("--model", launchRuntimeFields.model);
|
|
7505
7400
|
}
|
|
7506
7401
|
const spawnEnv = (await prepareCliTransport(ctx, { NO_COLOR: "1" })).spawnEnv;
|
|
7507
|
-
const
|
|
7508
|
-
const proc = spawn7(
|
|
7402
|
+
const launch = resolveKimiSpawn(args);
|
|
7403
|
+
const proc = spawn7(launch.command, launch.args, {
|
|
7509
7404
|
cwd: ctx.workingDirectory,
|
|
7510
7405
|
stdio: ["pipe", "pipe", "pipe"],
|
|
7511
7406
|
env: spawnEnv,
|
|
@@ -7513,7 +7408,7 @@ var KimiDriver = class {
|
|
|
7513
7408
|
// and has an 8191-character command-line limit. Kimi's official
|
|
7514
7409
|
// installer/uv entrypoint is an executable, so launch it directly and
|
|
7515
7410
|
// keep prompts on stdin / files instead of routing through cmd.exe.
|
|
7516
|
-
shell:
|
|
7411
|
+
shell: launch.shell
|
|
7517
7412
|
});
|
|
7518
7413
|
proc.stdin?.write(JSON.stringify({
|
|
7519
7414
|
jsonrpc: "2.0",
|
|
@@ -7626,9 +7521,14 @@ var KimiDriver = class {
|
|
|
7626
7521
|
return detectKimiModels();
|
|
7627
7522
|
}
|
|
7628
7523
|
};
|
|
7629
|
-
function detectKimiModels(home = os4.homedir()
|
|
7630
|
-
const
|
|
7631
|
-
|
|
7524
|
+
function detectKimiModels(home = os4.homedir()) {
|
|
7525
|
+
const configPath = path9.join(home, ".kimi", "config.toml");
|
|
7526
|
+
let raw;
|
|
7527
|
+
try {
|
|
7528
|
+
raw = readFileSync3(configPath, "utf8");
|
|
7529
|
+
} catch {
|
|
7530
|
+
return null;
|
|
7531
|
+
}
|
|
7632
7532
|
const models = [];
|
|
7633
7533
|
const sectionRe = /^\s*\[models(?:\.([^\]]+)|"\.[^"]+"|\."[^"]+")\s*\]\s*$/gm;
|
|
7634
7534
|
const lineRe = /^\s*\[models\.(.+?)\s*\]\s*$/gm;
|
|
@@ -8352,7 +8252,7 @@ function runOpenCodeModelsCommand(home, deps = {}) {
|
|
|
8352
8252
|
const platform = deps.platform ?? process.platform;
|
|
8353
8253
|
const spawnSyncFn = deps.spawnSyncFn ?? spawnSync2;
|
|
8354
8254
|
const result = spawnSyncFn("opencode", ["models"], {
|
|
8355
|
-
env:
|
|
8255
|
+
env: { ...process.env, HOME: home, FORCE_COLOR: "0", NO_COLOR: "1" },
|
|
8356
8256
|
encoding: "utf8",
|
|
8357
8257
|
timeout: 5e3,
|
|
8358
8258
|
shell: platform === "win32"
|
|
@@ -17034,7 +16934,7 @@ var DAEMON_CORE_TRACE_ATTR_CONTRACTS = {
|
|
|
17034
16934
|
spanAttrs: ["agentId", "event_kind", "runtime"]
|
|
17035
16935
|
}
|
|
17036
16936
|
};
|
|
17037
|
-
var DAEMON_CLI_USAGE =
|
|
16937
|
+
var DAEMON_CLI_USAGE = "Usage: slock-daemon --server-url <url> --api-key <key>";
|
|
17038
16938
|
var RunnerCredentialMintError2 = class extends Error {
|
|
17039
16939
|
code;
|
|
17040
16940
|
retryable;
|
|
@@ -17070,9 +16970,9 @@ function runnerCredentialErrorDetail2(error) {
|
|
|
17070
16970
|
async function waitForRunnerCredentialRetry2() {
|
|
17071
16971
|
await new Promise((resolve) => setTimeout(resolve, RUNNER_CREDENTIAL_MINT_RETRY_DELAY_MS2));
|
|
17072
16972
|
}
|
|
17073
|
-
function parseDaemonCliArgs(args
|
|
16973
|
+
function parseDaemonCliArgs(args) {
|
|
17074
16974
|
let serverUrl = "";
|
|
17075
|
-
let apiKey =
|
|
16975
|
+
let apiKey = "";
|
|
17076
16976
|
for (let i = 0; i < args.length; i++) {
|
|
17077
16977
|
if (args[i] === "--server-url" && args[i + 1]) serverUrl = args[++i];
|
|
17078
16978
|
if (args[i] === "--api-key" && args[i + 1]) apiKey = args[++i];
|
|
@@ -17997,8 +17897,6 @@ var DaemonCore = class {
|
|
|
17997
17897
|
|
|
17998
17898
|
export {
|
|
17999
17899
|
subscribeDaemonLogs,
|
|
18000
|
-
DAEMON_API_KEY_ENV,
|
|
18001
|
-
scrubDaemonAuthEnv,
|
|
18002
17900
|
resolveWorkspaceDirectoryPath,
|
|
18003
17901
|
scanWorkspaceDirectories,
|
|
18004
17902
|
deleteWorkspaceDirectory,
|
package/dist/core.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
DAEMON_API_KEY_ENV,
|
|
3
2
|
DAEMON_CLI_USAGE,
|
|
4
3
|
DaemonCore,
|
|
5
4
|
deleteWorkspaceDirectory,
|
|
@@ -11,11 +10,9 @@ import {
|
|
|
11
10
|
resolveWorkspaceDirectoryPath,
|
|
12
11
|
runBundledSlockCli,
|
|
13
12
|
scanWorkspaceDirectories,
|
|
14
|
-
scrubDaemonAuthEnv,
|
|
15
13
|
subscribeDaemonLogs
|
|
16
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-RZHNJV7U.js";
|
|
17
15
|
export {
|
|
18
|
-
DAEMON_API_KEY_ENV,
|
|
19
16
|
DAEMON_CLI_USAGE,
|
|
20
17
|
DaemonCore,
|
|
21
18
|
deleteWorkspaceDirectory,
|
|
@@ -27,6 +24,5 @@ export {
|
|
|
27
24
|
resolveWorkspaceDirectoryPath,
|
|
28
25
|
runBundledSlockCli,
|
|
29
26
|
scanWorkspaceDirectories,
|
|
30
|
-
scrubDaemonAuthEnv,
|
|
31
27
|
subscribeDaemonLogs
|
|
32
28
|
};
|
package/dist/index.js
CHANGED
|
@@ -2,13 +2,11 @@
|
|
|
2
2
|
import {
|
|
3
3
|
DAEMON_CLI_USAGE,
|
|
4
4
|
DaemonCore,
|
|
5
|
-
parseDaemonCliArgs
|
|
6
|
-
|
|
7
|
-
} from "./chunk-COT7JNSQ.js";
|
|
5
|
+
parseDaemonCliArgs
|
|
6
|
+
} from "./chunk-RZHNJV7U.js";
|
|
8
7
|
|
|
9
8
|
// src/index.ts
|
|
10
|
-
var parsedArgs = parseDaemonCliArgs(process.argv.slice(2)
|
|
11
|
-
scrubDaemonAuthEnv(process.env);
|
|
9
|
+
var parsedArgs = parseDaemonCliArgs(process.argv.slice(2));
|
|
12
10
|
if (!parsedArgs) {
|
|
13
11
|
console.error(DAEMON_CLI_USAGE);
|
|
14
12
|
process.exit(1);
|