feat: improve direct model workspace tools

Direct models now use bundled ripgrep for workspace discovery, read files through resumable pages, and edit multiple files with apply_patch. Ask can search and read while Execute retains write access, and fixed total input limits no longer constrain these tools.

Release note: 直连模型现可使用随包 ripgrep 搜索项目、分页读取任意大小的文本,并通过多文件补丁修改代码;设置中的相关能力统一显示为工作区文件和开发工具。
This commit is contained in:
mesalogo
2026-09-10 00:45:03 +08:00
parent c1f8ba80ee
commit ec100f8176
28 changed files with 1542 additions and 171 deletions
+18
View File
@@ -3,6 +3,7 @@ import { join } from 'node:path'
export type BundledRuntimePaths = {
opencode: string
opencodeConfig?: string
ripgrep: string
continue: string
deepseekHarness: string
}
@@ -15,11 +16,14 @@ export function resolveBundledRuntimePaths(input: {
resourcesPath: string
packaged: boolean
platform?: NodeJS.Platform
arch?: NodeJS.Architecture
}): BundledRuntimePaths {
const packagedExecutable =
(input.platform ?? process.platform) === 'win32'
? 'opencode.exe'
: 'opencode'
const ripgrepExecutable =
(input.platform ?? process.platform) === 'win32' ? 'rg.exe' : 'rg'
if (input.packaged) {
return {
opencode: join(
@@ -33,6 +37,12 @@ export function resolveBundledRuntimePaths(input: {
'runtimes',
'opencode-config'
),
ripgrep: join(
input.resourcesPath,
'runtimes',
'opencode',
ripgrepExecutable
),
continue: join(
input.resourcesPath,
'runtimes',
@@ -58,6 +68,14 @@ export function resolveBundledRuntimePaths(input: {
'bin',
'opencode.exe'
),
ripgrep: join(
input.appPath,
'node_modules',
'@vscode',
`ripgrep-${input.platform ?? process.platform}-${input.arch ?? process.arch}`,
'bin',
ripgrepExecutable
),
continue: join(
input.appPath,
'node_modules',