@addai/node 0.27.0 → 0.27.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.
Files changed (2) hide show
  1. package/dist/kimi-spawn.js +29 -10
  2. package/package.json +1 -1
@@ -68,17 +68,37 @@ const child_process_1 = require("child_process");
68
68
  const fs = __importStar(require("fs"));
69
69
  const path = __importStar(require("path"));
70
70
  const kimi_binary_1 = require("./kimi-binary");
71
+ const harness_registry_1 = require("./harness-registry");
71
72
  const win_1 = require("./win");
72
73
  const events_1 = require("./events");
73
74
  const think_split_1 = require("./think-split");
74
75
  const mcp_headers_1 = require("./mcp-headers");
75
- /** kimi forwards this string to the provider verbatim — the override exists
76
- * precisely to bypass the model's declared support_efforts so a level kimi
77
- * has never heard of reaches the API as-is. It retired 'max' (it migrates a
78
- * stored 'max' to 'high' on load) and never had our 'xhigh', so both collapse
79
- * to the highest level it does know. */
76
+ /**
77
+ * The effort level to send kimi, or null to send nothing.
78
+ *
79
+ * KIMI_MODEL_THINKING_EFFORT is a real kimi env var, but it exists precisely to
80
+ * BYPASS the model's declared support_efforts kimi forwards the string to the
81
+ * provider verbatim and lets the API judge it. Setting it unconditionally is
82
+ * therefore not a safe default: an entity on medium effort got
83
+ *
84
+ * provider.api_error: 400 Invalid request Error
85
+ *
86
+ * four seconds into the run, every run, because the model behind kimi takes no
87
+ * thinking effort at all.
88
+ *
89
+ * The harness registry already records which levels a harness supports, and
90
+ * kimi's list is empty — so the registry decides, and an empty list means the
91
+ * variable is never set. If kimi gains effort support, updating the registry is
92
+ * enough; nothing here needs to change.
93
+ */
80
94
  function kimiEffort(level) {
81
- return level === 'max' || level === 'xhigh' ? 'high' : level;
95
+ const supported = (0, harness_registry_1.harness)('kimi')?.efforts ?? [];
96
+ if (supported.length === 0)
97
+ return null;
98
+ // 'max' was retired by kimi (it migrates a stored 'max' to 'high') and it
99
+ // never had our 'xhigh', so both collapse to the highest level it declares.
100
+ const wanted = level === 'max' || level === 'xhigh' ? 'high' : level;
101
+ return supported.includes(wanted) ? wanted : null;
82
102
  }
83
103
  /**
84
104
  * Write the entity's MCP servers where kimi will actually read them:
@@ -339,13 +359,12 @@ function spawnKimi(input) {
339
359
  // No HOME override: the real $HOME flows through so kimi's own auth +
340
360
  // shelled-out tools (git/pip/node) can find their config files. The
341
361
  // explicit --mcp-config-file already prevents host mcp.json leakage.
362
+ const effortValue = input.effortLevel ? kimiEffort(input.effortLevel) : null;
342
363
  const childEnv = {
343
364
  ...process.env,
344
365
  TERM: 'dumb',
345
- // kimi's own effort override. It bypasses the model's support_efforts
346
- // list, and kimi migrates a stored 'max' to 'high' — so normalise here
347
- // rather than send a level the provider may reject.
348
- ...(input.effortLevel ? { KIMI_MODEL_THINKING_EFFORT: kimiEffort(input.effortLevel) } : {}),
366
+ // Effort, only when the registry says kimi can take one — see kimiEffort.
367
+ ...(effortValue ? { KIMI_MODEL_THINKING_EFFORT: effortValue } : {}),
349
368
  };
350
369
  const listeners = [];
351
370
  const emit = (e) => { for (const l of listeners)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@addai/node",
3
- "version": "0.27.0",
3
+ "version": "0.27.1",
4
4
  "description": "Daemon that pairs a machine with your +Ai account and runs Claude / Codex / Kimi / Gemini agents on its behalf. Reachable via Supabase from Vault, Entity Studio, or any other +Ai surface.",
5
5
  "license": "MIT",
6
6
  "keywords": [