@botiverse/raft-daemon 0.63.1-play.20260619141001 → 0.63.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.
@@ -1,6 +1,6 @@
1
1
  // src/core.ts
2
2
  import path18 from "path";
3
- import os9 from "os";
3
+ import os8 from "os";
4
4
  import { createRequire as createRequire3 } from "module";
5
5
  import { accessSync } from "fs";
6
6
  import { fileURLToPath } from "url";
@@ -1599,12 +1599,12 @@ var DISPLAY_PLAN_CONFIG = {
1599
1599
  var FREE_MONTHLY_FILE_UPLOAD_LIMIT_BYTES = 100 * 1024 * 1024;
1600
1600
 
1601
1601
  // src/agentProcessManager.ts
1602
- import { existsSync as existsSync9, mkdirSync as mkdirSync5, readFileSync as readFileSync6, readdirSync as readdirSync3, statSync, writeFileSync as writeFileSync4 } from "fs";
1602
+ import { existsSync as existsSync8, mkdirSync as mkdirSync4, readFileSync as readFileSync6, readdirSync as readdirSync4, statSync, writeFileSync as writeFileSync4 } from "fs";
1603
1603
  import { mkdir, writeFile, access, readdir as readdir2, stat as stat2, readFile, rm as rm2, lstat, realpath, open } from "fs/promises";
1604
1604
  import { createHash as createHash3, randomUUID as randomUUID5 } from "crypto";
1605
1605
  import path14 from "path";
1606
1606
  import { gzipSync } from "zlib";
1607
- import os7 from "os";
1607
+ import os6 from "os";
1608
1608
 
1609
1609
  // src/proxy.ts
1610
1610
  import { HttpsProxyAgent } from "https-proxy-agent";
@@ -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
- "SLOCK_AGENT_TOKEN",
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
- scrubDaemonChildEnv(spawnEnv);
4503
+ delete spawnEnv.SLOCK_AGENT_TOKEN;
4519
4504
  for (const key of RAW_CREDENTIAL_ENV_DENYLIST) {
4520
4505
  delete spawnEnv[key];
4521
4506
  }
@@ -4784,12 +4769,101 @@ var ClaudeEventNormalizer = class {
4784
4769
 
4785
4770
  // src/drivers/claudeLaunch.ts
4786
4771
  import { writeFileSync as writeFileSync2 } from "fs";
4787
- import path4 from "path";
4772
+ import path5 from "path";
4773
+
4774
+ // src/drivers/claudeProviderIsolation.ts
4775
+ import { readdirSync as readdirSync2 } from "fs";
4776
+ import path3 from "path";
4777
+ var LEGACY_CLAUDE_PROVIDER_CONFIG_DIR = path3.join(".slock", "claude-provider", "home", ".claude");
4778
+ var warnedLegacyClaudeProviderConfigDirs = /* @__PURE__ */ new Set();
4779
+ var CLAUDE_CUSTOM_PROVIDER_HOST_ENV_KEYS = [
4780
+ "ANTHROPIC_AUTH_TOKEN",
4781
+ "ANTHROPIC_CUSTOM_HEADERS",
4782
+ "CLAUDE_CODE_OAUTH_TOKEN",
4783
+ "CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR",
4784
+ "ANTHROPIC_FEDERATION_RULE_ID",
4785
+ "ANTHROPIC_ORGANIZATION_ID",
4786
+ "ANTHROPIC_MODEL",
4787
+ "ANTHROPIC_SMALL_FAST_MODEL",
4788
+ "ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION",
4789
+ "CLAUDE_CODE_USE_BEDROCK",
4790
+ "CLAUDE_CODE_SKIP_BEDROCK_AUTH",
4791
+ "AWS_BEARER_TOKEN_BEDROCK",
4792
+ "ANTHROPIC_BEDROCK_BASE_URL",
4793
+ "ANTHROPIC_BEDROCK_SERVICE_TIER",
4794
+ "CLAUDE_CODE_USE_MANTLE",
4795
+ "CLAUDE_CODE_SKIP_MANTLE_AUTH",
4796
+ "ANTHROPIC_BEDROCK_MANTLE_API_KEY",
4797
+ "ANTHROPIC_BEDROCK_MANTLE_BASE_URL",
4798
+ "CLAUDE_CODE_USE_VERTEX",
4799
+ "CLAUDE_CODE_SKIP_VERTEX_AUTH",
4800
+ "ANTHROPIC_VERTEX_PROJECT_ID",
4801
+ "ANTHROPIC_VERTEX_BASE_URL",
4802
+ "CLOUD_ML_REGION",
4803
+ "CLAUDE_CODE_USE_FOUNDRY",
4804
+ "CLAUDE_CODE_SKIP_FOUNDRY_AUTH",
4805
+ "ANTHROPIC_FOUNDRY_API_KEY",
4806
+ "ANTHROPIC_FOUNDRY_AUTH_TOKEN",
4807
+ "ANTHROPIC_FOUNDRY_RESOURCE",
4808
+ "ANTHROPIC_FOUNDRY_BASE_URL",
4809
+ "CLAUDE_CODE_USE_ANTHROPIC_AWS",
4810
+ "CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH",
4811
+ "CLAUDE_CODE_USE_GATEWAY",
4812
+ "CLAUDE_CODE_USE_CCR_V2"
4813
+ ];
4814
+ function isClaudeCustomProviderConfig(config) {
4815
+ const launchRuntimeFields = runtimeConfigToLaunchFields(config);
4816
+ return launchRuntimeFields.runtime === "claude" && Boolean(launchRuntimeFields.envVars?.ANTHROPIC_BASE_URL) && Boolean(launchRuntimeFields.envVars?.ANTHROPIC_API_KEY);
4817
+ }
4818
+ function clearInheritedClaudeProviderEnv(explicitEnv) {
4819
+ const env = {};
4820
+ for (const key of CLAUDE_CUSTOM_PROVIDER_HOST_ENV_KEYS) {
4821
+ if (!Object.prototype.hasOwnProperty.call(explicitEnv ?? {}, key)) {
4822
+ env[key] = void 0;
4823
+ }
4824
+ }
4825
+ return env;
4826
+ }
4827
+ var LEGACY_CLAUDE_PROVIDER_CONFIG_ENTRIES = /* @__PURE__ */ new Set([
4828
+ "agents",
4829
+ "commands",
4830
+ "projects",
4831
+ "settings.json",
4832
+ "skills",
4833
+ "todos"
4834
+ ]);
4835
+ function hasLegacyClaudeProviderConfigEntry(directory) {
4836
+ try {
4837
+ return readdirSync2(directory).some((entry) => LEGACY_CLAUDE_PROVIDER_CONFIG_ENTRIES.has(entry));
4838
+ } catch {
4839
+ return false;
4840
+ }
4841
+ }
4842
+ function shouldWarnLegacyClaudeProviderConfigDir(workingDirectory) {
4843
+ const legacyConfigDir = path3.resolve(workingDirectory, LEGACY_CLAUDE_PROVIDER_CONFIG_DIR);
4844
+ if (!hasLegacyClaudeProviderConfigEntry(legacyConfigDir)) {
4845
+ return false;
4846
+ }
4847
+ if (warnedLegacyClaudeProviderConfigDirs.has(legacyConfigDir)) {
4848
+ return false;
4849
+ }
4850
+ warnedLegacyClaudeProviderConfigDirs.add(legacyConfigDir);
4851
+ return true;
4852
+ }
4853
+ function buildClaudeProviderIsolationEnv(ctx) {
4854
+ if (!isClaudeCustomProviderConfig(ctx.config)) {
4855
+ return {};
4856
+ }
4857
+ const launchRuntimeFields = runtimeConfigToLaunchFields(ctx.config);
4858
+ return {
4859
+ ...clearInheritedClaudeProviderEnv(launchRuntimeFields.envVars)
4860
+ };
4861
+ }
4788
4862
 
4789
4863
  // src/drivers/probe.ts
4790
4864
  import { execFileSync } from "child_process";
4791
4865
  import { existsSync as existsSync3 } from "fs";
4792
- import path3 from "path";
4866
+ import path4 from "path";
4793
4867
  function normalizeExecOutput(raw) {
4794
4868
  return Buffer.isBuffer(raw) ? raw.toString("utf8") : String(raw ?? "");
4795
4869
  }
@@ -4922,13 +4996,13 @@ function resolveCommandOnWindows(command, env, execFileSyncFn, existsSyncFn) {
4922
4996
  if (!resolved) return null;
4923
4997
  const lowerResolved = resolved.toLowerCase();
4924
4998
  if (lowerResolved.endsWith(".ps1")) {
4925
- const dir = path3.dirname(resolved);
4926
- const base = path3.basename(resolved, ".ps1");
4999
+ const dir = path4.dirname(resolved);
5000
+ const base = path4.basename(resolved, ".ps1");
4927
5001
  const alternatives = [
4928
- path3.join(dir, `${base}.cmd`),
4929
- path3.join(dir, `${base}.bat`),
4930
- path3.join(dir, `${base}.exe`),
4931
- path3.join(dir, base)
5002
+ path4.join(dir, `${base}.cmd`),
5003
+ path4.join(dir, `${base}.bat`),
5004
+ path4.join(dir, `${base}.exe`),
5005
+ path4.join(dir, base)
4932
5006
  ];
4933
5007
  for (const alt of alternatives) {
4934
5008
  if (existsSyncFn(alt)) return alt;
@@ -4948,7 +5022,7 @@ function requiresWindowsShell(command, platform = process.platform) {
4948
5022
  }
4949
5023
  function resolveCommandOnPath(command, deps = {}) {
4950
5024
  const platform = deps.platform ?? process.platform;
4951
- const env = scrubDaemonChildEnv({ ...withWindowsUserEnvironment(deps.env ?? process.env, deps) });
5025
+ const env = withWindowsUserEnvironment(deps.env ?? process.env, deps);
4952
5026
  const execFileSyncFn = deps.execFileSyncFn ?? execFileSync;
4953
5027
  const existsSyncFn = deps.existsSyncFn ?? existsSync3;
4954
5028
  if (platform === "win32") {
@@ -4974,7 +5048,7 @@ function firstExistingPath(candidates, deps = {}) {
4974
5048
  return null;
4975
5049
  }
4976
5050
  function readCommandVersion(command, args = [], deps = {}) {
4977
- const env = scrubDaemonChildEnv({ ...withWindowsUserEnvironment(deps.env ?? process.env, deps) });
5051
+ const env = withWindowsUserEnvironment(deps.env ?? process.env, deps);
4978
5052
  const execFileSyncFn = deps.execFileSyncFn ?? execFileSync;
4979
5053
  try {
4980
5054
  const output = normalizeExecOutput(execFileSyncFn(command, [...args, "--version"], {
@@ -4989,11 +5063,11 @@ function readCommandVersion(command, args = [], deps = {}) {
4989
5063
  }
4990
5064
  function resolveHomePath(relativePath, deps = {}) {
4991
5065
  const homeDir = deps.homeDir ?? deps.env?.HOME ?? process.env.HOME ?? "";
4992
- return path3.join(homeDir, relativePath);
5066
+ return path4.join(homeDir, relativePath);
4993
5067
  }
4994
5068
 
4995
5069
  // src/drivers/claudeLaunch.ts
4996
- var CLAUDE_DESKTOP_CLI_RELATIVE_PATH = path4.join("Applications", "Claude Code URL Handler.app", "Contents", "MacOS", "claude");
5070
+ var CLAUDE_DESKTOP_CLI_RELATIVE_PATH = path5.join("Applications", "Claude Code URL Handler.app", "Contents", "MacOS", "claude");
4997
5071
  var CLAUDE_DESKTOP_CLI_SYSTEM_PATH = "/Applications/Claude Code URL Handler.app/Contents/MacOS/claude";
4998
5072
  var CLAUDE_SYSTEM_PROMPT_FILE = "claude-system-prompt.md";
4999
5073
  var CLAUDE_DISALLOWED_TOOLS = [
@@ -5048,6 +5122,9 @@ function buildClaudeArgs(config, opts) {
5048
5122
  if (launchRuntimeFields.reasoningEffort) {
5049
5123
  args.push("--effort", launchRuntimeFields.reasoningEffort);
5050
5124
  }
5125
+ if (isClaudeCustomProviderConfig(config)) {
5126
+ args.push("--setting-sources", "project,local");
5127
+ }
5051
5128
  if (launchRuntimeFields.mode.kind === "fast") {
5052
5129
  args.push("--settings", JSON.stringify({ fastMode: true }));
5053
5130
  }
@@ -5057,7 +5134,7 @@ function buildClaudeArgs(config, opts) {
5057
5134
  return args;
5058
5135
  }
5059
5136
  function writeClaudeSystemPromptFile(standingPrompt, slockDir) {
5060
- const systemPromptPath = path4.join(slockDir, CLAUDE_SYSTEM_PROMPT_FILE);
5137
+ const systemPromptPath = path5.join(slockDir, CLAUDE_SYSTEM_PROMPT_FILE);
5061
5138
  writeFileSync2(systemPromptPath, standingPrompt, { mode: 384 });
5062
5139
  return systemPromptPath;
5063
5140
  }
@@ -5072,52 +5149,6 @@ function buildClaudeSpawnSpec(claudeCommand, platform = process.platform) {
5072
5149
  };
5073
5150
  }
5074
5151
 
5075
- // src/drivers/claudeProviderIsolation.ts
5076
- import { existsSync as existsSync4, mkdirSync as mkdirSync2, symlinkSync } from "fs";
5077
- import os2 from "os";
5078
- import path5 from "path";
5079
- function isClaudeCustomProviderConfig(config) {
5080
- const launchRuntimeFields = runtimeConfigToLaunchFields(config);
5081
- return launchRuntimeFields.runtime === "claude" && Boolean(launchRuntimeFields.envVars?.ANTHROPIC_BASE_URL) && Boolean(launchRuntimeFields.envVars?.ANTHROPIC_API_KEY);
5082
- }
5083
- function getClaudeProviderStatePaths(workingDirectory) {
5084
- const root = path5.join(workingDirectory, ".slock", "claude-provider");
5085
- const home = path5.join(root, "home");
5086
- return {
5087
- root,
5088
- home,
5089
- configDir: path5.join(home, ".claude")
5090
- };
5091
- }
5092
- function linkIfPresent(source, target) {
5093
- try {
5094
- if (!existsSync4(source) || existsSync4(target)) return;
5095
- mkdirSync2(path5.dirname(target), { recursive: true, mode: 448 });
5096
- symlinkSync(source, target, "dir");
5097
- } catch {
5098
- }
5099
- }
5100
- function ensureClaudeProviderStatePaths(workingDirectory, hostClaudeHome = path5.join(os2.homedir(), ".claude")) {
5101
- const paths = getClaudeProviderStatePaths(workingDirectory);
5102
- mkdirSync2(paths.home, { recursive: true, mode: 448 });
5103
- mkdirSync2(paths.configDir, { recursive: true, mode: 448 });
5104
- linkIfPresent(path5.join(hostClaudeHome, "skills"), path5.join(paths.configDir, "skills"));
5105
- linkIfPresent(path5.join(hostClaudeHome, "commands"), path5.join(paths.configDir, "commands"));
5106
- return paths;
5107
- }
5108
- function buildClaudeProviderIsolationEnv(ctx) {
5109
- if (!isClaudeCustomProviderConfig(ctx.config)) {
5110
- return {};
5111
- }
5112
- const paths = ensureClaudeProviderStatePaths(ctx.workingDirectory);
5113
- return {
5114
- HOME: paths.home,
5115
- USERPROFILE: paths.home,
5116
- CLAUDE_CONFIG_DIR: paths.configDir,
5117
- CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST: "1"
5118
- };
5119
- }
5120
-
5121
5152
  // src/drivers/claude.ts
5122
5153
  var ClaudeDriver = class {
5123
5154
  id = "claude";
@@ -5155,6 +5186,11 @@ var ClaudeDriver = class {
5155
5186
  ctx,
5156
5187
  buildClaudeProviderIsolationEnv(ctx)
5157
5188
  );
5189
+ if (isClaudeCustomProviderConfig(ctx.config) && shouldWarnLegacyClaudeProviderConfigDir(ctx.workingDirectory)) {
5190
+ logger.warn(
5191
+ `[Agent ${ctx.agentId}] Legacy Claude custom-provider config directory ${LEGACY_CLAUDE_PROVIDER_CONFIG_DIR} is no longer used; custom-provider Claude now uses host Claude state plus explicit provider env.`
5192
+ );
5193
+ }
5158
5194
  const systemPromptPath = writeClaudeSystemPromptFile(ctx.standingPrompt, slockDir);
5159
5195
  const args = this.buildClaudeArgs(ctx.config, {
5160
5196
  standingPromptFilePath: systemPromptPath
@@ -5212,12 +5248,12 @@ var ClaudeDriver = class {
5212
5248
 
5213
5249
  // src/drivers/codex.ts
5214
5250
  import { spawn as spawn2, execFileSync as execFileSync2 } from "child_process";
5215
- import { existsSync as existsSync5, readFileSync as readFileSync2 } from "fs";
5216
- import os4 from "os";
5251
+ import { existsSync as existsSync4, readFileSync as readFileSync2 } from "fs";
5252
+ import os3 from "os";
5217
5253
  import path7 from "path";
5218
5254
 
5219
5255
  // src/drivers/codexHome.ts
5220
- import os3 from "os";
5256
+ import os2 from "os";
5221
5257
  import path6 from "path";
5222
5258
  function readConfiguredCodexHome(env) {
5223
5259
  const raw = env.CODEX_HOME;
@@ -5228,7 +5264,7 @@ function resolveCodexHomeRootFromEnv(env = process.env, opts = {}) {
5228
5264
  if (raw) {
5229
5265
  return path6.resolve(opts.cwd ?? process.cwd(), raw);
5230
5266
  }
5231
- return path6.join(opts.defaultHomeDir ?? os3.homedir(), ".codex");
5267
+ return path6.join(opts.defaultHomeDir ?? os2.homedir(), ".codex");
5232
5268
  }
5233
5269
  function hasConfiguredCodexHome(config, baseEnv = process.env) {
5234
5270
  const launchRuntimeFields = config ? runtimeConfigToLaunchFields(config) : null;
@@ -5859,7 +5895,7 @@ function isWindowsSandboxRunner(commandPath) {
5859
5895
  return path7.basename(commandPath).toLowerCase().startsWith("codex-command-runner");
5860
5896
  }
5861
5897
  function resolveWindowsNpmCodexEntry(deps = {}) {
5862
- const existsSyncFn = deps.existsSyncFn ?? existsSync5;
5898
+ const existsSyncFn = deps.existsSyncFn ?? existsSync4;
5863
5899
  const execFileSyncFn = deps.execFileSyncFn ?? execFileSync2;
5864
5900
  const env = deps.env ?? process.env;
5865
5901
  const winPath = path7.win32;
@@ -5881,7 +5917,7 @@ function resolveWindowsNpmCodexEntry(deps = {}) {
5881
5917
  return null;
5882
5918
  }
5883
5919
  function resolveWindowsCodexDesktopEntry(deps = {}) {
5884
- const existsSyncFn = deps.existsSyncFn ?? existsSync5;
5920
+ const existsSyncFn = deps.existsSyncFn ?? existsSync4;
5885
5921
  const env = deps.env ?? process.env;
5886
5922
  const homeDir = deps.homeDir;
5887
5923
  const winPath = path7.win32;
@@ -6209,7 +6245,7 @@ var CodexDriver = class {
6209
6245
  this.normalizer.reset();
6210
6246
  this.spawnWorkingDirectory = ctx.workingDirectory;
6211
6247
  this.codexHomeRoot = resolveCodexHomeRootFromEnv(spawnEnv, {
6212
- defaultHomeDir: os4.homedir(),
6248
+ defaultHomeDir: os3.homedir(),
6213
6249
  cwd: ctx.workingDirectory
6214
6250
  });
6215
6251
  const args = ["app-server", "--listen", "stdio://"];
@@ -6633,7 +6669,7 @@ function detectCodexModels(home = resolveCodexHomeRootFromEnv()) {
6633
6669
  let configPath = null;
6634
6670
  for (const root of codexStateRootCandidates(home)) {
6635
6671
  const candidate = path7.join(root, "models_cache.json");
6636
- if (existsSync5(candidate)) {
6672
+ if (existsSync4(candidate)) {
6637
6673
  cachePath = candidate;
6638
6674
  configPath = path7.join(root, "config.toml");
6639
6675
  break;
@@ -7092,11 +7128,11 @@ function detectCursorModels(runCommand = runCursorModelsCommand) {
7092
7128
  return parseCursorModelsOutput(String(result.stdout || ""));
7093
7129
  }
7094
7130
  function buildCursorModelProbeEnv(deps = {}) {
7095
- return scrubDaemonChildEnv(withWindowsUserEnvironment({
7131
+ return withWindowsUserEnvironment({
7096
7132
  ...deps.env ?? process.env,
7097
7133
  FORCE_COLOR: "0",
7098
7134
  NO_COLOR: "1"
7099
- }, deps));
7135
+ }, deps);
7100
7136
  }
7101
7137
  function runCursorModelsCommand() {
7102
7138
  return spawnSync("cursor-agent", ["models"], {
@@ -7108,7 +7144,7 @@ function runCursorModelsCommand() {
7108
7144
 
7109
7145
  // src/drivers/gemini.ts
7110
7146
  import { execFileSync as execFileSync3, spawn as spawn6 } from "child_process";
7111
- import { existsSync as existsSync6 } from "fs";
7147
+ import { existsSync as existsSync5 } from "fs";
7112
7148
  import path8 from "path";
7113
7149
  async function buildGeminiSpawnEnv(ctx, platform = process.platform) {
7114
7150
  const { spawnEnv } = await prepareCliTransport(ctx, { NO_COLOR: "1" }, platform);
@@ -7151,8 +7187,8 @@ function resolveGeminiSpawn(commandArgs, deps = {}) {
7151
7187
  return { command: resolveCommandOnPath("gemini", deps) ?? "gemini", args: commandArgs };
7152
7188
  }
7153
7189
  const execFileSyncFn = deps.execFileSyncFn ?? execFileSync3;
7154
- const existsSyncFn = deps.existsSyncFn ?? existsSync6;
7155
- const env = scrubDaemonChildEnv({ ...deps.env ?? process.env });
7190
+ const existsSyncFn = deps.existsSyncFn ?? existsSync5;
7191
+ const env = deps.env ?? process.env;
7156
7192
  const winPath = path8.win32;
7157
7193
  let geminiEntry = null;
7158
7194
  try {
@@ -7289,15 +7325,12 @@ var GeminiDriver = class {
7289
7325
  // src/drivers/kimi.ts
7290
7326
  import { randomUUID as randomUUID2 } from "crypto";
7291
7327
  import { spawn as spawn7 } from "child_process";
7292
- import { chmodSync, existsSync as existsSync7, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
7293
- import os5 from "os";
7328
+ import { existsSync as existsSync6, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
7329
+ import os4 from "os";
7294
7330
  import path9 from "path";
7295
7331
  var KIMI_WIRE_PROTOCOL_VERSION = "1.3";
7296
7332
  var KIMI_SYSTEM_PROMPT_FILE = ".slock-kimi-system.md";
7297
7333
  var KIMI_AGENT_FILE = ".slock-kimi-agent.yaml";
7298
- var KIMI_GENERATED_CONFIG_FILE = ".slock-kimi-config.toml";
7299
- var SLOCK_KIMI_CONFIG_CONTENT_ENV = "SLOCK_KIMI_CONFIG_CONTENT";
7300
- var SLOCK_KIMI_CONFIG_FILE_ENV = "SLOCK_KIMI_CONFIG_FILE";
7301
7334
  function parseToolArguments(raw) {
7302
7335
  if (typeof raw !== "string") return raw;
7303
7336
  try {
@@ -7306,73 +7339,6 @@ function parseToolArguments(raw) {
7306
7339
  return raw;
7307
7340
  }
7308
7341
  }
7309
- function readKimiConfigSource(home = os5.homedir(), env = process.env) {
7310
- const inlineConfig = env[SLOCK_KIMI_CONFIG_CONTENT_ENV];
7311
- if (inlineConfig && inlineConfig.trim()) {
7312
- return {
7313
- raw: inlineConfig,
7314
- explicitPath: null,
7315
- sourcePath: SLOCK_KIMI_CONFIG_CONTENT_ENV
7316
- };
7317
- }
7318
- const explicitPath = env[SLOCK_KIMI_CONFIG_FILE_ENV];
7319
- const configPath = explicitPath && explicitPath.trim() ? explicitPath : path9.join(home, ".kimi", "config.toml");
7320
- try {
7321
- return {
7322
- raw: readFileSync3(configPath, "utf8"),
7323
- explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
7324
- sourcePath: configPath
7325
- };
7326
- } catch {
7327
- return {
7328
- raw: null,
7329
- explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
7330
- sourcePath: configPath
7331
- };
7332
- }
7333
- }
7334
- function buildKimiSpawnEnv(env = process.env) {
7335
- const spawnEnv = { ...env, FORCE_COLOR: "0", NO_COLOR: "1" };
7336
- delete spawnEnv[SLOCK_KIMI_CONFIG_CONTENT_ENV];
7337
- delete spawnEnv[SLOCK_KIMI_CONFIG_FILE_ENV];
7338
- return scrubDaemonChildEnv(spawnEnv);
7339
- }
7340
- function buildKimiEffectiveEnv(ctx, overrideEnv) {
7341
- return {
7342
- ...process.env,
7343
- ...ctx.config.envVars || {},
7344
- ...overrideEnv || {}
7345
- };
7346
- }
7347
- function buildKimiLaunchOptions(ctx, opts = {}) {
7348
- const env = buildKimiEffectiveEnv(ctx, opts.env);
7349
- const source = readKimiConfigSource(opts.home ?? os5.homedir(), env);
7350
- const args = [];
7351
- let configFilePath = null;
7352
- let configContent = null;
7353
- if (source.explicitPath) {
7354
- configFilePath = source.explicitPath;
7355
- } else if (source.raw !== null && source.sourcePath === SLOCK_KIMI_CONFIG_CONTENT_ENV) {
7356
- configFilePath = path9.join(ctx.workingDirectory, KIMI_GENERATED_CONFIG_FILE);
7357
- configContent = source.raw;
7358
- if (opts.writeGeneratedConfig !== false) {
7359
- writeFileSync3(configFilePath, source.raw, { encoding: "utf8", mode: 384 });
7360
- chmodSync(configFilePath, 384);
7361
- }
7362
- }
7363
- if (configFilePath) {
7364
- args.push("--config-file", configFilePath);
7365
- }
7366
- if (ctx.config.model && ctx.config.model !== "default") {
7367
- args.push("--model", ctx.config.model);
7368
- }
7369
- return {
7370
- args,
7371
- env: buildKimiSpawnEnv(env),
7372
- configFilePath,
7373
- configContent
7374
- };
7375
- }
7376
7342
  function resolveKimiSpawn(commandArgs, deps = {}) {
7377
7343
  return {
7378
7344
  command: resolveCommandOnPath("kimi", deps) ?? "kimi",
@@ -7396,25 +7362,7 @@ var KimiDriver = class {
7396
7362
  };
7397
7363
  model = {
7398
7364
  detectedModelsVerifiedAs: "launchable",
7399
- toLaunchSpec: (modelId, ctx, opts) => {
7400
- if (!ctx) return { args: ["--model", modelId] };
7401
- const launchCtx = {
7402
- ...ctx,
7403
- config: {
7404
- ...ctx.config,
7405
- model: modelId
7406
- }
7407
- };
7408
- const launch = buildKimiLaunchOptions(launchCtx, {
7409
- home: opts?.home,
7410
- writeGeneratedConfig: false
7411
- });
7412
- return {
7413
- args: launch.args,
7414
- env: launch.env,
7415
- configFiles: launch.configFilePath ? [launch.configFilePath] : void 0
7416
- };
7417
- }
7365
+ toLaunchSpec: (modelId) => ({ args: ["--model", modelId] })
7418
7366
  };
7419
7367
  supportsStdinNotification = true;
7420
7368
  busyDeliveryMode = "direct";
@@ -7428,7 +7376,7 @@ var KimiDriver = class {
7428
7376
  this.promptRequestId = randomUUID2();
7429
7377
  const systemPromptPath = path9.join(ctx.workingDirectory, KIMI_SYSTEM_PROMPT_FILE);
7430
7378
  const agentFilePath = path9.join(ctx.workingDirectory, KIMI_AGENT_FILE);
7431
- if (!isResume || !existsSync7(systemPromptPath)) {
7379
+ if (!isResume || !existsSync6(systemPromptPath)) {
7432
7380
  writeFileSync3(systemPromptPath, ctx.prompt, "utf8");
7433
7381
  }
7434
7382
  writeFileSync3(agentFilePath, [
@@ -7438,23 +7386,21 @@ var KimiDriver = class {
7438
7386
  ` system_prompt_path: ./${KIMI_SYSTEM_PROMPT_FILE}`,
7439
7387
  ""
7440
7388
  ].join("\n"), "utf8");
7441
- const launch = buildKimiLaunchOptions(ctx);
7442
7389
  const args = [
7443
7390
  "--wire",
7444
7391
  "--yolo",
7445
7392
  "--agent-file",
7446
7393
  agentFilePath,
7447
7394
  "--session",
7448
- this.sessionId,
7449
- ...launch.args
7395
+ this.sessionId
7450
7396
  ];
7451
7397
  const launchRuntimeFields = runtimeConfigToLaunchFields(ctx.config);
7452
7398
  if (launchRuntimeFields.model && launchRuntimeFields.model !== "default") {
7453
7399
  args.push("--model", launchRuntimeFields.model);
7454
7400
  }
7455
7401
  const spawnEnv = (await prepareCliTransport(ctx, { NO_COLOR: "1" })).spawnEnv;
7456
- const spawnTarget = resolveKimiSpawn(args);
7457
- const proc = spawn7(spawnTarget.command, spawnTarget.args, {
7402
+ const launch = resolveKimiSpawn(args);
7403
+ const proc = spawn7(launch.command, launch.args, {
7458
7404
  cwd: ctx.workingDirectory,
7459
7405
  stdio: ["pipe", "pipe", "pipe"],
7460
7406
  env: spawnEnv,
@@ -7462,7 +7408,7 @@ var KimiDriver = class {
7462
7408
  // and has an 8191-character command-line limit. Kimi's official
7463
7409
  // installer/uv entrypoint is an executable, so launch it directly and
7464
7410
  // keep prompts on stdin / files instead of routing through cmd.exe.
7465
- shell: spawnTarget.shell
7411
+ shell: launch.shell
7466
7412
  });
7467
7413
  proc.stdin?.write(JSON.stringify({
7468
7414
  jsonrpc: "2.0",
@@ -7575,9 +7521,14 @@ var KimiDriver = class {
7575
7521
  return detectKimiModels();
7576
7522
  }
7577
7523
  };
7578
- function detectKimiModels(home = os5.homedir(), opts = {}) {
7579
- const raw = readKimiConfigSource(home, opts.env).raw;
7580
- if (raw === null) return null;
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
+ }
7581
7532
  const models = [];
7582
7533
  const sectionRe = /^\s*\[models(?:\.([^\]]+)|"\.[^"]+"|\."[^"]+")\s*\]\s*$/gm;
7583
7534
  const lineRe = /^\s*\[models\.(.+?)\s*\]\s*$/gm;
@@ -7599,7 +7550,7 @@ function detectKimiModels(home = os5.homedir(), opts = {}) {
7599
7550
  // src/drivers/kimi-sdk.ts
7600
7551
  import { randomUUID as randomUUID3 } from "crypto";
7601
7552
  import { EventEmitter } from "events";
7602
- import { mkdirSync as mkdirSync3, readFileSync as readFileSync4 } from "fs";
7553
+ import { mkdirSync as mkdirSync2, readFileSync as readFileSync4 } from "fs";
7603
7554
  import path10 from "path";
7604
7555
  import { createRequire as createRequire2 } from "module";
7605
7556
  import {
@@ -7748,12 +7699,12 @@ var KIMI_SDK_RUNTIME_SESSION_DESCRIPTOR = {
7748
7699
  };
7749
7700
  async function createKimiAgentSessionForContext(ctx, sessionId) {
7750
7701
  const sessionDir = buildKimiSessionDir(ctx.workingDirectory);
7751
- mkdirSync3(sessionDir, { recursive: true });
7702
+ mkdirSync2(sessionDir, { recursive: true });
7752
7703
  const cliTransport = await prepareCliTransport(ctx, { NO_COLOR: "1" });
7753
7704
  const spawnEnv = cliTransport.spawnEnv;
7754
7705
  const wrapperPath = cliTransport.wrapperPath;
7755
7706
  const homeDir = spawnEnv.KIMI_HOME || (process.env.HOME ? path10.join(process.env.HOME, ".kimi") : path10.join(ctx.workingDirectory, ".kimi"));
7756
- mkdirSync3(homeDir, { recursive: true });
7707
+ mkdirSync2(homeDir, { recursive: true });
7757
7708
  const harness = createKimiHarness({
7758
7709
  homeDir,
7759
7710
  identity: {
@@ -8084,8 +8035,8 @@ var KimiSdkDriver = class {
8084
8035
 
8085
8036
  // src/drivers/opencode.ts
8086
8037
  import { spawn as spawn8, spawnSync as spawnSync2 } from "child_process";
8087
- import { existsSync as existsSync8, readFileSync as readFileSync5 } from "fs";
8088
- import os6 from "os";
8038
+ import { existsSync as existsSync7, readFileSync as readFileSync5 } from "fs";
8039
+ import os5 from "os";
8089
8040
  import path11 from "path";
8090
8041
  var SLOCK_AGENT_NAME = "slock";
8091
8042
  var NO_MESSAGE_PROMPT = "No new messages are pending. Stop now.";
@@ -8114,7 +8065,7 @@ function parseUserOpenCodeConfig(ctx) {
8114
8065
  const raw = runtimeConfigToLaunchFields(ctx.config).envVars?.OPENCODE_CONFIG_CONTENT;
8115
8066
  return parseOpenCodeConfigContent(raw);
8116
8067
  }
8117
- function readLocalOpenCodeConfig(home = os6.homedir()) {
8068
+ function readLocalOpenCodeConfig(home = os5.homedir()) {
8118
8069
  const configPath = path11.join(home, ".config", "opencode", "opencode.json");
8119
8070
  try {
8120
8071
  return parseOpenCodeConfigContent(readFileSync5(configPath, "utf8"));
@@ -8175,7 +8126,7 @@ function mergeOpenCodeConfigs(localConfig, envConfig) {
8175
8126
  }
8176
8127
  };
8177
8128
  }
8178
- function buildOpenCodeConfig(ctx, home = os6.homedir()) {
8129
+ function buildOpenCodeConfig(ctx, home = os5.homedir()) {
8179
8130
  const userConfig = mergeOpenCodeConfigs(readLocalOpenCodeConfig(home), parseUserOpenCodeConfig(ctx));
8180
8131
  const userAgents = recordField(userConfig.agent);
8181
8132
  const userSlockAgent = recordField(userAgents[SLOCK_AGENT_NAME]);
@@ -8193,7 +8144,7 @@ function buildOpenCodeConfig(ctx, home = os6.homedir()) {
8193
8144
  mcp: recordField(userConfig.mcp)
8194
8145
  };
8195
8146
  }
8196
- async function buildOpenCodeLaunchOptions(ctx, home = os6.homedir(), version = null) {
8147
+ async function buildOpenCodeLaunchOptions(ctx, home = os5.homedir(), version = null) {
8197
8148
  const slock = await prepareCliTransport(ctx, { NO_COLOR: "1" });
8198
8149
  const config = buildOpenCodeConfig(ctx, home);
8199
8150
  const env = {
@@ -8292,7 +8243,7 @@ function formatOpenCodeLabelToken(token) {
8292
8243
  if (/^\d/.test(token)) return token;
8293
8244
  return normalized.charAt(0).toUpperCase() + normalized.slice(1);
8294
8245
  }
8295
- function detectOpenCodeModels(home = os6.homedir(), runCommand = runOpenCodeModelsCommand) {
8246
+ function detectOpenCodeModels(home = os5.homedir(), runCommand = runOpenCodeModelsCommand) {
8296
8247
  const commandResult = runCommand(home);
8297
8248
  if (commandResult.error || commandResult.status !== 0) return null;
8298
8249
  return parseOpenCodeModelsOutput(commandResult.stdout);
@@ -8301,7 +8252,7 @@ function runOpenCodeModelsCommand(home, deps = {}) {
8301
8252
  const platform = deps.platform ?? process.platform;
8302
8253
  const spawnSyncFn = deps.spawnSyncFn ?? spawnSync2;
8303
8254
  const result = spawnSyncFn("opencode", ["models"], {
8304
- env: scrubDaemonChildEnv({ ...process.env, HOME: home, FORCE_COLOR: "0", NO_COLOR: "1" }),
8255
+ env: { ...process.env, HOME: home, FORCE_COLOR: "0", NO_COLOR: "1" },
8305
8256
  encoding: "utf8",
8306
8257
  timeout: 5e3,
8307
8258
  shell: platform === "win32"
@@ -8332,7 +8283,7 @@ function openCodeSpecForEntry(entry, commandArgs) {
8332
8283
  return { command: process.execPath, args: [entry, ...commandArgs], shell: false };
8333
8284
  }
8334
8285
  function resolveWindowsOpenCodePackageEntry(commandPath, deps = {}) {
8335
- const existsSyncFn = deps.existsSyncFn ?? existsSync8;
8286
+ const existsSyncFn = deps.existsSyncFn ?? existsSync7;
8336
8287
  const execFileSyncFn = deps.execFileSyncFn;
8337
8288
  const env = deps.env ?? process.env;
8338
8289
  const winPath = path11.win32;
@@ -8493,7 +8444,7 @@ var OpenCodeDriver = class {
8493
8444
  if (unsupportedMessage) {
8494
8445
  throw new Error(unsupportedMessage);
8495
8446
  }
8496
- const launch = await buildOpenCodeLaunchOptions(ctx, os6.homedir(), version);
8447
+ const launch = await buildOpenCodeLaunchOptions(ctx, os5.homedir(), version);
8497
8448
  const spawnSpec = resolveOpenCodeSpawn(launch.args);
8498
8449
  const proc = spawn8(spawnSpec.command, spawnSpec.args, {
8499
8450
  cwd: ctx.workingDirectory,
@@ -8560,7 +8511,7 @@ var OpenCodeDriver = class {
8560
8511
  // src/drivers/pi.ts
8561
8512
  import { randomUUID as randomUUID4 } from "crypto";
8562
8513
  import { EventEmitter as EventEmitter2 } from "events";
8563
- import { mkdirSync as mkdirSync4, readdirSync as readdirSync2 } from "fs";
8514
+ import { mkdirSync as mkdirSync3, readdirSync as readdirSync3 } from "fs";
8564
8515
  import path12 from "path";
8565
8516
  import {
8566
8517
  AuthStorage,
@@ -8604,7 +8555,7 @@ function resolvePiModelFromRegistry(modelId, modelRegistry) {
8604
8555
  function findPiSessionFile(sessionDir, sessionId) {
8605
8556
  let entries;
8606
8557
  try {
8607
- entries = readdirSync2(sessionDir);
8558
+ entries = readdirSync3(sessionDir);
8608
8559
  } catch {
8609
8560
  return null;
8610
8561
  }
@@ -8828,7 +8779,7 @@ var PI_IDLE_PROMPT_RETRY_MS = 25;
8828
8779
  var PI_IDLE_PROMPT_MAX_WAIT_MS = 1e3;
8829
8780
  async function createPiAgentSessionForContext(ctx, sessionId) {
8830
8781
  const sessionDir = buildPiSessionDir(ctx.workingDirectory);
8831
- mkdirSync4(sessionDir, { recursive: true });
8782
+ mkdirSync3(sessionDir, { recursive: true });
8832
8783
  const launchRuntimeFields = runtimeConfigToLaunchFields(ctx.config);
8833
8784
  const requestedModel = launchRuntimeFields.model || "default";
8834
8785
  const traceSpan = ctx.tracer?.startSpan("daemon.pi.session.create", {
@@ -10058,7 +10009,7 @@ function findSessionJsonl(root, predicate) {
10058
10009
  if (depth < 0 || visited >= maxEntries) return null;
10059
10010
  let entries;
10060
10011
  try {
10061
- entries = readdirSync3(dir, { withFileTypes: true }).sort((a, b) => b.name.localeCompare(a.name));
10012
+ entries = readdirSync4(dir, { withFileTypes: true }).sort((a, b) => b.name.localeCompare(a.name));
10062
10013
  } catch {
10063
10014
  return null;
10064
10015
  }
@@ -10085,7 +10036,7 @@ function findKimiSdkSessionDir(sessionId, agentId, homeDir) {
10085
10036
  if (!line.trim()) continue;
10086
10037
  try {
10087
10038
  const entry = JSON.parse(line);
10088
- if (entry.sessionId === sessionId && entry.sessionDir && existsSync9(entry.sessionDir)) {
10039
+ if (entry.sessionId === sessionId && entry.sessionDir && existsSync8(entry.sessionDir)) {
10089
10040
  return entry.sessionDir;
10090
10041
  }
10091
10042
  } catch {
@@ -10096,10 +10047,10 @@ function findKimiSdkSessionDir(sessionId, agentId, homeDir) {
10096
10047
  const sessionsRoot = path14.join(homeDir, ".kimi", "sessions");
10097
10048
  try {
10098
10049
  const prefix = agentId ? `wd_${agentId}_` : `wd_`;
10099
- for (const entry of readdirSync3(sessionsRoot, { withFileTypes: true })) {
10050
+ for (const entry of readdirSync4(sessionsRoot, { withFileTypes: true })) {
10100
10051
  if (!entry.isDirectory() || !entry.name.startsWith(prefix)) continue;
10101
10052
  const candidate = path14.join(sessionsRoot, entry.name, `session_${sessionId}`);
10102
- if (existsSync9(candidate)) return candidate;
10053
+ if (existsSync8(candidate)) return candidate;
10103
10054
  }
10104
10055
  } catch {
10105
10056
  }
@@ -10109,7 +10060,7 @@ function findPiSessionFile2(sessionId, workingDirectory, homeDir) {
10109
10060
  if (workingDirectory) {
10110
10061
  const piSessionsDir = path14.join(workingDirectory, ".pi-sessions");
10111
10062
  try {
10112
- const files = readdirSync3(piSessionsDir, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => ({ name: e.name, path: path14.join(piSessionsDir, e.name), stat: statSync(path14.join(piSessionsDir, e.name)) })).filter((f) => f.stat.isFile() && f.name.includes(sessionId)).sort((a, b) => b.stat.mtimeMs - a.stat.mtimeMs);
10063
+ const files = readdirSync4(piSessionsDir, { withFileTypes: true }).filter((e) => e.isFile() && e.name.endsWith(".jsonl")).map((e) => ({ name: e.name, path: path14.join(piSessionsDir, e.name), stat: statSync(path14.join(piSessionsDir, e.name)) })).filter((f) => f.stat.isFile() && f.name.includes(sessionId)).sort((a, b) => b.stat.mtimeMs - a.stat.mtimeMs);
10113
10064
  if (files[0]) return files[0].path;
10114
10065
  } catch {
10115
10066
  }
@@ -10131,7 +10082,7 @@ function safeSessionFilename(value) {
10131
10082
  function writeRuntimeSessionHandoff(runtime, sessionId, fallbackDir) {
10132
10083
  try {
10133
10084
  const dir = path14.join(fallbackDir, ".slock", "runtime-sessions");
10134
- mkdirSync5(dir, { recursive: true });
10085
+ mkdirSync4(dir, { recursive: true });
10135
10086
  const filePath = path14.join(dir, `${runtime}-${safeSessionFilename(sessionId)}.jsonl`);
10136
10087
  writeFileSync4(filePath, JSON.stringify({
10137
10088
  type: "runtime_session_handoff",
@@ -10152,28 +10103,22 @@ function writeRuntimeSessionHandoff(runtime, sessionId, fallbackDir) {
10152
10103
  }
10153
10104
  }
10154
10105
  function resolveRuntimeHomeDir(config, defaultHomeDir, workspacePath, opts = {}) {
10155
- if (isClaudeCustomProviderConfig(config)) {
10156
- return getClaudeProviderStatePaths(workspacePath).home;
10157
- }
10158
10106
  if (config.runtime === "codex") {
10159
10107
  return resolveCodexHomeRootFromConfig(config, defaultHomeDir, workspacePath, process.env, opts);
10160
10108
  }
10161
10109
  return defaultHomeDir;
10162
10110
  }
10163
10111
  function ensureRuntimeHomeDir(config, defaultHomeDir, workspacePath, opts = {}) {
10164
- if (isClaudeCustomProviderConfig(config)) {
10165
- return ensureClaudeProviderStatePaths(workspacePath).home;
10166
- }
10167
10112
  if (config.runtime === "codex") {
10168
10113
  const home = resolveCodexHomeRootFromConfig(config, defaultHomeDir, workspacePath, process.env, opts);
10169
10114
  if (opts.agentId) {
10170
- mkdirSync5(home, { recursive: true });
10115
+ mkdirSync4(home, { recursive: true });
10171
10116
  }
10172
10117
  return home;
10173
10118
  }
10174
10119
  return defaultHomeDir;
10175
10120
  }
10176
- function resolveRuntimeSessionRef(runtime, sessionId, homeDir = os7.homedir(), fallbackDir, opts) {
10121
+ function resolveRuntimeSessionRef(runtime, sessionId, homeDir = os6.homedir(), fallbackDir, opts) {
10177
10122
  let resolvedPath = null;
10178
10123
  let lookupMethod = "none";
10179
10124
  if (runtime === "claude") {
@@ -11298,7 +11243,7 @@ var AgentProcessManager = class _AgentProcessManager {
11298
11243
  this.serverUrl = opts.serverUrl;
11299
11244
  this.slockHome = opts.slockHome ? path14.resolve(opts.slockHome) : resolveSlockHome();
11300
11245
  this.dataDir = opts.dataDir || resolveSlockHomePath("agents", this.slockHome);
11301
- this.runtimeSessionHomeDir = opts.runtimeSessionHomeDir || os7.homedir();
11246
+ this.runtimeSessionHomeDir = opts.runtimeSessionHomeDir || os6.homedir();
11302
11247
  this.driverResolver = opts.driverResolver || getDriver;
11303
11248
  this.defaultAgentEnvVarsProvider = opts.defaultAgentEnvVarsProvider || null;
11304
11249
  this.tracer = opts.tracer ?? noopTracer;
@@ -11990,7 +11935,25 @@ var AgentProcessManager = class _AgentProcessManager {
11990
11935
  queue_depth: this.agentStartQueue.length,
11991
11936
  active_starts: this.activeAgentStartCount,
11992
11937
  max_concurrent_starts: this.maxConcurrentAgentStarts,
11993
- min_start_interval_ms: this.agentStartIntervalMs
11938
+ min_start_interval_ms: this.agentStartIntervalMs,
11939
+ ...this.runtimeLaunchPolicyTraceAttrs(config)
11940
+ };
11941
+ }
11942
+ runtimeLaunchPolicyTraceAttrs(config) {
11943
+ if (config.runtime !== "claude") return {};
11944
+ const customProvider = isClaudeCustomProviderConfig(config);
11945
+ if (!customProvider) {
11946
+ return {
11947
+ claude_custom_provider: false
11948
+ };
11949
+ }
11950
+ return {
11951
+ claude_custom_provider: true,
11952
+ claude_custom_provider_settings_sources_policy: "project,local",
11953
+ claude_custom_provider_inherited_provider_scrub: true,
11954
+ claude_custom_provider_host_managed_flag: false,
11955
+ claude_custom_provider_home_override: false,
11956
+ claude_custom_provider_config_dir_override: false
11994
11957
  };
11995
11958
  }
11996
11959
  getDeliveryTraceContext(message) {
@@ -14236,7 +14199,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
14236
14199
  const config = agent?.config ?? idle?.config ?? null;
14237
14200
  const runtime = runtimeHint || config?.runtime || "claude";
14238
14201
  const workspaceDir = path14.join(this.dataDir, agentId);
14239
- const hostHome = os7.homedir();
14202
+ const hostHome = os6.homedir();
14240
14203
  const home = agent?.runtime.currentRuntimeHomeDir || (config ? ensureRuntimeHomeDir(config, hostHome, workspaceDir, { agentId, slockHome: this.slockHome }) : runtime === "codex" ? resolveCodexHomeRootFromEnv(process.env, { defaultHomeDir: hostHome, cwd: workspaceDir }) : hostHome);
14241
14204
  const paths = _AgentProcessManager.SKILL_PATHS[runtime] || _AgentProcessManager.SKILL_PATHS.claude;
14242
14205
  const globalDirs = runtime === "codex" ? [
@@ -14691,6 +14654,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
14691
14654
  hasSession: Boolean(ap.sessionId),
14692
14655
  ...this.messagesTraceAttrs(messages),
14693
14656
  ...inputTraceAttrs,
14657
+ ...this.runtimeLaunchPolicyTraceAttrs(ap.config),
14694
14658
  ...this.runtimeProfileTurnControlTraceAttrs(ap.runtimeProfileTurnControl)
14695
14659
  }
14696
14660
  });
@@ -14698,6 +14662,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
14698
14662
  reason,
14699
14663
  ...this.messagesTraceAttrs(messages),
14700
14664
  ...inputTraceAttrs,
14665
+ ...this.runtimeLaunchPolicyTraceAttrs(ap.config),
14701
14666
  ...this.runtimeProfileTurnControlTraceAttrs(ap.runtimeProfileTurnControl)
14702
14667
  });
14703
14668
  ap.runtimeTraceSpan = span;
@@ -16330,8 +16295,8 @@ var ReminderCache = class {
16330
16295
 
16331
16296
  // src/machineLock.ts
16332
16297
  import { createHash as createHash4, randomUUID as randomUUID6 } from "crypto";
16333
- import { mkdirSync as mkdirSync6, readFileSync as readFileSync7, rmSync as rmSync3, statSync as statSync2, writeFileSync as writeFileSync5 } from "fs";
16334
- import os8 from "os";
16298
+ import { mkdirSync as mkdirSync5, readFileSync as readFileSync7, rmSync as rmSync3, statSync as statSync2, writeFileSync as writeFileSync5 } from "fs";
16299
+ import os7 from "os";
16335
16300
  import path15 from "path";
16336
16301
  var INCOMPLETE_LOCK_STALE_MS = 3e4;
16337
16302
  var DaemonMachineLockConflictError = class extends Error {
@@ -16387,14 +16352,14 @@ function acquireDaemonMachineLock(options) {
16387
16352
  const machineDir = path15.join(rootDir, lockId);
16388
16353
  const lockDir = path15.join(machineDir, "daemon.lock");
16389
16354
  const token = randomUUID6();
16390
- mkdirSync6(machineDir, { recursive: true });
16355
+ mkdirSync5(machineDir, { recursive: true });
16391
16356
  for (let attempt = 0; attempt < 2; attempt += 1) {
16392
16357
  try {
16393
- mkdirSync6(lockDir);
16358
+ mkdirSync5(lockDir);
16394
16359
  const owner = {
16395
16360
  pid: process.pid,
16396
16361
  token,
16397
- hostname: os8.hostname(),
16362
+ hostname: os7.hostname(),
16398
16363
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
16399
16364
  serverUrl: options.serverUrl,
16400
16365
  apiKeyFingerprint: fingerprint.slice(0, 16)
@@ -16445,7 +16410,7 @@ function acquireDaemonMachineLock(options) {
16445
16410
  }
16446
16411
 
16447
16412
  // src/localTraceSink.ts
16448
- import { appendFileSync, mkdirSync as mkdirSync7, readdirSync as readdirSync4, rmSync as rmSync4, statSync as statSync3, writeFileSync as writeFileSync6 } from "fs";
16413
+ import { appendFileSync, mkdirSync as mkdirSync6, readdirSync as readdirSync5, rmSync as rmSync4, statSync as statSync3, writeFileSync as writeFileSync6 } from "fs";
16449
16414
  import path16 from "path";
16450
16415
  var DEFAULT_MAX_FILE_BYTES = 5 * 1024 * 1024;
16451
16416
  var DEFAULT_MAX_FILE_AGE_MS = 5 * 60 * 1e3;
@@ -16509,7 +16474,7 @@ var LocalRotatingTraceSink = class {
16509
16474
  return this.currentFile;
16510
16475
  }
16511
16476
  ensureFile(nextBytes) {
16512
- mkdirSync7(this.traceDir, { recursive: true, mode: 448 });
16477
+ mkdirSync6(this.traceDir, { recursive: true, mode: 448 });
16513
16478
  const nowMs = this.nowMsProvider();
16514
16479
  const shouldRotateForAge = this.currentFileOpenedAtMs !== null && nowMs - this.currentFileOpenedAtMs >= this.maxFileAgeMs;
16515
16480
  if (!this.currentFile || this.currentSize + nextBytes > this.maxFileBytes || shouldRotateForAge) {
@@ -16524,7 +16489,7 @@ var LocalRotatingTraceSink = class {
16524
16489
  }
16525
16490
  }
16526
16491
  pruneOldFiles() {
16527
- const files = readdirSync4(this.traceDir).filter((name) => name.startsWith("daemon-trace-") && name.endsWith(".jsonl")).sort();
16492
+ const files = readdirSync5(this.traceDir).filter((name) => name.startsWith("daemon-trace-") && name.endsWith(".jsonl")).sort();
16528
16493
  const excess = files.length - this.maxFiles;
16529
16494
  if (excess <= 0) return;
16530
16495
  for (const file of files.slice(0, excess)) {
@@ -16914,7 +16879,7 @@ var DAEMON_CORE_TRACE_ATTR_CONTRACTS = {
16914
16879
  spanAttrs: ["agentId", "event_kind", "runtime"]
16915
16880
  }
16916
16881
  };
16917
- var DAEMON_CLI_USAGE = `Usage: slock-daemon --server-url <url> (--api-key <key> or ${DAEMON_API_KEY_ENV}=<key>)`;
16882
+ var DAEMON_CLI_USAGE = "Usage: slock-daemon --server-url <url> --api-key <key>";
16918
16883
  var RunnerCredentialMintError2 = class extends Error {
16919
16884
  code;
16920
16885
  retryable;
@@ -16950,9 +16915,9 @@ function runnerCredentialErrorDetail2(error) {
16950
16915
  async function waitForRunnerCredentialRetry2() {
16951
16916
  await new Promise((resolve) => setTimeout(resolve, RUNNER_CREDENTIAL_MINT_RETRY_DELAY_MS2));
16952
16917
  }
16953
- function parseDaemonCliArgs(args, env = {}) {
16918
+ function parseDaemonCliArgs(args) {
16954
16919
  let serverUrl = "";
16955
- let apiKey = env[DAEMON_API_KEY_ENV] ?? "";
16920
+ let apiKey = "";
16956
16921
  for (let i = 0; i < args.length; i++) {
16957
16922
  if (args[i] === "--server-url" && args[i + 1]) serverUrl = args[++i];
16958
16923
  if (args[i] === "--api-key" && args[i + 1]) apiKey = args[++i];
@@ -16989,7 +16954,7 @@ function resolveSlockCliPathOrEmpty(moduleUrl = import.meta.url) {
16989
16954
  }
16990
16955
  async function runBundledSlockCli(argv) {
16991
16956
  process.argv = [process.execPath, "slock", ...argv];
16992
- await import("./dist-5BEASCX5.js");
16957
+ await import("./dist-4KV4FRQE.js");
16993
16958
  }
16994
16959
  function detectRuntimes(tracer = noopTracer) {
16995
16960
  const ids = [];
@@ -17794,8 +17759,8 @@ var DaemonCore = class {
17794
17759
  capabilities: ["agent:start", "agent:stop", "agent:deliver", "workspace:files"],
17795
17760
  runtimes,
17796
17761
  runningAgents: runningAgentIds,
17797
- hostname: this.options.hostname ?? os9.hostname(),
17798
- os: this.options.osDescription ?? `${os9.platform()} ${os9.arch()}`,
17762
+ hostname: this.options.hostname ?? os8.hostname(),
17763
+ os: this.options.osDescription ?? `${os8.platform()} ${os8.arch()}`,
17799
17764
  daemonVersion: this.daemonVersion,
17800
17765
  ...this.computerVersion ? { computerVersion: this.computerVersion } : {}
17801
17766
  });
@@ -17876,8 +17841,6 @@ var DaemonCore = class {
17876
17841
 
17877
17842
  export {
17878
17843
  subscribeDaemonLogs,
17879
- DAEMON_API_KEY_ENV,
17880
- scrubDaemonAuthEnv,
17881
17844
  resolveWorkspaceDirectoryPath,
17882
17845
  scanWorkspaceDirectories,
17883
17846
  deleteWorkspaceDirectory,
package/dist/cli/index.js CHANGED
@@ -18337,6 +18337,7 @@ function formatHeldSendOutput(target, data) {
18337
18337
  ${MESSAGE_HEREDOC_DELIMITER}
18338
18338
  To send the current draft unchanged:
18339
18339
  raft message send --send-draft --target "${target}"
18340
+ You can also choose not to send anything.
18340
18341
  `,
18341
18342
  continueAnywayInstruction: `If repeated updates keep blocking the same draft and this is still the right reply, you may use:
18342
18343
  raft message send --send-draft --anyway --target "${target}"
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-R3YQ3ZXU.js";
14
+ } from "./chunk-RNUZAZCS.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
  };
@@ -18099,6 +18099,7 @@ function formatHeldSendOutput(target, data) {
18099
18099
  ${MESSAGE_HEREDOC_DELIMITER}
18100
18100
  To send the current draft unchanged:
18101
18101
  raft message send --send-draft --target "${target}"
18102
+ You can also choose not to send anything.
18102
18103
  `,
18103
18104
  continueAnywayInstruction: `If repeated updates keep blocking the same draft and this is still the right reply, you may use:
18104
18105
  raft message send --send-draft --anyway --target "${target}"
package/dist/index.js CHANGED
@@ -2,13 +2,11 @@
2
2
  import {
3
3
  DAEMON_CLI_USAGE,
4
4
  DaemonCore,
5
- parseDaemonCliArgs,
6
- scrubDaemonAuthEnv
7
- } from "./chunk-R3YQ3ZXU.js";
5
+ parseDaemonCliArgs
6
+ } from "./chunk-RNUZAZCS.js";
8
7
 
9
8
  // src/index.ts
10
- var parsedArgs = parseDaemonCliArgs(process.argv.slice(2), process.env);
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botiverse/raft-daemon",
3
- "version": "0.63.1-play.20260619141001",
3
+ "version": "0.63.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "raft-daemon": "dist/raft-daemon.js",