fix: CORE_REGISTER_TOOL fallback to raw string on unmarshal error

Previously the wrapper silently ignored json.Unmarshal errors and returned
nil, causing tools returning raw JSON strings (via C ABI bridge's
json.Marshal) to appear as empty map[] to the agent.
This commit is contained in:
root
2026-07-20 17:51:34 +08:00
parent aa0f0ad8ea
commit cfb4b72587

View File

@ -279,7 +279,9 @@ func go_core_dispatch(methodID C.int, ctx unsafe.Pointer, s1, s2, s3 *C.char, i1
if err != nil { return nil, err }
if r == "" { return nil, nil }
var res map[string]interface{}
json.Unmarshal([]byte(r), &res)
if err := json.Unmarshal([]byte(r), &res); err != nil {
return r, nil
}
return res, nil
})
return 0