Skip to content

Commit f0df7bb

Browse files
committed
feat: implement smart pruning
1 parent d3d379f commit f0df7bb

File tree

5 files changed

+420
-29
lines changed

5 files changed

+420
-29
lines changed

packages/opencode/script/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bun
22

3-
import solidPlugin from "../node_modules/@opentui/solid/scripts/solid-plugin"
3+
import solidPlugin from "@opentui/solid/bun-plugin"
44
import path from "path"
55
import fs from "fs"
66
import { $ } from "bun"

packages/opencode/src/config/config.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -930,6 +930,42 @@ export namespace Config {
930930
prune: z.boolean().optional().describe("Enable pruning of old tool outputs (default: true)"),
931931
})
932932
.optional(),
933+
pruning: z
934+
.object({
935+
enabled: z.boolean().optional().describe("Enable smart pruning (default: true)"),
936+
budgets: z
937+
.object({
938+
content: z
939+
.number()
940+
.optional()
941+
.describe("Token budget for content tools like read/webfetch (default: 60000)"),
942+
navigation: z
943+
.number()
944+
.optional()
945+
.describe("Token budget for navigation tools like grep/glob (default: 15000)"),
946+
})
947+
.optional(),
948+
summarization: z
949+
.object({
950+
enabled: z.boolean().optional().describe("Enable LLM summarization for content tools (default: true)"),
951+
model: z
952+
.string()
953+
.optional()
954+
.describe("Model to use for summarization (default: uses small_model or provider's small model)"),
955+
})
956+
.optional(),
957+
contentTools: z
958+
.array(z.string())
959+
.optional()
960+
.describe("Additional tools to treat as content tools (high priority)"),
961+
navigationTools: z
962+
.array(z.string())
963+
.optional()
964+
.describe("Additional tools to treat as navigation tools (low priority)"),
965+
protectedTools: z.array(z.string()).optional().describe("Tools that should never be pruned"),
966+
})
967+
.optional()
968+
.describe("Smart pruning configuration for tiered tool output management"),
933969
experimental: z
934970
.object({
935971
hook: z

0 commit comments

Comments
 (0)