Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
ollama
Commits
e30e08a7
Unverified
Commit
e30e08a7
authored
Jan 07, 2026
by
Parth Sareen
Committed by
GitHub
Jan 07, 2026
Browse files
x: remove Ctrl+O tool output expansion feature (#13640)
parent
12e2b351
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
57 deletions
+11
-57
readline/errors.go
readline/errors.go
+0
-3
readline/readline.go
readline/readline.go
+0
-3
x/cmd/run.go
x/cmd/run.go
+11
-51
No files found.
readline/errors.go
View file @
e30e08a7
...
@@ -6,9 +6,6 @@ import (
...
@@ -6,9 +6,6 @@ import (
var
ErrInterrupt
=
errors
.
New
(
"Interrupt"
)
var
ErrInterrupt
=
errors
.
New
(
"Interrupt"
)
// ErrExpandOutput is returned when user presses Ctrl+O to expand tool output
var
ErrExpandOutput
=
errors
.
New
(
"ExpandOutput"
)
type
InterruptError
struct
{
type
InterruptError
struct
{
Line
[]
rune
Line
[]
rune
}
}
...
...
readline/readline.go
View file @
e30e08a7
...
@@ -206,9 +206,6 @@ func (i *Instance) Readline() (string, error) {
...
@@ -206,9 +206,6 @@ func (i *Instance) Readline() (string, error) {
buf
.
DeleteBefore
()
buf
.
DeleteBefore
()
case
CharCtrlL
:
case
CharCtrlL
:
buf
.
ClearScreen
()
buf
.
ClearScreen
()
case
CharCtrlO
:
// Ctrl+O - expand tool output
return
""
,
ErrExpandOutput
case
CharCtrlW
:
case
CharCtrlW
:
buf
.
DeleteWord
()
buf
.
DeleteWord
()
case
CharCtrlZ
:
case
CharCtrlZ
:
...
...
x/cmd/run.go
View file @
e30e08a7
...
@@ -137,13 +137,6 @@ type RunOptions struct {
...
@@ -137,13 +137,6 @@ type RunOptions struct {
// YoloMode skips all tool approval prompts
// YoloMode skips all tool approval prompts
YoloMode
bool
YoloMode
bool
// LastToolOutput stores the full output of the last tool execution
// for Ctrl+O expansion. Updated by Chat(), read by caller.
LastToolOutput
*
string
// LastToolOutputTruncated stores the truncated version shown inline
LastToolOutputTruncated
*
string
}
}
// Chat runs an agent chat loop with tool support.
// Chat runs an agent chat loop with tool support.
...
@@ -446,25 +439,15 @@ func Chat(ctx context.Context, opts RunOptions) (*api.Message, error) {
...
@@ -446,25 +439,15 @@ func Chat(ctx context.Context, opts RunOptions) (*api.Message, error) {
toolSuccess
:
toolSuccess
:
// Display tool output (truncated for display)
// Display tool output (truncated for display)
truncatedOutput
:=
""
if
toolResult
!=
""
{
if
toolResult
!=
""
{
output
:=
toolResult
output
:=
toolResult
if
len
(
output
)
>
300
{
if
len
(
output
)
>
300
{
output
=
output
[
:
300
]
+
"... (truncated
, press Ctrl+O to expand
)"
output
=
output
[
:
300
]
+
"... (truncated)"
}
}
truncatedOutput
=
output
// Show result in grey, indented
// Show result in grey, indented
fmt
.
Fprintf
(
os
.
Stderr
,
"
\0
33[90m %s
\0
33[0m
\n
"
,
strings
.
ReplaceAll
(
output
,
"
\n
"
,
"
\n
"
))
fmt
.
Fprintf
(
os
.
Stderr
,
"
\0
33[90m %s
\0
33[0m
\n
"
,
strings
.
ReplaceAll
(
output
,
"
\n
"
,
"
\n
"
))
}
}
// Store full and truncated output for Ctrl+O toggle
if
opts
.
LastToolOutput
!=
nil
{
*
opts
.
LastToolOutput
=
toolResult
}
if
opts
.
LastToolOutputTruncated
!=
nil
{
*
opts
.
LastToolOutputTruncated
=
truncatedOutput
}
// Truncate output to prevent context overflow
// Truncate output to prevent context overflow
toolResultForLLM
:=
truncateToolOutput
(
toolResult
,
opts
.
Model
)
toolResultForLLM
:=
truncateToolOutput
(
toolResult
,
opts
.
Model
)
...
@@ -690,11 +673,6 @@ func GenerateInteractive(cmd *cobra.Command, modelName string, wordWrap bool, op
...
@@ -690,11 +673,6 @@ func GenerateInteractive(cmd *cobra.Command, modelName string, wordWrap bool, op
var
messages
[]
api
.
Message
var
messages
[]
api
.
Message
var
sb
strings
.
Builder
var
sb
strings
.
Builder
// Track last tool output for Ctrl+O toggle
var
lastToolOutput
string
var
lastToolOutputTruncated
string
var
toolOutputExpanded
bool
for
{
for
{
line
,
err
:=
scanner
.
Readline
()
line
,
err
:=
scanner
.
Readline
()
switch
{
switch
{
...
@@ -707,20 +685,6 @@ func GenerateInteractive(cmd *cobra.Command, modelName string, wordWrap bool, op
...
@@ -707,20 +685,6 @@ func GenerateInteractive(cmd *cobra.Command, modelName string, wordWrap bool, op
}
}
sb
.
Reset
()
sb
.
Reset
()
continue
continue
case
errors
.
Is
(
err
,
readline
.
ErrExpandOutput
)
:
// Ctrl+O pressed - toggle between expanded and collapsed tool output
if
lastToolOutput
==
""
{
fmt
.
Fprintf
(
os
.
Stderr
,
"
\0
33[90mNo tool output to expand
\0
33[0m
\n
"
)
}
else
if
toolOutputExpanded
{
// Currently expanded, show truncated
fmt
.
Fprintf
(
os
.
Stderr
,
"
\0
33[90m %s
\0
33[0m
\n
"
,
strings
.
ReplaceAll
(
lastToolOutputTruncated
,
"
\n
"
,
"
\n
"
))
toolOutputExpanded
=
false
}
else
{
// Currently collapsed, show full
fmt
.
Fprintf
(
os
.
Stderr
,
"
\0
33[90m %s
\0
33[0m
\n
"
,
strings
.
ReplaceAll
(
lastToolOutput
,
"
\n
"
,
"
\n
"
))
toolOutputExpanded
=
true
}
continue
case
err
!=
nil
:
case
err
!=
nil
:
return
err
return
err
}
}
...
@@ -759,21 +723,17 @@ func GenerateInteractive(cmd *cobra.Command, modelName string, wordWrap bool, op
...
@@ -759,21 +723,17 @@ func GenerateInteractive(cmd *cobra.Command, modelName string, wordWrap bool, op
messages
=
append
(
messages
,
newMessage
)
messages
=
append
(
messages
,
newMessage
)
opts
:=
RunOptions
{
opts
:=
RunOptions
{
Model
:
modelName
,
Model
:
modelName
,
Messages
:
messages
,
Messages
:
messages
,
WordWrap
:
wordWrap
,
WordWrap
:
wordWrap
,
Options
:
options
,
Options
:
options
,
Think
:
think
,
Think
:
think
,
HideThinking
:
hideThinking
,
HideThinking
:
hideThinking
,
KeepAlive
:
keepAlive
,
KeepAlive
:
keepAlive
,
Tools
:
toolRegistry
,
Tools
:
toolRegistry
,
Approval
:
approval
,
Approval
:
approval
,
YoloMode
:
yoloMode
,
YoloMode
:
yoloMode
,
LastToolOutput
:
&
lastToolOutput
,
LastToolOutputTruncated
:
&
lastToolOutputTruncated
,
}
}
// Reset expanded state for new tool execution
toolOutputExpanded
=
false
assistant
,
err
:=
Chat
(
cmd
.
Context
(),
opts
)
assistant
,
err
:=
Chat
(
cmd
.
Context
(),
opts
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment