micro-models-agent 0.28.2 → 0.28.3
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/dist/main.js +56 -18
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -6896,16 +6896,16 @@ class ProcessRegistry {
|
|
|
6896
6896
|
const decoder = platform() === "win32" ? (() => {
|
|
6897
6897
|
try {
|
|
6898
6898
|
const cpOut = __require("child_process").execSync("chcp.com", {
|
|
6899
|
-
encoding: "
|
|
6899
|
+
encoding: "buffer",
|
|
6900
6900
|
timeout: 2000,
|
|
6901
6901
|
windowsHide: true
|
|
6902
|
-
}).toString();
|
|
6902
|
+
}).toString("latin1");
|
|
6903
6903
|
const m = cpOut.match(/(\d+)/);
|
|
6904
6904
|
if (m)
|
|
6905
6905
|
return new TextDecoder("ibm" + m[1]);
|
|
6906
6906
|
} catch {}
|
|
6907
|
-
return
|
|
6908
|
-
})() :
|
|
6907
|
+
return new TextDecoder("ibm866");
|
|
6908
|
+
})() : new TextDecoder("utf-8");
|
|
6909
6909
|
let buf = "";
|
|
6910
6910
|
const pushLine = (line) => {
|
|
6911
6911
|
if (entry.log.length >= MAX_LOG_LINES) {
|
|
@@ -6914,7 +6914,7 @@ class ProcessRegistry {
|
|
|
6914
6914
|
entry.log.push(line);
|
|
6915
6915
|
};
|
|
6916
6916
|
const append = (chunk) => {
|
|
6917
|
-
const decoded = decoder
|
|
6917
|
+
const decoded = decoder.decode(chunk, { stream: true });
|
|
6918
6918
|
buf += decoded;
|
|
6919
6919
|
const lines = buf.split(/\r?\n/);
|
|
6920
6920
|
buf = lines.pop() ?? "";
|
|
@@ -6923,9 +6923,7 @@ class ProcessRegistry {
|
|
|
6923
6923
|
}
|
|
6924
6924
|
};
|
|
6925
6925
|
const flush = () => {
|
|
6926
|
-
|
|
6927
|
-
buf += decoder.decode();
|
|
6928
|
-
}
|
|
6926
|
+
buf += decoder.decode();
|
|
6929
6927
|
if (buf) {
|
|
6930
6928
|
pushLine(buf);
|
|
6931
6929
|
buf = "";
|
|
@@ -7053,6 +7051,9 @@ import { platform as platform2 } from "os";
|
|
|
7053
7051
|
function adaptCommandForWindows(command) {
|
|
7054
7052
|
if (platform2() !== "win32")
|
|
7055
7053
|
return command;
|
|
7054
|
+
if (/\|\|\s*true\b/.test(command)) {
|
|
7055
|
+
command = command.replace(/\s*\|\|\s*true\b/g, "; exit 0");
|
|
7056
|
+
}
|
|
7056
7057
|
const trimmed = command.trim();
|
|
7057
7058
|
if (trimmed.startsWith("mkdir -p ")) {
|
|
7058
7059
|
return trimmed.replace(/^mkdir -p /, "mkdir ");
|
|
@@ -13465,9 +13466,30 @@ var init_loader = __esm(() => {
|
|
|
13465
13466
|
});
|
|
13466
13467
|
|
|
13467
13468
|
// src/modules/plugins/builtin/lint-on-write.ts
|
|
13468
|
-
import { spawn as spawn4 } from "child_process";
|
|
13469
|
+
import { spawn as spawn4, execSync } from "child_process";
|
|
13469
13470
|
import { existsSync as existsSync24, readFileSync as readFileSync13 } from "fs";
|
|
13470
13471
|
import { resolve as resolve13, extname as extname4, join as join18 } from "path";
|
|
13472
|
+
import { platform as platform3 } from "os";
|
|
13473
|
+
function getWinDecoder() {
|
|
13474
|
+
if (_winDecoder === undefined) {
|
|
13475
|
+
if (platform3() !== "win32") {
|
|
13476
|
+
_winDecoder = null;
|
|
13477
|
+
} else {
|
|
13478
|
+
try {
|
|
13479
|
+
const cpOut = execSync("chcp.com", {
|
|
13480
|
+
encoding: "buffer",
|
|
13481
|
+
timeout: 2000,
|
|
13482
|
+
windowsHide: true
|
|
13483
|
+
}).toString("latin1");
|
|
13484
|
+
const m = cpOut.match(/(\d+)/);
|
|
13485
|
+
_winDecoder = m ? new TextDecoder("ibm" + m[1]) : null;
|
|
13486
|
+
} catch {
|
|
13487
|
+
_winDecoder = null;
|
|
13488
|
+
}
|
|
13489
|
+
}
|
|
13490
|
+
}
|
|
13491
|
+
return _winDecoder ?? new TextDecoder("utf-8");
|
|
13492
|
+
}
|
|
13471
13493
|
|
|
13472
13494
|
class LintOnWritePlugin {
|
|
13473
13495
|
name = "lint-on-write";
|
|
@@ -13602,11 +13624,12 @@ function runAsync(command, cwd, timeoutMs) {
|
|
|
13602
13624
|
});
|
|
13603
13625
|
let stdout = "";
|
|
13604
13626
|
let stderr = "";
|
|
13627
|
+
const decoder = getWinDecoder();
|
|
13605
13628
|
child.stdout?.on("data", (d) => {
|
|
13606
|
-
stdout +=
|
|
13629
|
+
stdout += decoder.decode(d, { stream: true });
|
|
13607
13630
|
});
|
|
13608
13631
|
child.stderr?.on("data", (d) => {
|
|
13609
|
-
stderr +=
|
|
13632
|
+
stderr += decoder.decode(d, { stream: true });
|
|
13610
13633
|
});
|
|
13611
13634
|
const timer = setTimeout(() => {
|
|
13612
13635
|
child.kill();
|
|
@@ -13618,6 +13641,8 @@ function runAsync(command, cwd, timeoutMs) {
|
|
|
13618
13641
|
});
|
|
13619
13642
|
child.on("close", (code) => {
|
|
13620
13643
|
clearTimeout(timer);
|
|
13644
|
+
stdout += decoder.decode();
|
|
13645
|
+
stderr += decoder.decode();
|
|
13621
13646
|
if (code === 0) {
|
|
13622
13647
|
resolve14({ stdout, stderr });
|
|
13623
13648
|
} else {
|
|
@@ -13630,7 +13655,7 @@ function runAsync(command, cwd, timeoutMs) {
|
|
|
13630
13655
|
});
|
|
13631
13656
|
});
|
|
13632
13657
|
}
|
|
13633
|
-
var TYPE_CHECK_DEBOUNCE_MS = 2000, plugin;
|
|
13658
|
+
var TYPE_CHECK_DEBOUNCE_MS = 2000, _winDecoder, plugin;
|
|
13634
13659
|
var init_lint_on_write = __esm(() => {
|
|
13635
13660
|
plugin = new LintOnWritePlugin;
|
|
13636
13661
|
});
|
|
@@ -14232,6 +14257,19 @@ Sub-tasks: ${note}`
|
|
|
14232
14257
|
this.stuckDetector.reset();
|
|
14233
14258
|
this.consecutivePlanWarnings = 0;
|
|
14234
14259
|
this.lastStepId = -1;
|
|
14260
|
+
const iter = typeof ctx.iteration === "number" ? ctx.iteration : 0;
|
|
14261
|
+
if (iter === 3 && !this.tracker && ctx.contextManager) {
|
|
14262
|
+
ctx.contextManager.addMessage({
|
|
14263
|
+
role: "user",
|
|
14264
|
+
content: `<system-summary>You have made 3 tool calls without creating a plan. For any task that involves creating files, installing packages, or multiple steps — you MUST use plan create BEFORE continuing. Use the plan tool now with concrete steps (exact filenames, commands, deliverables). Do NOT make any more write/edit/bash calls until you have a plan.</system-summary>`
|
|
14265
|
+
});
|
|
14266
|
+
}
|
|
14267
|
+
if (iter >= 6 && !this.tracker && ctx.contextManager) {
|
|
14268
|
+
ctx.contextManager.addMessage({
|
|
14269
|
+
role: "user",
|
|
14270
|
+
content: `<system-summary>STOP. ${iter} iterations without a plan. You MUST call plan create RIGHT NOW. No more tool calls until you create a plan.</system-summary>`
|
|
14271
|
+
});
|
|
14272
|
+
}
|
|
14235
14273
|
}
|
|
14236
14274
|
const stuckReason = this.stuckDetector.getStuckReason();
|
|
14237
14275
|
if (stuckReason) {
|
|
@@ -15031,7 +15069,7 @@ class ProfileCompressor {
|
|
|
15031
15069
|
// src/modules/user-profile/profile.ts
|
|
15032
15070
|
import { readFileSync as readFileSync18, writeFileSync as writeFileSync11, existsSync as existsSync30, mkdirSync as mkdirSync13 } from "fs";
|
|
15033
15071
|
import { join as join22 } from "path";
|
|
15034
|
-
import { homedir as homedir9, hostname, platform as
|
|
15072
|
+
import { homedir as homedir9, hostname, platform as platform4, type } from "os";
|
|
15035
15073
|
import { env } from "process";
|
|
15036
15074
|
|
|
15037
15075
|
class UserProfile {
|
|
@@ -15043,7 +15081,7 @@ class UserProfile {
|
|
|
15043
15081
|
}
|
|
15044
15082
|
collect() {
|
|
15045
15083
|
this.info = {
|
|
15046
|
-
platform:
|
|
15084
|
+
platform: platform4(),
|
|
15047
15085
|
os: `${type()} ${hostname()}`,
|
|
15048
15086
|
hostname: hostname(),
|
|
15049
15087
|
shell: env.SHELL || env.ComSpec || "unknown",
|
|
@@ -15393,7 +15431,7 @@ var init_browser2 = __esm(() => {
|
|
|
15393
15431
|
});
|
|
15394
15432
|
|
|
15395
15433
|
// src/modules/lsp/client.ts
|
|
15396
|
-
import { spawn as spawn5, execSync } from "child_process";
|
|
15434
|
+
import { spawn as spawn5, execSync as execSync2 } from "child_process";
|
|
15397
15435
|
import { resolve as resolve16 } from "path";
|
|
15398
15436
|
|
|
15399
15437
|
class LspClient {
|
|
@@ -15450,7 +15488,7 @@ class LspClient {
|
|
|
15450
15488
|
async startServer(config, baseDir) {
|
|
15451
15489
|
if (config.autoInstall === false) {
|
|
15452
15490
|
try {
|
|
15453
|
-
|
|
15491
|
+
execSync2(`where ${config.command}`, { stdio: "pipe", timeout: 3000 });
|
|
15454
15492
|
} catch {
|
|
15455
15493
|
throw new Error(`${config.command} not found in PATH`);
|
|
15456
15494
|
}
|
|
@@ -24643,7 +24681,7 @@ var init_fact_checker = () => {};
|
|
|
24643
24681
|
// src/modules/certification/runner.ts
|
|
24644
24682
|
import { spawn as spawn6 } from "child_process";
|
|
24645
24683
|
import { existsSync as existsSync39, mkdirSync as mkdirSync16, rmSync as rmSync3, cpSync as cpSync2 } from "fs";
|
|
24646
|
-
import { platform as
|
|
24684
|
+
import { platform as platform5 } from "os";
|
|
24647
24685
|
import { join as join32, resolve as resolve19, dirname as dirname9 } from "path";
|
|
24648
24686
|
async function runScenario(scenario, opts) {
|
|
24649
24687
|
if (scenario.mode === "skip") {
|
|
@@ -24754,7 +24792,7 @@ function killTree2(child) {
|
|
|
24754
24792
|
const pid = child.pid;
|
|
24755
24793
|
if (!pid)
|
|
24756
24794
|
return;
|
|
24757
|
-
if (
|
|
24795
|
+
if (platform5() === "win32") {
|
|
24758
24796
|
spawn6("taskkill", ["/pid", String(pid), "/T", "/F"], {
|
|
24759
24797
|
windowsHide: true,
|
|
24760
24798
|
stdio: "ignore"
|