micro-models-agent 0.18.0 → 0.18.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.
@@ -62,21 +62,36 @@ export function runCommand(command, options = {}) {
62
62
  detached: platform() !== "win32",
63
63
  stdio: ["ignore", "pipe", "pipe"],
64
64
  });
65
- const append = (ref, chunk) => {
66
- const text = chunk.toString();
67
- const next = ref.value.length + text.length;
65
+ const stdoutRef = { value: stdout };
66
+ const stderrRef = { value: stderr };
67
+ // On Windows, child processes spawned via cmd.exe output in the OEM code
68
+ // page (typically CP866 for Russian), NOT UTF-8 — even when the parent
69
+ // console reports code page 65001 via `chcp`. Always decode with ibm866
70
+ // so that Cyrillic and other non-ASCII text is not garbled.
71
+ const decoder = platform() === "win32" ? new TextDecoder("ibm866") : null;
72
+ const decodeChunk = (chunk) => decoder ? decoder.decode(chunk, { stream: true }) : chunk.toString("utf-8");
73
+ child.stdout?.on("data", (chunk) => {
74
+ const text = decodeChunk(chunk);
75
+ const next = stdoutRef.value.length + text.length;
68
76
  if (next > maxBuffer) {
69
- ref.value =
70
- ref.value.slice(ref.value.length + text.length - maxBuffer) + text;
77
+ stdoutRef.value =
78
+ stdoutRef.value.slice(stdoutRef.value.length + text.length - maxBuffer) + text;
71
79
  }
72
80
  else {
73
- ref.value = ref.value + text;
81
+ stdoutRef.value = stdoutRef.value + text;
74
82
  }
75
- };
76
- const stdoutRef = { value: stdout };
77
- const stderrRef = { value: stderr };
78
- child.stdout?.on("data", (chunk) => append(stdoutRef, chunk));
79
- child.stderr?.on("data", (chunk) => append(stderrRef, chunk));
83
+ });
84
+ child.stderr?.on("data", (chunk) => {
85
+ const text = decodeChunk(chunk);
86
+ const next = stderrRef.value.length + text.length;
87
+ if (next > maxBuffer) {
88
+ stderrRef.value =
89
+ stderrRef.value.slice(stderrRef.value.length + text.length - maxBuffer) + text;
90
+ }
91
+ else {
92
+ stderrRef.value = stderrRef.value + text;
93
+ }
94
+ });
80
95
  const entry = {
81
96
  kill: () => killTree(child),
82
97
  };
@@ -18,6 +18,7 @@ function adaptCommandForWindows(command) {
18
18
  if (trimmed === 'mkdir -p' || trimmed.startsWith('mkdir -p ')) {
19
19
  return trimmed.replace(/mkdir -p/g, 'mkdir');
20
20
  }
21
+ // No encoding adaptation needed — runner.ts handles UTF-8 decoding
21
22
  return command;
22
23
  }
23
24
  /** Common Unix → Windows command mapping for error hints. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "micro-models-agent",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
4
4
  "description": "Micro Models Agent (MMA) — LLM agent harness for small models (Qwen3.5-9B, 32K-64K context)",
5
5
  "type": "module",
6
6
  "bin": {