@botiverse/raft-daemon 0.66.0-play.20260703142434 → 0.67.0
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.
|
@@ -4700,19 +4700,6 @@ function listLegacySlockStatePaths(slockHome = resolveSlockHome(), homeDir = os.
|
|
|
4700
4700
|
return candidates.filter((candidate) => existsSync(candidate.path));
|
|
4701
4701
|
}
|
|
4702
4702
|
|
|
4703
|
-
// src/authEnv.ts
|
|
4704
|
-
var DAEMON_API_KEY_ENV = "SLOCK_MACHINE_API_KEY";
|
|
4705
|
-
var SLOCK_AGENT_TOKEN_ENV = "SLOCK_AGENT_TOKEN";
|
|
4706
|
-
function scrubDaemonAuthEnv(env) {
|
|
4707
|
-
delete env[DAEMON_API_KEY_ENV];
|
|
4708
|
-
return env;
|
|
4709
|
-
}
|
|
4710
|
-
function scrubDaemonChildEnv(env) {
|
|
4711
|
-
delete env[DAEMON_API_KEY_ENV];
|
|
4712
|
-
delete env[SLOCK_AGENT_TOKEN_ENV];
|
|
4713
|
-
return env;
|
|
4714
|
-
}
|
|
4715
|
-
|
|
4716
4703
|
// src/agentCredentialProxy.ts
|
|
4717
4704
|
import { randomBytes } from "crypto";
|
|
4718
4705
|
import http from "http";
|
|
@@ -6267,9 +6254,7 @@ var LOOPBACK_NO_PROXY = "127.0.0.1,localhost";
|
|
|
6267
6254
|
var CLI_TRANSPORT_TRACE_DIR_ENV = "SLOCK_CLI_TRANSPORT_TRACE_DIR";
|
|
6268
6255
|
var safePathPart = (value) => value.replace(/[^a-zA-Z0-9_.-]/g, "_");
|
|
6269
6256
|
var RAW_CREDENTIAL_ENV_DENYLIST = [
|
|
6270
|
-
"
|
|
6271
|
-
"SLOCK_AGENT_CREDENTIAL_KEY",
|
|
6272
|
-
"SLOCK_AGENT_CREDENTIAL_KEY_FILE"
|
|
6257
|
+
"SLOCK_AGENT_CREDENTIAL_KEY"
|
|
6273
6258
|
];
|
|
6274
6259
|
var WORKSPACE_CLI_TRANSPORT_FILENAMES = [
|
|
6275
6260
|
"agent-token",
|
|
@@ -6624,7 +6609,7 @@ set "SLOCK_AGENT_ACTIVE_CAPABILITIES=${DEFAULT_ACTIVE_CAPABILITIES}"\r
|
|
|
6624
6609
|
SLOCK_SERVER_URL: ctx.config.serverUrl,
|
|
6625
6610
|
PATH: `${slockDir}${path2.delimiter}${process.env.PATH ?? ""}`
|
|
6626
6611
|
};
|
|
6627
|
-
|
|
6612
|
+
delete spawnEnv.SLOCK_AGENT_TOKEN;
|
|
6628
6613
|
for (const key of RAW_CREDENTIAL_ENV_DENYLIST) {
|
|
6629
6614
|
delete spawnEnv[key];
|
|
6630
6615
|
}
|
|
@@ -7147,7 +7132,7 @@ function requiresWindowsShell(command, platform = process.platform) {
|
|
|
7147
7132
|
}
|
|
7148
7133
|
function resolveCommandOnPath(command, deps = {}) {
|
|
7149
7134
|
const platform = deps.platform ?? process.platform;
|
|
7150
|
-
const env =
|
|
7135
|
+
const env = withWindowsUserEnvironment(deps.env ?? process.env, deps);
|
|
7151
7136
|
const execFileSyncFn = deps.execFileSyncFn ?? execFileSync;
|
|
7152
7137
|
const existsSyncFn = deps.existsSyncFn ?? existsSync3;
|
|
7153
7138
|
if (platform === "win32") {
|
|
@@ -7173,7 +7158,7 @@ function firstExistingPath(candidates, deps = {}) {
|
|
|
7173
7158
|
return null;
|
|
7174
7159
|
}
|
|
7175
7160
|
function readCommandVersion(command, args = [], deps = {}) {
|
|
7176
|
-
const env =
|
|
7161
|
+
const env = withWindowsUserEnvironment(deps.env ?? process.env, deps);
|
|
7177
7162
|
const execFileSyncFn = deps.execFileSyncFn ?? execFileSync;
|
|
7178
7163
|
try {
|
|
7179
7164
|
const output = normalizeExecOutput(execFileSyncFn(command, [...args, "--version"], {
|
|
@@ -9257,11 +9242,11 @@ function detectCursorModels(runCommand = runCursorModelsCommand) {
|
|
|
9257
9242
|
return parseCursorModelsOutput(String(result.stdout || ""));
|
|
9258
9243
|
}
|
|
9259
9244
|
function buildCursorModelProbeEnv(deps = {}) {
|
|
9260
|
-
return
|
|
9245
|
+
return withWindowsUserEnvironment({
|
|
9261
9246
|
...deps.env ?? process.env,
|
|
9262
9247
|
FORCE_COLOR: "0",
|
|
9263
9248
|
NO_COLOR: "1"
|
|
9264
|
-
}, deps)
|
|
9249
|
+
}, deps);
|
|
9265
9250
|
}
|
|
9266
9251
|
function runCursorModelsCommand() {
|
|
9267
9252
|
return spawnSync("cursor-agent", ["models"], {
|
|
@@ -9317,7 +9302,7 @@ function resolveGeminiSpawn(commandArgs, deps = {}) {
|
|
|
9317
9302
|
}
|
|
9318
9303
|
const execFileSyncFn = deps.execFileSyncFn ?? execFileSync3;
|
|
9319
9304
|
const existsSyncFn = deps.existsSyncFn ?? existsSync5;
|
|
9320
|
-
const env =
|
|
9305
|
+
const env = deps.env ?? process.env;
|
|
9321
9306
|
const winPath = path8.win32;
|
|
9322
9307
|
let geminiEntry = null;
|
|
9323
9308
|
try {
|
|
@@ -9454,15 +9439,12 @@ var GeminiDriver = class {
|
|
|
9454
9439
|
// src/drivers/kimi.ts
|
|
9455
9440
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
9456
9441
|
import { spawn as spawn7 } from "child_process";
|
|
9457
|
-
import {
|
|
9442
|
+
import { existsSync as existsSync6, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
9458
9443
|
import os4 from "os";
|
|
9459
9444
|
import path9 from "path";
|
|
9460
9445
|
var KIMI_WIRE_PROTOCOL_VERSION = "1.3";
|
|
9461
9446
|
var KIMI_SYSTEM_PROMPT_FILE = ".slock-kimi-system.md";
|
|
9462
9447
|
var KIMI_AGENT_FILE = ".slock-kimi-agent.yaml";
|
|
9463
|
-
var KIMI_GENERATED_CONFIG_FILE = ".slock-kimi-config.toml";
|
|
9464
|
-
var SLOCK_KIMI_CONFIG_CONTENT_ENV = "SLOCK_KIMI_CONFIG_CONTENT";
|
|
9465
|
-
var SLOCK_KIMI_CONFIG_FILE_ENV = "SLOCK_KIMI_CONFIG_FILE";
|
|
9466
9448
|
function parseToolArguments(raw) {
|
|
9467
9449
|
if (typeof raw !== "string") return raw;
|
|
9468
9450
|
try {
|
|
@@ -9471,73 +9453,6 @@ function parseToolArguments(raw) {
|
|
|
9471
9453
|
return raw;
|
|
9472
9454
|
}
|
|
9473
9455
|
}
|
|
9474
|
-
function readKimiConfigSource(home = os4.homedir(), env = process.env) {
|
|
9475
|
-
const inlineConfig = env[SLOCK_KIMI_CONFIG_CONTENT_ENV];
|
|
9476
|
-
if (inlineConfig && inlineConfig.trim()) {
|
|
9477
|
-
return {
|
|
9478
|
-
raw: inlineConfig,
|
|
9479
|
-
explicitPath: null,
|
|
9480
|
-
sourcePath: SLOCK_KIMI_CONFIG_CONTENT_ENV
|
|
9481
|
-
};
|
|
9482
|
-
}
|
|
9483
|
-
const explicitPath = env[SLOCK_KIMI_CONFIG_FILE_ENV];
|
|
9484
|
-
const configPath = explicitPath && explicitPath.trim() ? explicitPath : path9.join(home, ".kimi", "config.toml");
|
|
9485
|
-
try {
|
|
9486
|
-
return {
|
|
9487
|
-
raw: readFileSync3(configPath, "utf8"),
|
|
9488
|
-
explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
|
|
9489
|
-
sourcePath: configPath
|
|
9490
|
-
};
|
|
9491
|
-
} catch {
|
|
9492
|
-
return {
|
|
9493
|
-
raw: null,
|
|
9494
|
-
explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
|
|
9495
|
-
sourcePath: configPath
|
|
9496
|
-
};
|
|
9497
|
-
}
|
|
9498
|
-
}
|
|
9499
|
-
function buildKimiSpawnEnv(env = process.env) {
|
|
9500
|
-
const spawnEnv = { ...env, FORCE_COLOR: "0", NO_COLOR: "1" };
|
|
9501
|
-
delete spawnEnv[SLOCK_KIMI_CONFIG_CONTENT_ENV];
|
|
9502
|
-
delete spawnEnv[SLOCK_KIMI_CONFIG_FILE_ENV];
|
|
9503
|
-
return scrubDaemonChildEnv(spawnEnv);
|
|
9504
|
-
}
|
|
9505
|
-
function buildKimiEffectiveEnv(ctx, overrideEnv) {
|
|
9506
|
-
return {
|
|
9507
|
-
...process.env,
|
|
9508
|
-
...ctx.config.envVars || {},
|
|
9509
|
-
...overrideEnv || {}
|
|
9510
|
-
};
|
|
9511
|
-
}
|
|
9512
|
-
function buildKimiLaunchOptions(ctx, opts = {}) {
|
|
9513
|
-
const env = buildKimiEffectiveEnv(ctx, opts.env);
|
|
9514
|
-
const source = readKimiConfigSource(opts.home ?? os4.homedir(), env);
|
|
9515
|
-
const args = [];
|
|
9516
|
-
let configFilePath = null;
|
|
9517
|
-
let configContent = null;
|
|
9518
|
-
if (source.explicitPath) {
|
|
9519
|
-
configFilePath = source.explicitPath;
|
|
9520
|
-
} else if (source.raw !== null && source.sourcePath === SLOCK_KIMI_CONFIG_CONTENT_ENV) {
|
|
9521
|
-
configFilePath = path9.join(ctx.workingDirectory, KIMI_GENERATED_CONFIG_FILE);
|
|
9522
|
-
configContent = source.raw;
|
|
9523
|
-
if (opts.writeGeneratedConfig !== false) {
|
|
9524
|
-
writeFileSync3(configFilePath, source.raw, { encoding: "utf8", mode: 384 });
|
|
9525
|
-
chmodSync(configFilePath, 384);
|
|
9526
|
-
}
|
|
9527
|
-
}
|
|
9528
|
-
if (configFilePath) {
|
|
9529
|
-
args.push("--config-file", configFilePath);
|
|
9530
|
-
}
|
|
9531
|
-
if (ctx.config.model && ctx.config.model !== "default") {
|
|
9532
|
-
args.push("--model", ctx.config.model);
|
|
9533
|
-
}
|
|
9534
|
-
return {
|
|
9535
|
-
args,
|
|
9536
|
-
env: buildKimiSpawnEnv(env),
|
|
9537
|
-
configFilePath,
|
|
9538
|
-
configContent
|
|
9539
|
-
};
|
|
9540
|
-
}
|
|
9541
9456
|
function resolveKimiSpawn(commandArgs, deps = {}) {
|
|
9542
9457
|
return {
|
|
9543
9458
|
command: resolveCommandOnPath("kimi", deps) ?? "kimi",
|
|
@@ -9561,25 +9476,7 @@ var KimiDriver = class {
|
|
|
9561
9476
|
};
|
|
9562
9477
|
model = {
|
|
9563
9478
|
detectedModelsVerifiedAs: "launchable",
|
|
9564
|
-
toLaunchSpec: (modelId
|
|
9565
|
-
if (!ctx) return { args: ["--model", modelId] };
|
|
9566
|
-
const launchCtx = {
|
|
9567
|
-
...ctx,
|
|
9568
|
-
config: {
|
|
9569
|
-
...ctx.config,
|
|
9570
|
-
model: modelId
|
|
9571
|
-
}
|
|
9572
|
-
};
|
|
9573
|
-
const launch = buildKimiLaunchOptions(launchCtx, {
|
|
9574
|
-
home: opts?.home,
|
|
9575
|
-
writeGeneratedConfig: false
|
|
9576
|
-
});
|
|
9577
|
-
return {
|
|
9578
|
-
args: launch.args,
|
|
9579
|
-
env: launch.env,
|
|
9580
|
-
configFiles: launch.configFilePath ? [launch.configFilePath] : void 0
|
|
9581
|
-
};
|
|
9582
|
-
}
|
|
9479
|
+
toLaunchSpec: (modelId) => ({ args: ["--model", modelId] })
|
|
9583
9480
|
};
|
|
9584
9481
|
supportsStdinNotification = true;
|
|
9585
9482
|
busyDeliveryMode = "direct";
|
|
@@ -9603,23 +9500,21 @@ var KimiDriver = class {
|
|
|
9603
9500
|
` system_prompt_path: ./${KIMI_SYSTEM_PROMPT_FILE}`,
|
|
9604
9501
|
""
|
|
9605
9502
|
].join("\n"), "utf8");
|
|
9606
|
-
const launch = buildKimiLaunchOptions(ctx);
|
|
9607
9503
|
const args = [
|
|
9608
9504
|
"--wire",
|
|
9609
9505
|
"--yolo",
|
|
9610
9506
|
"--agent-file",
|
|
9611
9507
|
agentFilePath,
|
|
9612
9508
|
"--session",
|
|
9613
|
-
this.sessionId
|
|
9614
|
-
...launch.args
|
|
9509
|
+
this.sessionId
|
|
9615
9510
|
];
|
|
9616
9511
|
const launchRuntimeFields = runtimeConfigToLaunchFields(hydrateRuntimeConfig(ctx.config));
|
|
9617
9512
|
if (launchRuntimeFields.model && launchRuntimeFields.model !== "default") {
|
|
9618
9513
|
args.push("--model", launchRuntimeFields.model);
|
|
9619
9514
|
}
|
|
9620
9515
|
const spawnEnv = (await prepareCliTransport(ctx, { NO_COLOR: "1" })).spawnEnv;
|
|
9621
|
-
const
|
|
9622
|
-
const proc = spawn7(
|
|
9516
|
+
const launch = resolveKimiSpawn(args);
|
|
9517
|
+
const proc = spawn7(launch.command, launch.args, {
|
|
9623
9518
|
cwd: ctx.workingDirectory,
|
|
9624
9519
|
stdio: ["pipe", "pipe", "pipe"],
|
|
9625
9520
|
env: spawnEnv,
|
|
@@ -9627,7 +9522,7 @@ var KimiDriver = class {
|
|
|
9627
9522
|
// and has an 8191-character command-line limit. Kimi's official
|
|
9628
9523
|
// installer/uv entrypoint is an executable, so launch it directly and
|
|
9629
9524
|
// keep prompts on stdin / files instead of routing through cmd.exe.
|
|
9630
|
-
shell:
|
|
9525
|
+
shell: launch.shell
|
|
9631
9526
|
});
|
|
9632
9527
|
proc.stdin?.write(JSON.stringify({
|
|
9633
9528
|
jsonrpc: "2.0",
|
|
@@ -9740,9 +9635,14 @@ var KimiDriver = class {
|
|
|
9740
9635
|
return detectKimiModels();
|
|
9741
9636
|
}
|
|
9742
9637
|
};
|
|
9743
|
-
function detectKimiModels(home = os4.homedir()
|
|
9744
|
-
const
|
|
9745
|
-
|
|
9638
|
+
function detectKimiModels(home = os4.homedir()) {
|
|
9639
|
+
const configPath = path9.join(home, ".kimi", "config.toml");
|
|
9640
|
+
let raw;
|
|
9641
|
+
try {
|
|
9642
|
+
raw = readFileSync3(configPath, "utf8");
|
|
9643
|
+
} catch {
|
|
9644
|
+
return null;
|
|
9645
|
+
}
|
|
9746
9646
|
const models = [];
|
|
9747
9647
|
const sectionRe = /^\s*\[models(?:\.([^\]]+)|"\.[^"]+"|\."[^"]+")\s*\]\s*$/gm;
|
|
9748
9648
|
const lineRe = /^\s*\[models\.(.+?)\s*\]\s*$/gm;
|
|
@@ -10408,7 +10308,7 @@ function runOpenCodeModelsCommand(home, deps = {}) {
|
|
|
10408
10308
|
const platform = deps.platform ?? process.platform;
|
|
10409
10309
|
const spawnSyncFn = deps.spawnSyncFn ?? spawnSync2;
|
|
10410
10310
|
const result = spawnSyncFn("opencode", ["models"], {
|
|
10411
|
-
env:
|
|
10311
|
+
env: { ...process.env, HOME: home, FORCE_COLOR: "0", NO_COLOR: "1" },
|
|
10412
10312
|
encoding: "utf8",
|
|
10413
10313
|
timeout: 5e3,
|
|
10414
10314
|
shell: platform === "win32"
|
|
@@ -21057,7 +20957,7 @@ var DAEMON_CORE_TRACE_ATTR_CONTRACTS = {
|
|
|
21057
20957
|
spanAttrs: ["agentId", "event_kind", "runtime"]
|
|
21058
20958
|
}
|
|
21059
20959
|
};
|
|
21060
|
-
var DAEMON_CLI_USAGE =
|
|
20960
|
+
var DAEMON_CLI_USAGE = "Usage: slock-daemon --server-url <url> --api-key <key>";
|
|
21061
20961
|
var RunnerCredentialMintError2 = class extends Error {
|
|
21062
20962
|
code;
|
|
21063
20963
|
retryable;
|
|
@@ -21093,9 +20993,9 @@ function runnerCredentialErrorDetail2(error) {
|
|
|
21093
20993
|
async function waitForRunnerCredentialRetry2() {
|
|
21094
20994
|
await new Promise((resolve) => setTimeout(resolve, RUNNER_CREDENTIAL_MINT_RETRY_DELAY_MS2));
|
|
21095
20995
|
}
|
|
21096
|
-
function parseDaemonCliArgs(args
|
|
20996
|
+
function parseDaemonCliArgs(args) {
|
|
21097
20997
|
let serverUrl = "";
|
|
21098
|
-
let apiKey =
|
|
20998
|
+
let apiKey = "";
|
|
21099
20999
|
for (let i = 0; i < args.length; i++) {
|
|
21100
21000
|
if (args[i] === "--server-url" && args[i + 1]) serverUrl = args[++i];
|
|
21101
21001
|
if (args[i] === "--api-key" && args[i + 1]) apiKey = args[++i];
|
|
@@ -21132,7 +21032,7 @@ function resolveSlockCliPathOrEmpty(moduleUrl = import.meta.url) {
|
|
|
21132
21032
|
}
|
|
21133
21033
|
async function runBundledSlockCli(argv) {
|
|
21134
21034
|
process.argv = [process.execPath, "slock", ...argv];
|
|
21135
|
-
await import("./dist-
|
|
21035
|
+
await import("./dist-TGKVYIA7.js");
|
|
21136
21036
|
}
|
|
21137
21037
|
function detectRuntimes(tracer = noopTracer) {
|
|
21138
21038
|
const ids = [];
|
|
@@ -22074,8 +21974,6 @@ var DaemonCore = class {
|
|
|
22074
21974
|
|
|
22075
21975
|
export {
|
|
22076
21976
|
subscribeDaemonLogs,
|
|
22077
|
-
DAEMON_API_KEY_ENV,
|
|
22078
|
-
scrubDaemonAuthEnv,
|
|
22079
21977
|
resolveWorkspaceDirectoryPath,
|
|
22080
21978
|
scanWorkspaceDirectories,
|
|
22081
21979
|
deleteWorkspaceDirectory,
|
package/dist/cli/index.js
CHANGED
|
@@ -44746,9 +44746,6 @@ init_esm_shims();
|
|
|
44746
44746
|
// ../shared/src/agentScopes.ts
|
|
44747
44747
|
init_esm_shims();
|
|
44748
44748
|
|
|
44749
|
-
// ../shared/src/docs/crossPageInvariants.ts
|
|
44750
|
-
init_esm_shims();
|
|
44751
|
-
|
|
44752
44749
|
// ../shared/src/testing/failpoints.ts
|
|
44753
44750
|
init_esm_shims();
|
|
44754
44751
|
var NoopFailpointRegistry = class {
|
package/dist/core.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
DAEMON_API_KEY_ENV,
|
|
3
2
|
DAEMON_CLI_USAGE,
|
|
4
3
|
DAEMON_CORE_TRACE_ATTR_CONTRACTS,
|
|
5
4
|
DaemonCore,
|
|
@@ -12,11 +11,9 @@ import {
|
|
|
12
11
|
resolveWorkspaceDirectoryPath,
|
|
13
12
|
runBundledSlockCli,
|
|
14
13
|
scanWorkspaceDirectories,
|
|
15
|
-
scrubDaemonAuthEnv,
|
|
16
14
|
subscribeDaemonLogs
|
|
17
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-H3WRFI54.js";
|
|
18
16
|
export {
|
|
19
|
-
DAEMON_API_KEY_ENV,
|
|
20
17
|
DAEMON_CLI_USAGE,
|
|
21
18
|
DAEMON_CORE_TRACE_ATTR_CONTRACTS,
|
|
22
19
|
DaemonCore,
|
|
@@ -29,6 +26,5 @@ export {
|
|
|
29
26
|
resolveWorkspaceDirectoryPath,
|
|
30
27
|
runBundledSlockCli,
|
|
31
28
|
scanWorkspaceDirectories,
|
|
32
|
-
scrubDaemonAuthEnv,
|
|
33
29
|
subscribeDaemonLogs
|
|
34
30
|
};
|
|
@@ -44281,7 +44281,6 @@ init_esm_shims();
|
|
|
44281
44281
|
init_esm_shims();
|
|
44282
44282
|
init_esm_shims();
|
|
44283
44283
|
init_esm_shims();
|
|
44284
|
-
init_esm_shims();
|
|
44285
44284
|
var NoopFailpointRegistry = class {
|
|
44286
44285
|
get enabled() {
|
|
44287
44286
|
return false;
|
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-F5LZAKPP.js";
|
|
5
|
+
parseDaemonCliArgs
|
|
6
|
+
} from "./chunk-H3WRFI54.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);
|