File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed
Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -113,6 +113,8 @@ export const ExperimentalConfigSchema = z.object({
113113 preemptive_compaction : z . boolean ( ) . optional ( ) ,
114114 /** Threshold percentage to trigger preemptive compaction (default: 0.80) */
115115 preemptive_compaction_threshold : z . number ( ) . min ( 0.5 ) . max ( 0.95 ) . optional ( ) ,
116+ /** Truncate all tool outputs, not just whitelisted tools (default: false) */
117+ truncate_all_tool_outputs : z . boolean ( ) . optional ( ) ,
116118} )
117119
118120export const OhMyOpenCodeConfigSchema = z . object ( {
Original file line number Diff line number Diff line change 11import type { PluginInput } from "@opencode-ai/plugin"
2+ import type { ExperimentalConfig } from "../config/schema"
23import { createDynamicTruncator } from "../shared/dynamic-truncator"
34
45const TRUNCATABLE_TOOLS = [
@@ -17,14 +18,19 @@ const TRUNCATABLE_TOOLS = [
1718 "Interactive_bash" ,
1819]
1920
20- export function createToolOutputTruncatorHook ( ctx : PluginInput ) {
21+ interface ToolOutputTruncatorOptions {
22+ experimental ?: ExperimentalConfig
23+ }
24+
25+ export function createToolOutputTruncatorHook ( ctx : PluginInput , options ?: ToolOutputTruncatorOptions ) {
2126 const truncator = createDynamicTruncator ( ctx )
27+ const truncateAll = options ?. experimental ?. truncate_all_tool_outputs ?? false
2228
2329 const toolExecuteAfter = async (
2430 input : { tool : string ; sessionID : string ; callID : string } ,
2531 output : { title : string ; output : string ; metadata : unknown }
2632 ) => {
27- if ( ! TRUNCATABLE_TOOLS . includes ( input . tool ) ) return
33+ if ( ! truncateAll && ! TRUNCATABLE_TOOLS . includes ( input . tool ) ) return
2834
2935 try {
3036 const { result, truncated } = await truncator . truncate ( input . sessionID , output . output )
Original file line number Diff line number Diff line change @@ -251,7 +251,7 @@ const OhMyOpenCodePlugin: Plugin = async (ctx) => {
251251 ? createCommentCheckerHooks ( )
252252 : null ;
253253 const toolOutputTruncator = isHookEnabled ( "tool-output-truncator" )
254- ? createToolOutputTruncatorHook ( ctx )
254+ ? createToolOutputTruncatorHook ( ctx , { experimental : pluginConfig . experimental } )
255255 : null ;
256256 const directoryAgentsInjector = isHookEnabled ( "directory-agents-injector" )
257257 ? createDirectoryAgentsInjectorHook ( ctx )
You can’t perform that action at this time.
0 commit comments