refactor: убрать мёртвый API и сентинель-исключение
- удалены неиспользуемые ToolRegistry::all(), FileSandbox::root(), ChatResult::\ (вместе с параметром конструктора) - HttpRequestTool: allowPrivate больше не свойство, только параметр - FileWalker возвращает bool: колбэк возвращает false, чтобы остановить обход; из search_files и find_files убраны throw/catch '__limit__' - добавлены тесты лимита для search_files и find_files - 102 теста
This commit is contained in:
1 parent
27c0fc2477
commit
6734ca5289
9 files changed
+72
-66
No files matched your search
@@ -359,3 +359,32 @@ test('sandbox: ограниченный режим по-прежнему бло
|
||||
});
|
||||
|
||||
|
||||
|
||||
test('search_files: лимит останавливает обход', function (): void {
|
||||
$dir = testDir();
|
||||
file_put_contents($dir . '/a.txt', "one\ntwo\nthree\n");
|
||||
|
||||
$result = (new SearchFilesTool(new FileSandbox($dir)))->handle([
|
||||
'pattern' => '\w+',
|
||||
'limit' => 2,
|
||||
]);
|
||||
|
||||
assertContains('обрезано по лимиту 2', $result);
|
||||
assertContains('Найдено 2', $result);
|
||||
});
|
||||
|
||||
test('find_files: лимит останавливает обход', function (): void {
|
||||
$dir = testDir();
|
||||
|
||||
for ($i = 1; $i <= 5; $i++) {
|
||||
file_put_contents($dir . '/f' . $i . '.php', 'x');
|
||||
}
|
||||
|
||||
$result = (new FindFilesTool(new FileSandbox($dir)))->handle([
|
||||
'pattern' => '*.php',
|
||||
'limit' => 2,
|
||||
]);
|
||||
|
||||
assertContains('обрезано по лимиту 2', $result);
|
||||
assertContains('Найдено 2', $result);
|
||||
});
|
||||
Reference in new issue
Block a user