@botiverse/raft-daemon 0.61.0 → 0.61.1

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.
@@ -1371,14 +1371,20 @@ var RUNTIME_MODELS = {
1371
1371
  kimi: [
1372
1372
  { id: "default", label: "Configured Default" }
1373
1373
  ],
1374
- // kimi-sdk runs the Kimi Code SDK in-process. Surface the canonical model
1375
- // first so getDefaultModel("kimi-sdk") returns it (without a static entry,
1376
- // useRuntimeModels falls back to Claude's list and getDefaultModel returns
1377
- // "sonnet" which the SDK driver would pass through to the Kimi session
1378
- // and the LLM call would fail). Mirrors detectKimiSdkModels() in the daemon.
1374
+ // kimi-sdk runs the Kimi Code SDK in-process. The daemon's
1375
+ // `detectKimiSdkModels()` reads the live model list from the user's
1376
+ // `<kimiHome>/config.toml` (populated by `kimi login` from Moonshot's
1377
+ // `/models` endpoint) and reports it to the server, so the picker reflects
1378
+ // whatever the user has actually provisioned including new rollouts
1379
+ // (e.g. K2.7) without a daemon bump.
1380
+ //
1381
+ // This static entry is a fallback for hosts where detection failed (no
1382
+ // `kimi login` yet, missing config.toml, daemon detect path errored). It
1383
+ // surfaces the canonical model so getDefaultModel("kimi-sdk") returns
1384
+ // something usable and doesn't fall through to Claude's "sonnet" default.
1385
+ // Keep this list minimal — it's the floor, not the catalog.
1379
1386
  "kimi-sdk": [
1380
- { id: "kimi-code/kimi-for-coding", label: "Kimi-K2.6 (Kimi for Coding)", verified: "launchable" },
1381
- { id: "kimi-k2-0905-preview", label: "Kimi K2 (preview)", verified: "suggestion_only" }
1387
+ { id: "kimi-code/kimi-for-coding", label: "Kimi for Coding (default)", verified: "launchable" }
1382
1388
  ]
1383
1389
  };
