@botiverse/raft-daemon 0.69.0-play.20260705140609 → 0.70.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.
@@ -4244,7 +4244,7 @@ Threads are sub-conversations attached to a specific message. They let you discu
4244
4244
  - When you receive a message from a thread (the target has a \`:shortid\` suffix), **always reply using that same target** to keep the conversation in the thread.
4245
4245
  - **Start a new thread**: Use the \`msg=\` field from the header as the thread suffix. For example, if you see \`[target=#general msg=00000000 ...]\`, reply with \`raft message send --target "#general:00000000" <<'${D}'\` followed by the message body and \`${D}\`. The thread will be auto-created if it doesn't exist yet. Example IDs like \`00000000\` are placeholders; real message IDs come from received messages.
4246
4246
  - When you send a message, the response includes the message ID. You can use it to start a thread on your own message.
4247
- - You can read thread history: \`raft message read --channel "#general:00000000"\`
4247
+ - You can read thread history: \`raft message read --target "#general:00000000"\`
4248
4248
  - You can stop receiving ordinary delivery for a thread with \`raft thread unfollow --target "#general:00000000"\`. Only do this when your work in that thread is clearly complete or no longer relevant.
4249
4249
  - Threads cannot be nested \u2014 you cannot start a thread inside a thread.`;
4250
4250
  }
@@ -4252,7 +4252,7 @@ function buildDiscoverySection() {
4252
4252
  return `### Discovering people and channels
4253
4253
 
4254
4254
  Call \`raft server info\` to see all channels in this server, which ones you have joined, other agents, and humans.
4255
- Visible public channels may appear even when \`joined=false\`. In that state you can still inspect them with \`raft message read\` and \`raft channel members\`, but you cannot send messages there or receive ordinary channel delivery until you join with \`raft channel join --target "#channel-name"\`. Private channels require a human with access to add you. To leave a regular channel you have joined, use \`raft channel leave --target "#channel-name"\`. To mute ordinary Activity delivery without leaving a regular channel, use \`raft channel mute "#channel-name"\`; personal @mentions and DMs still pierce (a task pierces only when it personally @mentions you), and thread following is separate. To reverse that setting, use \`raft channel unmute "#channel-name"\`. To stop following a thread without leaving its parent channel, use \`raft thread unfollow --target "#channel-name:shortid"\`.
4255
+ Visible public channels may appear even when \`joined=false\`. In that state you can still inspect them with \`raft message read\` and \`raft channel members\`, but you cannot send messages there or receive ordinary channel delivery until you join with \`raft channel join --target "#channel-name"\`. Private channels require a human with access to add you. To leave a regular channel you have joined, use \`raft channel leave --target "#channel-name"\`. To mute ordinary Activity delivery without leaving a regular channel, use \`raft channel mute --target "#channel-name"\`; personal @mentions and DMs still pierce (a task pierces only when it personally @mentions you), and thread following is separate. To reverse that setting, use \`raft channel unmute --target "#channel-name"\`. To stop following a thread without leaving its parent channel, use \`raft thread unfollow --target "#channel-name:shortid"\`.
4256
4256
  Private channels are membership-gated. If \`raft server info\` shows a channel as private, treat its name, members, and content as private to that channel; do not disclose that information in other channels, DMs, summaries, or task reports unless a human explicitly asks within an authorized context. In \`raft channel members\`, human role labels such as owner/admin show server-level authority; no role label means ordinary member.`;
4257
4257
  }
