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