1384
1390
  function getDefaultModel(runtimeId) {
@@ -1605,7 +1611,7 @@ Use the \`raft\` CLI for chat / task / attachment operations (\`slock\` remains
1605
1611
  11. **\`raft message react\`** \u2014 Add or remove your reaction on a message. Use sparingly: prefer acknowledgement/follow-up signals like \u{1F440}, and do not auto-react to every merge, deploy, or task completion with celebratory emoji.
1606
1612
  12. **\`raft task list\`** \u2014 View a channel's task board.
1607
1613
  13. **\`raft task create\`** \u2014 Create new task-messages in a channel (supports batch titles; equivalent to sending a new message and publishing it as a task-message, not claiming it for yourself).
1608
- 14. **\`raft task claim\`** \u2014 Claim tasks by number or message ID (supports batch, handles conflicts).
1614
+ 14. **\`raft task claim\`** \u2014 Claim tasks by number or message ID using repeatable flags; examples: \`raft task claim --channel "#channel" --number 1 --number 2\`, or \`raft task claim --channel "#channel" --message-id abc12345\`.
1609
1615
  15. **\`raft task unclaim\`** \u2014 Release your claim on a task.
1610
1616
  16. **\`raft task update\`** \u2014 Change a task's status (e.g. to in_review or done).
1611
1617
  17. **\`raft attachment upload\`** \u2014 Upload a file to attach to a message. Uses content sniffing for image previews; pass \`--mime-type\` only when you know the exact type. Returns an attachment ID to pass to \`raft message send\`.
@@ -1737,7 +1743,7 @@ Only top-level channel / DM messages can become tasks. Messages inside threads a
1737
1743
  **Assignee** is independent from status \u2014 a task can be claimed or unclaimed at any status except \`done\`.
1738
1744
 
1739
1745
  **Workflow:**
1740
- 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)
1746
+ 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\`.
1741
1747
  2. If the claim fails, someone else is working on it \u2014 move on to another task
1742
1748
  3. Post updates in the task's thread: \`raft message send --target "#channel:msgShortId" <<'${D}'\` followed by the message body and \`${D}\`
1743
1749
  4. When done, set status to \`in_review\` so a human can validate via \`raft task update\`
@@ -1749,7 +1755,7 @@ Only top-level channel / DM messages can become tasks. Messages inside threads a
1749
1755
  - \`raft task create\` only creates the task \u2014 to own it, call \`raft task claim\` afterward.
1750
1756
  - 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.
1751
1757
  - If someone already sent the work item as a message, just claim that existing message/task instead of creating a new one.
1752
- - If the work already exists as a message, reuse it via \`raft task claim --message-id ...\`.
1758
+ - If the work already exists as a message, reuse it via \`raft task claim --channel "#channel" --message-id abc12345\`.
1753
1759
 
1754
1760
  **Creating new tasks:**
1755
1761
  - 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.
@@ -6236,11 +6242,12 @@ function detectKimiModels(home = os4.homedir()) {
6236
6242
  // src/drivers/kimi-sdk.ts
6237
6243
  import { randomUUID as randomUUID3 } from "crypto";
6238
6244
  import { EventEmitter } from "events";
6239
- import { mkdirSync as mkdirSync3 } from "fs";
6245
+ import { mkdirSync as mkdirSync3, readFileSync as readFileSync4 } from "fs";
6240
6246
  import path9 from "path";
6241
6247
  import { createRequire as createRequire2 } from "module";
6242
6248
  import {
6243
- createKimiHarness
6249
+ createKimiHarness,
6250
+ resolveKimiHome
6244
6251
  } from "@botiverse/kimi-code-sdk";
6245
6252
  var requireFromHere = createRequire2(import.meta.url);
6246
6253
  var KIMI_CODE_USER_AGENT_PRODUCT = "kimi-code-cli";
@@ -6608,16 +6615,54 @@ So instead of \`raft message send ...\`, run \`${this.wrapperPath} message send
6608
6615
  this.events.emit("close", info);
6609
6616
  }
6610
6617
  };
6611
- var KIMI_SDK_DEFAULT_MODELS = [
6612
- // Canonical Kimi Code SDK model (matches the `default_model` upstream
6613
- // ships in `~/.kimi/config.toml` after `kimi login`). Mirrored as the first
6614
- // entry in `RUNTIME_MODELS["kimi-sdk"]` (packages/shared/src/index.ts) so
6615
- // both the daemon's launch resolution and the web's getDefaultModel agree.
6616
- { id: "kimi-code/kimi-for-coding", label: "Kimi-K2.6 (Kimi for Coding)", verified: "launchable" },
6617
- { id: "kimi-k2-0905-preview", label: "Kimi K2 (preview)", verified: "suggestion_only" }
6618
- ];
6619
- function detectKimiSdkModels() {
6620
- return { models: KIMI_SDK_DEFAULT_MODELS };
6618
+ function detectKimiSdkModels(home = resolveKimiHome(), ctx = {}) {
6619
+ const span = ctx.span;
6620
+ const configPath = path9.join(home, "config.toml");
6621
+ const homeFromEnv = Boolean(process.env.KIMI_CODE_HOME);
6622
+ const emit2 = (outcome, extra = {}) => {
6623
+ span?.addEvent("daemon.kimi_sdk.models.config", {
6624
+ outcome,
6625
+ kimi_code_home_env_set: homeFromEnv,
6626
+ ...extra
6627
+ });
6628
+ };
6629
+ let raw;
6630
+ try {
6631
+ raw = readFileSync4(configPath, "utf8");
6632
+ } catch (err) {
6633
+ const code = err?.code ?? "unknown";
6634
+ emit2(code === "ENOENT" ? "missing_config" : "read_error", { errno_code: code });
6635
+ return null;
6636
+ }
6637
+ const models = [];
6638
+ const sectionRe = /^\s*\[models\.(.+?)\s*\]\s*$/gm;
6639
+ let sectionMatch;
6640
+ let displayNamePresentCount = 0;
6641
+ while ((sectionMatch = sectionRe.exec(raw)) !== null) {
6642
+ let id = sectionMatch[1].trim();
6643
+ if (id.startsWith('"') && id.endsWith('"')) id = id.slice(1, -1);
6644
+ if (!id) continue;
6645
+ const sectionStart = sectionMatch.index + sectionMatch[0].length;
6646
+ const nextSection = raw.slice(sectionStart).search(/^\s*\[/m);
6647
+ const body = nextSection === -1 ? raw.slice(sectionStart) : raw.slice(sectionStart, sectionStart + nextSection);
6648
+ const displayMatch = body.match(/^\s*display_name\s*=\s*"([^"]+)"/m);
6649
+ const label = displayMatch ? displayMatch[1] : id;
6650
+ if (displayMatch) displayNamePresentCount++;
6651
+ models.push({ id, label, verified: "launchable" });
6652
+ }
6653
+ let defaultModel;
6654
+ const defaultMatch = raw.match(/^\s*default_model\s*=\s*"([^"]+)"/m);
6655
+ if (defaultMatch) defaultModel = defaultMatch[1];
6656
+ if (models.length === 0) {
6657
+ emit2("no_models", { default_model_present: Boolean(defaultModel) });
6658
+ return null;
6659
+ }
6660
+ emit2("models_returned", {
6661
+ models_count: models.length,
6662
+ display_name_present_count: displayNamePresentCount,
6663
+ default_model_present: Boolean(defaultModel)
6664
+ });
6665
+ return { models, default: defaultModel };
6621
6666
  }
6622
6667
  var KimiSdkDriver = class {
6623
6668
  id = "kimi-sdk";
@@ -6647,8 +6692,8 @@ var KimiSdkDriver = class {
6647
6692
  probe() {
6648
6693
  return { available: true };
6649
6694
  }
6650
- async detectModels() {
6651
- return detectKimiSdkModels();
6695
+ async detectModels(ctx) {
6696
+ return detectKimiSdkModels(void 0, ctx);
6652
6697
  }
6653
6698
  createSession(ctx) {
6654
6699
  this.sessionId = ctx.config.sessionId || null;
@@ -6679,7 +6724,7 @@ var KimiSdkDriver = class {
6679
6724
 
6680
6725
  // src/drivers/opencode.ts
6681
6726
  import { spawn as spawn8, spawnSync as spawnSync2 } from "child_process";
6682
- import { existsSync as existsSync8, readFileSync as readFileSync4 } from "fs";
6727
+ import { existsSync as existsSync8, readFileSync as readFileSync5 } from "fs";
6683
6728
  import os5 from "os";
6684
6729
  import path10 from "path";
6685
6730
  var SLOCK_AGENT_NAME = "slock";
@@ -6712,7 +6757,7 @@ function parseUserOpenCodeConfig(ctx) {
6712
6757
  function readLocalOpenCodeConfig(home = os5.homedir()) {
6713
6758
  const configPath = path10.join(home, ".config", "opencode", "opencode.json");
6714
6759
  try {
6715
- return parseOpenCodeConfigContent(readFileSync4(configPath, "utf8"));
6760
+ return parseOpenCodeConfigContent(readFileSync5(configPath, "utf8"));
6716
6761
  } catch {
6717
6762
  }
6718
6763
  return {};
@@ -6957,7 +7002,7 @@ function resolveWindowsOpenCodePackageEntry(commandPath, deps = {}) {
6957
7002
  }
6958
7003
  function extractWindowsShimTargets(commandPath, deps = {}) {
6959
7004
  if (!isWindowsCommandShim(commandPath)) return [];
6960
- const readFileSyncFn = deps.readFileSyncFn ?? readFileSync4;
7005
+ const readFileSyncFn = deps.readFileSyncFn ?? readFileSync5;
6961
7006
  const commandDir = path10.win32.dirname(commandPath);
6962
7007
  let raw;
6963
7008
  try {
@@ -14167,7 +14212,7 @@ var ReminderCache = class {
14167
14212
 
14168
14213
  // src/machineLock.ts
14169
14214
  import { createHash as createHash4, randomUUID as randomUUID5 } from "crypto";
14170
- import { mkdirSync as mkdirSync6, readFileSync as readFileSync5, rmSync as rmSync3, statSync as statSync2, writeFileSync as writeFileSync5 } from "fs";
14215
+ import { mkdirSync as mkdirSync6, readFileSync as readFileSync6, rmSync as rmSync3, statSync as statSync2, writeFileSync as writeFileSync5 } from "fs";
14171
14216
  import os7 from "os";
14172
14217
  import path14 from "path";
14173
14218
  var INCOMPLETE_LOCK_STALE_MS = 3e4;
@@ -14195,7 +14240,7 @@ function ownerPath(lockDir) {
14195
14240
  }
14196
14241
  function readOwner(lockDir) {
14197
14242
  try {
14198
- return JSON.parse(readFileSync5(ownerPath(lockDir), "utf8"));
14243
+ return JSON.parse(readFileSync6(ownerPath(lockDir), "utf8"));
14199
14244
  } catch {
14200
14245
  return null;
14201
14246
  }
@@ -15038,7 +15083,7 @@ function resolveSlockCliPathOrEmpty(moduleUrl = import.meta.url) {
15038
15083
  }
15039
15084
  async function runBundledSlockCli(argv) {
15040
15085
  process.argv = [process.execPath, "slock", ...argv];
15041
- await import("./dist-6YUWBDWX.js");
15086
+ await import("./dist-KVBO6CH7.js");
15042
15087
  }
15043
15088
  function detectRuntimes(tracer = noopTracer) {
15044
15089
  const ids = [];
package/dist/cli/index.js CHANGED
@@ -15827,14 +15827,20 @@ var RUNTIME_MODELS = {
15827
15827
  kimi: [
15828
15828
  { id: "default", label: "Configured Default" }
15829
15829
  ],
15830
- // kimi-sdk runs the Kimi Code SDK in-process. Surface the canonical model
15831
- // first so getDefaultModel("kimi-sdk") returns it (without a static entry,
15832
- // useRuntimeModels falls back to Claude's list and getDefaultModel returns
15833
- // "sonnet" which the SDK driver would pass through to the Kimi session
15834
- // and the LLM call would fail). Mirrors detectKimiSdkModels() in the daemon.
15830
+ // kimi-sdk runs the Kimi Code SDK in-process. The daemon's
15831
+ // `detectKimiSdkModels()` reads the live model list from the user's
15832
+ // `<kimiHome>/config.toml` (populated by `kimi login` from Moonshot's
15833
+ // `/models` endpoint) and reports it to the server, so the picker reflects
15834
+ // whatever the user has actually provisioned including new rollouts
15835
+ // (e.g. K2.7) without a daemon bump.
15836
+ //
15837
+ // This static entry is a fallback for hosts where detection failed (no
15838
+ // `kimi login` yet, missing config.toml, daemon detect path errored). It
15839
+ // surfaces the canonical model so getDefaultModel("kimi-sdk") returns
15840
+ // something usable and doesn't fall through to Claude's "sonnet" default.
15841
+ // Keep this list minimal — it's the floor, not the catalog.
15835
15842
  "kimi-sdk": [
15836
- { id: "kimi-code/kimi-for-coding", label: "Kimi-K2.6 (Kimi for Coding)", verified: "launchable" },
15837
- { id: "kimi-k2-0905-preview", label: "Kimi K2 (preview)", verified: "suggestion_only" }
15843
+ { id: "kimi-code/kimi-for-coding", label: "Kimi for Coding (default)", verified: "launchable" }
15838
15844
  ]
15839
15845
  };
15840
15846
  var PLAN_CONFIG = {
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@botiverse/raft",
3
- "version": "0.0.14",
3
+ "version": "0.0.15",
4
4
  "type": "module"
5
5
  }
package/dist/core.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  runBundledSlockCli,
12
12
  scanWorkspaceDirectories,
13
13
  subscribeDaemonLogs
14
- } from "./chunk-XMSXOB5R.js";
14
+ } from "./chunk-5JCAPBBM.js";
15
15
  export {
16
16
  DAEMON_CLI_USAGE,
17
17
  DaemonCore,
@@ -15631,14 +15631,20 @@ var RUNTIME_MODELS = {
15631
15631
  kimi: [
15632
15632
  { id: "default", label: "Configured Default" }
15633
15633
  ],
15634
- // kimi-sdk runs the Kimi Code SDK in-process. Surface the canonical model
15635
- // first so getDefaultModel("kimi-sdk") returns it (without a static entry,
15636
- // useRuntimeModels falls back to Claude's list and getDefaultModel returns
15637
- // "sonnet" which the SDK driver would pass through to the Kimi session
15638
- // and the LLM call would fail). Mirrors detectKimiSdkModels() in the daemon.
15634
+ // kimi-sdk runs the Kimi Code SDK in-process. The daemon's
15635
+ // `detectKimiSdkModels()` reads the live model list from the user's
15636
+ // `<kimiHome>/config.toml` (populated by `kimi login` from Moonshot's
15637
+ // `/models` endpoint) and reports it to the server, so the picker reflects
15638
+ // whatever the user has actually provisioned including new rollouts
15639
+ // (e.g. K2.7) without a daemon bump.
15640
+ //
15641
+ // This static entry is a fallback for hosts where detection failed (no
15642
+ // `kimi login` yet, missing config.toml, daemon detect path errored). It
15643
+ // surfaces the canonical model so getDefaultModel("kimi-sdk") returns
15644
+ // something usable and doesn't fall through to Claude's "sonnet" default.
15645
+ // Keep this list minimal — it's the floor, not the catalog.
15639
15646
  "kimi-sdk": [
15640
- { id: "kimi-code/kimi-for-coding", label: "Kimi-K2.6 (Kimi for Coding)", verified: "launchable" },
15641
- { id: "kimi-k2-0905-preview", label: "Kimi K2 (preview)", verified: "suggestion_only" }
15647
+ { id: "kimi-code/kimi-for-coding", label: "Kimi for Coding (default)", verified: "launchable" }
15642
15648
  ]
15643
15649
  };
15644
15650
  var PLAN_CONFIG = {
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  DAEMON_CLI_USAGE,
4
4
  DaemonCore,
5
5
  parseDaemonCliArgs
6
- } from "./chunk-XMSXOB5R.js";
6
+ } from "./chunk-5JCAPBBM.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.61.0",
3
+ "version": "0.61.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "raft-daemon": "dist/raft-daemon.js",