@slock-ai/daemon 0.46.0-play.20260508180641 → 0.46.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.
@@ -1093,17 +1093,6 @@ Keep the user informed. They cannot see your internal reasoning, so:
1093
1093
  - For multi-step work, send short progress updates (e.g. "Working on step 2/3\u2026").
1094
1094
  - When done, summarize the result.
1095
1095
  - Keep updates concise \u2014 one or two sentences. Don't flood the chat.
1096
- - For long answers where users need the conclusion first but details still matter, put the conclusion and next action outside any collapse, then use sanitized HTML details blocks for optional depth:
1097
-
1098
- \`\`\`html
1099
- <details>
1100
- <summary>Evidence, logs, or edge cases</summary>
1101
-
1102
- Detailed notes go here.
1103
- </details>
1104
- \`\`\`
1105
-
1106
- Do not hide the main recommendation, blocker, or required action inside \`<details>\`; only fold supporting evidence, logs, alternatives, or extended rationale.
1107
1096
 
1108
1097
  ### Conversation etiquette
1109
1098
 
@@ -2569,8 +2558,8 @@ function runCursorModelsCommand() {
2569
2558
  }
2570
2559
 
2571
2560
  // src/drivers/gemini.ts
2572
- import { spawn as spawn5 } from "child_process";
2573
- import { writeFileSync as writeFileSync5, mkdirSync as mkdirSync3 } from "fs";
2561
+ import { execFileSync as execFileSync2, spawn as spawn5 } from "child_process";
2562
+ import { existsSync as existsSync5, mkdirSync as mkdirSync3, writeFileSync as writeFileSync5 } from "fs";
2574
2563
  import path7 from "path";
2575
2564
  function buildGeminiSpawnEnv(ctx, platform = process.platform) {
2576
2565
  const { spawnEnv } = prepareCliTransport(ctx, { NO_COLOR: "1" }, platform);
@@ -2579,6 +2568,71 @@ function buildGeminiSpawnEnv(ctx, platform = process.platform) {
2579
2568
  }
2580
2569
  return spawnEnv;
2581
2570
  }
2571
+ function normalizeExecOutput2(raw) {
2572
+ return Buffer.isBuffer(raw) ? raw.toString("utf8") : String(raw ?? "");
2573
+ }
2574
+ function buildGeminiArgs(config) {
2575
+ const args = [
2576
+ "--output-format",
2577
+ "stream-json",
2578
+ "--yolo",
2579
+ // Gemini CLI headless mode is selected by -p/--prompt. Keep the actual
2580
+ // prompt off argv and feed it through stdin below; this avoids Windows
2581
+ // cmd.exe's 8191-character command-line limit and keeps long wake payloads
2582
+ // below CreateProcess argv pressure too.
2583
+ "-p",
2584
+ ""
2585
+ ];
2586
+ if (config.model && config.model !== "default") {
2587
+ args.push("--model", config.model);
2588
+ }
2589
+ if (config.sessionId) {
2590
+ args.push("--resume", config.sessionId);
2591
+ }
2592
+ return args;
2593
+ }
2594
+ function resolveGeminiSpawn(commandArgs, deps = {}) {
2595
+ const platform = deps.platform ?? process.platform;
2596
+ if (platform !== "win32") {
2597
+ return { command: resolveCommandOnPath("gemini", deps) ?? "gemini", args: commandArgs };
2598
+ }
2599
+ const execFileSyncFn = deps.execFileSyncFn ?? execFileSync2;
2600
+ const existsSyncFn = deps.existsSyncFn ?? existsSync5;
2601
+ const env = deps.env ?? process.env;
2602
+ const winPath = path7.win32;
2603
+ let geminiEntry = null;
2604
+ try {
2605
+ const globalRoot = normalizeExecOutput2(execFileSyncFn("npm", ["root", "-g"], {
2606
+ encoding: "utf8",
2607
+ stdio: ["ignore", "pipe", "pipe"],
2608
+ env
2609
+ })).trim();
2610
+ const candidate = winPath.join(globalRoot, "@google", "gemini-cli", "bundle", "gemini.js");
2611
+ if (existsSyncFn(candidate)) geminiEntry = candidate;
2612
+ } catch {
2613
+ }
2614
+ if (!geminiEntry) {
2615
+ try {
2616
+ const cmdPath = normalizeExecOutput2(execFileSyncFn("where.exe", ["gemini"], {
2617
+ encoding: "utf8",
2618
+ stdio: ["ignore", "pipe", "pipe"],
2619
+ env
2620
+ })).trim().split(/\r?\n/)[0];
2621
+ const candidate = winPath.join(winPath.dirname(cmdPath), "node_modules", "@google", "gemini-cli", "bundle", "gemini.js");
2622
+ if (existsSyncFn(candidate)) geminiEntry = candidate;
2623
+ } catch {
2624
+ }
2625
+ }
2626
+ if (!geminiEntry) {
2627
+ throw new Error(
2628
+ "Cannot resolve Gemini CLI entry point on Windows. Ensure @google/gemini-cli is installed globally via npm (npm i -g @google/gemini-cli)."
2629
+ );
2630
+ }
2631
+ return {
2632
+ command: process.execPath,
2633
+ args: [geminiEntry, ...commandArgs]
2634
+ };
2635
+ }
2582
2636
  var GeminiDriver = class {
2583
2637
  id = "gemini";
2584
2638
  lifecycle = {
@@ -2608,26 +2662,15 @@ var GeminiDriver = class {
2608
2662
  this.sessionId = ctx.config.sessionId || null;
2609
2663
  this.sessionAnnounced = false;
2610
2664
  this.writeGeminiSettings(ctx);
2611
- const args = [
2612
- "--output-format",
2613
- "stream-json",
2614
- "--yolo",
2615
- "-p",
2616
- ctx.prompt
2617
- ];
2618
- if (ctx.config.model && ctx.config.model !== "default") {
2619
- args.push("--model", ctx.config.model);
2620
- }
2621
- if (ctx.config.sessionId) {
2622
- args.push("--resume", ctx.config.sessionId);
2623
- }
2665
+ const { command, args } = resolveGeminiSpawn(buildGeminiArgs(ctx.config));
2624
2666
  const spawnEnv = buildGeminiSpawnEnv(ctx);
2625
- const proc = spawn5("gemini", args, {
2667
+ const proc = spawn5(command, args, {
2626
2668
  cwd: ctx.workingDirectory,
2627
2669
  stdio: ["pipe", "pipe", "pipe"],
2628
2670
  env: spawnEnv,
2629
- shell: process.platform === "win32"
2671
+ shell: false
2630
2672
  });
2673
+ proc.stdin?.end(ctx.prompt);
2631
2674
  return { process: proc };
2632
2675
  }
2633
2676
  parseLine(line) {
@@ -2729,16 +2772,13 @@ var GeminiDriver = class {
2729
2772
  // src/drivers/kimi.ts
2730
2773
  import { randomUUID } from "crypto";
2731
2774
  import { spawn as spawn6 } from "child_process";
2732
- import { chmodSync, existsSync as existsSync5, readFileSync as readFileSync3, writeFileSync as writeFileSync6 } from "fs";
2775
+ import { existsSync as existsSync6, readFileSync as readFileSync3, writeFileSync as writeFileSync6 } from "fs";
2733
2776
  import os3 from "os";
2734
2777
  import path8 from "path";
2735
2778
  var KIMI_WIRE_PROTOCOL_VERSION = "1.3";
2736
2779
  var KIMI_SYSTEM_PROMPT_FILE = ".slock-kimi-system.md";
2737
2780
  var KIMI_AGENT_FILE = ".slock-kimi-agent.yaml";
2738
2781
  var KIMI_MCP_FILE = ".slock-kimi-mcp.json";
2739
- var KIMI_GENERATED_CONFIG_FILE = ".slock-kimi-config.toml";
2740
- var SLOCK_KIMI_CONFIG_CONTENT_ENV = "SLOCK_KIMI_CONFIG_CONTENT";
2741
- var SLOCK_KIMI_CONFIG_FILE_ENV = "SLOCK_KIMI_CONFIG_FILE";
2742
2782
  function parseToolArguments(raw) {
2743
2783
  if (typeof raw !== "string") return raw;
2744
2784
  try {
@@ -2747,73 +2787,6 @@ function parseToolArguments(raw) {
2747
2787
  return raw;
2748
2788
  }
2749
2789
  }
2750
- function readKimiConfigSource(home = os3.homedir(), env = process.env) {
2751
- const inlineConfig = env[SLOCK_KIMI_CONFIG_CONTENT_ENV];
2752
- if (inlineConfig && inlineConfig.trim()) {
2753
- return {
2754
- raw: inlineConfig,
2755
- explicitPath: null,
2756
- sourcePath: SLOCK_KIMI_CONFIG_CONTENT_ENV
2757
- };
2758
- }
2759
- const explicitPath = env[SLOCK_KIMI_CONFIG_FILE_ENV];
2760
- const configPath = explicitPath && explicitPath.trim() ? explicitPath : path8.join(home, ".kimi", "config.toml");
2761
- try {
2762
- return {
2763
- raw: readFileSync3(configPath, "utf8"),
2764
- explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
2765
- sourcePath: configPath
2766
- };
2767
- } catch {
2768
- return {
2769
- raw: null,
2770
- explicitPath: explicitPath && explicitPath.trim() ? explicitPath : null,
2771
- sourcePath: configPath
2772
- };
2773
- }
2774
- }
2775
- function buildKimiSpawnEnv(env = process.env) {
2776
- const spawnEnv = { ...env, FORCE_COLOR: "0", NO_COLOR: "1" };
2777
- delete spawnEnv[SLOCK_KIMI_CONFIG_CONTENT_ENV];
2778
- delete spawnEnv[SLOCK_KIMI_CONFIG_FILE_ENV];
2779
- return spawnEnv;
2780
- }
2781
- function buildKimiEffectiveEnv(ctx, overrideEnv) {
2782
- return {
2783
- ...process.env,
2784
- ...ctx.config.envVars || {},
2785
- ...overrideEnv || {}
2786
- };
2787
- }
2788
- function buildKimiLaunchOptions(ctx, opts = {}) {
2789
- const env = buildKimiEffectiveEnv(ctx, opts.env);
2790
- const source = readKimiConfigSource(opts.home ?? os3.homedir(), env);
2791
- const args = [];
2792
- let configFilePath = null;
2793
- let configContent = null;
2794
- if (source.explicitPath) {
2795
- configFilePath = source.explicitPath;
2796
- } else if (source.raw !== null && source.sourcePath === SLOCK_KIMI_CONFIG_CONTENT_ENV) {
2797
- configFilePath = path8.join(ctx.workingDirectory, KIMI_GENERATED_CONFIG_FILE);
2798
- configContent = source.raw;
2799
- if (opts.writeGeneratedConfig !== false) {
2800
- writeFileSync6(configFilePath, source.raw, { encoding: "utf8", mode: 384 });
2801
- chmodSync(configFilePath, 384);
2802
- }
2803
- }
2804
- if (configFilePath) {
2805
- args.push("--config-file", configFilePath);
2806
- }
2807
- if (ctx.config.model && ctx.config.model !== "default") {
2808
- args.push("--model", ctx.config.model);
2809
- }
2810
- return {
2811
- args,
2812
- env: buildKimiSpawnEnv(env),
2813
- configFilePath,
2814
- configContent
2815
- };
2816
- }
2817
2790
  var KimiDriver = class {
2818
2791
  id = "kimi";
2819
2792
  lifecycle = {
@@ -2830,25 +2803,7 @@ var KimiDriver = class {
2830
2803
  };
2831
2804
  model = {
2832
2805
  detectedModelsVerifiedAs: "launchable",
2833
- toLaunchSpec: (modelId, ctx, opts) => {
2834
- if (!ctx) return { args: ["--model", modelId] };
2835
- const launchCtx = {
2836
- ...ctx,
2837
- config: {
2838
- ...ctx.config,
2839
- model: modelId
2840
- }
2841
- };
2842
- const launch = buildKimiLaunchOptions(launchCtx, {
2843
- home: opts?.home,
2844
- writeGeneratedConfig: false
2845
- });
2846
- return {
2847
- args: launch.args,
2848
- env: launch.env,
2849
- configFiles: launch.configFilePath ? [launch.configFilePath] : void 0
2850
- };
2851
- }
2806
+ toLaunchSpec: (modelId) => ({ args: ["--model", modelId] })
2852
2807
  };
2853
2808
  supportsStdinNotification = true;
2854
2809
  mcpToolPrefix = "";
@@ -2882,7 +2837,7 @@ var KimiDriver = class {
2882
2837
  const systemPromptPath = path8.join(ctx.workingDirectory, KIMI_SYSTEM_PROMPT_FILE);
2883
2838
  const agentFilePath = path8.join(ctx.workingDirectory, KIMI_AGENT_FILE);
2884
2839
  const mcpConfigPath = path8.join(ctx.workingDirectory, KIMI_MCP_FILE);
2885
- if (!isResume || !existsSync5(systemPromptPath)) {
2840
+ if (!isResume || !existsSync6(systemPromptPath)) {
2886
2841
  writeFileSync6(systemPromptPath, ctx.prompt, "utf8");
2887
2842
  }
2888
2843
  writeFileSync6(agentFilePath, [
@@ -2900,7 +2855,6 @@ var KimiDriver = class {
2900
2855
  }
2901
2856
  }
2902
2857
  }), "utf8");
2903
- const launch = buildKimiLaunchOptions(ctx);
2904
2858
  const args = [
2905
2859
  "--wire",
2906
2860
  "--yolo",
@@ -2909,13 +2863,16 @@ var KimiDriver = class {
2909
2863
  "--mcp-config-file",
2910
2864
  mcpConfigPath,
2911
2865
  "--session",
2912
- this.sessionId,
2913
- ...launch.args
2866
+ this.sessionId
2914
2867
  ];
2868
+ if (ctx.config.model && ctx.config.model !== "default") {
2869
+ args.push("--model", ctx.config.model);
2870
+ }
2871
+ const spawnEnv = { ...process.env, FORCE_COLOR: "0", NO_COLOR: "1" };
2915
2872
  const proc = spawn6("kimi", args, {
2916
2873
  cwd: ctx.workingDirectory,
2917
2874
  stdio: ["pipe", "pipe", "pipe"],
2918
- env: launch.env,
2875
+ env: spawnEnv,
2919
2876
  shell: process.platform === "win32"
2920
2877
  });
2921
2878
  proc.stdin?.write(JSON.stringify({
@@ -3032,9 +2989,14 @@ var KimiDriver = class {
3032
2989
  return detectKimiModels();
3033
2990
  }
3034
2991
  };
3035
- function detectKimiModels(home = os3.homedir(), opts = {}) {
3036
- const raw = readKimiConfigSource(home, opts.env).raw;
3037
- if (raw === null) return null;
2992
+ function detectKimiModels(home = os3.homedir()) {
2993
+ const configPath = path8.join(home, ".kimi", "config.toml");
2994
+ let raw;
2995
+ try {
2996
+ raw = readFileSync3(configPath, "utf8");
2997
+ } catch {
2998
+ return null;
2999
+ }
3038
3000
  const models = [];
3039
3001
  const sectionRe = /^\s*\[models(?:\.([^\]]+)|"\.[^"]+"|\."[^"]+")\s*\]\s*$/gm;
3040
3002
  const lineRe = /^\s*\[models\.(.+?)\s*\]\s*$/gm;
package/dist/core.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  resolveSlockCliPath,
10
10
  resolveWorkspaceDirectoryPath,
11
11
  scanWorkspaceDirectories
12
- } from "./chunk-MEY33LAG.js";
12
+ } from "./chunk-XW57NR6Y.js";
13
13
  import {
14
14
  subscribeDaemonLogs
15
15
  } from "./chunk-Z3PCMYZO.js";
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  DAEMON_CLI_USAGE,
4
4
  DaemonCore,
5
5
  parseDaemonCliArgs
6
- } from "./chunk-MEY33LAG.js";
6
+ } from "./chunk-XW57NR6Y.js";
7
7
  import "./chunk-Z3PCMYZO.js";
8
8
 
9
9
  // src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slock-ai/daemon",
3
- "version": "0.46.0-play.20260508180641",
3
+ "version": "0.46.1",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "slock-daemon": "dist/index.js"