micro-models-agent 0.36.2 → 0.37.0
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 +80 -24
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -15726,34 +15726,53 @@ class ModuleRegistry {
|
|
|
15726
15726
|
|
|
15727
15727
|
// src/modules/plugins/loader.ts
|
|
15728
15728
|
import { readdirSync as readdirSync7, existsSync as existsSync26, statSync as statSync5 } from "fs";
|
|
15729
|
-
import { join as join21 } from "path";
|
|
15729
|
+
import { join as join21, basename as basename2 } from "path";
|
|
15730
15730
|
|
|
15731
15731
|
class PluginLoader {
|
|
15732
15732
|
loadFromDir(dirPath, pluginManager, logger) {
|
|
15733
15733
|
if (!existsSync26(dirPath))
|
|
15734
15734
|
return;
|
|
15735
|
-
const entries = readdirSync7(dirPath);
|
|
15735
|
+
const entries = readdirSync7(dirPath).sort();
|
|
15736
15736
|
for (const entry of entries) {
|
|
15737
15737
|
const fullPath = join21(dirPath, entry);
|
|
15738
|
-
|
|
15739
|
-
|
|
15740
|
-
|
|
15741
|
-
|
|
15742
|
-
|
|
15743
|
-
|
|
15744
|
-
const
|
|
15745
|
-
if (
|
|
15746
|
-
|
|
15747
|
-
logger?.warn(t("plugin.loaded", { name: plugin.name }));
|
|
15738
|
+
const stat = statSync5(fullPath);
|
|
15739
|
+
if (stat.isFile()) {
|
|
15740
|
+
if (!entry.endsWith(".ts") && !entry.endsWith(".js"))
|
|
15741
|
+
continue;
|
|
15742
|
+
this.tryLoad(fullPath, entry, pluginManager, logger);
|
|
15743
|
+
} else if (stat.isDirectory()) {
|
|
15744
|
+
const entryFile = this.findEntryFile(fullPath);
|
|
15745
|
+
if (entryFile) {
|
|
15746
|
+
this.tryLoad(entryFile, `${entry}/${basename2(entryFile)}`, pluginManager, logger);
|
|
15748
15747
|
}
|
|
15749
|
-
} catch (e) {
|
|
15750
|
-
logger?.warn(t("plugin.skipped", { entry, message: e.message }));
|
|
15751
15748
|
}
|
|
15752
15749
|
}
|
|
15753
15750
|
}
|
|
15751
|
+
findEntryFile(dir) {
|
|
15752
|
+
for (const name of FOLDER_ENTRY_NAMES) {
|
|
15753
|
+
const candidate = join21(dir, name);
|
|
15754
|
+
if (existsSync26(candidate))
|
|
15755
|
+
return candidate;
|
|
15756
|
+
}
|
|
15757
|
+
return null;
|
|
15758
|
+
}
|
|
15759
|
+
tryLoad(fullPath, label, pluginManager, logger) {
|
|
15760
|
+
try {
|
|
15761
|
+
const mod = __require(fullPath);
|
|
15762
|
+
const plugin = mod.default || mod.plugin;
|
|
15763
|
+
if (plugin && plugin.name) {
|
|
15764
|
+
pluginManager.register(plugin);
|
|
15765
|
+
logger?.warn(t("plugin.loaded", { name: plugin.name }));
|
|
15766
|
+
}
|
|
15767
|
+
} catch (e) {
|
|
15768
|
+
logger?.warn(t("plugin.skipped", { entry: label, message: e.message }));
|
|
15769
|
+
}
|
|
15770
|
+
}
|
|
15754
15771
|
}
|
|
15772
|
+
var FOLDER_ENTRY_NAMES;
|
|
15755
15773
|
var init_loader = __esm(() => {
|
|
15756
15774
|
init_i18n();
|
|
15775
|
+
FOLDER_ENTRY_NAMES = ["plugin.ts", "plugin.js", "index.ts", "index.js"];
|
|
15757
15776
|
});
|
|
15758
15777
|
|
|
15759
15778
|
// src/modules/plugins/builtin/lint-on-write.ts
|
|
@@ -16265,12 +16284,12 @@ var init_audit_runners = __esm(() => {
|
|
|
16265
16284
|
|
|
16266
16285
|
// src/modules/execution/auditor.ts
|
|
16267
16286
|
import { existsSync as existsSync29, readdirSync as readdirSync9 } from "fs";
|
|
16268
|
-
import { resolve as resolve18, join as join24, basename as
|
|
16287
|
+
import { resolve as resolve18, join as join24, basename as basename3 } from "path";
|
|
16269
16288
|
function findExistingFile(baseDir, filePath) {
|
|
16270
16289
|
const direct = resolve18(baseDir, filePath);
|
|
16271
16290
|
if (existsSync29(direct))
|
|
16272
16291
|
return direct;
|
|
16273
|
-
const name =
|
|
16292
|
+
const name = basename3(filePath).toLowerCase();
|
|
16274
16293
|
const suffix = filePath.replace(/\\/g, "/").toLowerCase();
|
|
16275
16294
|
let found = null;
|
|
16276
16295
|
const walk = (dir, depth) => {
|
|
@@ -16594,7 +16613,7 @@ function extractFilePaths(text) {
|
|
|
16594
16613
|
}
|
|
16595
16614
|
return result;
|
|
16596
16615
|
}
|
|
16597
|
-
function
|
|
16616
|
+
function basename4(p) {
|
|
16598
16617
|
const parts = p.split(/[/\\]/);
|
|
16599
16618
|
return parts[parts.length - 1] ?? p;
|
|
16600
16619
|
}
|
|
@@ -16606,7 +16625,7 @@ function checkPlanCoverage(taskText, stepDescriptions) {
|
|
|
16606
16625
|
`);
|
|
16607
16626
|
const missing = taskPaths.filter((p) => {
|
|
16608
16627
|
const lower = p.toLowerCase();
|
|
16609
|
-
const base =
|
|
16628
|
+
const base = basename4(lower);
|
|
16610
16629
|
return !stepText.includes(lower) && !stepText.includes(base);
|
|
16611
16630
|
});
|
|
16612
16631
|
return { missing };
|
|
@@ -30109,6 +30128,8 @@ class LineEditor {
|
|
|
30109
30128
|
stash = null;
|
|
30110
30129
|
isDone = false;
|
|
30111
30130
|
isPaste = false;
|
|
30131
|
+
pasteBuffer = "";
|
|
30132
|
+
pasteLastWasCR = false;
|
|
30112
30133
|
lastWasCR = false;
|
|
30113
30134
|
questionCb = null;
|
|
30114
30135
|
rawMode = false;
|
|
@@ -30235,22 +30256,38 @@ class LineEditor {
|
|
|
30235
30256
|
}
|
|
30236
30257
|
if (name === "paste-start" || seq2 === "\x1B[200~") {
|
|
30237
30258
|
this.isPaste = true;
|
|
30259
|
+
this.pasteBuffer = "";
|
|
30260
|
+
this.pasteLastWasCR = false;
|
|
30238
30261
|
return;
|
|
30239
30262
|
}
|
|
30240
30263
|
if (name === "paste-end" || seq2 === "\x1B[201~") {
|
|
30241
30264
|
this.isPaste = false;
|
|
30242
|
-
this.
|
|
30265
|
+
if (this.pasteBuffer) {
|
|
30266
|
+
this.insertPaste(this.pasteBuffer);
|
|
30267
|
+
} else {
|
|
30268
|
+
this.render();
|
|
30269
|
+
}
|
|
30270
|
+
this.pasteBuffer = "";
|
|
30271
|
+
this.pasteLastWasCR = false;
|
|
30243
30272
|
return;
|
|
30244
30273
|
}
|
|
30245
30274
|
if (this.isPaste) {
|
|
30246
|
-
if (name === "return" || seq2 === "\r"
|
|
30275
|
+
if (name === "return" || seq2 === "\r") {
|
|
30276
|
+
this.pasteBuffer += `
|
|
30277
|
+
`;
|
|
30278
|
+
this.pasteLastWasCR = true;
|
|
30279
|
+
} else if (name === "enter" || seq2 === `
|
|
30247
30280
|
`) {
|
|
30248
|
-
this.
|
|
30249
|
-
|
|
30281
|
+
if (this.pasteLastWasCR) {
|
|
30282
|
+
this.pasteLastWasCR = false;
|
|
30283
|
+
} else {
|
|
30284
|
+
this.pasteBuffer += `
|
|
30285
|
+
`;
|
|
30286
|
+
}
|
|
30250
30287
|
} else if (str) {
|
|
30251
|
-
this.
|
|
30288
|
+
this.pasteLastWasCR = false;
|
|
30289
|
+
this.pasteBuffer += str;
|
|
30252
30290
|
}
|
|
30253
|
-
this.render();
|
|
30254
30291
|
return;
|
|
30255
30292
|
}
|
|
30256
30293
|
if (name === "return" && (seq2 === "\x1B\r" || k.meta)) {
|
|
@@ -30455,6 +30492,25 @@ class LineEditor {
|
|
|
30455
30492
|
this.col += t2.length;
|
|
30456
30493
|
this.render();
|
|
30457
30494
|
}
|
|
30495
|
+
insertPaste(text) {
|
|
30496
|
+
const segments = text.split(`
|
|
30497
|
+
`);
|
|
30498
|
+
if (segments.length === 1) {
|
|
30499
|
+
this.insertText(segments[0]);
|
|
30500
|
+
return;
|
|
30501
|
+
}
|
|
30502
|
+
const chars = this.currentChars();
|
|
30503
|
+
const head = chars.slice(0, this.col).join("");
|
|
30504
|
+
const tail = chars.slice(this.col).join("");
|
|
30505
|
+
const lines = [head + segments[0]];
|
|
30506
|
+
for (let i = 1;i < segments.length - 1; i++)
|
|
30507
|
+
lines.push(segments[i]);
|
|
30508
|
+
lines.push(segments[segments.length - 1] + tail);
|
|
30509
|
+
this.lines.splice(this.row, 1, ...lines);
|
|
30510
|
+
this.row += segments.length - 1;
|
|
30511
|
+
this.col = charLen(segments[segments.length - 1]);
|
|
30512
|
+
this.render();
|
|
30513
|
+
}
|
|
30458
30514
|
insertNewline() {
|
|
30459
30515
|
const chars = this.currentChars();
|
|
30460
30516
|
const rest = chars.slice(this.col).join("");
|