first pass making system prompt less fast

This commit is contained in:
Dax Raad
2025-06-15 20:24:51 -04:00
parent c5eefd1752
commit 7d174767b0
5 changed files with 75 additions and 9 deletions

View File

@@ -4,7 +4,7 @@ import { App } from "../app/app"
import * as path from "path"
import DESCRIPTION from "./ls.txt"
const IGNORE_PATTERNS = [
export const IGNORE_PATTERNS = [
"node_modules/",
"__pycache__/",
".git/",
@@ -18,6 +18,8 @@ const IGNORE_PATTERNS = [
".vscode/",
]
const LIMIT = 100
export const ListTool = Tool.define({
id: "opencode.list",
description: DESCRIPTION,
@@ -45,7 +47,7 @@ export const ListTool = Tool.define({
if (params.ignore?.some((pattern) => new Bun.Glob(pattern).match(file)))
continue
files.push(file)
if (files.length >= 1000) break
if (files.length >= LIMIT) break
}
// Build directory structure
@@ -99,7 +101,7 @@ export const ListTool = Tool.define({
return {
metadata: {
count: files.length,
truncated: files.length >= 1000,
truncated: files.length >= LIMIT,
title: path.relative(app.path.root, searchPath),
},
output,