micro-models-agent 0.29.0 → 0.29.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.
- package/dist/main.js +43 -42
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -12119,6 +12119,7 @@ var DEFAULT_CHUNK_SYSTEM_PROMPT = 'Answer the query using ONLY the provided text
|
|
|
12119
12119
|
|
|
12120
12120
|
// src/tools/chunk-query.ts
|
|
12121
12121
|
import { readFileSync as readFileSync12 } from "node:fs";
|
|
12122
|
+
import { resolve as resolve14 } from "node:path";
|
|
12122
12123
|
var chunkQueryTool;
|
|
12123
12124
|
var init_chunk_query = __esm(() => {
|
|
12124
12125
|
init_i18n();
|
|
@@ -12186,7 +12187,7 @@ var init_chunk_query = __esm(() => {
|
|
|
12186
12187
|
return { success: false, output: `[SCOPE] ${check.reason || "Path not allowed"}` };
|
|
12187
12188
|
}
|
|
12188
12189
|
try {
|
|
12189
|
-
content = readFileSync12(inputPath, "utf8");
|
|
12190
|
+
content = readFileSync12(resolve14(ctx.baseDir, inputPath), "utf8");
|
|
12190
12191
|
} catch (e) {
|
|
12191
12192
|
return { success: false, output: `Cannot read ${inputPath}: ${e.message}` };
|
|
12192
12193
|
}
|
|
@@ -12965,7 +12966,7 @@ class MCPClient {
|
|
|
12965
12966
|
}
|
|
12966
12967
|
}
|
|
12967
12968
|
connectStdio() {
|
|
12968
|
-
return new Promise((
|
|
12969
|
+
return new Promise((resolve15, reject) => {
|
|
12969
12970
|
const child = spawn3(this.config.command, this.config.args || [], {
|
|
12970
12971
|
env: { ...process.env, ...this.config.env },
|
|
12971
12972
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -12989,7 +12990,7 @@ class MCPClient {
|
|
|
12989
12990
|
this._connected = true;
|
|
12990
12991
|
this.process = child;
|
|
12991
12992
|
_resolved = true;
|
|
12992
|
-
|
|
12993
|
+
resolve15();
|
|
12993
12994
|
});
|
|
12994
12995
|
});
|
|
12995
12996
|
}
|
|
@@ -13058,7 +13059,7 @@ class MCPClient {
|
|
|
13058
13059
|
if (!this.process) {
|
|
13059
13060
|
throw new Error("Not connected to MCP server");
|
|
13060
13061
|
}
|
|
13061
|
-
return new Promise((
|
|
13062
|
+
return new Promise((resolve15, reject) => {
|
|
13062
13063
|
const request = {
|
|
13063
13064
|
jsonrpc: "2.0",
|
|
13064
13065
|
id: Date.now(),
|
|
@@ -13082,7 +13083,7 @@ class MCPClient {
|
|
|
13082
13083
|
if (response.error) {
|
|
13083
13084
|
reject(new Error(response.error.message));
|
|
13084
13085
|
} else {
|
|
13085
|
-
|
|
13086
|
+
resolve15(response.result?.tools || []);
|
|
13086
13087
|
}
|
|
13087
13088
|
return;
|
|
13088
13089
|
}
|
|
@@ -13164,8 +13165,8 @@ class MCPClient {
|
|
|
13164
13165
|
arguments: args
|
|
13165
13166
|
}
|
|
13166
13167
|
};
|
|
13167
|
-
return new Promise((
|
|
13168
|
-
this.pendingResolve =
|
|
13168
|
+
return new Promise((resolve15, reject) => {
|
|
13169
|
+
this.pendingResolve = resolve15;
|
|
13169
13170
|
this.pendingReject = reject;
|
|
13170
13171
|
const timeout = this.config.timeout || 30000;
|
|
13171
13172
|
const timer = setTimeout(() => {
|
|
@@ -13192,7 +13193,7 @@ class MCPClient {
|
|
|
13192
13193
|
if (result.error) {
|
|
13193
13194
|
reject(new Error(result.error.message));
|
|
13194
13195
|
} else {
|
|
13195
|
-
|
|
13196
|
+
resolve15(result.result || result);
|
|
13196
13197
|
}
|
|
13197
13198
|
}).catch((err) => {
|
|
13198
13199
|
clearTimeout(timer);
|
|
@@ -13206,7 +13207,7 @@ class MCPClient {
|
|
|
13206
13207
|
if (!this.process) {
|
|
13207
13208
|
throw new Error("Not connected to MCP server");
|
|
13208
13209
|
}
|
|
13209
|
-
return new Promise((
|
|
13210
|
+
return new Promise((resolve15, reject) => {
|
|
13210
13211
|
const request = {
|
|
13211
13212
|
jsonrpc: "2.0",
|
|
13212
13213
|
id: Date.now(),
|
|
@@ -13234,7 +13235,7 @@ class MCPClient {
|
|
|
13234
13235
|
if (response.error) {
|
|
13235
13236
|
reject(new Error(response.error.message));
|
|
13236
13237
|
} else {
|
|
13237
|
-
|
|
13238
|
+
resolve15(response.result);
|
|
13238
13239
|
}
|
|
13239
13240
|
return;
|
|
13240
13241
|
}
|
|
@@ -14364,7 +14365,7 @@ var init_image_utils = __esm(() => {
|
|
|
14364
14365
|
|
|
14365
14366
|
// src/tools/attach-image.ts
|
|
14366
14367
|
import { existsSync as existsSync24 } from "fs";
|
|
14367
|
-
import { resolve as
|
|
14368
|
+
import { resolve as resolve15 } from "path";
|
|
14368
14369
|
var attachImageTool;
|
|
14369
14370
|
var init_attach_image = __esm(() => {
|
|
14370
14371
|
init_i18n();
|
|
@@ -14405,7 +14406,7 @@ var init_attach_image = __esm(() => {
|
|
|
14405
14406
|
const result = await loadUrlAsDataUrl(source);
|
|
14406
14407
|
dataUrl = result.dataUrl;
|
|
14407
14408
|
} else {
|
|
14408
|
-
const absPath =
|
|
14409
|
+
const absPath = resolve15(ctx.baseDir, source);
|
|
14409
14410
|
if (!existsSync24(absPath)) {
|
|
14410
14411
|
return {
|
|
14411
14412
|
success: false,
|
|
@@ -14598,7 +14599,7 @@ var init_loader = __esm(() => {
|
|
|
14598
14599
|
// src/modules/plugins/builtin/lint-on-write.ts
|
|
14599
14600
|
import { spawn as spawn4, execSync } from "child_process";
|
|
14600
14601
|
import { existsSync as existsSync26, readFileSync as readFileSync15 } from "fs";
|
|
14601
|
-
import { resolve as
|
|
14602
|
+
import { resolve as resolve16, extname as extname4, join as join20 } from "path";
|
|
14602
14603
|
import { platform as platform3 } from "os";
|
|
14603
14604
|
function contentHash(content) {
|
|
14604
14605
|
let h = 5381;
|
|
@@ -14643,7 +14644,7 @@ class LintOnWritePlugin {
|
|
|
14643
14644
|
const path = String(call.arguments.path || "");
|
|
14644
14645
|
if (!path)
|
|
14645
14646
|
return;
|
|
14646
|
-
const fullPath =
|
|
14647
|
+
const fullPath = resolve16(ctx.baseDir, path);
|
|
14647
14648
|
if (!existsSync26(fullPath))
|
|
14648
14649
|
return;
|
|
14649
14650
|
const ext = extname4(fullPath);
|
|
@@ -14762,7 +14763,7 @@ class LintOnWritePlugin {
|
|
|
14762
14763
|
}
|
|
14763
14764
|
}
|
|
14764
14765
|
function runAsync(command, cwd, timeoutMs) {
|
|
14765
|
-
return new Promise((
|
|
14766
|
+
return new Promise((resolve17, reject) => {
|
|
14766
14767
|
const child = spawn4(command, {
|
|
14767
14768
|
cwd,
|
|
14768
14769
|
shell: true,
|
|
@@ -14791,7 +14792,7 @@ function runAsync(command, cwd, timeoutMs) {
|
|
|
14791
14792
|
stdout += decoder.decode();
|
|
14792
14793
|
stderr += decoder.decode();
|
|
14793
14794
|
if (code === 0) {
|
|
14794
|
-
|
|
14795
|
+
resolve17({ stdout, stderr });
|
|
14795
14796
|
} else {
|
|
14796
14797
|
const err = new Error(`Command failed with exit code ${code}`);
|
|
14797
14798
|
err.stdout = stdout;
|
|
@@ -14964,7 +14965,7 @@ var init_tracker = () => {};
|
|
|
14964
14965
|
|
|
14965
14966
|
// src/modules/execution/auditor.ts
|
|
14966
14967
|
import { existsSync as existsSync27, readdirSync as readdirSync8 } from "fs";
|
|
14967
|
-
import { resolve as
|
|
14968
|
+
import { resolve as resolve17, join as join21 } from "path";
|
|
14968
14969
|
function findTestFile(dir, depth = 0) {
|
|
14969
14970
|
if (depth > 5)
|
|
14970
14971
|
return null;
|
|
@@ -15054,7 +15055,7 @@ class Auditor {
|
|
|
15054
15055
|
const missingFiles = [];
|
|
15055
15056
|
const existingFiles = [];
|
|
15056
15057
|
for (const filePath of uniqueFiles) {
|
|
15057
|
-
const resolved =
|
|
15058
|
+
const resolved = resolve17(this.baseDir, filePath);
|
|
15058
15059
|
if (existsSync27(resolved)) {
|
|
15059
15060
|
existingFiles.push(filePath);
|
|
15060
15061
|
} else {
|
|
@@ -15350,7 +15351,7 @@ var init_plan_coverage = __esm(() => {
|
|
|
15350
15351
|
|
|
15351
15352
|
// src/modules/execution/module.ts
|
|
15352
15353
|
import { existsSync as existsSync29, readFileSync as readFileSync17 } from "fs";
|
|
15353
|
-
import { resolve as
|
|
15354
|
+
import { resolve as resolve18 } from "path";
|
|
15354
15355
|
|
|
15355
15356
|
class ExecutionModule {
|
|
15356
15357
|
name = "execution";
|
|
@@ -16005,7 +16006,7 @@ Tool "${this.stuckDetector.getLastFailedTool()}" is failing. Try "${alternative}
|
|
|
16005
16006
|
"poetry.lock",
|
|
16006
16007
|
"requirements.txt"
|
|
16007
16008
|
];
|
|
16008
|
-
const hasLockFile = lockFiles.some((f) => existsSync29(
|
|
16009
|
+
const hasLockFile = lockFiles.some((f) => existsSync29(resolve18(this.baseDir, f)));
|
|
16009
16010
|
if (!hasLockFile) {
|
|
16010
16011
|
if (contextManager) {
|
|
16011
16012
|
const hints = this.depsGateHints.get(step.id) || 0;
|
|
@@ -16025,13 +16026,13 @@ Tool "${this.stuckDetector.getLastFailedTool()}" is failing. Try "${alternative}
|
|
|
16025
16026
|
}
|
|
16026
16027
|
if (stepPaths.length === 0)
|
|
16027
16028
|
return;
|
|
16028
|
-
const allExist = stepPaths.every((p) => existsSync29(
|
|
16029
|
+
const allExist = stepPaths.every((p) => existsSync29(resolve18(this.baseDir, p)));
|
|
16029
16030
|
if (!allExist)
|
|
16030
16031
|
return;
|
|
16031
16032
|
const emptyFiles = [];
|
|
16032
16033
|
for (const p of stepPaths) {
|
|
16033
16034
|
try {
|
|
16034
|
-
const content = readFileSync17(
|
|
16035
|
+
const content = readFileSync17(resolve18(this.baseDir, p), "utf-8");
|
|
16035
16036
|
if (content.trim().length < 10) {
|
|
16036
16037
|
emptyFiles.push(p);
|
|
16037
16038
|
}
|
|
@@ -16968,7 +16969,7 @@ var init_browser2 = __esm(() => {
|
|
|
16968
16969
|
|
|
16969
16970
|
// src/modules/lsp/client.ts
|
|
16970
16971
|
import { spawn as spawn5, execSync as execSync2 } from "child_process";
|
|
16971
|
-
import { resolve as
|
|
16972
|
+
import { resolve as resolve19 } from "path";
|
|
16972
16973
|
|
|
16973
16974
|
class LspClient {
|
|
16974
16975
|
process = null;
|
|
@@ -16984,7 +16985,7 @@ class LspClient {
|
|
|
16984
16985
|
const timeout = config.timeout ?? DEFAULT_TIMEOUT;
|
|
16985
16986
|
try {
|
|
16986
16987
|
await this.startServer(config, baseDir);
|
|
16987
|
-
const rootUri = this.pathToUri(
|
|
16988
|
+
const rootUri = this.pathToUri(resolve19(baseDir));
|
|
16988
16989
|
const initResult = await this.sendRequest("initialize", {
|
|
16989
16990
|
processId: process.pid,
|
|
16990
16991
|
rootUri,
|
|
@@ -16993,11 +16994,11 @@ class LspClient {
|
|
|
16993
16994
|
}, timeout);
|
|
16994
16995
|
this.initialized = true;
|
|
16995
16996
|
this.sendNotification("initialized", {});
|
|
16996
|
-
const uri = this.pathToUri(
|
|
16997
|
+
const uri = this.pathToUri(resolve19(filePath));
|
|
16997
16998
|
const fs2 = await import("fs");
|
|
16998
16999
|
const content = fs2.readFileSync(filePath, "utf-8");
|
|
16999
|
-
const diagPromise = new Promise((
|
|
17000
|
-
this.diagnosticsResolve =
|
|
17000
|
+
const diagPromise = new Promise((resolve20) => {
|
|
17001
|
+
this.diagnosticsResolve = resolve20;
|
|
17001
17002
|
this.diagnostics = [];
|
|
17002
17003
|
this.diagnosticsTimer = setTimeout(() => {
|
|
17003
17004
|
if (this.diagnosticsResolve) {
|
|
@@ -17029,7 +17030,7 @@ class LspClient {
|
|
|
17029
17030
|
throw new Error(`${config.command} not found in PATH`);
|
|
17030
17031
|
}
|
|
17031
17032
|
}
|
|
17032
|
-
return new Promise((
|
|
17033
|
+
return new Promise((resolve20, reject) => {
|
|
17033
17034
|
const args = config.args ?? [];
|
|
17034
17035
|
const proc = spawn5(config.command, args, {
|
|
17035
17036
|
stdio: ["pipe", "pipe", "pipe"],
|
|
@@ -17042,7 +17043,7 @@ class LspClient {
|
|
|
17042
17043
|
});
|
|
17043
17044
|
proc.stderr.on("data", () => {});
|
|
17044
17045
|
proc.once("spawn", () => {
|
|
17045
|
-
|
|
17046
|
+
resolve20();
|
|
17046
17047
|
});
|
|
17047
17048
|
this.process = proc;
|
|
17048
17049
|
setTimeout(() => {
|
|
@@ -17119,9 +17120,9 @@ class LspClient {
|
|
|
17119
17120
|
}
|
|
17120
17121
|
}
|
|
17121
17122
|
sendRequest(method, params, timeout) {
|
|
17122
|
-
return new Promise((
|
|
17123
|
+
return new Promise((resolve20, reject) => {
|
|
17123
17124
|
const id = ++this.requestId;
|
|
17124
|
-
this.pending.set(id, { resolve:
|
|
17125
|
+
this.pending.set(id, { resolve: resolve20, reject });
|
|
17125
17126
|
const message = JSON.stringify({ jsonrpc: "2.0", id, method, params });
|
|
17126
17127
|
this.write(message);
|
|
17127
17128
|
setTimeout(() => {
|
|
@@ -17200,7 +17201,7 @@ var init_client2 = () => {};
|
|
|
17200
17201
|
|
|
17201
17202
|
// src/modules/lsp/module.ts
|
|
17202
17203
|
import { existsSync as existsSync34 } from "fs";
|
|
17203
|
-
import { resolve as
|
|
17204
|
+
import { resolve as resolve20 } from "path";
|
|
17204
17205
|
|
|
17205
17206
|
class LspModule {
|
|
17206
17207
|
name = "lsp";
|
|
@@ -17224,7 +17225,7 @@ class LspModule {
|
|
|
17224
17225
|
const filePath = String(call.arguments.path ?? "");
|
|
17225
17226
|
if (!filePath)
|
|
17226
17227
|
return;
|
|
17227
|
-
const fullPath =
|
|
17228
|
+
const fullPath = resolve20(_ctx.baseDir, filePath);
|
|
17228
17229
|
if (!existsSync34(fullPath))
|
|
17229
17230
|
return;
|
|
17230
17231
|
const serverConfig = getServerForFile(fullPath, self.config);
|
|
@@ -17827,7 +17828,7 @@ __export(exports_bootstrap, {
|
|
|
17827
17828
|
bootstrap: () => bootstrap
|
|
17828
17829
|
});
|
|
17829
17830
|
import { homedir as homedir11 } from "os";
|
|
17830
|
-
import { join as join30, resolve as
|
|
17831
|
+
import { join as join30, resolve as resolve21 } from "path";
|
|
17831
17832
|
import { existsSync as existsSync37, readFileSync as readFileSync24, writeFileSync as writeFileSync14 } from "fs";
|
|
17832
17833
|
function buildSystemInfo(config, baseDir, profileCompressed) {
|
|
17833
17834
|
const now = new Date().toISOString().replace("T", " ").slice(0, 19);
|
|
@@ -17897,7 +17898,7 @@ async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplete) {
|
|
|
17897
17898
|
retry: config.retry,
|
|
17898
17899
|
rateLimits: config.security?.rateLimits
|
|
17899
17900
|
});
|
|
17900
|
-
const baseDir = projectDir ?
|
|
17901
|
+
const baseDir = projectDir ? resolve21(projectDir) : process.cwd();
|
|
17901
17902
|
const projectMapCacheDir = join30(baseDir, ".mma");
|
|
17902
17903
|
const indexerModule = new IndexerModule({
|
|
17903
17904
|
baseDir,
|
|
@@ -18698,10 +18699,10 @@ function menuList(items) {
|
|
|
18698
18699
|
console.log(l);
|
|
18699
18700
|
}
|
|
18700
18701
|
function ask(rl, question, defaultValue) {
|
|
18701
|
-
return new Promise((
|
|
18702
|
+
return new Promise((resolve22) => {
|
|
18702
18703
|
const prompt = defaultValue ? `${question} [${defaultValue}]: ` : `${question}: `;
|
|
18703
18704
|
rl.question(prompt, (answer) => {
|
|
18704
|
-
|
|
18705
|
+
resolve22(answer.trim() || defaultValue || "");
|
|
18705
18706
|
});
|
|
18706
18707
|
});
|
|
18707
18708
|
}
|
|
@@ -26285,7 +26286,7 @@ var init_fact_checker = () => {};
|
|
|
26285
26286
|
import { spawn as spawn6 } from "child_process";
|
|
26286
26287
|
import { existsSync as existsSync41, mkdirSync as mkdirSync18, rmSync as rmSync4, cpSync as cpSync2 } from "fs";
|
|
26287
26288
|
import { platform as platform5 } from "os";
|
|
26288
|
-
import { join as join35, resolve as
|
|
26289
|
+
import { join as join35, resolve as resolve22, dirname as dirname8 } from "path";
|
|
26289
26290
|
async function runScenario(scenario, opts) {
|
|
26290
26291
|
if (scenario.mode === "skip") {
|
|
26291
26292
|
return {
|
|
@@ -26382,8 +26383,8 @@ function resolveMmaEntry(mmaRoot) {
|
|
|
26382
26383
|
}
|
|
26383
26384
|
function findMmaRoot(fromDir) {
|
|
26384
26385
|
const candidates = [
|
|
26385
|
-
|
|
26386
|
-
|
|
26386
|
+
resolve22(fromDir, "..", "..", ".."),
|
|
26387
|
+
resolve22(fromDir, "..")
|
|
26387
26388
|
];
|
|
26388
26389
|
for (const c of candidates) {
|
|
26389
26390
|
if (existsSync41(join35(c, "package.json")))
|
|
@@ -26699,7 +26700,7 @@ function registerMmaCommands(ctx) {
|
|
|
26699
26700
|
try {
|
|
26700
26701
|
const { loadFileAsDataUrl: loadFileAsDataUrl2, loadUrlAsDataUrl: loadUrlAsDataUrl2, readClipboardImage: readClipboardImage2 } = await Promise.resolve().then(() => (init_image_utils(), exports_image_utils));
|
|
26701
26702
|
const { existsSync: existsSync45 } = await import("fs");
|
|
26702
|
-
const { resolve:
|
|
26703
|
+
const { resolve: resolve23 } = await import("path");
|
|
26703
26704
|
let dataUrl;
|
|
26704
26705
|
let label;
|
|
26705
26706
|
if (source.toLowerCase() === "clipboard") {
|
|
@@ -26717,7 +26718,7 @@ function registerMmaCommands(ctx) {
|
|
|
26717
26718
|
dataUrl = result.dataUrl;
|
|
26718
26719
|
label = source;
|
|
26719
26720
|
} else {
|
|
26720
|
-
const absPath =
|
|
26721
|
+
const absPath = resolve23(process.cwd(), source);
|
|
26721
26722
|
if (!existsSync45(absPath)) {
|
|
26722
26723
|
console.log(pc2.red(t("image.not_found", { path: source })));
|
|
26723
26724
|
return;
|