micro-models-agent 0.28.6 → 0.28.7
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 +77 -27
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -2351,6 +2351,8 @@ var init_en = __esm(() => {
|
|
|
2351
2351
|
"tool.friendly.web_search": "Web search",
|
|
2352
2352
|
"tool.friendly.web_fetch": "Fetching page",
|
|
2353
2353
|
"tool.friendly.web_browse": "Browsing page",
|
|
2354
|
+
"tool.web_fetch_result": "Fetched page: {url} — {chars} chars, {lines} lines{truncated}",
|
|
2355
|
+
"tool.web_browse_result": "Browsed page: {url} — {chars} chars, {lines} lines{truncated}",
|
|
2354
2356
|
"tool.friendly.browser": "Browser",
|
|
2355
2357
|
"tool.friendly.subagent": "Sub-agent task",
|
|
2356
2358
|
"tool.friendly.question": "Question to user",
|
|
@@ -2896,6 +2898,8 @@ var init_ru = __esm(() => {
|
|
|
2896
2898
|
"tool.friendly.web_search": "Поиск в интернете",
|
|
2897
2899
|
"tool.friendly.web_fetch": "Загрузка страницы",
|
|
2898
2900
|
"tool.friendly.web_browse": "Просмотр страницы",
|
|
2901
|
+
"tool.web_fetch_result": "Загружена страница: {url} — {chars} симв., {lines} строк{truncated}",
|
|
2902
|
+
"tool.web_browse_result": "Просмотрена страница: {url} — {chars} симв., {lines} строк{truncated}",
|
|
2899
2903
|
"tool.friendly.browser": "Браузер",
|
|
2900
2904
|
"tool.friendly.subagent": "Задача подагенту",
|
|
2901
2905
|
"tool.friendly.question": "Вопрос пользователю",
|
|
@@ -11434,36 +11438,56 @@ var init_web_fetch = __esm(() => {
|
|
|
11434
11438
|
};
|
|
11435
11439
|
}
|
|
11436
11440
|
try {
|
|
11437
|
-
const response = await fetch(url, {
|
|
11441
|
+
const response = await fetch(url, {
|
|
11442
|
+
signal: AbortSignal.timeout(securityConfig?.requestTimeout || 15000)
|
|
11443
|
+
});
|
|
11438
11444
|
if (!response.ok) {
|
|
11439
|
-
return {
|
|
11445
|
+
return {
|
|
11446
|
+
success: false,
|
|
11447
|
+
output: t("error.http", {
|
|
11448
|
+
status: response.status,
|
|
11449
|
+
statusText: response.statusText
|
|
11450
|
+
})
|
|
11451
|
+
};
|
|
11440
11452
|
}
|
|
11441
11453
|
const contentType = response.headers.get("content-type") || "";
|
|
11442
11454
|
const text = await response.text();
|
|
11443
11455
|
const cleaned = contentType.includes("html") ? stripHtml(text) : text;
|
|
11444
11456
|
logNetworkRequest(ctx.sessionId, sanitizeUrl(url), true, `Status: ${response.status}`);
|
|
11445
|
-
|
|
11446
|
-
|
|
11447
|
-
|
|
11448
|
-
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
|
|
11454
|
-
return { success: true, output: content };
|
|
11457
|
+
const fullChars = cleaned.length;
|
|
11458
|
+
const fullLines = cleaned.split(`
|
|
11459
|
+
`).length;
|
|
11460
|
+
const maxChars = securityConfig?.maxResponseSize || MAX_CHARS;
|
|
11461
|
+
let content;
|
|
11462
|
+
if (cleaned.length > maxChars) {
|
|
11463
|
+
content = cleaned.slice(0, maxChars) + t("file.truncated");
|
|
11464
|
+
} else {
|
|
11465
|
+
content = cleaned;
|
|
11455
11466
|
}
|
|
11456
|
-
const
|
|
11467
|
+
const contentLines = content.split(`
|
|
11457
11468
|
`);
|
|
11458
|
-
if (
|
|
11459
|
-
|
|
11469
|
+
if (contentLines.length > MAX_PREVIEW_LINES) {
|
|
11470
|
+
content = contentLines.slice(0, MAX_PREVIEW_LINES).join(`
|
|
11460
11471
|
`) + `
|
|
11461
|
-
... (${
|
|
11472
|
+
... (${contentLines.length - MAX_PREVIEW_LINES} more lines)`;
|
|
11462
11473
|
}
|
|
11463
|
-
|
|
11474
|
+
const truncated = cleaned.length > maxChars || fullLines > MAX_PREVIEW_LINES ? t("file.truncated").trim() : "";
|
|
11475
|
+
return {
|
|
11476
|
+
success: true,
|
|
11477
|
+
output: content || t("file.empty_page"),
|
|
11478
|
+
display: t("tool.web_fetch_result", {
|
|
11479
|
+
url: sanitizeUrl(url),
|
|
11480
|
+
chars: String(fullChars),
|
|
11481
|
+
lines: String(fullLines),
|
|
11482
|
+
truncated
|
|
11483
|
+
})
|
|
11484
|
+
};
|
|
11464
11485
|
} catch (e) {
|
|
11465
11486
|
logNetworkRequest(ctx.sessionId, sanitizeUrl(url), false, `Error: ${e.message}`);
|
|
11466
|
-
return {
|
|
11487
|
+
return {
|
|
11488
|
+
success: false,
|
|
11489
|
+
output: t("error.fetch_failed", { message: e.message })
|
|
11490
|
+
};
|
|
11467
11491
|
}
|
|
11468
11492
|
}
|
|
11469
11493
|
};
|
|
@@ -11499,23 +11523,49 @@ var init_web_browse = __esm(() => {
|
|
|
11499
11523
|
};
|
|
11500
11524
|
}
|
|
11501
11525
|
try {
|
|
11502
|
-
const response = await fetch(url, {
|
|
11526
|
+
const response = await fetch(url, {
|
|
11527
|
+
signal: AbortSignal.timeout(securityConfig?.requestTimeout || 15000)
|
|
11528
|
+
});
|
|
11503
11529
|
const text = await response.text();
|
|
11504
11530
|
const stripped = text.replace(/<script[\s\S]*?<\/script>/gi, "").replace(/<style[\s\S]*?<\/style>/gi, "").replace(/<[^>]+>/g, "").replace(/&[^;]+;/g, " ").replace(/\s+/g, " ").trim();
|
|
11505
11531
|
logNetworkRequest(ctx.sessionId, sanitizeUrl(url), true, `Status: ${response.status}`);
|
|
11506
|
-
const
|
|
11507
|
-
|
|
11508
|
-
|
|
11532
|
+
const fullChars = stripped.length;
|
|
11533
|
+
const fullLines = stripped.split(`
|
|
11534
|
+
`).length;
|
|
11535
|
+
const maxChars = securityConfig?.maxResponseSize || MAX_CHARS2;
|
|
11536
|
+
let content;
|
|
11537
|
+
if (stripped.length > maxChars) {
|
|
11538
|
+
content = stripped.slice(0, maxChars) + t("file.truncated");
|
|
11539
|
+
} else {
|
|
11540
|
+
content = stripped;
|
|
11541
|
+
}
|
|
11542
|
+
const contentLines = content.split(`
|
|
11509
11543
|
`);
|
|
11510
|
-
if (
|
|
11511
|
-
content =
|
|
11544
|
+
if (contentLines.length > MAX_PREVIEW_LINES) {
|
|
11545
|
+
content = contentLines.slice(0, MAX_PREVIEW_LINES).join(`
|
|
11512
11546
|
`) + `
|
|
11513
|
-
... (${
|
|
11547
|
+
... (${contentLines.length - MAX_PREVIEW_LINES} more lines)`;
|
|
11514
11548
|
}
|
|
11515
|
-
|
|
11549
|
+
const truncated = stripped.length > maxChars || fullLines > MAX_PREVIEW_LINES ? t("file.truncated").trim() : "";
|
|
11550
|
+
return {
|
|
11551
|
+
success: true,
|
|
11552
|
+
output: content || t("file.empty_page"),
|
|
11553
|
+
display: t("tool.web_browse_result", {
|
|
11554
|
+
url: sanitizeUrl(url),
|
|
11555
|
+
chars: String(fullChars),
|
|
11556
|
+
lines: String(fullLines),
|
|
11557
|
+
truncated
|
|
11558
|
+
})
|
|
11559
|
+
};
|
|
11516
11560
|
} catch (err) {
|
|
11517
11561
|
logNetworkRequest(ctx.sessionId, sanitizeUrl(url), false, `Error: ${err.message}`);
|
|
11518
|
-
return {
|
|
11562
|
+
return {
|
|
11563
|
+
success: false,
|
|
11564
|
+
output: t("error.fetch_url_failed", {
|
|
11565
|
+
url: sanitizeUrl(url),
|
|
11566
|
+
message: err.message
|
|
11567
|
+
})
|
|
11568
|
+
};
|
|
11519
11569
|
}
|
|
11520
11570
|
}
|
|
11521
11571
|
};
|