Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions internal/core/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,10 @@ func stringifyArguments(arguments json.RawMessage) string {
}

var out bytes.Buffer
if err := json.Indent(&out, arguments, "", " "); err == nil {
return out.String()
if err := json.Indent(&out, arguments, "", " "); err != nil {
return string(arguments)
}
return string(arguments)
return out.String()
}

func emitProgress(observer TurnObserver, event ProgressEvent) {
Expand Down
3 changes: 0 additions & 3 deletions internal/tools/interceptors.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,6 @@ func SafeJoin(root string, candidate string) (string, error) {

// stringArg 从已解析参数中安全读取字符串值。
func stringArg(arguments map[string]any, key string) (string, bool) {
if arguments == nil {
return "", false
}
value, ok := arguments[key]
if !ok {
return "", false
Expand Down
4 changes: 1 addition & 3 deletions internal/tools/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,7 @@ func (r *Registry) Execute(ctx context.Context, call provider.ToolCall, state St
SessionID: state.SessionID,
Arguments: call.Arguments,
}
if len(call.Arguments) > 0 {
_ = json.Unmarshal(call.Arguments, &invocation.ParsedArgs)
}
_ = json.Unmarshal(call.Arguments, &invocation.ParsedArgs)

for _, interceptor := range r.interceptors {
if err := interceptor.Before(ctx, &invocation); err != nil {
Expand Down
6 changes: 2 additions & 4 deletions internal/tools/write_tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,8 @@ func (t *WriteTool) Execute(_ context.Context, invocation Invocation) (Result, e
}

create := true
if invocation.ParsedArgs != nil {
if v, ok := invocation.ParsedArgs["create"].(bool); ok {
create = v
}
if v, ok := invocation.ParsedArgs["create"].(bool); ok {
create = v
}

return t.write(target, args.Content, args.Append, create)
Expand Down