@botiverse/raft-daemon 0.63.1 → 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";
@@ -4769,12 +4769,101 @@ var ClaudeEventNormalizer = class {
4769
4769
 
4770
4770
  // src/drivers/claudeLaunch.ts
4771
4771
  import { writeFileSync as writeFileSync2 } from "fs";
4772
- 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
+ }
4773
4862
 
4774
4863
  // src/drivers/probe.ts
4775
4864
  import { execFileSync } from "child_process";
4776
4865
  import { existsSync as existsSync3 } from "fs";
4777
- import path3 from "path";
4866
+ import path4 from "path";
4778
4867
  function normalizeExecOutput(raw) {
4779
4868
  return Buffer.isBuffer(raw) ? raw.toString("utf8") : String(raw ?? "");
4780
4869
  }
@@ -4907,13 +4996,13 @@ function resolveCommandOnWindows(command, env, execFileSyncFn, existsSyncFn) {
4907
4996
  if (!resolved) return null;
4908
4997
  const lowerResolved = resolved.toLowerCase();
4909
4998
  if (lowerResolved.endsWith(".ps1")) {
4910
- const dir = path3.dirname(resolved);
4911
- const base = path3.basename(resolved, ".ps1");
4999
+ const dir = path4.dirname(resolved);
5000
+ const base = path4.basename(resolved, ".ps1");
4912
5001
  const alternatives = [
4913
- path3.join(dir, `${base}.cmd`),
4914
- path3.join(dir, `${base}.bat`),
4915
- path3.join(dir, `${base}.exe`),
4916
- 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)
4917
5006
  ];
4918
5007
  for (const alt of alternatives) {
4919
5008
  if (existsSyncFn(alt)) return alt;
@@ -4974,11 +5063,11 @@ function readCommandVersion(command, args = [], deps = {}) {
4974
5063
  }
4975
5064
  function resolveHomePath(relativePath, deps = {}) {
4976
5065
  const homeDir = deps.homeDir ?? deps.env?.HOME ?? process.env.HOME ?? "";
4977
- return path3.join(homeDir, relativePath);
5066
+ return path4.join(homeDir, relativePath);
4978
5067
  }
4979
5068
 
4980
5069
  // src/drivers/claudeLaunch.ts
4981
- 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");
4982
5071
  var CLAUDE_DESKTOP_CLI_SYSTEM_PATH = "/Applications/Claude Code URL Handler.app/Contents/MacOS/claude";
4983
5072
  var CLAUDE_SYSTEM_PROMPT_FILE = "claude-system-prompt.md";
4984
5073
  var CLAUDE_DISALLOWED_TOOLS = [
@@ -5033,6 +5122,9 @@ function buildClaudeArgs(config, opts) {
5033
5122
  if (launchRuntimeFields.reasoningEffort) {
5034
5123
  args.push("--effort", launchRuntimeFields.reasoningEffort);
5035
5124
  }
5125
+ if (isClaudeCustomProviderConfig(config)) {
5126
+ args.push("--setting-sources", "project,local");
5127
+ }
5036
5128
  if (launchRuntimeFields.mode.kind === "fast") {
5037
5129
  args.push("--settings", JSON.stringify({ fastMode: true }));
5038
5130
  }
@@ -5042,7 +5134,7 @@ function buildClaudeArgs(config, opts) {
5042
5134
  return args;
5043
5135
  }
5044
5136
  function writeClaudeSystemPromptFile(standingPrompt, slockDir) {
5045
- const systemPromptPath = path4.join(slockDir, CLAUDE_SYSTEM_PROMPT_FILE);
5137
+ const systemPromptPath = path5.join(slockDir, CLAUDE_SYSTEM_PROMPT_FILE);
5046
5138
  writeFileSync2(systemPromptPath, standingPrompt, { mode: 384 });
5047
5139
  return systemPromptPath;
5048
5140
  }
@@ -5057,52 +5149,6 @@ function buildClaudeSpawnSpec(claudeCommand, platform = process.platform) {
5057
5149
  };
5058
5150
  }
5059
5151
 
5060
- // src/drivers/claudeProviderIsolation.ts
5061
- import { existsSync as existsSync4, mkdirSync as mkdirSync2, symlinkSync } from "fs";
5062
- import os2 from "os";
5063
- import path5 from "path";
5064
- function isClaudeCustomProviderConfig(config) {
5065
- const launchRuntimeFields = runtimeConfigToLaunchFields(config);
5066
- return launchRuntimeFields.runtime === "claude" && Boolean(launchRuntimeFields.envVars?.ANTHROPIC_BASE_URL) && Boolean(launchRuntimeFields.envVars?.ANTHROPIC_API_KEY);
5067
- }
5068
- function getClaudeProviderStatePaths(workingDirectory) {
5069
- const root = path5.join(workingDirectory, ".slock", "claude-provider");
5070
- const home = path5.join(root, "home");
5071
- return {
5072
- root,
5073
- home,
5074
- configDir: path5.join(home, ".claude")
5075
- };
5076
- }
5077
- function linkIfPresent(source, target) {
5078
- try {
5079
- if (!existsSync4(source) || existsSync4(target)) return;
5080
- mkdirSync2(path5.dirname(target), { recursive: true, mode: 448 });
5081
- symlinkSync(source, target, "dir");
5082
- } catch {
5083
- }
5084
- }
5085
- function ensureClaudeProviderStatePaths(workingDirectory, hostClaudeHome = path5.join(os2.homedir(), ".claude")) {
5086
- const paths = getClaudeProviderStatePaths(workingDirectory);
5087
- mkdirSync2(paths.home, { recursive: true, mode: 448 });
5088
- mkdirSync2(paths.configDir, { recursive: true, mode: 448 });
5089
- linkIfPresent(path5.join(hostClaudeHome, "skills"), path5.join(paths.configDir, "skills"));
5090
- linkIfPresent(path5.join(hostClaudeHome, "commands"), path5.join(paths.configDir, "commands"));
5091
- return paths;
5092
- }
5093
- function buildClaudeProviderIsolationEnv(ctx) {
5094
- if (!isClaudeCustomProviderConfig(ctx.config)) {
5095
- return {};
5096
- }
5097
- const paths = ensureClaudeProviderStatePaths(ctx.workingDirectory);
5098
- return {
5099
- HOME: paths.home,
5100
- USERPROFILE: paths.home,
5101
- CLAUDE_CONFIG_DIR: paths.configDir,
5102
- CLAUDE_CODE_PROVIDER_MANAGED_BY_HOST: "1"
5103
- };
5104
- }
5105
-
5106
5152
  // src/drivers/claude.ts
5107
5153
  var ClaudeDriver = class {
5108
5154
  id = "claude";
@@ -5140,6 +5186,11 @@ var ClaudeDriver = class {
5140
5186
  ctx,
5141
5187
  buildClaudeProviderIsolationEnv(ctx)
5142
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
+ }
5143
5194
  const systemPromptPath = writeClaudeSystemPromptFile(ctx.standingPrompt, slockDir);
5144
5195
  const args = this.buildClaudeArgs(ctx.config, {
5145
5196
  standingPromptFilePath: systemPromptPath
@@ -5197,12 +5248,12 @@ var ClaudeDriver = class {
5197
5248
 
5198
5249
  // src/drivers/codex.ts
5199
5250
  import { spawn as spawn2, execFileSync as execFileSync2 } from "child_process";
5200
- import { existsSync as existsSync5, readFileSync as readFileSync2 } from "fs";
5201
- import os4 from "os";
5251
+ import { existsSync as existsSync4, readFileSync as readFileSync2 } from "fs";
5252
+ import os3 from "os";
5202
5253
  import path7 from "path";
5203
5254
 
5204
5255
  // src/drivers/codexHome.ts
5205
- import os3 from "os";
5256
+ import os2 from "os";
5206
5257
  import path6 from "path";
5207
5258
  function readConfiguredCodexHome(env) {
5208
5259
  const raw = env.CODEX_HOME;
@@ -5213,7 +5264,7 @@ function resolveCodexHomeRootFromEnv(env = process.env, opts = {}) {
5213
5264
  if (raw) {
5214
5265
  return path6.resolve(opts.cwd ?? process.cwd(), raw);
5215
5266
  }
5216
- return path6.join(opts.defaultHomeDir ?? os3.homedir(), ".codex");
5267
+ return path6.join(opts.defaultHomeDir ?? os2.homedir(), ".codex");
5217
5268
  }
5218
5269
  function hasConfiguredCodexHome(config, baseEnv = process.env) {
5219
5270
  const launchRuntimeFields = config ? runtimeConfigToLaunchFields(config) : null;
@@ -5844,7 +5895,7 @@ function isWindowsSandboxRunner(commandPath) {
5844
5895
  return path7.basename(commandPath).toLowerCase().startsWith("codex-command-runner");
5845
5896
  }
5846
5897
  function resolveWindowsNpmCodexEntry(deps = {}) {
5847
- const existsSyncFn = deps.existsSyncFn ?? existsSync5;
5898
+ const existsSyncFn = deps.existsSyncFn ?? existsSync4;
5848
5899
  const execFileSyncFn = deps.execFileSyncFn ?? execFileSync2;
5849
5900
  const env = deps.env ?? process.env;
5850
5901
  const winPath = path7.win32;
@@ -5866,7 +5917,7 @@ function resolveWindowsNpmCodexEntry(deps = {}) {
5866
5917
  return null;
5867
5918
  }
5868
5919
  function resolveWindowsCodexDesktopEntry(deps = {}) {
5869
- const existsSyncFn = deps.existsSyncFn ?? existsSync5;
5920
+ const existsSyncFn = deps.existsSyncFn ?? existsSync4;
5870
5921
  const env = deps.env ?? process.env;
5871
5922
  const homeDir = deps.homeDir;
5872
5923
  const winPath = path7.win32;
@@ -6194,7 +6245,7 @@ var CodexDriver = class {
6194
6245
  this.normalizer.reset();
6195
6246
  this.spawnWorkingDirectory = ctx.workingDirectory;
6196
6247
  this.codexHomeRoot = resolveCodexHomeRootFromEnv(spawnEnv, {
6197
- defaultHomeDir: os4.homedir(),
6248
+ defaultHomeDir: os3.homedir(),
6198
6249
  cwd: ctx.workingDirectory
6199
6250
  });
6200
6251
  const args = ["app-server", "--listen", "stdio://"];
@@ -6618,7 +6669,7 @@ function detectCodexModels(home = resolveCodexHomeRootFromEnv()) {
6618
6669
  let configPath = null;
6619
6670
  for (const root of codexStateRootCandidates(home)) {
6620
6671
  const candidate = path7.join(root, "models_cache.json");
6621
- if (existsSync5(candidate)) {
6672
+ if (existsSync4(candidate)) {
6622
6673
  cachePath = candidate;
6623
6674
  configPath = path7.join(root, "config.toml");
6624
6675
  break;
@@ -7093,7 +7144,7 @@ function runCursorModelsCommand() {
7093
7144
 
7094
7145
  // src/drivers/gemini.ts
7095
7146
  import { execFileSync as execFileSync3, spawn as spawn6 } from "child_process";
7096
- import { existsSync as existsSync6 } from "fs";
7147
+ import { existsSync as existsSync5 } from "fs";
7097
7148
  import path8 from "path";
7098
7149
  async function buildGeminiSpawnEnv(ctx, platform = process.platform) {
7099
7150
  const { spawnEnv } = await prepareCliTransport(ctx, { NO_COLOR: "1" }, platform);
@@ -7136,7 +7187,7 @@ function resolveGeminiSpawn(commandArgs, deps = {}) {
7136
7187
  return { command: resolveCommandOnPath("gemini", deps) ?? "gemini", args: commandArgs };
7137
7188
  }
7138
7189
  const execFileSyncFn = deps.execFileSyncFn ?? execFileSync3;
7139
- const existsSyncFn = deps.existsSyncFn ?? existsSync6;
7190
+ const existsSyncFn = deps.existsSyncFn ?? existsSync5;
7140
7191
  const env = deps.env ?? process.env;
7141
7192
  const winPath = path8.win32;
7142
7193
  let geminiEntry = null;
@@ -7274,8 +7325,8 @@ var GeminiDriver = class {
7274
7325
  // src/drivers/kimi.ts
7275
7326
  import { randomUUID as randomUUID2 } from "crypto";
7276
7327
  import { spawn as spawn7 } from "child_process";
7277
- import { existsSync as existsSync7, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
7278
- import os5 from "os";
7328
+ import { existsSync as existsSync6, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
7329
+ import os4 from "os";
7279
7330
  import path9 from "path";
7280
7331
  var KIMI_WIRE_PROTOCOL_VERSION = "1.3";
7281
7332
  var KIMI_SYSTEM_PROMPT_FILE = ".slock-kimi-system.md";
@@ -7325,7 +7376,7 @@ var KimiDriver = class {
7325
7376
  this.promptRequestId = randomUUID2();
7326
7377
  const systemPromptPath = path9.join(ctx.workingDirectory, KIMI_SYSTEM_PROMPT_FILE);
7327
7378
  const agentFilePath = path9.join(ctx.workingDirectory, KIMI_AGENT_FILE);
7328
- if (!isResume || !existsSync7(systemPromptPath)) {
7379
+ if (!isResume || !existsSync6(systemPromptPath)) {
7329
7380
  writeFileSync3(systemPromptPath, ctx.prompt, "utf8");
7330
7381
  }
7331
7382
  writeFileSync3(agentFilePath, [
@@ -7470,7 +7521,7 @@ var KimiDriver = class {
7470
7521
  return detectKimiModels();
7471
7522
  }
7472
7523
  };
7473
- function detectKimiModels(home = os5.homedir()) {
7524
+ function detectKimiModels(home = os4.homedir()) {
7474
7525
  const configPath = path9.join(home, ".kimi", "config.toml");
7475
7526
  let raw;
7476
7527
  try {
@@ -7499,7 +7550,7 @@ function detectKimiModels(home = os5.homedir()) {
7499
7550
  // src/drivers/kimi-sdk.ts
7500
7551
  import { randomUUID as randomUUID3 } from "crypto";
7501
7552
  import { EventEmitter } from "events";
7502
- import { mkdirSync as mkdirSync3, readFileSync as readFileSync4 } from "fs";
7553
+ import { mkdirSync as mkdirSync2, readFileSync as readFileSync4 } from "fs";
7503
7554
  import path10 from "path";
7504
7555
  import { createRequire as createRequire2 } from "module";
7505
7556
  import {
@@ -7648,12 +7699,12 @@ var KIMI_SDK_RUNTIME_SESSION_DESCRIPTOR = {
7648
7699
  };
7649
7700
  async function createKimiAgentSessionForContext(ctx, sessionId) {
7650
7701
  const sessionDir = buildKimiSessionDir(ctx.workingDirectory);
7651
- mkdirSync3(sessionDir, { recursive: true });
7702
+ mkdirSync2(sessionDir, { recursive: true });
7652
7703
  const cliTransport = await prepareCliTransport(ctx, { NO_COLOR: "1" });
7653
7704
  const spawnEnv = cliTransport.spawnEnv;
7654
7705
  const wrapperPath = cliTransport.wrapperPath;
7655
7706
  const homeDir = spawnEnv.KIMI_HOME || (process.env.HOME ? path10.join(process.env.HOME, ".kimi") : path10.join(ctx.workingDirectory, ".kimi"));
7656
- mkdirSync3(homeDir, { recursive: true });
7707
+ mkdirSync2(homeDir, { recursive: true });
7657
7708
  const harness = createKimiHarness({
7658
7709
  homeDir,
7659
7710
  identity: {
@@ -7984,8 +8035,8 @@ var KimiSdkDriver = class {
7984
8035
 
7985
8036
  // src/drivers/opencode.ts
7986
8037
  import { spawn as spawn8, spawnSync as spawnSync2 } from "child_process";
7987
- import { existsSync as existsSync8, readFileSync as readFileSync5 } from "fs";
7988
- import os6 from "os";
8038
+ import { existsSync as existsSync7, readFileSync as readFileSync5 } from "fs";
8039
+ import os5 from "os";
7989
8040
  import path11 from "path";
7990
8041
  var SLOCK_AGENT_NAME = "slock";
7991
8042
  var NO_MESSAGE_PROMPT = "No new messages are pending. Stop now.";
@@ -8014,7 +8065,7 @@ function parseUserOpenCodeConfig(ctx) {
8014
8065
  const raw = runtimeConfigToLaunchFields(ctx.config).envVars?.OPENCODE_CONFIG_CONTENT;
8015
8066
  return parseOpenCodeConfigContent(raw);
8016
8067
  }
8017
- function readLocalOpenCodeConfig(home = os6.homedir()) {
8068
+ function readLocalOpenCodeConfig(home = os5.homedir()) {
8018
8069
  const configPath = path11.join(home, ".config", "opencode", "opencode.json");
8019
8070
  try {
8020
8071
  return parseOpenCodeConfigContent(readFileSync5(configPath, "utf8"));
@@ -8075,7 +8126,7 @@ function mergeOpenCodeConfigs(localConfig, envConfig) {
8075
8126
  }
8076
8127
  };
8077
8128
  }
8078
- function buildOpenCodeConfig(ctx, home = os6.homedir()) {
8129
+ function buildOpenCodeConfig(ctx, home = os5.homedir()) {
8079
8130
  const userConfig = mergeOpenCodeConfigs(readLocalOpenCodeConfig(home), parseUserOpenCodeConfig(ctx));
8080
8131
  const userAgents = recordField(userConfig.agent);
8081
8132
  const userSlockAgent = recordField(userAgents[SLOCK_AGENT_NAME]);
@@ -8093,7 +8144,7 @@ function buildOpenCodeConfig(ctx, home = os6.homedir()) {
8093
8144
  mcp: recordField(userConfig.mcp)
8094
8145
  };
8095
8146
  }
8096
- async function buildOpenCodeLaunchOptions(ctx, home = os6.homedir(), version = null) {
8147
+ async function buildOpenCodeLaunchOptions(ctx, home = os5.homedir(), version = null) {
8097
8148
  const slock = await prepareCliTransport(ctx, { NO_COLOR: "1" });
8098
8149
  const config = buildOpenCodeConfig(ctx, home);
8099
8150
  const env = {
@@ -8192,7 +8243,7 @@ function formatOpenCodeLabelToken(token) {
8192
8243
  if (/^\d/.test(token)) return token;
8193
8244
  return normalized.charAt(0).toUpperCase() + normalized.slice(1);
8194
8245
  }
8195
- function detectOpenCodeModels(home = os6.homedir(), runCommand = runOpenCodeModelsCommand) {
8246
+ function detectOpenCodeModels(home = os5.homedir(), runCommand = runOpenCodeModelsCommand) {
8196
8247
  const commandResult = runCommand(home);
8197
8248
  if (commandResult.error || commandResult.status !== 0) return null;
8198
8249
  return parseOpenCodeModelsOutput(commandResult.stdout);
@@ -8232,7 +8283,7 @@ function openCodeSpecForEntry(entry, commandArgs) {
8232
8283
  return { command: process.execPath, args: [entry, ...commandArgs], shell: false };
8233
8284
  }
8234
8285
  function resolveWindowsOpenCodePackageEntry(commandPath, deps = {}) {
8235
- const existsSyncFn = deps.existsSyncFn ?? existsSync8;
8286
+ const existsSyncFn = deps.existsSyncFn ?? existsSync7;
8236
8287
  const execFileSyncFn = deps.execFileSyncFn;
8237
8288
  const env = deps.env ?? process.env;
8238
8289
  const winPath = path11.win32;
@@ -8393,7 +8444,7 @@ var OpenCodeDriver = class {
8393
8444
  if (unsupportedMessage) {
8394
8445
  throw new Error(unsupportedMessage);
8395
8446
  }
8396
- const launch = await buildOpenCodeLaunchOptions(ctx, os6.homedir(), version);
8447
+ const launch = await buildOpenCodeLaunchOptions(ctx, os5.homedir(), version);
8397
8448
  const spawnSpec = resolveOpenCodeSpawn(launch.args);
8398
8449
  const proc = spawn8(spawnSpec.command, spawnSpec.args, {
8399
8450
  cwd: ctx.workingDirectory,
@@ -8460,7 +8511,7 @@ var OpenCodeDriver = class {
8460
8511
  // src/drivers/pi.ts
8461
8512
  import { randomUUID as randomUUID4 } from "crypto";
8462
8513
  import { EventEmitter as EventEmitter2 } from "events";
8463
- import { mkdirSync as mkdirSync4, readdirSync as readdirSync2 } from "fs";
8514
+ import { mkdirSync as mkdirSync3, readdirSync as readdirSync3 } from "fs";
8464
8515
  import path12 from "path";
8465
8516
  import {
8466
8517
  AuthStorage,
@@ -8504,7 +8555,7 @@ function resolvePiModelFromRegistry(modelId, modelRegistry) {
8504
8555
  function findPiSessionFile(sessionDir, sessionId) {
8505
8556
  let entries;
8506
8557
  try {
8507
- entries = readdirSync2(sessionDir);
8558
+ entries = readdirSync3(sessionDir);
8508
8559
  } catch {
8509
8560
  return null;
8510
8561
  }
@@ -8728,7 +8779,7 @@ var PI_IDLE_PROMPT_RETRY_MS = 25;
8728
8779
  var PI_IDLE_PROMPT_MAX_WAIT_MS = 1e3;
8729
8780
  async function createPiAgentSessionForContext(ctx, sessionId) {
8730
8781
  const sessionDir = buildPiSessionDir(ctx.workingDirectory);
8731
- mkdirSync4(sessionDir, { recursive: true });
8782
+ mkdirSync3(sessionDir, { recursive: true });
8732
8783
  const launchRuntimeFields = runtimeConfigToLaunchFields(ctx.config);
8733
8784
  const requestedModel = launchRuntimeFields.model || "default";
8734
8785
  const traceSpan = ctx.tracer?.startSpan("daemon.pi.session.create", {
@@ -9958,7 +10009,7 @@ function findSessionJsonl(root, predicate) {
9958
10009
  if (depth < 0 || visited >= maxEntries) return null;
9959
10010
  let entries;
9960
10011
  try {
9961
- 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));
9962
10013
  } catch {
9963
10014
  return null;
9964
10015
  }
@@ -9985,7 +10036,7 @@ function findKimiSdkSessionDir(sessionId, agentId, homeDir) {
9985
10036
  if (!line.trim()) continue;
9986
10037
  try {
9987
10038
  const entry = JSON.parse(line);
9988
- if (entry.sessionId === sessionId && entry.sessionDir && existsSync9(entry.sessionDir)) {
10039
+ if (entry.sessionId === sessionId && entry.sessionDir && existsSync8(entry.sessionDir)) {
9989
10040
  return entry.sessionDir;
9990
10041
  }
9991
10042
  } catch {
@@ -9996,10 +10047,10 @@ function findKimiSdkSessionDir(sessionId, agentId, homeDir) {
9996
10047
  const sessionsRoot = path14.join(homeDir, ".kimi", "sessions");
9997
10048
  try {
9998
10049
  const prefix = agentId ? `wd_${agentId}_` : `wd_`;
9999
- for (const entry of readdirSync3(sessionsRoot, { withFileTypes: true })) {
10050
+ for (const entry of readdirSync4(sessionsRoot, { withFileTypes: true })) {
10000
10051
  if (!entry.isDirectory() || !entry.name.startsWith(prefix)) continue;
10001
10052
  const candidate = path14.join(sessionsRoot, entry.name, `session_${sessionId}`);
10002
- if (existsSync9(candidate)) return candidate;
10053
+ if (existsSync8(candidate)) return candidate;
10003
10054
  }
10004
10055
  } catch {
10005
10056
  }
@@ -10009,7 +10060,7 @@ function findPiSessionFile2(sessionId, workingDirectory, homeDir) {
10009
10060
  if (workingDirectory) {
10010
10061
  const piSessionsDir = path14.join(workingDirectory, ".pi-sessions");
10011
10062
  try {
10012
- 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);
10013
10064
  if (files[0]) return files[0].path;
10014
10065
  } catch {
10015
10066
  }
@@ -10031,7 +10082,7 @@ function safeSessionFilename(value) {
10031
10082
  function writeRuntimeSessionHandoff(runtime, sessionId, fallbackDir) {
10032
10083
  try {
10033
10084
  const dir = path14.join(fallbackDir, ".slock", "runtime-sessions");
10034
- mkdirSync5(dir, { recursive: true });
10085
+ mkdirSync4(dir, { recursive: true });
10035
10086
  const filePath = path14.join(dir, `${runtime}-${safeSessionFilename(sessionId)}.jsonl`);
10036
10087
  writeFileSync4(filePath, JSON.stringify({
10037
10088
  type: "runtime_session_handoff",
@@ -10052,28 +10103,22 @@ function writeRuntimeSessionHandoff(runtime, sessionId, fallbackDir) {
10052
10103
  }
10053
10104
  }
10054
10105
  function resolveRuntimeHomeDir(config, defaultHomeDir, workspacePath, opts = {}) {
10055
- if (isClaudeCustomProviderConfig(config)) {
10056
- return getClaudeProviderStatePaths(workspacePath).home;
10057
- }
10058
10106
  if (config.runtime === "codex") {
10059
10107
  return resolveCodexHomeRootFromConfig(config, defaultHomeDir, workspacePath, process.env, opts);
10060
10108
  }
10061
10109
  return defaultHomeDir;
10062
10110
  }
10063
10111
  function ensureRuntimeHomeDir(config, defaultHomeDir, workspacePath, opts = {}) {
10064
- if (isClaudeCustomProviderConfig(config)) {
10065
- return ensureClaudeProviderStatePaths(workspacePath).home;
10066
- }
10067
10112
  if (config.runtime === "codex") {
10068
10113
  const home = resolveCodexHomeRootFromConfig(config, defaultHomeDir, workspacePath, process.env, opts);
10069
10114
  if (opts.agentId) {
10070
- mkdirSync5(home, { recursive: true });
10115
+ mkdirSync4(home, { recursive: true });
10071
10116
  }
10072
10117
  return home;
10073
10118
  }
10074
10119
  return defaultHomeDir;
10075
10120
  }
10076
- function resolveRuntimeSessionRef(runtime, sessionId, homeDir = os7.homedir(), fallbackDir, opts) {
10121
+ function resolveRuntimeSessionRef(runtime, sessionId, homeDir = os6.homedir(), fallbackDir, opts) {
10077
10122
  let resolvedPath = null;
10078
10123
  let lookupMethod = "none";
10079
10124
  if (runtime === "claude") {
@@ -11198,7 +11243,7 @@ var AgentProcessManager = class _AgentProcessManager {
11198
11243
  this.serverUrl = opts.serverUrl;
11199
11244
  this.slockHome = opts.slockHome ? path14.resolve(opts.slockHome) : resolveSlockHome();
11200
11245
  this.dataDir = opts.dataDir || resolveSlockHomePath("agents", this.slockHome);
11201
- this.runtimeSessionHomeDir = opts.runtimeSessionHomeDir || os7.homedir();
11246
+ this.runtimeSessionHomeDir = opts.runtimeSessionHomeDir || os6.homedir();
11202
11247
  this.driverResolver = opts.driverResolver || getDriver;
11203
11248
  this.defaultAgentEnvVarsProvider = opts.defaultAgentEnvVarsProvider || null;
11204
11249
  this.tracer = opts.tracer ?? noopTracer;
@@ -11890,7 +11935,25 @@ var AgentProcessManager = class _AgentProcessManager {
11890
11935
  queue_depth: this.agentStartQueue.length,
11891
11936
  active_starts: this.activeAgentStartCount,
11892
11937
  max_concurrent_starts: this.maxConcurrentAgentStarts,
11893
- 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
11894
11957
  };
11895
11958
  }
11896
11959
  getDeliveryTraceContext(message) {
@@ -14136,7 +14199,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
14136
14199
  const config = agent?.config ?? idle?.config ?? null;
14137
14200
  const runtime = runtimeHint || config?.runtime || "claude";
14138
14201
  const workspaceDir = path14.join(this.dataDir, agentId);
14139
- const hostHome = os7.homedir();
14202
+ const hostHome = os6.homedir();
14140
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);
14141
14204
  const paths = _AgentProcessManager.SKILL_PATHS[runtime] || _AgentProcessManager.SKILL_PATHS.claude;
14142
14205
  const globalDirs = runtime === "codex" ? [
@@ -14591,6 +14654,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
14591
14654
  hasSession: Boolean(ap.sessionId),
14592
14655
  ...this.messagesTraceAttrs(messages),
14593
14656
  ...inputTraceAttrs,
14657
+ ...this.runtimeLaunchPolicyTraceAttrs(ap.config),
14594
14658
  ...this.runtimeProfileTurnControlTraceAttrs(ap.runtimeProfileTurnControl)
14595
14659
  }
14596
14660
  });
@@ -14598,6 +14662,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
14598
14662
  reason,
14599
14663
  ...this.messagesTraceAttrs(messages),
14600
14664
  ...inputTraceAttrs,
14665
+ ...this.runtimeLaunchPolicyTraceAttrs(ap.config),
14601
14666
  ...this.runtimeProfileTurnControlTraceAttrs(ap.runtimeProfileTurnControl)
14602
14667
  });
14603
14668
  ap.runtimeTraceSpan = span;
@@ -16230,8 +16295,8 @@ var ReminderCache = class {
16230
16295
 
16231
16296
  // src/machineLock.ts
16232
16297
  import { createHash as createHash4, randomUUID as randomUUID6 } from "crypto";
16233
- import { mkdirSync as mkdirSync6, readFileSync as readFileSync7, rmSync as rmSync3, statSync as statSync2, writeFileSync as writeFileSync5 } from "fs";
16234
- 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";
16235
16300
  import path15 from "path";
16236
16301
  var INCOMPLETE_LOCK_STALE_MS = 3e4;
16237
16302
  var DaemonMachineLockConflictError = class extends Error {
@@ -16287,14 +16352,14 @@ function acquireDaemonMachineLock(options) {
16287
16352
  const machineDir = path15.join(rootDir, lockId);
16288
16353
  const lockDir = path15.join(machineDir, "daemon.lock");
16289
16354
  const token = randomUUID6();
16290
- mkdirSync6(machineDir, { recursive: true });
16355
+ mkdirSync5(machineDir, { recursive: true });
16291
16356
  for (let attempt = 0; attempt < 2; attempt += 1) {
16292
16357
  try {
16293
- mkdirSync6(lockDir);
16358
+ mkdirSync5(lockDir);
16294
16359
  const owner = {
16295
16360
  pid: process.pid,
16296
16361
  token,
16297
- hostname: os8.hostname(),
16362
+ hostname: os7.hostname(),
16298
16363
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
16299
16364
  serverUrl: options.serverUrl,
16300
16365
  apiKeyFingerprint: fingerprint.slice(0, 16)
@@ -16345,7 +16410,7 @@ function acquireDaemonMachineLock(options) {
16345
16410
  }
16346
16411
 
16347
16412
  // src/localTraceSink.ts
16348
- 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";
16349
16414
  import path16 from "path";
16350
16415
  var DEFAULT_MAX_FILE_BYTES = 5 * 1024 * 1024;
16351
16416
  var DEFAULT_MAX_FILE_AGE_MS = 5 * 60 * 1e3;
@@ -16409,7 +16474,7 @@ var LocalRotatingTraceSink = class {
16409
16474
  return this.currentFile;
16410
16475
  }
16411
16476
  ensureFile(nextBytes) {
16412
- mkdirSync7(this.traceDir, { recursive: true, mode: 448 });
16477
+ mkdirSync6(this.traceDir, { recursive: true, mode: 448 });
16413
16478
  const nowMs = this.nowMsProvider();
16414
16479
  const shouldRotateForAge = this.currentFileOpenedAtMs !== null && nowMs - this.currentFileOpenedAtMs >= this.maxFileAgeMs;
16415
16480
  if (!this.currentFile || this.currentSize + nextBytes > this.maxFileBytes || shouldRotateForAge) {
@@ -16424,7 +16489,7 @@ var LocalRotatingTraceSink = class {
16424
16489
  }
16425
16490
  }
16426
16491
  pruneOldFiles() {
16427
- 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();
16428
16493
  const excess = files.length - this.maxFiles;
16429
16494
  if (excess <= 0) return;
16430
16495
  for (const file of files.slice(0, excess)) {
@@ -16889,7 +16954,7 @@ function resolveSlockCliPathOrEmpty(moduleUrl = import.meta.url) {
16889
16954
  }
16890
16955
  async function runBundledSlockCli(argv) {
16891
16956
  process.argv = [process.execPath, "slock", ...argv];
16892
- await import("./dist-5BEASCX5.js");
16957
+ await import("./dist-4KV4FRQE.js");
16893
16958
  }
16894
16959
  function detectRuntimes(tracer = noopTracer) {
16895
16960
  const ids = [];
@@ -17694,8 +17759,8 @@ var DaemonCore = class {
17694
17759
  capabilities: ["agent:start", "agent:stop", "agent:deliver", "workspace:files"],
17695
17760
  runtimes,
17696
17761
  runningAgents: runningAgentIds,
17697
- hostname: this.options.hostname ?? os9.hostname(),
17698
- os: this.options.osDescription ?? `${os9.platform()} ${os9.arch()}`,
17762
+ hostname: this.options.hostname ?? os8.hostname(),
17763
+ os: this.options.osDescription ?? `${os8.platform()} ${os8.arch()}`,
17699
17764
  daemonVersion: this.daemonVersion,
17700
17765
  ...this.computerVersion ? { computerVersion: this.computerVersion } : {}
17701
17766
  });
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
@@ -11,7 +11,7 @@ import {
11
11
  runBundledSlockCli,
12
12
  scanWorkspaceDirectories,
13
13
  subscribeDaemonLogs
14
- } from "./chunk-RENPNQK3.js";
14
+ } from "./chunk-RNUZAZCS.js";
15
15
  export {
16
16
  DAEMON_CLI_USAGE,
17
17
  DaemonCore,
@@ -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
@@ -3,7 +3,7 @@ import {
3
3
  DAEMON_CLI_USAGE,
4
4
  DaemonCore,
5
5
  parseDaemonCliArgs
6
- } from "./chunk-RENPNQK3.js";
6
+ } from "./chunk-RNUZAZCS.js";
7
7
 
8
8
  // src/index.ts
9
9
  var parsedArgs = parseDaemonCliArgs(process.argv.slice(2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botiverse/raft-daemon",
3
- "version": "0.63.1",
3
+ "version": "0.63.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "raft-daemon": "dist/raft-daemon.js",