4258
4258
  function buildChannelAwarenessSection() {
@@ -4266,9 +4266,9 @@ Each channel has a **name** and optionally a **description** that define its pur
4266
4266
  function buildReadingHistorySection() {
4267
4267
  return `### Reading history
4268
4268
 
4269
- \`raft message read --channel "#channel-name"\` or \`raft message read --channel dm:@peer-name\` or \`raft message read --channel "#channel:shortid"\`
4269
+ \`raft message read --target "#channel-name"\` or \`raft message read --target dm:@peer-name\` or \`raft message read --target "#channel:shortid"\`
4270
4270
 
4271
- To jump directly to a specific hit with nearby context, use \`raft message read --channel "..." --around "messageId"\` or \`raft message read --channel "..." --around 12345\`.`;
4271
+ To jump directly to a specific hit with nearby context, use \`raft message read --target "..." --around "messageId"\` or \`raft message read --target "..." --around 12345\`.`;
4272
4272
  }
4273
4273
  function buildHistoricalReferencesSection() {
4274
4274
  return `### Historical references
@@ -4297,7 +4297,7 @@ Only top-level channel / DM messages can become tasks. Messages inside threads a
4297
4297
  **Assignee** is independent from status \u2014 a task can be claimed or unclaimed at any status except \`done\`.
4298
4298
 
4299
4299
  **Workflow:**
4300
- 1. Receive a message that requires action \u2192 claim it first (by task number if already a task, or by message ID if it's a regular message). Use repeat flags: \`raft task claim --channel "#channel" --number 1 --number 2\` or \`raft task claim --channel "#channel" --message-id abc12345\`.
4300
+ 1. Receive a message that requires action \u2192 claim it first (by task number if already a task, or by message ID if it's a regular message). Use repeat flags: \`raft task claim --target "#channel" --number 1 --number 2\` or \`raft task claim --target "#channel" --message-id abc12345\`.
4301
4301
  2. If the claim fails, someone else is working on it \u2014 do not work on that task unless an owner/admin explicitly redirects it to you
4302
4302
  3. Post updates in the task's thread: \`raft message send --target "#channel:msgShortId" <<'${D}'\` followed by the message body and \`${D}\`
4303
4303
  4. When done, set status to \`in_review\` so a human can validate via \`raft task update\`
@@ -4309,7 +4309,7 @@ Only top-level channel / DM messages can become tasks. Messages inside threads a
4309
4309
  - \`raft task create\` only creates the task \u2014 to own it, call \`raft task claim\` afterward.
4310
4310
  - Typical uses for \`raft task create\` are breaking down a larger task into parallel subtasks, or batch-creating genuinely new work for others to claim.
4311
4311
  - If someone already sent the work item as a message, just claim that existing message/task instead of creating a new one.
4312
- - If the work already exists as a message, reuse it via \`raft task claim --channel "#channel" --message-id abc12345\`.
4312
+ - If the work already exists as a message, reuse it via \`raft task claim --target "#channel" --message-id abc12345\`.
4313
4313
 
4314
4314
  **Creating new tasks:**
4315
4315
  - The task system exists to prevent duplicate work. If you see an existing task for the work, either claim that task or leave it alone.
@@ -4716,19 +4716,6 @@ function listLegacySlockStatePaths(slockHome = resolveSlockHome(), homeDir = os.
4716
4716
  return candidates.filter((candidate) => existsSync(candidate.path));
4717
4717
  }
4718
4718
 
4719
- // src/authEnv.ts
4720
- var DAEMON_API_KEY_ENV = "SLOCK_MACHINE_API_KEY";
4721
- var SLOCK_AGENT_TOKEN_ENV = "SLOCK_AGENT_TOKEN";
4722
- function scrubDaemonAuthEnv(env) {
4723
- delete env[DAEMON_API_KEY_ENV];
4724
- return env;
4725
- }
4726
- function scrubDaemonChildEnv(env) {
4727
- delete env[DAEMON_API_KEY_ENV];
4728
- delete env[SLOCK_AGENT_TOKEN_ENV];
4729
- return env;
4730
- }
4731
-
4732
4719
  // src/agentCredentialProxy.ts
4733
4720
  import { randomBytes } from "crypto";
4734
4721
  import http from "http";
@@ -6303,9 +6290,7 @@ var LOOPBACK_NO_PROXY = "127.0.0.1,localhost";
6303
6290
  var CLI_TRANSPORT_TRACE_DIR_ENV = "SLOCK_CLI_TRANSPORT_TRACE_DIR";
6304
6291
  var safePathPart = (value) => value.replace(/[^a-zA-Z0-9_.-]/g, "_");
6305
6292
  var RAW_CREDENTIAL_ENV_DENYLIST = [
6306
- "SLOCK_AGENT_TOKEN",
6307
- "SLOCK_AGENT_CREDENTIAL_KEY",
6308
- "SLOCK_AGENT_CREDENTIAL_KEY_FILE"
6293
+ "SLOCK_AGENT_CREDENTIAL_KEY"
6309
6294
  ];
6310
6295
  var WORKSPACE_CLI_TRANSPORT_FILENAMES = [
6311
6296
  "agent-token",
@@ -6660,7 +6645,7 @@ set "SLOCK_AGENT_ACTIVE_CAPABILITIES=${DEFAULT_ACTIVE_CAPABILITIES}"\r
6660
6645
  SLOCK_SERVER_URL: ctx.config.serverUrl,
6661
6646
  PATH: `${slockDir}${path2.delimiter}${process.env.PATH ?? ""}`
6662
6647
  };
6663
- scrubDaemonChildEnv(spawnEnv);
6648
+ delete spawnEnv.SLOCK_AGENT_TOKEN;
6664
6649
  for (const key of RAW_CREDENTIAL_ENV_DENYLIST) {
6665
6650
  delete spawnEnv[key];
6666
6651
  }
@@ -7228,7 +7213,7 @@ function requiresWindowsShell(command, platform = process.platform) {
7228
7213
  }
7229
7214
  function resolveCommandOnPath(command, deps = {}) {
7230
7215
  const platform = deps.platform ?? process.platform;
7231
- const env = scrubDaemonChildEnv({ ...withWindowsUserEnvironment(deps.env ?? process.env, deps) });
7216
+ const env = withWindowsUserEnvironment(deps.env ?? process.env, deps);
7232
7217
  const execFileSyncFn = deps.execFileSyncFn ?? execFileSync;
7233
7218
  const existsSyncFn = deps.existsSyncFn ?? existsSync3;
7234
7219
  if (platform === "win32") {
@@ -7254,7 +7239,7 @@ function firstExistingPath(candidates, deps = {}) {
7254
7239
  return null;
7255
7240
  }
7256
7241
  function readCommandVersion(command, args = [], deps = {}) {
7257
- const env = scrubDaemonChildEnv({ ...withWindowsUserEnvironment(deps.env ?? process.env, deps) });
7242
+ const env = withWindowsUserEnvironment(deps.env ?? process.env, deps);
7258
7243
  const execFileSyncFn = deps.execFileSyncFn ?? execFileSync;
7259
7244
  try {
7260
7245
  const output = normalizeExecOutput(execFileSyncFn(command, [...args, "--version"], {
@@ -9338,11 +9323,11 @@ function detectCursorModels(runCommand = runCursorModelsCommand) {
9338
9323
  return parseCursorModelsOutput(String(result.stdout || ""));
9339
9324
  }
9340
9325
  function buildCursorModelProbeEnv(deps = {}) {
9341
- return scrubDaemonChildEnv(withWindowsUserEnvironment({
9326
+ return withWindowsUserEnvironment({
9342
9327
  ...deps.env ?? process.env,
9343
9328
  FORCE_COLOR: "0",
9344
9329
  NO_COLOR: "1"
9345
- }, deps));
9330
+ }, deps);
9346
9331
  }
9347
9332
  function runCursorModelsCommand() {
9348
9333
  return spawnSync("cursor-agent", ["models"], {
@@ -9398,7 +9383,7 @@ function resolveGeminiSpawn(commandArgs, deps = {}) {
9398
9383
  }
9399
9384
  const execFileSyncFn = deps.execFileSyncFn ?? execFileSync3;
9400
9385
  const existsSyncFn = deps.existsSyncFn ?? existsSync5;
9401
- const env = scrubDaemonChildEnv({ ...deps.env ?? process.env });
9386
+ const env = deps.env ?? process.env;
9402
9387
  const winPath = path8.win32;
9403
9388
  let geminiEntry = null;
9404
9389
  try {
@@ -9535,15 +9520,12 @@ var GeminiDriver = class {
9535
9520
  // src/drivers/kimi.ts
9536
9521
  import { randomUUID as randomUUID2 } from "crypto";
9537
9522
  import { spawn as spawn7 } from "child_process";
9538
- import { chmodSync, existsSync as existsSync6, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
9523
+ import { existsSync as existsSync6, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
9539
9524
  import os4 from "os";
9540
9525
  import path9 from "path";
9541
9526
  var KIMI_WIRE_PROTOCOL_VERSION = "1.3";
9542
9527
  var KIMI_SYSTEM_PROMPT_FILE = ".slock-kimi-system.md";
9543
9528
  var KIMI_AGENT_FILE = ".slock-kimi-agent.yaml";
9544
- var KIMI_GENERATED_CONFIG_FILE = ".slock-kimi-config.toml";
9545
- var SLOCK_KIMI_CONFIG_CONTENT_ENV = "SLOCK_KIMI_CONFIG_CONTENT";
9546
- var SLOCK_KIMI_CONFIG_FILE_ENV = "SLOCK_KIMI_CONFIG_FILE";
9547
9529
  function parseToolArguments(raw) {
9548
9530
  if (typeof raw !== "string") return raw;
9549
9531
  try {
@@ -9552,73 +9534,6 @@ function parseToolArguments(raw) {
9552
9534
  return raw;
9553
9535
  }
9554
9536
  }
9555
- function readKimiConfigSource(home = os4.homedir(), env = process.env) {
9556
- const inlineConfig = env[SLOCK_KIMI_CONFIG_CONTENT_ENV];
9557
- if (inlineConfig && inlineConfig.trim()) {
9558
- return {
9559
- raw: inlineConfig,
9560
- explicitPath: null,
9561
- sourcePath: SLOCK_KIMI_CONFIG_CONTENT_ENV
9562
- };
9563
- }
9564
- const explicitPath = env[SLOCK_KIMI_CONFIG_FILE_ENV];
9565
- const configPath = explicitPath && explicitPath.trim() ? explicitPath : path9.join(home, ".kimi", "config.toml");
9566
- try {
9567
- return {
9568
- raw: readFileSync3(configPath, "utf8"),
9569
- explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
9570
- sourcePath: configPath
9571
- };
9572
- } catch {
9573
- return {
9574
- raw: null,
9575
- explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
9576
- sourcePath: configPath
9577
- };
9578
- }
9579
- }
9580
- function buildKimiSpawnEnv(env = process.env) {
9581
- const spawnEnv = { ...env, FORCE_COLOR: "0", NO_COLOR: "1" };
9582
- delete spawnEnv[SLOCK_KIMI_CONFIG_CONTENT_ENV];
9583
- delete spawnEnv[SLOCK_KIMI_CONFIG_FILE_ENV];
9584
- return scrubDaemonChildEnv(spawnEnv);
9585
- }
9586
- function buildKimiEffectiveEnv(ctx, overrideEnv) {
9587
- return {
9588
- ...process.env,
9589
- ...ctx.config.envVars || {},
9590
- ...overrideEnv || {}
9591
- };
9592
- }
9593
- function buildKimiLaunchOptions(ctx, opts = {}) {
9594
- const env = buildKimiEffectiveEnv(ctx, opts.env);
9595
- const source = readKimiConfigSource(opts.home ?? os4.homedir(), env);
9596
- const args = [];
9597
- let configFilePath = null;
9598
- let configContent = null;
9599
- if (source.explicitPath) {
9600
- configFilePath = source.explicitPath;
9601
- } else if (source.raw !== null && source.sourcePath === SLOCK_KIMI_CONFIG_CONTENT_ENV) {
9602
- configFilePath = path9.join(ctx.workingDirectory, KIMI_GENERATED_CONFIG_FILE);
9603
- configContent = source.raw;
9604
- if (opts.writeGeneratedConfig !== false) {
9605
- writeFileSync3(configFilePath, source.raw, { encoding: "utf8", mode: 384 });
9606
- chmodSync(configFilePath, 384);
9607
- }
9608
- }
9609
- if (configFilePath) {
9610
- args.push("--config-file", configFilePath);
9611
- }
9612
- if (ctx.config.model && ctx.config.model !== "default") {
9613
- args.push("--model", ctx.config.model);
9614
- }
9615
- return {
9616
- args,
9617
- env: buildKimiSpawnEnv(env),
9618
- configFilePath,
9619
- configContent
9620
- };
9621
- }
9622
9537
  function resolveKimiSpawn(commandArgs, deps = {}) {
9623
9538
  return {
9624
9539
  command: resolveCommandOnPath("kimi", deps) ?? "kimi",
@@ -9642,25 +9557,7 @@ var KimiDriver = class {
9642
9557
  };
9643
9558
  model = {
9644
9559
  detectedModelsVerifiedAs: "launchable",
9645
- toLaunchSpec: (modelId, ctx, opts) => {
9646
- if (!ctx) return { args: ["--model", modelId] };
9647
- const launchCtx = {
9648
- ...ctx,
9649
- config: {
9650
- ...ctx.config,
9651
- model: modelId
9652
- }
9653
- };
9654
- const launch = buildKimiLaunchOptions(launchCtx, {
9655
- home: opts?.home,
9656
- writeGeneratedConfig: false
9657
- });
9658
- return {
9659
- args: launch.args,
9660
- env: launch.env,
9661
- configFiles: launch.configFilePath ? [launch.configFilePath] : void 0
9662
- };
9663
- }
9560
+ toLaunchSpec: (modelId) => ({ args: ["--model", modelId] })
9664
9561
  };
9665
9562
  supportsStdinNotification = true;
9666
9563
  busyDeliveryMode = "direct";
@@ -9684,23 +9581,21 @@ var KimiDriver = class {
9684
9581
  ` system_prompt_path: ./${KIMI_SYSTEM_PROMPT_FILE}`,
9685
9582
  ""
9686
9583
  ].join("\n"), "utf8");
9687
- const launch = buildKimiLaunchOptions(ctx);
9688
9584
  const args = [
9689
9585
  "--wire",
9690
9586
  "--yolo",
9691
9587
  "--agent-file",
9692
9588
  agentFilePath,
9693
9589
  "--session",
9694
- this.sessionId,
9695
- ...launch.args
9590
+ this.sessionId
9696
9591
  ];
9697
9592
  const launchRuntimeFields = runtimeConfigToLaunchFields(hydrateRuntimeConfig(ctx.config));
9698
9593
  if (launchRuntimeFields.model && launchRuntimeFields.model !== "default") {
9699
9594
  args.push("--model", launchRuntimeFields.model);
9700
9595
  }
9701
9596
  const spawnEnv = (await prepareCliTransport(ctx, { NO_COLOR: "1" })).spawnEnv;
9702
- const spawnTarget = resolveKimiSpawn(args);
9703
- const proc = spawn7(spawnTarget.command, spawnTarget.args, {
9597
+ const launch = resolveKimiSpawn(args);
9598
+ const proc = spawn7(launch.command, launch.args, {
9704
9599
  cwd: ctx.workingDirectory,
9705
9600
  stdio: ["pipe", "pipe", "pipe"],
9706
9601
  env: spawnEnv,
@@ -9708,7 +9603,7 @@ var KimiDriver = class {
9708
9603
  // and has an 8191-character command-line limit. Kimi's official
9709
9604
  // installer/uv entrypoint is an executable, so launch it directly and
9710
9605
  // keep prompts on stdin / files instead of routing through cmd.exe.
9711
- shell: spawnTarget.shell
9606
+ shell: launch.shell
9712
9607
  });
9713
9608
  proc.stdin?.write(JSON.stringify({
9714
9609
  jsonrpc: "2.0",
@@ -9821,9 +9716,14 @@ var KimiDriver = class {
9821
9716
  return detectKimiModels();
9822
9717
  }
9823
9718
  };
9824
- function detectKimiModels(home = os4.homedir(), opts = {}) {
9825
- const raw = readKimiConfigSource(home, opts.env).raw;
9826
- if (raw === null) return null;
9719
+ function detectKimiModels(home = os4.homedir()) {
9720
+ const configPath = path9.join(home, ".kimi", "config.toml");
9721
+ let raw;
9722
+ try {
9723
+ raw = readFileSync3(configPath, "utf8");
9724
+ } catch {
9725
+ return null;
9726
+ }
9827
9727
  const models = [];
9828
9728
  const sectionRe = /^\s*\[models(?:\.([^\]]+)|"\.[^"]+"|\."[^"]+")\s*\]\s*$/gm;
9829
9729
  const lineRe = /^\s*\[models\.(.+?)\s*\]\s*$/gm;
@@ -10489,7 +10389,7 @@ function runOpenCodeModelsCommand(home, deps = {}) {
10489
10389
  const platform = deps.platform ?? process.platform;
10490
10390
  const spawnSyncFn = deps.spawnSyncFn ?? spawnSync2;
10491
10391
  const result = spawnSyncFn("opencode", ["models"], {
10492
- env: scrubDaemonChildEnv({ ...process.env, HOME: home, FORCE_COLOR: "0", NO_COLOR: "1" }),
10392
+ env: { ...process.env, HOME: home, FORCE_COLOR: "0", NO_COLOR: "1" },
10493
10393
  encoding: "utf8",
10494
10394
  timeout: 5e3,
10495
10395
  shell: platform === "win32"
@@ -13630,7 +13530,7 @@ function formatIncomingMessage(message, options = {}) {
13630
13530
  `[Slock thread context: you were added to a new thread via @mention.]`,
13631
13531
  `parent: ${message.thread_join_context.parent_target}`,
13632
13532
  `thread: ${message.thread_join_context.thread_target}`,
13633
- `suggested next step: raft message read --channel "${message.thread_join_context.suggested_read_history_target}"`,
13533
+ `suggested next step: raft message read --target "${message.thread_join_context.suggested_read_history_target}"`,
13634
13534
  "",
13635
13535
  "Parent message:",
13636
13536
  formatThreadContextMessage(message.thread_join_context.parent_message),
@@ -21594,7 +21494,7 @@ var DAEMON_CORE_TRACE_ATTR_CONTRACTS = {
21594
21494
  spanAttrs: ["agentId", "event_kind", "runtime"]
21595
21495
  }
21596
21496
  };
21597
- var DAEMON_CLI_USAGE = `Usage: slock-daemon --server-url <url> (--api-key <key> or ${DAEMON_API_KEY_ENV}=<key>)`;
21497
+ var DAEMON_CLI_USAGE = "Usage: slock-daemon --server-url <url> --api-key <key>";
21598
21498
  var RunnerCredentialMintError2 = class extends Error {
21599
21499
  code;
21600
21500
  retryable;
@@ -21630,9 +21530,9 @@ function runnerCredentialErrorDetail2(error) {
21630
21530
  async function waitForRunnerCredentialRetry2() {
21631
21531
  await new Promise((resolve) => setTimeout(resolve, RUNNER_CREDENTIAL_MINT_RETRY_DELAY_MS2));
21632
21532
  }
21633
- function parseDaemonCliArgs(args, env = {}) {
21533
+ function parseDaemonCliArgs(args) {
21634
21534
  let serverUrl = "";
21635
- let apiKey = env[DAEMON_API_KEY_ENV] ?? "";
21535
+ let apiKey = "";
21636
21536
  for (let i = 0; i < args.length; i++) {
21637
21537
  if (args[i] === "--server-url" && args[i + 1]) serverUrl = args[++i];
21638
21538
  if (args[i] === "--api-key" && args[i + 1]) apiKey = args[++i];
@@ -21669,7 +21569,7 @@ function resolveSlockCliPathOrEmpty(moduleUrl = import.meta.url) {
21669
21569
  }
21670
21570
  async function runBundledSlockCli(argv) {
21671
21571
  process.argv = [process.execPath, "slock", ...argv];
21672
- await import("./dist-RD3WLJSB.js");
21572
+ await import("./dist-I6ATP6I5.js");
21673
21573
  }
21674
21574
  function detectRuntimes(tracer = noopTracer) {
21675
21575
  const ids = [];
@@ -22611,8 +22511,6 @@ var DaemonCore = class {
22611
22511
 
22612
22512
  export {
22613
22513
  subscribeDaemonLogs,
22614
- DAEMON_API_KEY_ENV,
22615
- scrubDaemonAuthEnv,
22616
22514
  resolveWorkspaceDirectoryPath,
22617
22515
  scanWorkspaceDirectories,
22618
22516
  deleteWorkspaceDirectory,