@hncode/hncode 0.8.2 → 0.8.4
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.
- package/bin/hncode +54 -8
- package/package.json +1 -1
- package/src/agent-task.js +14 -12
- package/src/agent.js +1465 -1421
- package/src/animate.js +21 -0
- package/src/colors.js +615 -593
- package/src/config.js +36 -11
- package/src/context-bar.js +280 -277
- package/src/doctor.js +4 -3
- package/src/i18n.js +1438 -1214
- package/src/index.js +822 -730
- package/src/keybindings.js +2 -1
- package/src/markdown.js +37 -10
- package/src/mcp-server.js +409 -0
- package/src/mcp.js +279 -29
- package/src/memory-profile.js +19 -16
- package/src/plan.js +7 -5
- package/src/plugin.js +37 -21
- package/src/registry-browser.js +17 -15
- package/src/rows-tool-result.js +251 -235
- package/src/settings-schema.js +9 -0
- package/src/swarm-progress.js +1 -1
- package/src/tasks-browser.js +28 -28
- package/src/term.js +57 -21
- package/src/text.js +62 -0
- package/src/tools/agent.js +7 -2
- package/src/tools/bash.js +446 -440
- package/src/tools/edit.js +14 -1
- package/src/tui.js +542 -330
package/src/config.js
CHANGED
|
@@ -313,6 +313,27 @@ export function clampRatio(value, fallback) {
|
|
|
313
313
|
return (v > 0 && v < 1) ? v : fallback;
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
+
// ---- the runtime's own language -------------------------------------------
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* The language the SYSTEM is set to, as `zh` or `en`.
|
|
320
|
+
*
|
|
321
|
+
* Region, not timezone: a machine can sit in any timezone and still be an English
|
|
322
|
+
* install. `Intl` reports what the user picked in their OS settings, which is the same
|
|
323
|
+
* value their other applications follow. Anything outside Chinese falls back to English,
|
|
324
|
+
* which is what the UI is authored in.
|
|
325
|
+
*
|
|
326
|
+
* The locale is a parameter so a test can drive both branches without touching the host.
|
|
327
|
+
*/
|
|
328
|
+
export function systemLanguage(locale) {
|
|
329
|
+
let tag = locale;
|
|
330
|
+
if (tag === undefined) {
|
|
331
|
+
try { tag = new Intl.DateTimeFormat().resolvedOptions().locale; } catch { tag = ''; }
|
|
332
|
+
}
|
|
333
|
+
const norm = String(tag || '').trim().toLowerCase().replace('_', '-');
|
|
334
|
+
return (norm === 'zh' || norm.startsWith('zh-')) ? 'zh' : 'en';
|
|
335
|
+
}
|
|
336
|
+
|
|
316
337
|
export function resolveConfig() {
|
|
317
338
|
const root = loadBaseToml() || {};
|
|
318
339
|
// Merge plugin-provided defaults UNDER the user's config: an explicitly set
|
|
@@ -484,17 +505,21 @@ const b = baseUrl.replace(/\/+$/, '');
|
|
|
484
505
|
// Backwards-compat: read legacy cool_mode key if calm_mode is not set.
|
|
485
506
|
: (root.calm_mode === true || root.calm_mode === 'true'
|
|
486
507
|
|| root.cool_mode === true || root.cool_mode === 'true'),
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
//
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
508
|
+
lang: (() => {
|
|
509
|
+
const explicit = String(process.env.HNCODE_LANG || root.lang || '').trim().toLowerCase().replace('_', '-');
|
|
510
|
+
if (explicit === 'zh' || explicit.startsWith('zh-')) return 'zh';
|
|
511
|
+
if (explicit === 'en' || explicit.startsWith('en-')) return 'en';
|
|
512
|
+
return systemLanguage();
|
|
513
|
+
})(),
|
|
514
|
+
// THINKING TAGS: whether the model is told to wrap its reasoning in
|
|
515
|
+
// `<|thinking|>…<|/thinking|>`. THREE states: `auto` follows the model (a model with
|
|
516
|
+
// a native reasoning channel does not need the tag, one without it does), and `on`
|
|
517
|
+
// / `off` decide by hand.
|
|
518
|
+
thinkingTags: (() => {
|
|
519
|
+
const raw = String(process.env.HNCODE_THINKING_TAGS || root.thinking_tags || 'auto').trim().toLowerCase();
|
|
520
|
+
if (raw === 'on' || raw === 'true' || raw === 'yes' || raw === '1') return 'on';
|
|
521
|
+
if (raw === 'off' || raw === 'false' || raw === 'no' || raw === '0') return 'off';
|
|
522
|
+
return 'auto';
|
|
498
523
|
})(),
|
|
499
524
|
subagentModel: process.env.HNCODE_SUBAGENT_MODEL || root.subagent_model || '',
|
|
500
525
|
// SECONDARY MODEL (/secondary-model): the cheap model for side work — /btw,
|